Metadata-Version: 2.4
Name: strict-no-cover
Version: 0.1.1
Summary: Error on unnecessary `pragma: no cover` comments
Author-email: Samuel Colvin <samuel@pydantic.dev>
License-Expression: MIT
Project-URL: Homepage, https://github.com/samuelcolvin/strict-no-cover
Project-URL: Source, https://github.com/samuelcolvin/strict-no-cover
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.6
Dynamic: license-file

# strict-no-cover

Error on unnecessary `pragma: no cover` comments.

Utility to report `# pragma: no cover` comments which are unnecessary (where some of the relevant lines are actually covered).

For cases with flakey coverage or partial coverage on code, use `# pragma: lax no cover` which will not error if some relevant lines are covered.

## Install

```bash
uv add --dev strict-no-cover
```

## Usage

After running coverage and generating a `.coverage` file, run:

```bash
uv run strict-no-cover
```

or without installing it explicitly, run:

```bash
uvx strict-no-cover
```

You'll want to modify `pyproject.toml` to include the following:

```toml
[tool.coverage.report]
exclude_lines = [
    # `# pragma: no cover` is standard marker for code that's not covered, this will error if code is covered
    'pragma: no cover',
    # use `# pragma: lax no cover` if you want to ignore cases where (some of) the code is covered
    'pragma: lax no cover',
    'raise NotImplementedError',
    ...
]
```
