Skip to main content

🩺 CodePulse

GitHub Marketplace tests Python 3.10+ License: MIT Zero dependencies

Reveal a codebase's health from its git history.

Linters read your code. CodePulse reads your code's history — and that reveals things no linter can see: where bugs are born, what knowledge lives in one person's head, and which files are secretly glued together.

Because it works purely from git history, CodePulse works on any language, with zero dependencies beyond git and Python.


Demo

$ codepulse . --badge
Grade: B (83/100)
  -2 bus factor (9 fichiers à auteur unique)
  -15 pression hotspots en hausse
![code health](https://img.shields.io/badge/code%20health-B%20(83)-green)

$ codepulse . --changed origin/main
🔴 Release risk: HIGH (100/100)
   56 changed files · 2 high-risk
   [100] crates/ui-egui/src/lib.rs  (hotspot majeur)
   [ 70] crates/layout/src/para.rs  (zone active, auteur unique)
   👥 Relecteurs suggérés: Valentin Klein (29/37 fichiers), Dmitrii Khlapov (22/37)

$ codepulse . --who crates/ui-egui/src/canvas.rs
crates/ui-egui/src/canvas.rs — 64 commits, 22 auteur(s), dernier changement 2026-10-12
   45%   29 commits  Valentin Klein
   11%    7 commits  Dmitrii Khlapov

A recordable demo.tape (for VHS) generates an animated docs/demo.gif of the above.


What it shows

Signal Question it answers
🔥 Hotspots Where do I refactor first? Files that are both complex and changed constantly — the birthplace of most bugs.
👥 Bus factor What breaks if someone leaves? Files actively maintained by a single person.
🔗 Hidden coupling What really depends on what? Files that almost always change together, even when the code doesn't show a link.
🏆 Contributors Who is active across the analyzed window.

The result is a single self-contained HTML dashboard you can open anywhere or email to your team.


Quick start

# From a git repository:
python -m codepulse /path/to/repo --open

# Common options:
python -m codepulse . --since "6 months ago" --top 30 -o health.html

Running from the source checkout? Prefix with PYTHONPATH=src, or install it: pip install -e . then just run codepulse.

Options

Flag Meaning
repo Path to a git repository (default: current directory)
-o, --output Output HTML path (default: codepulse-report.html)
--since Only commits after a date, e.g. "6 months ago"
--max-count N Limit to the N most recent commits
--top N Rows per table (default: 20)
--open Open the report in a browser when done
--who PATH Show who knows a file best (from history) and exit
--badge Print a shields.io health-badge snippet and exit
--ignore GLOB Exclude paths matching a glob (repeatable)

Use in CI (the risk gate)

CodePulse can score only the files a change touches against the repo's risk map, then set an exit code so your pipeline can warn or block.

# Score what this branch changed vs main; fail the job on HIGH risk.
python -m codepulse . --changed origin/main --fail-on HIGH

# Machine-readable output for dashboards / PR comments:
python -m codepulse . --changed origin/main --format json

Output (JSON):

{
  "level": "HIGH",
  "score": 100,
  "high_risk_count": 1,
  "files": [
    { "path": "auth.py", "risk": 100, "commits": 6, "loc": 7,
      "reasons": ["hotspot majeur", "auteur unique (Alice)"] }
  ]
}

GitHub Action (two lines)

Add CodePulse to any repository as a reusable Action — it scores each PR, posts a sticky comment (updated in place, never spammed), and fails the check on HIGH risk:

name: CodePulse
on: pull_request
permissions:
  contents: read
  pull-requests: write
jobs:
  risk:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 } # full history is required
      - uses: Mehouelley/codepulse@v0.1.0
        with:
          fail-on: HIGH # or MEDIUM / LOW / '' to never fail

The PR comment looks like:

🩺 CodePulse — Risque : 🔴 HIGH (100/100) 38 fichiers modifiés · 1 à risque élevé

👥 Relecteurs suggérés : Valentin Klein (29/37 fichiers), Dmitrii Khlapov (22/37)

Prefer a plain workflow with no external action? One ships in .github/workflows/codepulse.yml — copy it in as-is.

Why DevOps cares: a release is roughly as risky as its riskiest file. Touching a well-known hotspot — or a file only one person understands — is exactly where change-failure-rate (a DORA metric) comes from. The gate makes that risk visible before merge, not after an incident.


How it works

  1. Parses git log --numstat into commits and file changes (no merges).
  2. Accumulates per-file history: commit count, authors, size on disk.
  3. Derives the signals:
    • Hotspot score = commits × complexity, where complexity estimates decision points (branch keywords + boolean operators) — far better than raw line count at telling "big but simple" from "dense and risky".
    • Bus factor risk = files with ≥3 commits but exactly one author.
    • Coupling degree = commits-together / min(individual commits), ignoring bulk commits that touch many files at once.

Inspired by the "code as a crime scene" approach to software analysis, made simple enough to run in one command.


Roadmap

  • Risk gate: score a change set, JSON output, CI exit code
  • Ignore globs / path filters for generated & data files
  • Post the gate result as a sticky PR comment (GitHub Action)
  • Trend over time (adaptive day/week/month buckets + hotspot-pressure verdict)
  • Complexity-based hotspots (decision-point estimate instead of line count)
  • Suggested PR reviewers from code ownership (in gate text/json/comment)
  • --who <file> — who knows this code best
  • --badge — shareable A–F health badge for your README
  • Orphaned-code section — complex files nobody touches anymore

Development

pip install -e ".[dev]"
pytest

The suite covers the complexity estimator, git parsing, every analyzer, and an end-to-end run against a throwaway git repo. CI runs it on Python 3.10 and 3.12.

License

MIT

Metadata

Release files for codepulse-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codepulse-cli 0.1.0
File Size Uploaded
codepulse_cli-0.1.0.tar.gz 25.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codepulse-cli 0.1.0
File Interpreter ABI Platform
codepulse_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.6 kB

Release files / codepulse_cli-0.1.0.tar.gz

Download URL codepulse_cli-0.1.0.tar.gz
Size 25.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9a042d96b948159762e144c2820e3882b8af23c7f47af6128585bc0b0e2b5942
BLAKE2b-256 checksum
How to use checksums
5244c3f753b091aa34a56c5e6787ac18cfff5082c1a53b3dca55e6711001412b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / codepulse_cli-0.1.0-py3-none-any.whl

Download URL codepulse_cli-0.1.0-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ab42ed381e4551401c4c258eadbd3d0485456d8fdece0b8d543162d2ddd676e
BLAKE2b-256 checksum
How to use checksums
11fe45459b87ad62bf3efb37100392fc3a093f3a397b7edf2ca7a19a9fa61547
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page