Feature request
Description
As a developer, I want a CLI tool that validates code metrics against configurable thresholds so that I can enforce code quality standards in CI/CD pipelines and prevent code quality degradation.
Acceptance criteria
- ✅ Tool uses UnifiedParser internally to analyze code without creating intermediate files
- ✅ Supports YAML and JSON configuration files for defining thresholds
- ✅ Validates file-level metrics (rloc, complexity, max_complexity_per_function, etc.)
- ✅ Supports both min and max thresholds for each metric
- ✅ Reports violations with clear, actionable output
- ✅ Sorts violations by severity (worst offenders first)
- ✅ Exits with appropriate codes: 0 (pass), 1 (violations), 2 (errors)
- ✅ Color-coded console output for better readability
- ✅ Supports standard UnifiedParser options (--exclude, --file-extensions, --bypass-gitignore)
- ✅ Interactive mode support via Dialog
- ✅ Comprehensive documentation
Assumptions & Exclusions
- Tool validates only file-level metrics from UnifiedParser
- Function-level data is available as aggregated statistics (max/min/mean/median)
- No custom metric calculation - relies on UnifiedParser's existing metrics
- Configuration file must be provided (no default thresholds)
Implementation Details
Tool Name: metricthresholdchecker
Usage:
ccsh metricthresholdchecker <input-path> --config <config-file> [options]
Configuration Format:
file_metrics:
rloc:
max: 500
max_complexity_per_function:
max: 10
number_of_functions:
max: 20
Example Output:
Metric Threshold Check Results
════════════════════════════════════════════════════════════
✗ 3 violation(s) found!
════════════════════════════════════════════════════════════
Violations:
Metric: rloc (2 violations)
Path Actual Value Threshold Exceeds By
─────────────────────────────────────────────────────────────────
src/HugeFile.kt 750 max: 500 +250
src/LargeFile.kt 550 max: 500 +50
Development notes (Task Breakdown)
Notes
Implementation PR: This feature has been implemented in branch feat/add-new-metric-checker-tool
Dependencies Added:
- Jackson 2.18.2 (databind, dataformat-yaml, module-kotlin)
Files Modified:
- analysis/analysers/tools/MetricThresholdChecker/ (new module)
- analysis/ccsh/build.gradle.kts
- analysis/ccsh/src/main/kotlin/de/maibornwolff/codecharta/ccsh/Ccsh.kt
- analysis/gradle/libs.versions.toml
- analysis/model/src/main/kotlin/de/maibornwolff/codecharta/serialization/FileExtension.kt
- analysis/settings.gradle.kts
- analysis/CHANGELOG.md
- gh-pages/_docs/07-filter/05-metric-threshold-checker.md
Documentation: https://maibornwolff.github.io/codecharta/docs/filter/metric-threshold-checker
Feature request
Description
As a developer, I want a CLI tool that validates code metrics against configurable thresholds so that I can enforce code quality standards in CI/CD pipelines and prevent code quality degradation.
Acceptance criteria
Assumptions & Exclusions
Implementation Details
Tool Name:
metricthresholdcheckerUsage:
Configuration Format:
Example Output:
Development notes (Task Breakdown)
Notes
Implementation PR: This feature has been implemented in branch
feat/add-new-metric-checker-toolDependencies Added:
Files Modified:
Documentation: https://maibornwolff.github.io/codecharta/docs/filter/metric-threshold-checker