crap-analysis

Analyze .NET code coverage and CRAP scores from OpenCover reports.

Updated Dec 4, 2022
One-click install
npx skills add https://github.com/devingoble/CloudOStat --skill crap-analysis-devingoble
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: crap-analysis
Source: https://github.com/devingoble/CloudOStat/tree/main/.github/skills/crap-analysis
Command: npx skills add https://github.com/devingoble/CloudOStat --skill crap-analysis-devingoble

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers identify high-risk code sections by analyzing cyclomatic complexity and test coverage, enabling focused refactoring and testing efforts.

Core Features & Use Cases

  • CRAP Score Calculation: Computes the Change Risk Anti-Patterns score to quantify code risk.
  • Risk Hotspot Identification: Pinpoints methods with high complexity and low coverage.
  • Coverage Reporting: Generates detailed HTML reports with risk analysis.
  • Use Case: Before merging a pull request, run this Skill to ensure that complex new features are adequately tested and to prioritize areas needing immediate attention.

Quick Start

Run the crap-analysis skill to generate a coverage report for your .NET project.

Frequently Asked Questions about crap-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I identify risky .NET code hotspots using cyclomatic complexity and test coverage?

CRAP score calculation quantifies code risk by analyzing cyclomatic complexity and test coverage together. It identifies methods with high complexity and low coverage, helping developers pinpoint high-risk code hotspots for focused refactoring.

How do I calculate CRAP scores for a .NET project before merging a pull request?

To calculate CRAP scores for a .NET project, analyze your code coverage using the OpenCover format. This generates detailed HTML reports with risk analysis to ensure complex new features are adequately tested before a pull request merge.

Does crap-analysis work with OpenCover format and ReportGenerator for .NET code coverage?

Yes, crap-analysis works with OpenCover format and ReportGenerator to analyze .NET code coverage. It uses these tools to compute Change Risk Anti-Patterns scores and generate detailed HTML reports highlighting risk hotspots based on complexity and coverage.

What is the best way to prioritize refactoring efforts in complex .NET codebases?

The best way to prioritize refactoring is to compute CRAP scores to quantify code risk across your .NET codebase. By identifying methods with high cyclomatic complexity and low test coverage, you can target the most critical hotspots first.

When do I need to run a CRAP score analysis on my codebase?

You need to run a CRAP score analysis when assessing code quality and prioritizing testing efforts, especially before merging complex new features. It helps identify high-risk code sections by quantifying the risk associated with high complexity and low coverage.