-
Notifications
You must be signed in to change notification settings - Fork 189
match-dir does not include files in subdirectories #363
Comments
This issue is also tripping me up. I have a project where I'd like to exclude certain third-party directories, but using So a practical example: in my config file, I have: [pydocstyle]
match_dir = (\.|foo|tests)
match = .*\.py This will match files in the top-level folder, I have also tried: |
it seems that maybe I don't understand well the reasons .. but my first guess is that would be easier to apply the a match pattern using as parameter the full relative path (the absolute path could have an undesirable result). probably related to this method https://github.com/PyCQA/pydocstyle/blob/master/src/pydocstyle/config.py#L124 |
In this PR: - Fixed omniscidb docstrings - Fixed some docstrings - Added pydocstyle check for ./ibis/.py and ./ibis/omniscidb/*.py Current issues with pydocstyle: - PyCQA/pydocstyle#111 - PyCQA/pydocstyle#363 Author: Ivan Ogasawara <[email protected]> Closes #1996 from xmnlab/add-docstring-check and squashes the following commits: bcda303 [Ivan Ogasawara] Fixed pydocstyle command. 55ff381 [Ivan Ogasawara] Add pydocstyle match-dir parameter into CI recipe. 5b270e8 [Ivan Ogasawara] Add docstring check to CI and git pre-commit hook
For backward compatibility reasons there would probably need to be a |
The only thing I could get to work was excluding directories by following the example here. I also could not figure out how to use a positive filter. [pydocstyle]
match = (?!test_).*\.py
match_dir = ^(?!(venv|ci_tests|some_sub_dir)).* |
Has there been any developments with matching directories using Currently, I am trying to pass An example of my repos:
...
- repo: https://github.com/pycqa/pydocstyle
rev: 5.1.1
hooks:
- id: pydocstyle
args:
- --match-dir='^(src).*' Solution Pre-commit can restrict the files that are passed to pydocstyle using the files key, for example: repos:
- repo: https://github.com/pycqa/pydocstyle
rev: 5.1.1
hooks:
- id: pydocstyle
files: ^src/
|
It has been noted in issue PyCQA#363 that match & match_dir are unwieldy when attempting to match against full paths. For unexample if you have A.py in directories B & C and you only want to run pydocstyle on one of them. From my own experience trying to deploy pydocstyle against a large legacy codebase it is unworkable as it would mean the entire codebase being converted as a big bang change. A more nuanced approach means the codebase can be converted gradually. This commit adds a new option, match_path, to the config & command lines which can be used to provide more nuanced matching. For example the following specification: match_path = [AB]/[ab].py D/e.py This defines two regexes. If either match a given path, relative to the directory specified, the file will be yielded for comparison. The is complimentary to match & match_dir and the three can be used together.
…et all linting functions to use setup.cfg for pydocstyle,
Let's say I use an option
--match-dir='^src'
and have a folder src and I want to match everything inside this folder including files in subfolders, currently it skips all files inside subfoldersThe text was updated successfully, but these errors were encountered: