Code Metrics

v1.0.0

Analyze code quality metrics including lines of code by language, cyclomatic complexity (Python), function/class counts, comment ratios, and largest file ran...

0· 135·0 current·0 all-time
byJohn Wang@johnnywang2001

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for johnnywang2001/code-metrics.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Code Metrics" (johnnywang2001/code-metrics) from ClawHub.
Skill page: https://clawhub.ai/johnnywang2001/code-metrics
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install code-metrics

ClawHub CLI

Package manager switcher

npx clawhub@latest install code-metrics
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description claim to compute LOC, comment ratios, function/class counts, and Python cyclomatic complexity; the repository includes a Python script that implements those analyses and no unrelated capabilities (no cloud SDKs, no credential usage, no unrelated binaries).
Instruction Scope
SKILL.md instructs running the bundled Python script against a project path (or cwd). The script only reads source files discovered under the provided path, parses Python AST for complexity, and computes text-based metrics. The instructions do not ask the agent to read unrelated system files, environment secrets, or transmit data to external endpoints.
Install Mechanism
No install spec is provided (instruction-only with a bundled script). The script uses only Python stdlib and there are no downloads or archive extraction steps.
Credentials
The skill requests no environment variables, credentials, or config paths. The code does not attempt to access environment secrets or network services; its filesystem access is limited to reading files under the target project directory.
Persistence & Privilege
always is false and the skill does not request persistent/privileged presence or modify other skills or system-wide configuration.
Assessment
This appears to be a straightforward, local code metrics tool. Before running it: 1) run it in the project directory you intend to analyze (avoid running it from / or other sensitive root paths), 2) review any large or unexpected files it reports if you pointed it at a wide path, and 3) confirm you are comfortable executing a Python script from this source (you can inspect scripts/code_metrics.py fully). There are no network calls or credential requests in the included code.

Like a lobster shell, security has layers — review code before you run it.

latestvk97e9khht67ca7sz855tsc66hs83g4aj
135downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

Code Metrics

Analyze code quality and complexity metrics across your project. Supports 17+ languages.

Quick Start

# Analyze current project
python3 scripts/code_metrics.py

# Analyze specific directory
python3 scripts/code_metrics.py /path/to/project

# JSON output
python3 scripts/code_metrics.py --json

# Skip complexity analysis (faster)
python3 scripts/code_metrics.py --no-complexity

# Exclude additional directories
python3 scripts/code_metrics.py --exclude migrations fixtures

Metrics Provided

  • Lines of Code — total, code, comments, blank lines per language
  • Comment-to-code ratio — overall documentation density
  • Function & class counts — per language
  • Cyclomatic complexity — per-function for Python files (AST-based)
  • Largest files — top N files ranked by code lines
  • High complexity warnings — flags functions with complexity ≥5

Complexity Scale (Python)

RangeRiskMeaning
1-4🟢 LowSimple, well-structured
5-9🟢 ModerateAcceptable
10-14🟡 HighConsider refactoring
15+🔴 Very HighRefactor strongly recommended

Dependencies

  • Python 3.8+ (stdlib only, no pip packages needed)

Comments

Loading comments...