Code quality done right
CodeHealth™ - the metric you can trust
CodeScene's Code Health is the only code-level metric with proven business impact, backed by winning, fact-based research. Know when and how to improve code to keep your system maintainable.
The smarter metric for code quality
Why choose Code Health as your quality metric?
Code-level metric backed by research
Code Health is the only code-level metric in our industry with a proven link to speed and quality. Code Health is evidence-based and the effectiveness of the metric was evaluated in the Code Red paper.
Local quality gates during the development process
Integrate local quality gates with CodeScene's CLI tool and IDE extension. Only merge high quality code and prevent any code health declines.
Actionable via Automated Code Reviews
CodeScene's Pull Request integration allows you to detect code quality issues via automated code reviews. Developers get detailed explanations of issues and recommendations. One-click, seamless integration with GitHub, BitBucket, Azure DevOps and GitLab.
Quality dimension for identifying technical debt and refactoring targets
When combining Hotspots with CodeScene's Code Health perspective, you can quickly prioritize technical debt or other code quality issues, and find refactoring candidates.

Understanding CodeHealth™
How is Code Health calculated?
Code Health is an aggregated metric based on 25+ factors scanned from the source code. The code health factors correlate with increased maintenance costs and an increased risk for defects. Code Health is a model that correlates measurable aspects of your code with positive or negative outcomes for your project.
From Healthy to Risky
How we classify code
Each file is categorized either as:
- Green code, healthy code that’s easy to change
- Yellow code, complex code with maintenance issues and increased defect risk
- Red code, code with a severe technical debt and maintainability challenges)

Module smells
Low Cohesion: Multiple unrelated responsibilities in a module/class, violating the Single Responsibility Principle (measured by LCOM4).
Brain Class (God Class): Large module with many lines of code, numerous functions, and at least one complex central method.
Developer Congestion: Bottlenecks when multiple developers work on the same code.
Complex Code by Former Contributors: If a developer behind a hotspot with low Code Health leaves the organization, the maintenance risk increases significantly.
Function smells
Brain Method (God Function): Complex function centralizing behavior, becoming a local hotspot.
DRY (Don't Repeat Yourself) Violations: Duplicated logic changed together predictably.
Complex Method: Many conditional statements (e.g. if, for, while) reduce code health (cyclomatic complexity).
Primitive Obsession: Overuse of built-in primitives without encapsulation.
Large Method: Functions with many lines of code are harder to understand.
Implementation smells
Nested Complexity: If-statements or loops inside others increase defect risk.
Bumpy Road: Functions with multiple logical chunks; needed for encapsulation into smaller functions.
Complex Conditional: Expression with multiple logical operators (AND/OR) inside branches complicate understanding.
Large Assertion Blocks: Consecutive assert statements indicate missing abstractions.
Duplicated Assertion Blocks: Copy-pasted assertion blocks in tests indicate DRY violations.
Quality metrics
What's a good Code Health score?
The Code Health scale goes from 1 to 10. Ten indicates very maintainable code. Moving from 6.0 to 8.0 would mean a quite dramatic improvement on time in development. This means your team can iterate 30% faster, on average, on your coding tasks.

Why is CodeHealth™ the industry-leading code-quality metric?
Supported by acclaimed research
CodeHealth™ is evidence-based and the effectiveness of the metric is evaluated in the Code Red paper. This quantitative study of 39 proprietary production codebases from various industries and domains shows that a healthy codebase enables a faster time-to-market while minimizing rework.
Ship healthier code and prevent up to 15x more defects before they happen
15x
Fewer bugs
Speed up delivery by 2x by addressing productivity bottlenecks
2x
Faster feature delivery
Reduce delivery risks by 9x with better Code Health
9x
More likely to deliver on time
Validated by benchmark study
Is Code Health a better metric than SonarQube?
A recent benchmark study compared CodeScene’s CodeHealth™ metric to SonarQube’s found that CodeHealth is 6x more accurate, performing at the level of expert human developers.
.png?width=2400&height=1168&name=feature-sonarqube-comparison%20(1).png)
The Code Health metric outperforms SonarQube in maintainability ratings
Benchmarking of SonarQube and CodeScene on public software maintainability datasets shows that CodeScene's Code Health metric is 6x more accurate, performing at the level of expert human developers.
Software maintainability is the most important metric
Software maintenance accounts for more than 90% of a software product’s lifecycle costs. Developers spend 70% of their time on understanding existing code.
Public benchmarking dataset to compare code quality metrics
For the benchmark study, a public and independent software maintainability dataset was used, containing 1.4 million lines of manually reviewed code as a ground truth for code quality. SonarQube and CodeScene results were then compared to this dataset.
Code quality issues can't be prioritized from code alone
Not all code is equally important, and not all technical debt is bad. Traditional code analysis tools are good at surface-level details, but they weren’t built to prioritize technical debt, being overwhelmed with 3,000 issues doesn’t help anyone.
CodeScene stands out by prioritizing technical debt based on how your team actually works with the code, not just how the code looks. By combining Code Health metrics with development hotspots, CodeScene pinpoints the parts of your system where poor code quality actively slows your team down. These are the areas that matter most, where refactoring delivers the biggest impact.


Main KPIs for your Code Health
A single KPI isn’t enough to capture the multi-facetted aspect of code health in a larger codebase
CodeScene presents three separate metrics to create a unique code health profile of your codebase. The three KPIs together give you a representative view of your code health. CodeScene weights and scores the findings according to an extensive set of baseline data from real-world codebases to come up with the normalized code health metric.
- The hotspots could be healthy, but other parts of the code have severe issues
- Averages are tricky since they might hide low-scoring files that represent a risk
- Or maybe you have a problematic legacy module that is relatively stable but could be a long-term risk?
Hotspot code health
A weighted average of the Code Health in your hotspots. Generally, this is the most critical metric since low Code Health in a hotspot will be expensive.
Average code health
A weighted average of all the files in the codebase. This KPI indicates how deep any potential Code Health issues go.
Worst performer
A single file Code Health score representing the lowest Code Health in any module across the codebase, and it points out long-term risks.
From trends to action
Follow your Code Health progress and identify risks

Track what matters over time
Trends are actionable
When analyzing code, prioritize trends over absolute values. Is the situation getting better or worse? With CodeScene’s high-level dashboards and Code Health KPIs, you can track progress over time, monitor trends, identify areas where code quality is degrading, and bring those insights into retrospectives.
Flexible code quality rules
Adapt Code Health to your coding standards
CodeScene’s Code Health rules are fine-tuned using real-world codebases, making the default rules highly effective in predicting maintenance and delivery risks. We also recognize the importance of giving users control over these rules. There are two customization options available:
Code Health directives
These are source code comments that instruct CodeScene to ignore specific code smells. Directives offer granular control at the function level.
JSON configuration
You can modify the code health rules for entire repositories, folders, or files by providing a JSON file with your custom settings.
Programming languages
Broad language support for smarter code analysis
CodeScene delivers deep insights across 30+ programming languages to keep your code maintainable and high-performing.

Deep Dive on CodeHealth™
Understanding Code Health and code complexity
In this tutorial, we discuss our Code Health metric and the reasoning behind it and why it's important.
Take control of your technical debt today
Don’t let technical debt slow down your development process. Ready to assess your Code Health?