← Back to Skills Marketplace
charlie-morrison

code-complexity-analyzer

by charlie-morrison · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
110
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install code-complexity-analyzer
Description
Measure cyclomatic complexity, cognitive complexity, and structural metrics for Python, JavaScript/TypeScript, and Go code. Use when analyzing code quality,...
README (SKILL.md)

Code Complexity Analyzer

Measure cyclomatic, cognitive, and structural complexity per function. Pure Python, no dependencies.

Quick Start

# Analyze a directory
python3 scripts/analyze_complexity.py src/

# Analyze specific files
python3 scripts/analyze_complexity.py app.py utils.py

# Show all functions (not just violations)
python3 scripts/analyze_complexity.py src/ --verbose

# Custom thresholds
python3 scripts/analyze_complexity.py src/ --cc 15 --cog 20 --max-lines 80

Output Formats

python3 scripts/analyze_complexity.py src/ --format text      # human-readable (default)
python3 scripts/analyze_complexity.py src/ --format json       # CI/tooling
python3 scripts/analyze_complexity.py src/ --format markdown   # reports

Supported Languages

  • Python (.py)
  • JavaScript (.js, .jsx, .mjs, .cjs)
  • TypeScript (.ts, .tsx)
  • Go (.go)

Metrics

Metric Description Default Threshold
Cyclomatic (CC) Independent execution paths ≤10
Cognitive (COG) Perceived difficulty to understand (nesting-weighted) ≤15
Lines Function length ≤50
Params Parameter count ≤5
Nesting Max nesting depth ≤4

Risk Levels

  • 🟢 Simple — CC≤5, COG≤8
  • 🟡 Low — CC≤10, COG≤15
  • 🟠 Moderate — CC≤20, COG≤25
  • 🔴 High — CC>20 or COG>25

Options

--cc N           Cyclomatic threshold (default: 10)
--cog N          Cognitive threshold (default: 15)
--max-lines N    Function length threshold (default: 50)
--max-params N   Parameter count threshold (default: 5)
--max-nesting N  Nesting depth threshold (default: 4)
--exclude DIR    Additional directories to exclude
--verbose, -v    Show all functions, not just violations

Auto-excluded: node_modules, .git, __pycache__, venv, dist, build.

Exit Codes

  • 0 — no violations
  • 1 — violations found (functions exceed CC or COG thresholds)
  • 2 — no analyzable files found
Usage Guidance
The skill appears coherent: it bundles a pure-Python analyzer and SKILL.md that tells you how to run it locally. Before running it on sensitive systems, (1) review the full script (especially any parts not shown to you) to confirm there are no network calls or shell executions; (2) run it in a sandbox or ephemeral environment (container or VM) the first time; (3) avoid running it against private/credential-containing directories unless you trust the code; and (4) if you need stronger assurance, request the full, untruncated source for review or run static checks (grep for 'socket', 'requests', 'subprocess', 'os.system', 'exec', 'eval') to detect unexpected network or execution behavior.
Capability Analysis
Type: OpenClaw Skill Name: code-complexity-analyzer Version: 1.0.0 The code-complexity-analyzer skill is a legitimate utility for measuring software metrics (cyclomatic and cognitive complexity) in Python, JavaScript/TypeScript, and Go. The core logic in scripts/analyze_complexity.py uses standard library modules and regular expressions to parse source files and calculate metrics without any external dependencies, network calls, or suspicious execution patterns.
Capability Assessment
Purpose & Capability
Name/description (measure complexity for Python/JS/TS/Go) matches the included SKILL.md and the analyzer script: it scans source files, reports per-function metrics, and exposes CLI options. No unrelated credentials, binaries, or config paths are requested.
Instruction Scope
SKILL.md instructs running the included Python script against source dirs/files and to choose output formats and thresholds. The instructions and script operate on local files only and do not instruct reading unrelated system state or transmitting results to external endpoints.
Install Mechanism
No install spec; skill is instruction-only with one bundled Python script. This is low-risk provided the script is reviewed before execution.
Credentials
Requires no environment variables, credentials, or special config paths. The script reads source files and directory contents only, which is proportionate to the stated purpose.
Persistence & Privilege
Skill does not request persistent presence, special agent privileges, or modifications to other skills; it is user-invocable and not always-enabled.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install code-complexity-analyzer
  3. After installation, invoke the skill by name or use /code-complexity-analyzer
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release
Metadata
Slug code-complexity-analyzer
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is code-complexity-analyzer?

Measure cyclomatic complexity, cognitive complexity, and structural metrics for Python, JavaScript/TypeScript, and Go code. Use when analyzing code quality,... It is an AI Agent Skill for Claude Code / OpenClaw, with 110 downloads so far.

How do I install code-complexity-analyzer?

Run "/install code-complexity-analyzer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is code-complexity-analyzer free?

Yes, code-complexity-analyzer is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does code-complexity-analyzer support?

code-complexity-analyzer is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created code-complexity-analyzer?

It is built and maintained by charlie-morrison (@charlie-morrison); the current version is v1.0.0.

💬 Comments