Skip to main content

Error on unnecessary `pragma: no cover`s comments

Project description

strict-no-cover

Error on unnecessary pragma: no covers comments.

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

Install

uv add --dev strict-no-cover

Usage

Run with

uv run strict-no-cover

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.

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.0.tar.gz (3.9 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.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file strict_no_cover-0.1.0.tar.gz.

File metadata

  • Download URL: strict_no_cover-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for strict_no_cover-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e79c1329d3a82182bf7cdd0ed396b5bc51bf9ae38cecdfcc2d3595a2a1083ab
MD5 d09c0b9384b6412001ab0513848414c6
BLAKE2b-256 c1235fe5f840b2c5bea2b79d274af8db2141976a52ce8db2faebfbb3c11bb5c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for strict_no_cover-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 599e4d5b178c27c9e38d2f42b34f60507d21ba439e8c7f3c9bff320d9e980987
MD5 3a63c1de0cd75450b6451c226ad96cdd
BLAKE2b-256 9c7d68ae9aca53a7cc827e94ab08fdfec2832af70e20840b0859027346a73874

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