
Crap Analysis
This walks you through setting up CRAP score analysis for .NET projects, which combines cyclomatic complexity with test coverage to find risky code (the formula is complexity times one minus coverage squared). The guide is thorough on the mechanics: you need OpenCover format specifically because it includes complexity metrics, ReportGenerator to build the HTML reports, and a proper runsettings file to exclude generated code and test assemblies. The Risk Hotspots section in the output is what you're after, showing methods with high complexity and low coverage that are dangerous to touch. Useful if you're inheriting a codebase or need to justify where testing effort should go. The threshold recommendations are reasonable: CRAP scores over 30 need immediate attention.
- skills.sh installs
- 581
- GitHub stars
- 1.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add aaronontheweb/dotnet-skills --skill crap-analysis --agent claude-codeInstalls into .claude/skills of the current project.
Files
CRAP Score Analysis
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
- Establishing coverage thresholds for CI/CD pipelines
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 |
| > 30 | High | Needs tests or refactoring |
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
Sponsors
Details
- Repository
- github.com/aaronontheweb/dotnet-skills
- Categories
- Testing & QA, Code Review & Quality, .NET & C#
- First seen
- Jun 3, 2026
More from aaronontheweb/dotnet-skills
All 34- Dotnet Slopwatch580
- Testcontainers Integration Tests579
- Playwright Blazor Testing560
- Dotnet Local Tools550
- Aspire Integration Testing522
- Mjml Email Templates513
- Aspire Service Defaults497
- Aspire Configuration487
- Snapshot Testing484
- Dotnet Devcert Trust457
- Skills Index Snippets456
- Playwright Ci Caching455
- Akka Net Best Practices451
- Mailpit Integration443
- Verify Email Snapshots436
- Akka Hosting Actor Patterns434
- Akka Net Testing Patterns431
- OpenTelemetry NET Instrumentation431
- Akka Net Management430
- Akka Net Aspire Configuration415
- Marketplace Publishing408
- Modern Csharp Coding Standards2.3K
- Csharp Concurrency Patterns1.6K
- Efcore Patterns1.6K