Commit 78345299 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix(cilint): produce all reports at once

parent a4fa4280
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -174,15 +174,6 @@ stages:
    cd -
  }

  function sonar_lint_report() {
    if [[ "${SONAR_HOST_URL:-$SONAR_URL}" ]]
    then
      log_info "SonarQube template detected (\$SONAR_HOST_URL or \$SONAR_URL): generate golangci-lint report for SonarQube (\\e[33;1mreports/golangci-lint-report.xml\\e[0m)"
      # shellcheck disable=SC2086
      golangci-lint run --out-format checkstyle $GO_CI_LINT_ARGS > reports/golangci-lint-report.xml
    fi
  }

  function install_go_mod_outdated() {
    cd "$(mktemp -d)"
    go mod init go-mod-outdated
@@ -379,16 +370,17 @@ go-ci-lint:
  image: $GO_CI_LINT_IMAGE
  script:
    - mkdir -p reports
    # maybe produce Sonar lint report (not failing)
    - sonar_lint_report || true
    # console output report (failing)
    - golangci-lint run $GO_CI_LINT_ARGS
    # produce all reports at once
    - golangci-lint run --out-format "colored-line-number:stdout,checkstyle:reports/golangci-lint-report.xml" $GO_CI_LINT_ARGS
  artifacts:
    name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    expire_in: 1 day
    when: always
    paths:
      - $GO_PROJECT_DIR/reports/
    reports:
      codequality:
        - "reports/go-cilint.codeclimate.json"
  rules:
    # exclude if GO_CI_LINT_DISABLED set
    - if: '$GO_CI_LINT_DISABLED == "true"'