Skip to main content

Code Quality Metrics Tracking Tool for Python Projects

Project description

Code Metrics Tracker

PyPI Version License: MIT Python Versions

A powerful code quality metrics tracking tool for Python projects that helps teams monitor and improve their codebase over time. Code Metrics Tracker generates comprehensive 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 (using Ruff)
  • Cyclomatic complexity: Identify complex functions and methods that need refactoring (using Radon)
  • Maintainability index: Measure how maintainable your code is over time (using Radon)

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

Installation

pip install code-metrics-tracker

Quick Start

  1. Initialize code quality tracking in your project:
codeqa init
  1. Create a code quality snapshot:
codeqa snapshot
  1. 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 project
  • codeqa snapshot - Create a new code quality snapshot
  • codeqa list - List all available snapshots
  • codeqa compare - Compare two snapshots to see trends
  • codeqa 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


Download files

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

Source Distribution

code_metrics_tracker-0.1.1.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

code_metrics_tracker-0.1.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file code_metrics_tracker-0.1.1.tar.gz.

File metadata

  • Download URL: code_metrics_tracker-0.1.1.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for code_metrics_tracker-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ded2e7abb66f05dcf2bedbab817cae4e068501609b94fc8450d7e78591d1ad7e
MD5 38d4b7e926462dbfc15dd35e90cbb45d
BLAKE2b-256 f4833d86a6491a347b1f194737f498a33ab93695caa23f6d3a8daa332176ab75

See more details on using hashes here.

File details

Details for the file code_metrics_tracker-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for code_metrics_tracker-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 51fc277da50102f72e14e0cb0c905d9b0a361cf5938b086621c3c078907ac517
MD5 33b7becda4ae63c4759654051f3aa641
BLAKE2b-256 851c6ffa887da4f643b26619646a638dd3c2193da869d01ce4d3cdb597886ce3

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