Remove fmt and vet checks from CI (#13063)
* Remove fmt and vet checks from CI - golangci-lint already does the vet and fmt checks. Remove those as it is redundant now. - Also start running golangci-lint as part of the CI pipeline now just as an extra layer of reliability. * Incorporate review comments * Adding golangci install to Jenkinsfile.pr too * dummy commit to test jenkins * Trying after cd to directory * Fix ineffective assign
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
8c22455d41
Коммит
3f072159e3
@@ -63,6 +63,8 @@ jobs:
|
|||||||
at: /go/src/github.com/mattermost/
|
at: /go/src/github.com/mattermost/
|
||||||
- run:
|
- run:
|
||||||
command: |
|
command: |
|
||||||
|
echo "Installing golangci-lint"
|
||||||
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /usr/local/bin v1.21.0
|
||||||
cd mattermost-server
|
cd mattermost-server
|
||||||
make config-reset
|
make config-reset
|
||||||
make check-style BUILD_NUMBER='${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}'
|
make check-style BUILD_NUMBER='${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}'
|
||||||
|
|||||||
28
Makefile
28
Makefile
@@ -149,31 +149,10 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
govet: ## Runs govet against all packages.
|
plugin-checker:
|
||||||
@echo Running GOVET
|
|
||||||
env GO111MODULE=off $(GO) get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
|
|
||||||
$(GO) vet $(GOFLAGS) $(ALL_PACKAGES) || exit 1
|
|
||||||
$(GO) vet -vettool=$(GOPATH)/bin/shadow $(GOFLAGS) $(ALL_PACKAGES) || exit 1
|
|
||||||
$(GO) run $(GOFLAGS) ./plugin/checker
|
$(GO) run $(GOFLAGS) ./plugin/checker
|
||||||
|
|
||||||
gofmt: ## Runs gofmt against all packages.
|
golangci-lint: ## Run golangci-lint on codebase
|
||||||
@echo Running GOFMT
|
|
||||||
|
|
||||||
@for package in $(TE_PACKAGES) $(EE_PACKAGES); do \
|
|
||||||
echo "Checking "$$package; \
|
|
||||||
files=$$($(GO) list $(GOFLAGS) -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' $$package); \
|
|
||||||
if [ "$$files" ]; then \
|
|
||||||
gofmt_output=$$(gofmt -d -s $$files 2>&1); \
|
|
||||||
if [ "$$gofmt_output" ]; then \
|
|
||||||
echo "$$gofmt_output"; \
|
|
||||||
echo "gofmt failure"; \
|
|
||||||
exit 1; \
|
|
||||||
fi; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
@echo "gofmt success"; \
|
|
||||||
|
|
||||||
golangci-lint: ## Run golangci-lint on codebasis
|
|
||||||
# https://stackoverflow.com/a/677212/1027058 (check if a command exists or not)
|
# https://stackoverflow.com/a/677212/1027058 (check if a command exists or not)
|
||||||
@if ! [ -x "$$(command -v golangci-lint)" ]; then \
|
@if ! [ -x "$$(command -v golangci-lint)" ]; then \
|
||||||
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \
|
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \
|
||||||
@@ -229,8 +208,7 @@ check-licenses: ## Checks license status.
|
|||||||
check-prereqs: ## Checks prerequisite software status.
|
check-prereqs: ## Checks prerequisite software status.
|
||||||
./scripts/prereq-check.sh
|
./scripts/prereq-check.sh
|
||||||
|
|
||||||
# TODO: remove govet and gofmt checks once golangci-lint is being enforced.
|
check-style: golangci-lint plugin-checker check-licenses check-plugin-golint ## Runs golangci against all packages and also ensures plugin package golint compliant
|
||||||
check-style: govet gofmt check-licenses check-plugin-golint ## Runs govet and gofmt against all packages and also ensures plugin package golint compliant
|
|
||||||
|
|
||||||
check-plugin-golint: # Checks if golint returns any uncompliant code for any file that starts with plugin/helpers
|
check-plugin-golint: # Checks if golint returns any uncompliant code for any file that starts with plugin/helpers
|
||||||
@! golint ./plugin/ | grep plugin/helpers
|
@! golint ./plugin/ | grep plugin/helpers
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ pipeline {
|
|||||||
ansiColor('xterm') {
|
ansiColor('xterm') {
|
||||||
sh """
|
sh """
|
||||||
cd /go/src/github.com/mattermost/mattermost-server
|
cd /go/src/github.com/mattermost/mattermost-server
|
||||||
|
echo "Installing golangci-lint"
|
||||||
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /usr/local/bin v1.21.0
|
||||||
make config-reset
|
make config-reset
|
||||||
make check-style BUILD_NUMBER='${BRANCH_NAME}-${BUILD_NUMBER}'
|
make check-style BUILD_NUMBER='${BRANCH_NAME}-${BUILD_NUMBER}'
|
||||||
make build BUILD_NUMBER='${BRANCH_NAME}-${BUILD_NUMBER}'
|
make build BUILD_NUMBER='${BRANCH_NAME}-${BUILD_NUMBER}'
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ func TestConfigIsValidFakeAlgorithm(t *testing.T) {
|
|||||||
require.Equal(t, "model.config.is_valid.saml_canonical_algorithm.app_error", err.Message)
|
require.Equal(t, "model.config.is_valid.saml_canonical_algorithm.app_error", err.Message)
|
||||||
*c1.SamlSettings.CanonicalAlgorithm = temp
|
*c1.SamlSettings.CanonicalAlgorithm = temp
|
||||||
|
|
||||||
temp = *c1.SamlSettings.SignatureAlgorithm
|
|
||||||
*c1.SamlSettings.SignatureAlgorithm = "Fake Algorithm"
|
*c1.SamlSettings.SignatureAlgorithm = "Fake Algorithm"
|
||||||
err = c1.SamlSettings.isValid()
|
err = c1.SamlSettings.isValid()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user