diff --git a/README.md b/README.md index 56e8c5fe..a1d67662 100644 --- a/README.md +++ b/README.md @@ -35,21 +35,34 @@ The provided arguments may be Python files or directories. For each directory Vulture analyzes all contained \*.py files. -Vulture assigns each chunk of dead code a confidence value. A confidence -value of 100% means that the code will never be executed. Values below -100% are very rough estimates (based on the type of code chunk) for how -likely it is that the code is unused. - After you have found and deleted dead code, run Vulture again, because it may discover more dead code. +## Types of unused code + +In addition to finding unused functions, classes, etc., Vulture can detect +unreachable code. Each chunk of dead code is assigned a *confidence value* +between 60% and 100%, where a value of 100% signals that it is certain that the +code won't be executed. Values below 100% are *very rough* estimates (based on +the type of code chunk) for how likely it is that the code is unused. + +| Code type | Confidence value | +| ------------------- | -- | +| function/method/class argument, unreachable code | 100% | +| import | 90% | +| attribute, class, function, method, property, variable | 60% | + +You can use the `--min-confidence` flag to set the minimum confidence +for code to be reported as unused. Use `--min-confidence 100` to only +report code that is guaranteed to be unused within the analyzed files. + ## Handling false positives When Vulture incorrectly reports chunks of code as unused, you have several options for suppressing the false positives. If fixing your false positives could benefit other users as well, please file an issue report. -**Whitelists** +#### Whitelists The recommended option is to add used code that is reported as unused to a Python module and add it to the list of scanned paths. To obtain such a @@ -65,12 +78,12 @@ make some modifications. We collect whitelists for common Python modules and packages in `vulture/whitelists/` (pull requests are welcome). -**Ignoring files** +#### Ignoring files If you want to ignore a whole file or directory, use the `--exclude` parameter (e.g., `--exclude *settings.py,docs/`). -**Flake8 noqa comments** +#### Flake8 noqa comments