Metadata-Version: 2.4
Name: comment-lens-scanner
Version: 0.1.1
Summary: Deterministic source comment maintenance and quality scanner
Author: Olayinka Vaughan
License-Expression: MIT
Project-URL: Homepage, https://github.com/Builder106/comment-lens
Project-URL: Repository, https://github.com/Builder106/comment-lens
Project-URL: Issues, https://github.com/Builder106/comment-lens/issues
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pygments<3,>=2.17
Requires-Dist: tree-sitter-language-pack<2,>=1
Dynamic: license-file

# Comment Lens Scanner

Comment Lens extracts code comments for review. The local command-line interface flags comments that may need attention, explains each finding with deterministic rule evidence, and leaves repository files unchanged.

## Features

- Parsing: Tree-sitter grammars, with a Pygments fallback, separate docstrings, line comments, inline notes and header blocks.
- Maintenance signals: flags unresolved `TODO`, `FIXME` and `HACK` comments, comments that repeat a symbol name, comments near changed code, and broken local file links.
- Git checks: `--changed` limits a pre-commit or CI check to comments added or modified on the current branch.
- Export: JSON, NDJSON, Markdown and SARIF, which GitHub Actions can turn into pull request annotations.
- Local by default: reads code without executing it and sends nothing to external servers.

## Installation

Install the scanner from PyPI. It needs Python 3.12 or newer.

```bash
python3 -m pip install comment-lens-scanner
```

To run the code in a checkout of the repository instead, use `python3 -m pip install ./scanner` from the repository root.

## Usage

### Scan a repository

Scan the current repository and generate local finding manifests (`.comment-lens/scan.json` and `.comment-lens/comments.ndjson`):

```bash
comment-lens scan .
```

### Check changed comments

Check only comments on lines changed between `origin/main` and `HEAD`. The command exits 1 if a high-severity finding is introduced:

```bash
comment-lens check . --changed origin/main...HEAD --fail-on high
```

Generate SARIF output for CI integration:

```bash
comment-lens check . --changed HEAD --scope files --format sarif --output findings.sarif
```

### Export an existing scan

Convert an existing scan artifact into Markdown or JSON:

```bash
comment-lens export . --format markdown
comment-lens export . --format json
```

## Configuration

Place a `.comment-lens.toml` file at your repository root to configure exclusions and rule policies:

```toml
version = 1
exclude = ["fixtures", "legacy"]

[policy]
fail_on = "none"

[policy.rules]
todo = "review"
fixme = "high"
restates_symbol = "review"
missing_local_reference = "high"
```

## License

MIT License. See [LICENSE](https://github.com/Builder106/comment-lens/blob/main/LICENSE) for details.
