Error on unnecessary `pragma: no cover` comments
Project description
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
uv add --dev strict-no-cover
Usage
After running coverage and generating a .coverage file, run:
uv run strict-no-cover
or without installing it explicitly, run:
uvx strict-no-cover
You'll want to modify pyproject.toml to include the following:
[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',
...
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strict_no_cover-0.1.1.tar.gz.
File metadata
- Download URL: strict_no_cover-0.1.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
428512000c2f8407008d4834619869b222f88124a0f330d7578caffa6447ea6b
|
|
| MD5 |
9138bd6e683fe3cbd72fef3dbbde6ce4
|
|
| BLAKE2b-256 |
769c0d3da51690d0d6d9114dacaacf80d8d7f7bfa2226ebbee4ac113ce872fed
|
File details
Details for the file strict_no_cover-0.1.1-py3-none-any.whl.
File metadata
- Download URL: strict_no_cover-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0af14678bbe6ec079931a2f3a4cbe4e1a53e41ccf6d3ffb21f042820acba948b
|
|
| MD5 |
9605c615ae38ef6952a558243363ab23
|
|
| BLAKE2b-256 |
c019dc7194d30abe5850324f4829b240f4a0afb37ff57082eb9fdc993054a7ec
|