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.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.0.3-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codestats_analyzer-1.0.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.0.3.tar.gz
Algorithm Hash digest
SHA256 76f6d6f039ee489f5dd5930d7743c16a6acf1d952bbe3e3b11e620d135870c13
MD5 d7e0616a39741bcbbba2cd8a66528cd9
BLAKE2b-256 f586cb8c8939d04c9409b6a2e5a7045af0b003c2315159782451a659c3e88e89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codestats_analyzer-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0bfb5a6bb2f64383a1db4c9fbeef0015b2d52f9253ac5dca76746ea8845eb2ce
MD5 b773403a20a0304682999885ce7596ec
BLAKE2b-256 2a0fd38da468b062d764618de48aa64c9a99f6c752a847fbdc031d0a6eef27b2

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