Metadata-Version: 2.4
Name: fork-meter
Version: 1.1.1
Summary: A command-line tool that measures cyclomatic complexity by counting decision points and branching paths in source code.
License-Expression: MIT
License-File: LICENSE
Keywords: cyclomatic-complexity,static-analysis,code-quality,linter,cli
Author: Ron Webb
Author-email: ron@ronella.xyz
Requires-Python: >=3.14
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Requires-Dist: braincraft (>=1.2.0,<2.0.0)
Requires-Dist: click (>=8.4.2,<9.0.0)
Requires-Dist: env-dir-bootstrap (>=1.0.0,<2.0.0)
Requires-Dist: jinja2 (>=3.1.0,<4.0.0)
Requires-Dist: logenrich (>=1.0.1,<2.0.0)
Requires-Dist: rich (>=15.0.0,<16.0.0)
Requires-Dist: tree-sitter (>=0.26.0,<0.27.0)
Requires-Dist: tree-sitter-c (>=0.24.2,<0.25.0)
Requires-Dist: tree-sitter-c-sharp (>=0.23.5,<0.24.0)
Requires-Dist: tree-sitter-cpp (>=0.23.4,<0.24.0)
Requires-Dist: tree-sitter-go (>=0.25.0,<0.26.0)
Requires-Dist: tree-sitter-gosu (>=0.2.0,<0.3.0)
Requires-Dist: tree-sitter-java (>=0.23.5,<0.24.0)
Requires-Dist: tree-sitter-javascript (>=0.25.0,<0.26.0)
Requires-Dist: tree-sitter-kotlin (>=1.1.0,<2.0.0)
Requires-Dist: tree-sitter-python (>=0.25.0,<0.26.0)
Requires-Dist: tree-sitter-rust (>=0.24.2,<0.25.0)
Requires-Dist: tree-sitter-scala (>=0.26.2,<0.27.0)
Requires-Dist: tree-sitter-typescript (>=0.23.2,<0.24.0)
Project-URL: Changelog, https://github.com/rcw3bb/fork-meter/blob/main/CHANGELOG.md
Project-URL: Homepage, https://github.com/rcw3bb/fork-meter
Project-URL: Issues, https://github.com/rcw3bb/fork-meter/issues
Project-URL: Repository, https://github.com/rcw3bb/fork-meter
Description-Content-Type: text/markdown

# fork-meter

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Version](https://img.shields.io/badge/Version-1.1.1-green.svg)](CHANGELOG.md) [![Python](https://img.shields.io/badge/Python-3.14%2B-blue)](https://www.python.org/) [![PyPI](https://img.shields.io/badge/PyPI-fork--meter-orange)](https://pypi.org/project/fork-meter/)

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

## Requirements

- Python `>=3.14`

## Installation

```bash
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

```bash
# 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:

```bash
export FORK_METER_CONFIG_DIR=/path/to/dir
```

## Development

### Setup

```bash
poetry install
```

### Format and Lint

```bash
poetry run black fork_meter; poetry run pylint fork_meter
```

### Run Tests with Coverage

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

## License

This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.

