Skip to content

Add code quality into pipeline

Implement code quality into pipeline as with default settings code quality template didn't pick it.

Suggestion from @eakca1


lint:
  image: golangci/golangci-lint
  stage: test
  script:
    - golangci-lint run --print-issued-lines=false --out-format code-climate:gl-code-quality-report.json,line-number
  artifacts:
    reports:
      codequality: gl-code-quality-report.json
    paths:
      - gl-code-quality-report.json
  rules:
    - if: $CODE_QUALITY_DISABLED
      when: never
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Run code quality job in merge request pipelines
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH      # Run code quality job in pipelines on the default branch (but not in other branch pipelines)
    - if: $CI_COMMIT_TAG  
  allow_failure: true