diff --git a/README.md b/README.md index fc7289818a2d69b48fb322bb6a6d95bd37ae78c9..7a5f323821990de362a93260fe65bdf9f1854e28 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ It is bound to the `build` stage, and uses the following variables: | Input / Variable | Description | Default value | |-----------------------|----------------------------------------------------------------------------------------------------------|----------------------------------------| | `ci-lint-image` / `GO_CI_LINT_IMAGE` | The Docker image used to run `golangci-lint` | `registry.hub.docker.com/golangci/golangci-lint:latest-alpine` <br/>[](https://to-be-continuous.gitlab.io/doc/secu/trivy-GO_CI_LINT_IMAGE) | -| `ci-lint-args` / `GO_CI_LINT_ARGS` | `golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options) | `-E gosec,goimports ./...` | +| `ci-lint-args` / `GO_CI_LINT_ARGS` | `golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options) | `-E gosec ./...` | | `ci-lint-disabled` / `GO_CI_LINT_DISABLED` | Set to `true` to disable this job | _none_ (enabled) | In addition to a textual report in the console, this job produces the following reports, kept for one day: diff --git a/kicker.json b/kicker.json index f709fcfa2330d48973dc414cf2b517994dced62d..1a592ce9389dfe8bdd5639a2ef02a5df55585be2 100644 --- a/kicker.json +++ b/kicker.json @@ -116,7 +116,7 @@ { "name": "GO_CI_LINT_ARGS", "description": "`golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options)", - "default": "-E gosec,goimports ./...", + "default": "-E gosec ./...", "advanced": true } ] diff --git a/templates/gitlab-ci-golang.yml b/templates/gitlab-ci-golang.yml index 9edc5fb49c3522258a476e5a14d922b8c0a076e1..4896e5a3b956367666c5f4e0122131474d7577fc 100644 --- a/templates/gitlab-ci-golang.yml +++ b/templates/gitlab-ci-golang.yml @@ -80,7 +80,7 @@ spec: default: registry.hub.docker.com/golangci/golangci-lint:latest-alpine ci-lint-args: description: '`golangci-lint` [command line arguments](https://github.com/golangci/golangci-lint#command-line-options)' - default: -E gosec,goimports ./... + default: -E gosec ./... semgrep-image: description: The Docker image used to run [Semgrep](https://semgrep.dev/docs/) default: registry.hub.docker.com/semgrep/semgrep:latest @@ -719,7 +719,14 @@ go-ci-lint: script: - mkdir -p -m 777 reports # produce all reports at once - - golangci-lint run --out-format "colored-line-number:stdout,code-climate:reports/go-ci-lint.codeclimate.json,checkstyle:reports/go-ci-lint.checkstyle.xml" $GO_CI_LINT_ARGS + - | + glc_ver_major=$(golangci-lint version | cut -d' ' -f4 | cut -d'.' -f1) + if [[ "$glc_major_ver" == "1" ]] + then + golangci-lint run --out-format "colored-line-number:stdout,code-climate:reports/go-ci-lint.codeclimate.json,checkstyle:reports/go-ci-lint.checkstyle.xml" $GO_CI_LINT_ARGS + else + golangci-lint run --output.text.path stdout --output.code-climate.path reports/go-ci-lint.codeclimate.json --output.checkstyle.path reports/go-ci-lint.checkstyle.xml $GO_CI_LINT_ARGS + fi artifacts: name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG" expire_in: 1 day