josharsh/100LinesOfAICode

🚀 New Tool: Code Complexity Analyzer (AI-powered)

オヌプン

#21 opened on 2025/11/22

 (0 件のコメント) (0 件のリアクション) (0 人の担圓者)Python (17 件のフォヌク)auto 404
ai-poweredenhancementhacktoberfesthelp-wantednew-tool

Repository metrics

Stars
 (4 個のスタヌ)
PR merge metrics
 (PR metrics pending)

説明

🎯 Goal

Create a new tool that analyzes code complexity and suggests simplifications!

📋 Description

Build complexity-analyzer/ - a tool that:

  • Scans code files
  • Identifies complex functions (cyclomatic complexity, nesting)
  • Uses Claude to suggest simplifications
  • Shows before/after comparisons

💡 Example Usage

python analyze.py mycode.py

🔍 Found 3 complex functions:

━━━━━━━━━━━━━━━━━━━━━━━━
Function: calculate_total (line 45)
Complexity: 12 (high)

💡 Suggestion:
Extract nested loops into separate functions
Consider using list comprehensions
━━━━━━━━━━━━━━━━━━━━━━━━

🔚 Implementation Ideas

  1. Use radon or mccabe for complexity metrics
  2. Parse code with ast module
  3. Send complex code to Claude for analysis
  4. Format suggestions nicely

📁 Structure

complexity-analyzer/
├── analyze.py (main script, <100 lines!)
├── README.md
└── examples/
    ├── before.py
    └── after.py

✅ Acceptance Criteria

  • Analyzes Python files (bonus: other languages)
  • Identifies functions above complexity threshold
  • AI suggestions are actionable
  • Under 100 lines (excluding README)
  • Clean terminal output
  • Examples showing improvement

🎓 Learning Outcomes

  • AST parsing
  • Code quality metrics
  • AI-powered refactoring
  • CLI design

Estimated time: 5-8 hours Impact: New tool that helps developers write better code! Cool factor: 🔥🔥🔥

コントリビュヌタヌガむド