Commit dbcabca6 authored by Mark Tyneway's avatar Mark Tyneway Committed by Andreas Bigger

ci: move lint command to makefile

CI had the command for running linting hardcoded in the CI config.
This commit migrates to using `make lint` across all of the services
to abstract away from CI what sort of linting is happening, also
makes it possible to run the linter locally.

Ideally there is a single place where the lint command is defined,
we could have makefiles that import makefiles
parent 16fcaa1d
...@@ -745,8 +745,7 @@ jobs: ...@@ -745,8 +745,7 @@ jobs:
- checkout - checkout
- run: - run:
name: run lint name: run lint
command: | command: make lint
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
working_directory: <<parameters.module>> working_directory: <<parameters.module>>
go-test: go-test:
...@@ -842,7 +841,7 @@ jobs: ...@@ -842,7 +841,7 @@ jobs:
patterns: <<parameters.working_directory>>,<<parameters.dependencies>> patterns: <<parameters.working_directory>>,<<parameters.dependencies>>
- run: - run:
name: Lint name: Lint
command: golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 2m -e "errors.As" -e "errors.Is" ./... command: make lint
working_directory: <<parameters.working_directory>> working_directory: <<parameters.working_directory>>
- store_test_results: - store_test_results:
path: /test-results path: /test-results
......
...@@ -17,7 +17,7 @@ test: ...@@ -17,7 +17,7 @@ test:
go test -v ./... go test -v ./...
lint: lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
fuzz: fuzz:
go test -run NOTAREALTEST -v -fuzztime 10s -fuzz FuzzChannelConfig_CheckTimeout ./batcher go test -run NOTAREALTEST -v -fuzztime 10s -fuzz FuzzChannelConfig_CheckTimeout ./batcher
......
...@@ -25,6 +25,9 @@ bindings-build: ...@@ -25,6 +25,9 @@ bindings-build:
-package $(pkg) \ -package $(pkg) \
-monorepo-base $(monorepo-base) -monorepo-base $(monorepo-base)
lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
mkdir: mkdir:
mkdir -p $(pkg) mkdir -p $(pkg)
......
GITCOMMIT := $(shell git rev-parse HEAD)
GITDATE := $(shell git show -s --format='%ct')
VERSION := v0.0.0
LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT)
LDFLAGSSTRING +=-X main.GitDate=$(GITDATE)
LDFLAGSSTRING +=-X main.Version=$(VERSION)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"
op-bootnode:
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-bootnode ./cmd
lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
...@@ -6,6 +6,9 @@ check-l2: ...@@ -6,6 +6,9 @@ check-l2:
test: test:
go test ./... go test ./...
lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
fuzz: fuzz:
go test -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzEncodeDecodeWithdrawal ./crossdomain go test -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzEncodeDecodeWithdrawal ./crossdomain
go test -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzEncodeDecodeLegacyWithdrawal ./crossdomain go test -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzEncodeDecodeLegacyWithdrawal ./crossdomain
......
...@@ -17,7 +17,7 @@ test: ...@@ -17,7 +17,7 @@ test:
go test -v ./... go test -v ./...
lint: lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
visualize: visualize:
./scripts/visualize.sh ./scripts/visualize.sh
......
...@@ -26,7 +26,7 @@ clean: ...@@ -26,7 +26,7 @@ clean:
rm -r ../op-program/bin rm -r ../op-program/bin
lint: lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
.PHONY: \ .PHONY: \
test \ test \
......
...@@ -23,3 +23,6 @@ all: build ...@@ -23,3 +23,6 @@ all: build
# Build binary # Build binary
build: build:
CGO_ENABLED=0 go build $(LDFLAGS) CGO_ENABLED=0 go build $(LDFLAGS)
lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
...@@ -17,7 +17,7 @@ test: ...@@ -17,7 +17,7 @@ test:
go test -v ./... go test -v ./...
lint: lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
.PHONY: \ .PHONY: \
clean \ clean \
......
...@@ -18,7 +18,7 @@ test: ...@@ -18,7 +18,7 @@ test:
go test -v ./... go test -v ./...
lint: lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
fuzz: fuzz:
go test -run NOTAREALTEST -v -fuzztime 10s -fuzz FuzzL1InfoRoundTrip ./rollup/derive go test -run NOTAREALTEST -v -fuzztime 10s -fuzz FuzzL1InfoRoundTrip ./rollup/derive
......
...@@ -31,7 +31,7 @@ test: ...@@ -31,7 +31,7 @@ test:
go test -v ./... go test -v ./...
lint: lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
verify-goerli: op-program-host op-program-client verify-goerli: op-program-host op-program-client
env GO111MODULE=on go run ./verify/cmd/goerli.go $$L1URL $$L2URL env GO111MODULE=on go run ./verify/cmd/goerli.go $$L1URL $$L2URL
......
...@@ -17,7 +17,7 @@ test: ...@@ -17,7 +17,7 @@ test:
go test -v ./... go test -v ./...
lint: lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
.PHONY: \ .PHONY: \
clean \ clean \
......
...@@ -2,7 +2,7 @@ test: ...@@ -2,7 +2,7 @@ test:
go test -v ./... go test -v ./...
lint: lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" ./... golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
generate-mocks: generate-mocks:
go generate ./... go generate ./...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment