Reporters

CodeClimate / GitLab Reporter

Generate GitLab Code Quality reports in the CodeClimate issue format.

Overview

The codeclimate reporter (alias: gitlab) writes gl-code-quality-report.json in the CodeClimate issue format, restricted to the subset GitLab defines for its Code Quality reports. Declare it as an artifacts:reports:codequality artifact and duplicated code appears as code quality issues directly in merge requests — unlike SARIF, which GitLab ingests as security vulnerability findings.

Available since v5.1.0.

Usage

jscpd --reporters codeclimate ./src
# or the alias:
jscpd --reporters gitlab ./src

Output file: ./report/gl-code-quality-report.json

GitLab CI Integration

.gitlab-ci.yml
jscpd:
  stage: test
  image: node:22
  before_script:
    - npm install -g jscpd@5
  script:
    - jscpd --reporters console,codeclimate --output report .
  artifacts:
    reports:
      codequality: report/gl-code-quality-report.json

Merge requests then show a Code Quality widget listing new and resolved duplication issues compared to the target branch.

How It Works

  • Each clone yields one issue per fragment; every issue describes the counterpart location in its message and in the CodeClimate other_locations field.
  • Issues carry a deterministic fingerprint derived from the clone's content hash, so GitLab can tell pre-existing issues from new ones across pipeline runs.
  • Severity is minor, escalating to major for clones absent from a configured baseline or when the run exceeds --threshold.

Configuration

.jscpd.json
{
  "reporters": ["codeclimate"],
  "output": "./report"
}