From e5880d57b163c7b6c82de0fb3d43de9b4fd9f27b Mon Sep 17 00:00:00 2001 From: Sambhav Kothari Date: Thu, 30 Dec 2021 20:52:31 +0000 Subject: [PATCH] Allow matching for both the basename and the full pathname This is to avoid backward incompatible changes in case people are still relying on the old behavior. --- docs/release_notes.rst | 2 +- src/pydocstyle/config.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/release_notes.rst b/docs/release_notes.rst index a9060aef..deba068b 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -17,7 +17,7 @@ New Features Bug Fixes -* Fix ``--match`` option to only consider filename when matching full paths (#550). +* Fix ``--match`` option to consider both the base filename and the full-path when matching full paths (#550). 6.1.1 - May 17th, 2021 --------------------------- diff --git a/src/pydocstyle/config.py b/src/pydocstyle/config.py index ed00c874..5a4d1215 100644 --- a/src/pydocstyle/config.py +++ b/src/pydocstyle/config.py @@ -288,8 +288,8 @@ def _get_property_decorators(conf): # Skip any dirs that do not match match_dir dirs[:] = [d for d in dirs if match_dir(d)] - for filename in map(os.path.basename, filenames): - if match(filename): + for filename in filenames: + if match(filename) or match(os.path.basename(filename)): full_path = os.path.join(root, filename) yield ( full_path, @@ -302,7 +302,7 @@ def _get_property_decorators(conf): match, _ = _get_matches(config) ignore_decorators = _get_ignore_decorators(config) property_decorators = _get_property_decorators(config) - if match(os.path.basename(name)): + if match(name) or match(os.path.basename(name)): yield ( name, list(config.checked_codes),