소스 정보
- 저장소
- 7Factor/crap4dotnet
- 최근 소스 활동
- 2026년 3월 13일 00:11
- 감지된 SKILL.md 언어
- 영어
- 스타
- 7
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/7Factor/crap4dotnet --skill crap명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | crap |
| description | Analyze C# code for CRAP (Change Risk Anti-Patterns) metrics using dotnet-crap |
| license | MIT |
| compatibility | Requires .NET 8.0+ SDK. The dotnet-crap global tool must be installed. |
| metadata | {"author":"7Factor","version":"0.1.0"} |
You have access to dotnet-crap, a .NET global tool that computes CRAP scores for C# code. CRAP combines cyclomatic complexity with code coverage to find methods that are both complex and poorly tested.
The tool is not yet published to NuGet. Install from source:
git clone <repo-url> && cd crap4dotnet
dotnet pack src/Crap4DotNet.Cli -o ./nupkg
dotnet tool install -g Crap4DotNet --add-source ./nupkg
Verify with dotnet-crap --version.
The simplest approach — let crap4dotnet run tests and generate coverage automatically:
dotnet-crap analyze <path> --run-tests
Or if the user already has Cobertura coverage files:
dotnet-crap analyze <path> --coverage <coverage-xml-path>
<path> can be a .cs file, directory, .csproj, or .sln (--run-tests requires .csproj, .sln, or directory)--run-tests runs dotnet test with coverage collection automatically (mutually exclusive with --coverage)--coverage accepts one or more Cobertura XML paths (globs work)--threshold <n> sets the CRAP threshold (default: 30)--min-crap <n> filters out low-scoring methods from output--output <path> writes JSON to a file instead of stdoutThe tool outputs JSON to stdout. Key fields:
stats.crappyMethodCount — number of methods exceeding the thresholdstats.averageCrap — project-wide average CRAP scoremethods[] — array of per-method results, each with:
fullName — fully qualified method namefilePath and lineNumber — source location (navigate directly)crap — the CRAP scorecomplexity — cyclomatic complexitycoverage — code coverage (0.0 to 1.0)isCrappy — whether it exceeds the thresholdseverity — one of: low, moderate, elevated, high, criticalSummarize findings for the user:
To track changes over time:
dotnet-crap diff <before.json> <after.json>
The diff output classifies methods as: added, removed, new_crappy, fixed, regressed, improved. Focus on new_crappy (newly risky) and fixed (wins to celebrate).
| CRAP Score | Severity | Action |
|---|---|---|
| 1 – 5 | Low | No action needed |
| 6 – 15 | Moderate | Consider adding tests |
| 16 – 30 | Elevated | Prioritize test coverage |
| 31 – 60 | High | Refactor and/or add tests |
| 60+ | Critical | Urgent refactoring required |
A method with complexity >= 31 is always CRAPpy regardless of coverage, because CRAP(31, 1.0) = 31 > 30. For these methods, the only fix is reducing complexity through refactoring.