Skip to content

Commit

Permalink
Clarify that --exclude patterns are matched against absolute paths to f…
Browse files Browse the repository at this point in the history
…ix #260.
  • Loading branch information
jendrikseipp committed Jan 8, 2023
1 parent 49831ca commit 4d694a6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* Add whitelist for `socketserver.TCPServer.allow_reuse_address` (Ben Elliston)
* Clarify that `--exclude` patterns are matched against absolute paths (Jendrik Seipp, #260).

# 2.6 (2022-09-19)

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ We collect whitelists for common Python modules and packages in

#### Ignoring files

If you want to ignore a whole file or directory, use the `--exclude`
parameter (e.g., `--exclude *settings.py,docs/`).
If you want to ignore a whole file or directory, use the `--exclude` parameter
(e.g., `--exclude "*settings.py,*/docs/*.py,*/test_*.py,*/.venv/*.py"`). The
exclude patterns are matched against absolute paths.

#### Flake8 noqa comments

Expand Down Expand Up @@ -174,7 +175,7 @@ Example Config:

``` toml
[tool.vulture]
exclude = ["file*.py", "dir/"]
exclude = ["*file*.py", "dir/"]
ignore_decorators = ["@app.route", "@require_*"]
ignore_names = ["visit_*", "do_*"]
make_whitelist = true
Expand Down
7 changes: 4 additions & 3 deletions vulture/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ def csv(exclude):
metavar="PATTERNS",
type=csv,
default=missing,
help=f"Comma-separated list of paths to ignore (e.g.,"
f' "*settings.py,docs/*.py"). {glob_help} A PATTERN without glob'
f" wildcards is treated as *PATTERN*.",
help=f"Comma-separated list of path patterns to ignore (e.g.,"
f' "*settings.py,docs,*/test_*.py,venv"). {glob_help} A PATTERN without '
f" glob wildcards is treated as *PATTERN*. Patterns are matched"
f" against absolute paths.",
)
parser.add_argument(
"--ignore-decorators",
Expand Down
6 changes: 3 additions & 3 deletions vulture/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def get_decorator_name(decorator):
def get_modules(paths):
"""Retrieve Python files to check.
Loop over all given paths, abort if any ends with .pyc and add collect
the other given files (even those not ending with .py) and all .py
files under the given directories.
Loop over all given paths, abort if any ends with .pyc, add the other given
files (even those not ending with .py) and collect all .py files under the
given directories.
"""
modules = []
Expand Down

0 comments on commit 4d694a6

Please sign in to comment.