
Why Code Quality Matters
- Detects potential bugs and anti-patterns early
- Tracks complexity and duplication over time
- Enforces coding standards and style guidelines
- Integrates seamlessly with merge requests for inline review
How It Works
GitLab’s built-in Code Quality template leverages the open-source Code Climate engine plus additional scanners. It produces a JSON (or HTML) report consumed by GitLab to annotate merge requests and pipeline views.
Verify your project’s language is supported by Code Climate before enabling the component.
Feature Comparison by GitLab Tier
Different GitLab subscriptions unlock advanced Code Quality capabilities:
Merge Request Inline Reports
Once enabled, Code Quality issues surface directly in the Merge Request widget—categorized by severity and file location.
debugger; statement as an issue.
1. Enable Code Quality in Your CI Configuration
Add the official GitLab CI/CD component at the top of your.gitlab-ci.yml:



2. Add Code Quality to Your Pipeline
Start with a basic Node.js pipeline:code_quality job automatically:

View the Merged Configuration
Click View full config in the pipeline editor to see how your.gitlab-ci.yml merges with the Code Quality template:
allow_failure: true ensures Code Quality issues don’t block merges.
3. Customize Stages & Report Formats
GitLab supports two special stages:.pre and .post. Assign code_quality to .pre for early feedback:
gl-code-quality-report.html as a job artifact.
4. Pipeline Run & Artifacts
Triggering a commit runs bothcode_quality and unit_testing jobs:

- Bug Risk
- Complexity
- Duplication
- Style
Example Findings
Bug RiskAdditional Code Quality Features
Top-tier GitLab plans unlock more advanced tools:
