Files
Luong NGUYEN c7261394b0 fix(i18n): re-point translations to code-review-specialist rename (#128)
* fix(i18n): re-point translations to code-review-specialist rename

The English code-review skill was renamed to code-review-specialist in #127
to avoid shadowing the new built-in /code-review command. Mirror that rename
across the uk, vi, ja, zh locales: rename each 03-skills/code-review/ directory
to code-review-specialist/, update the i18n-source markers in the moved ja
files, and fix path references in INDEX.md, QUICK_REFERENCE.md, and the vi
TRANSLATION_QUEUE.md.

* chore: ignore .asm-improver and .gitissue tooling state

* fix(i18n): re-point remaining code-review install paths to code-review-specialist
2026-05-26 10:29:51 +02:00

36 lines
896 B
Python

#!/usr/bin/env python3
import re
import sys
def analyze_code_metrics(code):
"""Analyze code for common metrics."""
# Count functions
functions = len(re.findall(r"^def\s+\w+", code, re.MULTILINE))
# Count classes
classes = len(re.findall(r"^class\s+\w+", code, re.MULTILINE))
# Average line length
lines = code.split("\n")
avg_length = sum(len(l) for l in lines) / len(lines) if lines else 0
# Estimate complexity
complexity = len(re.findall(r"\b(if|elif|else|for|while|and|or)\b", code))
return {
"functions": functions,
"classes": classes,
"avg_line_length": avg_length,
"complexity_score": complexity,
}
if __name__ == "__main__":
with open(sys.argv[1]) as f:
code = f.read()
metrics = analyze_code_metrics(code)
for key, value in metrics.items():
print(f"{key}: {value:.2f}")