This repo is an adaptor that converts the staticcheck output to a format that is recognized by the gitlab-ci.
go install github.com/miare-ir/staticcheck-gitlab-ci@latest
This application expects the staticcheck result as json in stdin and outputs the converted result as json.
After installation run the below at the desired directory:
staticcheck -f json ./... | staticcheck-gitlab-ci
Check the example for a full integration.
Somewhere in your gitlab-ci.yml
you'll need to add sth like this:
stages:
- checks
code_quality:
stage: checks
script:
- go install honnef.co/go/tools/cmd/[email protected]
- go install github.com/miare-ir/staticcheck-gitlab-ci@latest
- staticcheck -f json ./... | staticcheck-gitlab-ci > staticcheck-report.json
allow_failure: true
artifacts:
when: always
reports:
codequality: staticcheck-report.json
By doing so whenever the pipeline is ran, the Code Quality Report is put on the merge request: