crap analysis

Documentation Community

Skill notes

When to Use This Skill

Use this skill when: Evaluating code quality and test coverage before changes Identifying high-risk code that needs refactoring or testing Setting up coverage collection for a .NET project Prioritizing which code to test based on risk

What is CRAP?

CRAP Score = Complexity x (1 - Coverage)^2 The CRAP (Change Risk Anti-Patterns) score combines cyclomatic complexity with test coverage to identify risky code. CRAP Score · Risk Level · Action Required < 5 · Low · Well-tested, maintainable code 5-30 · Medium · Acceptable but watch complexity

Why CRAP Matters

High complexity + low coverage = danger: Code that's hard to understand AND untested is risky to modify Complexity alone isn't enough: A complex method with 100% coverage is safer than a simple method with 0% Focuses effort: Prioritize testing on complex code, not simple getters/setters

CRAP Score Examples

Method · Complexity · Coverage · Calculation · CRAP GetUserId() · 1 · 0% · 1 x (1 - 0)^2 · 1 ParseToken() · 54 · 52% · 54 x (1 - 0.52)^2 · 12.4 ValidateForm() · 20 · 0% · 20 x (1 - 0)^2 · 20 ProcessOrder() · 45 · 20% · 45 x (1 - 0.20)^2 · 28.8

coverage.runsettings

Create a coverage.runsettings file in your repository root. The OpenCover format is required for CRAP score calculation because it includes cyclomatic complexity metrics.

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Documentation
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@Aaronontheweb · no license declared
Token usage
Lean
Setup complexity
Guided setup
External API key
Not required
Operating systems
macOS · Linux · Windows
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Write / modify
  • Shell exec
Network behavior
Local-only
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

Output preview crap-analysis.preview
# CRAP Score Examples

| Method | Complexity | Coverage | Calculation | CRAP | |--------|------------|----------|-------------|------| | `GetUserId()` | 1 | 0% | 1 x (1 - 0)^2 | **1** | | `ParseToken()` | 54 | 52% | 54 x (1 - 0.52)^2 | **12.4** | | `ValidateForm()` | 20 | 0% | 20 x (1 - 0)^2 | **20** | | `ProcessOrder()` | 45 | 20% | 45 x (1 - 0.20)^2 | **28.8** | | `ImportData()` | 80 | 10% | 80 x (1 - 0.10)^2 | **64.8** | ---

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.