Supported Languages: Rust, TypeScript/JavaScript (TSX/JSX), Python, C, C++, Go, Java, Ruby, PHP, Tcl
Key Features:
CC = E - N + 2P (edges - nodes + 2×components) or (decision points) + 1if, while, for, switch, case, &&, ||, ternary operators, exception handlersStellarion Severity Classification:
| Score | Severity | Color | Assessment |
|---|---|---|---|
| 1-10 | Low | Green | Simple, testable, maintainable |
| 11-15 | Moderate | Yellow | Acceptable complexity |
| 16-20 | High | Orange | Consider refactoring |
| 21-30 | High | Orange | Refactoring recommended |
| >30 | Critical | Red | Immediate refactoring required |
Stellarion Severity Classification:
| Score | Severity | Assessment |
|---|---|---|
| 1-10 | Low | Easy to understand |
| 11-15 | Moderate | Acceptable cognitive load |
| 16-25 | High | Difficult to comprehend |
| >25 | Critical | Extremely difficult, immediate attention |
Key Difference: Cognitive complexity penalizes deeply nested structures more heavily than cyclomatic complexity. A function with CC=10 but deep nesting may have Cognitive=25.
MI = MAX(0, (171 - 5.2×ln(HV) - 0.23×CC - 16.2×ln(LOC)) × 100/171)Stellarion Rating System:
| Score | Rating | Color | Maintainability Level |
|---|---|---|---|
| 80-100 | Excellent | Green | Highly maintainable |
| 50-79 | Good | Green | Good maintainability |
| 20-49 | Fair | Yellow | Moderate maintainability |
| 10-19 | Poor | Red | Difficult to maintain |
| 0-9 | Poor | Red | Very difficult to maintain |
Example from agoran-stellarion-project:
content_hash.c: MI=35.5 (Poor), CC=33, Cognitive=48 → Critical priority refactoring/* */), Python docstrings (""" """), JSDoc (/** */)Stellarion Thresholds:
| Duplication % | Severity | Action Priority |
|---|---|---|
| 0-3% | Acceptable | Low - monitor |
| 3-5% | Warning | Medium - plan refactoring |
| 5-10% | High | High - extract shared code |
| >10% | Critical | Critical - major refactoring |
Priority Calculation:
Stellarion Metrics (from agoran-stellarion-project):
3 cycles: Critical architectural problem
Stellarion Threshold: Zero tolerance for circular dependencies in production code
Stellarion Recommendations:
Debt = (CC - 10) × 100 + (100 - MI) + (Duplication% × 10)When CC > 20 (Critical):
When Cognitive Complexity > 25 (Critical):
Example Action (from agoran-stellarion-project):
content_hash.c (CC=33, Cognitive=48) → Split into 5 smaller functions, target CC <10 per functionWhen MI < 30 (Poor):
When MI 30-50 (Fair):
Effort Estimation:
When Duplication > 5% (High):
Example Action (from agoran-stellarion-project):
useAuthForm hook, reduce to 3% duplicationWhen Coupling > 10 (High):
When Circular Dependencies > 0:
When File Size > 500 LOC:
When Directory Has >20 Files:
| Metric Category | Metric Name | Measurement Method | Acceptable | Warning | Critical | Stellarion Action | Secondary Action | Effort |
|---|---|---|---|---|---|---|---|---|
| Complexity | Cyclomatic Complexity | AST decision point counting | 1-10 | 11-15 | >15 (>20 blocking) | Extract methods, simplify logic | Add CC×1.5 test cases | High if >30 |
| Complexity | Cognitive Complexity | Weighted nesting + decisions | 1-10 | 11-20 | >20 (>25 blocking) | Reduce nesting depth | Extract nested logic | Medium-High |
| Complexity | Nesting Depth | Max nested level count | 1-2 | 3-4 | >4 | Use guard clauses | Invert conditionals | Low-Medium |
| Maintainability | Maintainability Index | 171-5.2×ln(HV)-0.23×CC-16.2×ln(LOC) | 80-100 | 50-79 | 20-49, <20 blocking | Reduce CC and LOC | Simplify expressions | High if <30 |
| Duplication | Code Duplication % | Hash-based block comparison | 0-3% | 3-5% | >5% | Extract shared functions | Create utility libraries | Medium-High if >5 occur |
| Size | Lines of Code (Function) | SLOC per function | 1-30 | 31-50 | >50 | Extract methods | Decompose logic | Low-Medium |
| Size | Lines of Code (File) | SLOC per file | 1-300 | 301-500 | >500 | Split into multiple files | Create submodules | Medium |
| Structure | Afferent Coupling (Ca) | Incoming dependencies | 0-5 | 6-10 | >10 | Reduce public API surface | Apply facade pattern | Medium |
| Structure | Efferent Coupling (Ce) | Outgoing dependencies | 0-7 | 8-15 | >15 | Reduce dependencies | Apply dependency injection | Medium |
| Structure | Circular Dependencies | Graph cycle count | 0 | 1-3 | >3 | Break circular deps | Apply dependency inversion | High |
| Quality | Test Coverage | Tested lines / total lines | >80% | 60-80% | <60% | Write unit tests | Focus on CC paths | Medium |
| Quality | Technical Debt Score | (CC-10)×100+(100-MI)+(Dup×10) | <200 | 200-500 | >500 | Prioritize by ROI | Allocate sprint capacity | Variable |
| Halstead | Halstead Volume | N × log₂(n) | Context-dep | >5,000 | >10,000 | Reduce program size | Simplify vocabulary | Medium |
| Halstead | Halstead Bugs | V / 3000 | <0.5/func | 0.5-1.0 | >1.0 | Simplify implementation | Increase test coverage | Low-Medium |
| Advanced | Complexity Hotspots | Files with CC > threshold | 0-5% files | 5-10% | >10% | Target hotspot refactoring | Create refactoring roadmap | High |
content_hash.c (CC=33, Cognitive=48, MI=35.5)useAuthForm hookStellarion provides production-ready code analysis with real metrics, intelligent insights, and actionable recommendations. Its AI-powered approach combines traditional software engineering metrics (cyclomatic complexity, maintainability index) with modern techniques (semantic search, graph analysis) to deliver comprehensive quality assessment.
Key Benefits:
Recommended Usage: Integrate Stellarion into your development workflow for continuous quality monitoring, use it during code reviews to identify complex sections, and leverage its reporting capabilities for stakeholder communication about code health.
Document Version: 1.0 | Last Updated: December 18, 2025 |