mirror of https://github.com/databricks/cli.git
Remove lint.sh; re-add 'make fmt' (#2113)
See Makefile for explanation on difference between 'make fmt' and 'make lint'. I also removed lint.sh. Original motivation was to use it in aider, but it's not a good fit there, because aider passes filenames and it does not work well with most golang linters which requires whole packages to work. Follow up to #2062, #2056, #2051.
This commit is contained in:
parent
72e833a897
commit
75cd582021
10
Makefile
10
Makefile
|
@ -5,11 +5,17 @@ PACKAGES=./acceptance/... ./libs/... ./internal/... ./cmd/... ./bundle/... .
|
|||
GOTESTSUM_FORMAT ?= pkgname-and-test-fails
|
||||
|
||||
lint:
|
||||
./lint.sh ./...
|
||||
golangci-lint run --fix
|
||||
|
||||
lintcheck:
|
||||
golangci-lint run ./...
|
||||
|
||||
# Note 'make lint' will do formatting as well. However, if there are compilation errors,
|
||||
# formatting/goimports will not be applied by 'make lint'. However, it will be applied by 'make fmt'.
|
||||
# If you need to ensure that formatting & imports are always fixed, do "make fmt lint"
|
||||
fmt:
|
||||
golangci-lint run --enable-only="gofmt,gofumpt,goimports" --fix ./...
|
||||
|
||||
test:
|
||||
gotestsum --format ${GOTESTSUM_FORMAT} --no-summary=skipped -- ${PACKAGES}
|
||||
|
||||
|
@ -39,4 +45,4 @@ integration:
|
|||
integration-short:
|
||||
$(INTEGRATION) -short
|
||||
|
||||
.PHONY: lint lintcheck test cover showcover build snapshot vendor schema integration integration-short
|
||||
.PHONY: lint lintcheck fmt test cover showcover build snapshot vendor schema integration integration-short
|
||||
|
|
14
lint.sh
14
lint.sh
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -uo pipefail
|
||||
# With golangci-lint, if there are any compliation issues, then formatters' autofix won't be applied.
|
||||
# https://github.com/golangci/golangci-lint/issues/5257
|
||||
|
||||
golangci-lint run --fix "$@"
|
||||
lint_exit_code=$?
|
||||
|
||||
if [ $lint_exit_code -ne 0 ]; then
|
||||
# These linters work in presence of compilation issues when run alone, so let's get these fixes at least.
|
||||
golangci-lint run --enable-only="gofmt,gofumpt,goimports" --fix "$@"
|
||||
fi
|
||||
|
||||
exit $lint_exit_code
|
Loading…
Reference in New Issue