find-complexity

Measure cyclomatic and cognitive complexity in Python code under ols/ and generate a ranked report.

71|88|Updated Nov 8, 2023
One-click install
npx skills add https://github.com/openshift/lightspeed-service --skill find-complexity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: find-complexity
Source: https://github.com/openshift/lightspeed-service/tree/main/.cursor/skills/find-complexity
Command: npx skills add https://github.com/openshift/lightspeed-service --skill find-complexity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identify functions and methods with high cyclomatic complexity, long bodies, or too many parameters to improve maintainability.

Core Features & Use Cases

  • Focus on production code (ols/) and rank findings by severity.
  • Report on cyclomatic complexity, maintainability, cognitive complexity, and function length for Python files; skip tests unless asked.
  • Use results to surface refactoring candidates and quality hotspots for code reviews.

Quick Start

Analyze the codebase to surface top complexity hotspots and generate a prioritized report.

Frequently Asked Questions about find-complexity

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

FAQPage Schema
How do I find Python code complexity hotspots for refactoring?

Code complexity analysis measures cyclomatic complexity, cognitive complexity, maintainability, and function length to identify hard-to-maintain functions. It ranks these hotspots by severity to guide refactoring decisions.

How do I measure cyclomatic and cognitive complexity in a Python repository?

Cyclomatic and cognitive complexity are measured by scanning Python code with Radon to compute metrics. The tool classifies findings and outputs a ranked report containing file paths, function names, and severity levels.

Does this code complexity analysis include test files?

By default, complexity analysis targets production code and skips tests unless explicitly requested. This ensures the severity-ranked report highlights true maintainability hotspots rather than test suite noise.

Can I scan a specific branch for code maintainability metrics?

Yes, complexity and maintainability metrics can be applied to a specific branch or full repository scan. This generates a prioritized report of refactoring candidates based on the targeted codebase.

What is the best way to prioritize technical debt in Python code?

Prioritize technical debt by measuring cyclomatic complexity, cognitive complexity, and function length, then ranking findings by severity. This surfaces the most critical refactoring candidates for code review.

Why does this complexity analysis focus on the ols directory?

Complexity analysis focuses on the ols directory to target production code specifically. This ensures the maintainability report reflects actual application logic rather than configuration or auxiliary scripts.