Code quality metrics tracking tool that combines Ruff, Radon, and cloc to generate detailed trends over time
Project description
Code Metrics Tracker
A powerful code quality metrics tracking tool for Python projects that helps teams monitor and improve their codebase over time. Code Metrics Tracker leverages three specialized tools to provide comprehensive analysis:
- cloc: Counts lines of code, comments, and blank lines across programming languages
- Ruff: Identifies linting issues, code style violations, and potential bugs with fast performance
- Radon: Analyzes code complexity (cyclomatic complexity) and maintainability
The tracker generates detailed reports focusing on:
- Lines of code statistics: Track code volume and distribution by language
- Linting issues: Detect and monitor code style, potential bugs, and anti-patterns
- Cyclomatic complexity: Identify complex functions and methods that need refactoring
- Maintainability index: Measure how maintainable your code is over time
Results are stored in two complementary formats:
- JSON snapshots: Detailed metrics data stored in versioned JSON files for programmatic analysis
- Markdown reports: Human-readable CODE_METRICS.md file that tracks metrics over time with trend indicators
Perfect for teams that want to:
- Track code quality trends over time
- Identify problematic areas in the codebase
- Make data-driven refactoring decisions
- Establish quality standards with measurable metrics
- Integrate metrics tracking into CI/CD pipelines
Installation
pip install code-metrics-tracker
Quick Start
- Initialize code quality tracking in your project:
codeqa init
- Create a code quality snapshot:
codeqa snapshot
- View the generated CODE_METRICS.md file for detailed metrics.
Features
- Track code quality metrics over time
- Generate formatted Markdown reports
- Compare snapshots to identify trends
- Highlight critical issues to address
- Configurable for different project structures
Commands
codeqa init- Initialize code quality tracking in your projectcodeqa snapshot- Create a new code quality snapshotcodeqa list- List all available snapshotscodeqa compare- Compare two snapshots to see trendscodeqa report- Generate a standalone report from a snapshot
Configuration
The tool uses a codeqa.json configuration file to determine which directories to analyze, focusing only on code maintained by your team.
Example configuration:
{
"include_paths": ["src", "tests"],
"exclude_patterns": ["venv", "site-packages", "__pycache__", ".pyc"]
}
GitHub Actions Integration
Add this to your GitHub Actions workflow to automatically track code quality metrics:
name: Code Quality Metrics
on:
push:
branches: [ main ]
jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codeqa
- name: Generate code quality snapshot
run: codeqa snapshot
- name: Commit updated CODE_METRICS.md
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Update code quality metrics"
file_pattern: CODE_METRICS.md generated/metrics/*
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_metrics_tracker-0.1.2.tar.gz.
File metadata
- Download URL: code_metrics_tracker-0.1.2.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
430921467679b9e31b5b100c1d1210c481485e1be4aa5f5b75464471e6fbacfc
|
|
| MD5 |
32e2a32e1b9be1df07583e7724039331
|
|
| BLAKE2b-256 |
e913f1b31feb7ee120ad6f212e5c0afd745dd7d85a5f556312714d26d090caa0
|
File details
Details for the file code_metrics_tracker-0.1.2-py3-none-any.whl.
File metadata
- Download URL: code_metrics_tracker-0.1.2-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7ff4a122668e765f63a8db8a5f1c29ad478ed58985aebffb27137e66a0d9f86
|
|
| MD5 |
2a4b721a1e81adff3d3c2ae27861c40d
|
|
| BLAKE2b-256 |
8d916a5d0befd343eedf3278f8bb0283abecbe529ebbe840cf4d9a726ca9ca78
|