Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Reviews code for bugs, security flaws, performance, readability, and error handling, with severity-ranked findings.
Use this skill ↓23% 41%+18 ptsof test cases passed
Passed 9 of 22 test cases with the skill, and 5 of 22 without it.
3 of 3 safety checks passed
Not used yet
"""
簡易コード分析スクリプト
コードの基本的な統計情報を収集する
"""
import sys
import re
from pathlib import Path
def analyze(filepath: str) -> dict:
code = Path(filepath).read_text(encoding="utf-8")
lines = code.split("\n")
stats = {
"total_lines": len(lines),
"blank_lines": sum(1 for l in lines if l.strip() == ""),
"comment_lines": sum(1 for l in lines if l.strip().startswith("//")),
"functions": len(re.findall(r"(?:function |async function |(?:app\.(?:get|post|put|delete)))", code)),
"any_count": len(re.findall(r":\s*any\b", code)),
"todo_count": len(re.findall(r"TODO|FIXME|HACK|XXX", code, re.IGNORECASE)),
"empty_catch": len(re.findall(r"catch\s*\([^)]*\)\s*\{\s*\}", code)),
"template_literal_in_query": len(re.findall(r"query\s*\(\s*`", code)),
"loop_with_await": len(re.findall(r"for\s*\([^)]*\)[^}]*await\s", code, re.DOTALL)),
"magic_numbers": len(re.findall(r"===\s*\d+(?!\s*\))", code)),
}
return stats
def main():
if len(sys.argv) < 2:
print("Usage: python analyze.py <filepath>")
sys.exit(1)
filepath = sys.argv[1]
stats = analyze(filepath)
print("=" * 50)
print("📊 コード分析レポート")
print("=" * 50)
for key, value in stats.items():Next to this one in the catalogue, plus more from the same author.