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.10.3.tar.gz (10.1 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.10.3-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codestats_analyzer-1.10.3.tar.gz
  • Upload date:
  • Size: 10.1 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.10.3.tar.gz
Algorithm Hash digest
SHA256 b4426d1b6050649acd6dcb297725078cda75d445fd7917d74c63bf460ed56fd2
MD5 2ac03dfd1890ca248f72adfe70ad96f8
BLAKE2b-256 1861941a951f7bd86b44c65af4aeeb205be14875d8ee9678decb54bee2123025

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codestats_analyzer-1.10.3-py3-none-any.whl
Algorithm Hash digest
SHA256 954cd3857617ef627455e857f8030cabdc1c706957776b66cb0e4a060bf437a3
MD5 1f0771ed9ae3fe85fa801360c689c6e2
BLAKE2b-256 a8803a854afe3ffbb3724c557da9b5983cfaa1d97919361666c2bf8dc8224152

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