Skip to main content

Python code analysis tool with insights - like GitHub insights but local

Project description

📊 CodeStats

Python code analysis tool that gives you insights about your codebase - like GitHub insights but local!

🚀 Features

  • 📁 Code Metrics: Lines, functions, classes count
  • 🧠 Complexity Analysis: Detect long functions and nested loops
  • 🔍 Code Smell Detection: Find unused imports, duplicate code patterns
  • 💬 Comment Analysis: Check documentation coverage
  • Quality Score: Get a score from 0-10
  • 💡 Smart Suggestions: Actionable improvement tips

📦 Installation

pip install codestats-analyzer

Or from GitHub:

pip install git+https://github.com/yourusername/codestats.git

💻 Usage

As a Python module:

from codestats import analyze

# Analyze a project
report = analyze("myproject")
print(report)

# Access specific metrics
print(f"Score: {report.score}/10")
print(f"Functions: {report.functions}")

From command line:

codestats .
codestats myproject/

📊 Example Output

📊 CodeStats Report
==================================================
📁 Total files: 25
🧠 Total lines: 3200
🐍 Python files: 18
💬 Comments: 450
⚡ Functions: 60
📦 Classes: 12
📊 Complexity: Medium
⭐ Code Score: 7.5 / 10

🔍 Code Smells Detected:
   • main.py: 2 long function(s)
   • utils.py: Low comment ratio (3.2%)

💡 Suggestions:
   • Break down 2 long function(s) into smaller ones
   • Add more comments in 5 file(s)
   • Code quality is good! Keep it up 🎉
==================================================

🎯 What It Checks

  • ⚠ Long functions (>50 lines)
  • 🔄 Nested loops
  • 📝 Comment coverage
  • 🗑️ Unused imports
  • 📏 File size
  • 🏗️ Code organization

🔥 Why CodeStats?

Unlike other tools, CodeStats focuses on:

  • Simplicity: Easy to use, clear output
  • Actionable: Specific suggestions, not just numbers
  • Local: No need to push to GitHub
  • Fast: Analyzes projects in seconds

📝 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codestats_analyzer-1.0.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codestats_analyzer-1.0.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file codestats_analyzer-1.0.0.tar.gz.

File metadata

  • Download URL: codestats_analyzer-1.0.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.11.9

File hashes

Hashes for codestats_analyzer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ed3c3459733b844cba30f7da76bcbbe4c37cc21715a4b242d64bef2615981fb5
MD5 75166c5c616e5b71c03eb351234b3f0d
BLAKE2b-256 e47ee2591b0687f638bd7c68c2a83fc327de16ef32d56e433c0a3fc6a49f9341

See more details on using hashes here.

File details

Details for the file codestats_analyzer-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for codestats_analyzer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74128267e66bd3f987c5bf8e3a2f74388ba2ed6119b6f56e7e21c702b656b5b7
MD5 016d875c5aa2d1a0a4da75f1c2ef9bc9
BLAKE2b-256 3d281b7507d549ac067e8b9e5f2a984b5af4ac7524d6ea1c8994a696a1cf7e0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page