Metadata-Version: 2.4
Name: fork-meter
Version: 1.1.0
Summary: A command-line tool that measures cyclomatic complexity by counting decision points and branching paths in source code.
License: MIT License
         
         Copyright (c) 2026 Ron Webb
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.14
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
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)
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.0-blue.svg)](CHANGELOG.md)

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.

