Skip to main content

Vulture and Coverage.py combined: Find dead code in your Python project.

Project description

vulturecov

image image Actions status

vulturecov is a tool to filter the dead code false positives found by Vulture using Coverage.py.

The rationale is that if a line of code is covered by a test, then it is unlikely to be dead code.

Installation

pip install vulturecov

Usage

First, generate the Vulture report:

vulture src/my_package > vulture_report.txt
vulture src/my_package whitelist.py > vulture_report.txt  # with a whitelist

Then, generate the Coverage report using pytest for example:

pytest --cov=src/my_package --cov-report=json:coverage.json

Once you have the two reports, you can use vulturecov to filter the Vulture report:

Show the dead code (lines of code that are found by Vulture and not covered by tests):

vulturecov vulture_report.txt coverage.json  # print the result to stdout
vulturecov vulture_report.txt coverage.json --output vulturecov_report.txt  # write the result to a file

Only show the false positives (lines of code that are covered by tests):

vulturecov vulture_report.txt coverage.json --false-positives  # print the result to stdout
vulturecov vulture_report.txt coverage.json --false-positives --output vulture_fp.txt  # write the result to a file

To add the false positives in your Vulture whitelist:

vulturecov vulture_report.txt coverage.json --false-positives >> whitelist.py

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

vulturecov-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

vulturecov-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vulturecov-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for vulturecov-0.1.0.tar.gz
Algorithm Hash digest
SHA256 385d0ee70c085ef10aa8987ae7dcb16f7d4a6e655436fa0132e80de0ca74a2fa
MD5 a86eebfd6bf79ae003041259e60506eb
BLAKE2b-256 98cb13ac3f2168a16975cffb5352acb84d5ea91b33647fd4fcaf088a8314d6e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vulturecov-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for vulturecov-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8269b867680724256e5f4c9037a14757439a855961116673f18d59bc1a7b9229
MD5 a29a9a3853976ab0d1e811ea723a35f7
BLAKE2b-256 29599f2fcb752dc847f6cbb9280c1628cc61b17f13de640375e11ff8a6c10ce8

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