Skip to main content

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

Project description

📊 CodeStats

PyPI version Python 3.7+ License: MIT

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

From PyPI (Recommended):

pip install codestats-analyzer

From GitHub:

pip install git+https://github.com/gitmanhimanshu/codestates.git

For Development:

git clone https://github.com/gitmanhimanshu/codestates.git
cd codestates
pip install -e .

💻 Usage

Command line:

# Analyze current directory
codestats .

# Analyze specific project
codestats myproject/

# Analyze specific file
codestats myfile.py

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}")
print(f"Complexity: {report.complexity}")

Full guide: See USER_GUIDE.md for detailed usage examples!

📊 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

🔗 Links

📝 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.1.tar.gz (10.8 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.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codestats_analyzer-1.0.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for codestats_analyzer-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1c07a16900a5209062fefd7b469829768f0bd09e32c59d4855761000a15078de
MD5 90ab092f8a0ea45da293b4d617c0284c
BLAKE2b-256 1566c361af251dfe87b7d894d2e5c3db96622554dc53a7647af9cd388f54c56a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codestats_analyzer-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b61360bab25bb2a96d7eecb3dd5b9ba3e601f1273ddd40a08ed7f889c727cc6
MD5 71a24bce1f37fd4c1065332d544089eb
BLAKE2b-256 9fb1310e717c1f655c5c061ebd41698b2e2f5a1b431f314641cf03f422de9fc9

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