Defect count is a key metric in assessing the quality and maintainability of a codebase. In CodeScene, defects can be identified either through direct integration with a Project Management (PM) tool or via heuristic-based detection using the Defect Mining feature. This flexibility ensures teams can measure defect trends even when a PM integration is not available.
Defect Sources in CodeScene
There are two main ways CodeScene gathers defect data:
1. Via PM Integration (e.g., JIRA)
When the PM Integration is enabled, CodeScene pulls defect data directly from the linked PM tool. This method provides precise and structured defect tracking aligned with work items, making it easy to correlate code changes with defect reports.
2. Via Defect Mining
If PM Integration is not enabled, CodeScene can still identify defects using the Defect Mining pattern. This pattern is configured under:
Configuration -> Code Health -> Defect Mining Pattern
The Defect Mining feature scans commit messages for keywords and patterns that typically indicate a bug fix (e.g., "fix", "bug", "defect", "resolve", etc.).
To enrich this process, teams can also configure the Ticket ID pattern under:
Configuration -> Ticket ID Mapping
This allows CodeScene to extract identifiers from commit messages that match work items in your external systems, ensuring that defect-related commits are properly linked.
Recommended Configuration
To get consistent and meaningful results across different analyses, it’s important to align the time spans for Hotspot and Cost & Team analyses. If the Hotspot analysis sliding window is set to 1 year, it’s recommended to set the Cost & Team analysis sliding window to 1 year as well by navigating to:
Configuration -> General
This consistency ensures that all relevant data is analyzed over the same time horizon, resulting in more accurate insights when evaluating defects per hotspot, team contributions, and associated development costs.
Summary
Whether using a direct PM Integration or relying on the Defect Mining pattern, CodeScene provides flexible ways to measure and visualize defect counts. Proper configuration - especially aligning time spans and mapping ticket IDs - helps ensure accurate and actionable analysis that can inform architectural decisions, team processes, and code health improvements.