improve lint
This commit is contained in:
parent
fdbaa68af7
commit
0906af7baf
3 changed files with 23 additions and 11 deletions
2
.github/workflows/vmware-go-kcl-v2-ci.yml
vendored
2
.github/workflows/vmware-go-kcl-v2-ci.yml
vendored
|
|
@ -40,7 +40,7 @@ jobs:
|
|||
- name: Lint
|
||||
shell: bash
|
||||
run: |
|
||||
make lint
|
||||
make lint-docker
|
||||
|
||||
- name: Scan
|
||||
shell: bash
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -44,9 +44,9 @@ scan: ## - execute static code analysis
|
|||
lint: ## - runs golangci-lint
|
||||
@ ./_support/scripts/ci.sh lint
|
||||
|
||||
.PHONY: ci-lint-docker
|
||||
.PHONY: lint-docker
|
||||
lint-docker: ## - runs golangci-lint with docker container
|
||||
@ docker run --rm -v "$(shell pwd)":/app -w /app ${LINT_IMAGE} golangci-lint run ${LINT_FLAGS}
|
||||
@ ./_support/scripts/ci.sh lintDocker
|
||||
|
||||
.PHONY: sonar-scan
|
||||
sonar-scan: ## - start sonar qube locally with docker (you will need docker installed in your machine)
|
||||
|
|
|
|||
|
|
@ -31,14 +31,25 @@ function go_format() {
|
|||
|
||||
function lint() {
|
||||
# golangci-lint run --enable-all -D forbidigo -D gochecknoglobals -D gofumpt -D gofmt -D nlreturn
|
||||
golangci-lint run \
|
||||
--skip-files=_mock.go \
|
||||
--disable=golint \
|
||||
--skip-dirs=test \
|
||||
--fast \
|
||||
--timeout=600s \
|
||||
--verbose \
|
||||
"$(local_go_pkgs)"
|
||||
|
||||
golangci-lint run \
|
||||
--skip-files=_mock.go \
|
||||
--skip-dirs=test \
|
||||
--skip-dirs=internal \
|
||||
--timeout=600s \
|
||||
--verbose
|
||||
}
|
||||
|
||||
function lintDocker() {
|
||||
lintVersion="1.41.1"
|
||||
lintImage="golangci/golangci-lint:v$lintVersion-alpine"
|
||||
|
||||
docker run --rm -v "${PWD}":/app -w /app "$lintImage" golangci-lint run \
|
||||
--skip-files=_mock.go \
|
||||
--skip-dirs=test \
|
||||
--skip-dirs=internal \
|
||||
--timeout=600s \
|
||||
--verbose
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
|
@ -99,6 +110,7 @@ case "$1" in
|
|||
fmtcheck) checkfmt ;;
|
||||
format) go_format ;;
|
||||
lint) lint ;;
|
||||
lintDocker) lintDocker ;;
|
||||
unittest) test ;;
|
||||
scan) scanast ;;
|
||||
*) usage ;;
|
||||
|
|
|
|||
Loading…
Reference in a new issue