Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

strict_no_cover-0.1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

strict_no_cover-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for strict_no_cover-0.1.1.tar.gz
Algorithm Hash digest
SHA256 428512000c2f8407008d4834619869b222f88124a0f330d7578caffa6447ea6b
MD5 9138bd6e683fe3cbd72fef3dbbde6ce4
BLAKE2b-256 769c0d3da51690d0d6d9114dacaacf80d8d7f7bfa2226ebbee4ac113ce872fed

See more details on using hashes here.

File details

Details for the file strict_no_cover-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for strict_no_cover-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0af14678bbe6ec079931a2f3a4cbe4e1a53e41ccf6d3ffb21f042820acba948b
MD5 9605c615ae38ef6952a558243363ab23
BLAKE2b-256 c019dc7194d30abe5850324f4829b240f4a0afb37ff57082eb9fdc993054a7ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page