ensure custom linter is built

Signed-off-by: Will Murphy <will.murphy@anchore.com>
This commit is contained in:
Will Murphy 2024-05-02 11:11:08 -04:00
parent 1af07a4775
commit 552cf45224

View File

@ -128,12 +128,19 @@ tasks:
- "{{ .TOOL_DIR }}/gosimports -local github.com/anchore -w ." - "{{ .TOOL_DIR }}/gosimports -local github.com/anchore -w ."
- go mod tidy - go mod tidy
lint-fix: custom-linter:
desc: Auto-format all source code + run golangci lint fixers desc: Compile a version of golangci-lint that includes our plugins
deps: [tools] deps: [tools]
cmds:
# build custom linter executable
- "{{ .TOOL_DIR }}/golangci-lint custom -v"
lint-fix:
desc: Auto-format all source code + run golangci lint fixers
deps: [tools, custom-linter]
cmds: cmds:
- task: format - task: format
- "{{ .TOOL_DIR }}/golangci-lint run --tests=false --fix" - "{{ .TOOL_DIR }}/custom-gcl run --tests=false --fix"
lint: lint:
desc: Run gofmt + golangci lint checks desc: Run gofmt + golangci lint checks
@ -142,7 +149,7 @@ tasks:
sh: gofmt -l -s . sh: gofmt -l -s .
BAD_FILE_NAMES: BAD_FILE_NAMES:
sh: "find . | grep -e ':' || true" sh: "find . | grep -e ':' || true"
deps: [tools] deps: [tools, custom-linter]
cmds: cmds:
# ensure there are no go fmt differences # ensure there are no go fmt differences
- cmd: 'test -z "{{ .BAD_FMT_FILES }}" || (echo "files with gofmt issues: [{{ .BAD_FMT_FILES }}]"; exit 1)' - cmd: 'test -z "{{ .BAD_FMT_FILES }}" || (echo "files with gofmt issues: [{{ .BAD_FMT_FILES }}]"; exit 1)'
@ -150,8 +157,6 @@ tasks:
# ensure there are no files with ":" in it (a known back case in the go ecosystem) # ensure there are no files with ":" in it (a known back case in the go ecosystem)
- cmd: 'test -z "{{ .BAD_FILE_NAMES }}" || (echo "files with bad names: [{{ .BAD_FILE_NAMES }}]"; exit 1)' - cmd: 'test -z "{{ .BAD_FILE_NAMES }}" || (echo "files with bad names: [{{ .BAD_FILE_NAMES }}]"; exit 1)'
silent: true silent: true
# build custom linter executable
- "{{ .TOOL_DIR }}/golangci-lint custom -v"
# run linting # run linting
- "{{ .TOOL_DIR }}/custom-gcl run --tests=false" - "{{ .TOOL_DIR }}/custom-gcl run --tests=false"