Skip to main content

fork-meter

License: MIT Version

A command-line tool that measures cyclomatic complexity by counting decision points and branching paths in source code.

Requirements

  • Python >=3.14

Installation

pip install fork-meter

Supported Languages

Language Grammar
Python tree-sitter-python
JavaScript tree-sitter-javascript
TypeScript tree-sitter-typescript
Java tree-sitter-java
Go tree-sitter-go
Gosu tree-sitter-gosu
C tree-sitter-c
C++ tree-sitter-cpp
C# tree-sitter-c-sharp
Rust tree-sitter-rust
Kotlin tree-sitter-kotlin
Scala tree-sitter-scala

Usage

fork-meter [OPTIONS] PATHS...

PATHS may be files or directories; directories are scanned recursively.

Options

Option Default Description
--max INT 10 Report functions with complexity strictly above this value
--output NAME fork-meter-output Base name for output files (no extension)
--output-dir DIR <cwd>/reports Directory for output files
--format [json|html|both] both Output format
--exclude PATTERN — Glob pattern to exclude from scanning (repeatable)
-V, --version Show version and exit
-h, --help Show help and exit

Example

# Scan a project, flag anything above complexity 5, write HTML only
fork-meter src/ --max 5 --format html --exclude "**/*_test.py"

While scanning, a live progress indicator shows how many files have been checked:

fork-meter checking files ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42/120 0:00:03

Once done, it is replaced by the final summary:

fork-meter done in 0.08s
  ✓ reports/fork-meter-output.html

fork-meter exits with status code 1 if any function exceeds --max complexity, and 0 otherwise.

Complexity Scale

Range Colour Risk
1 – 5 🟢 Green Low
6 – 10 🟡 Yellow Moderate
11 – 15 🟠 Orange High
16 + 🔴 Red Critical

Output Formats

  • HTML — self-contained interactive report with a sortable complexity table.
  • JSON — machine-readable report suitable for CI integration.

Configuration

fork-meter bootstraps its log/config directory automatically, including a default fm_ignore file (gitignore-style patterns) used to skip matching files during a scan. Override the location with:

export FORK_METER_CONFIG_DIR=/path/to/dir

Development

Setup

poetry install

Format and Lint

poetry run black fork_meter; poetry run pylint fork_meter

Run Tests with Coverage

poetry run pytest --cov=fork_meter tests --cov-report html

License

This project is licensed under the MIT License — see the LICENSE file for details.

Release files for fork-meter 1.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 fork-meter 1.1.0
File Size Uploaded
fork_meter-1.1.0.tar.gz 15.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fork-meter 1.1.0
File Interpreter ABI Platform
fork_meter-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.5 kB

Release files / fork_meter-1.1.0.tar.gz

Download URL fork_meter-1.1.0.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aa575e5e32efacbb0865b5f0af5af0e3515e3f43783ed452f8228b6f8b7d0330
BLAKE2b-256 checksum
How to use checksums
46c9a51bbd058de1137c2a9b358f8c716784c9781743a6d006718775cefecab1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.14.7 Linux/6.17.0-1022-azure

Release files / fork_meter-1.1.0-py3-none-any.whl

Download URL fork_meter-1.1.0-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67e7a7b3a75fd7339d3d55032b6c7a18488ee25ee6fff4354d8d2a048432919e
BLAKE2b-256 checksum
How to use checksums
78f7cf6d633eb2a70adba025ed19975cb2f77e9d0ab0ab490b62ec53b73901f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.14.7 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

1.2.0

2 release files

1.1.1

2 release files

This release

1.1.0 This release

2 release files

1.0.0

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