Skip to content

Remove dependency to 'tee' from job template for automatic linting

Eren Dursun requested to merge eren.d/gitlab:master into master

What does this MR do?

With v1.44.0 golangci-lint introduced support for multiple outputs. Therefore it isn't necessary any more to use 'tee' in the job template for automatic linting:

golangci-lint run --issues-exit-code 0 --out-format code-climate | tee gl-code-quality-report.json | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"'

The same could be achieved without 'tee' doing this instead:

golangci-lint run --issues-exit-code 0 --out-format code-climate:gl-code-quality-report.json,code-climate | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"'

If additional reports are required, like for example 'checkstyle' for SonarQube, we'd need to use the multiple outputs functionality anyways and this would look cleaner:

golangci-lint run --issues-exit-code 0 --out-format checkstyle:sq-code-quality-report.xml,code-climate:gl-code-quality-report.json,code-climate | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"'

than this:

golangci-lint run --issues-exit-code 0 --out-format checkstyle:sq-code-quality-report.xml,code-climate | tee gl-code-quality-report.json | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"'

Merge request reports