Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Exclusion regex passed to match-dir does not exclude #175

Closed
tomarak opened this issue Feb 24, 2016 · 11 comments
Closed

Exclusion regex passed to match-dir does not exclude #175

tomarak opened this issue Feb 24, 2016 · 11 comments

Comments

@tomarak
Copy link

tomarak commented Feb 24, 2016

When I supply a regex to the match-dir option to ignore my migrations folders, the migrations folders still get included in the directories checked. I've tried:

match-dir="[^(\.|migrations)].*”
match-dir="^((?!migrations.)*$”
match-dir="^(?!migrations).*”

And none work as expected.

The file structure of my project looks like this:

project/
│
└───app1/
|    │
|    ├───migrations/
│
└───app2/
|    │
|    ├───migrations/
│
└───app3/
     │
     ├───migrations/

@Nurdok Nurdok modified the milestone: pydocstyle 1.1.0 Apr 23, 2016
@goanpeca
Copy link

goanpeca commented Nov 3, 2016

Having an exclude option via cli and config (like pep8, flake8 and a lot of other tools) would make this easier

@mheppner
Copy link

mheppner commented May 6, 2017

An alternative solution to ignore the migrations themselves (files starting with 4 digits). This isn't ideal, but it helps:

match = (?!test_)(?!\d{4}_).*\.py

@cdeil
Copy link

cdeil commented May 9, 2017

+1 to add something simple like --exclude from flake8.
Or alternatively, to add a docs section that shows working examples how to ignore given files or folders. (this issue suggests that match-dir option processing is broken at the moment. Is this correct?)

@mrshannon
Copy link
Contributor

I agree this is a very confusing method to include/exclude directories and a clearer method, such as that in pycodestyle is needed. However, the last regex

match-dir="^(?!migrations).*”

does work in version 2.3.1, not sure at which point this was fixed. The first two regexes are not valid for the OP's purpose. The first will skip any directories beginning with '.', 'm', 'i', 'g', 'r', 'a', 't', 'i', 'o'. 'n', or 's' while the second only matches the empty string.

Therefore, this issue should probably be closed.

@craiga
Copy link

craiga commented Feb 26, 2018

Still appears to be an issue in 2.1.1. "^(?!migrations).*” appears to be excluding all directories in my project.

@dalepotter
Copy link

does work in version 2.3.1

Is this even a version? Not according to https://github.com/PyCQA/pydocstyle/tags

dalepotter added a commit to IATI/IATI-Standard-Website that referenced this issue May 8, 2018
Does not exclude all migrations folders given a bug in pydocstyle: PyCQA/pydocstyle#175
@StrikerRUS
Copy link

StrikerRUS commented Oct 13, 2018

2.1.1 with explicit default --match-dir='[^\.].*' ignores all folders. Even --match-dir='.*' produces no output. Seems that this option is completely broken.

@StrikerRUS
Copy link

Docs are lying: this option works without quotes, like: "^(?!migrations).*

@shacharoo
Copy link
Member

@tomarak and @craiga - your issue is that your closing double-quote isn't ASCII, it's some Unicode character, probably copied from somewhere:
image

Other than that, there is a difference between how different shells parse singe and double quotes, so "which quotes should I use" is completely a user decision based on his/hers setup. Take a look at this SOVF question for more info.

Bottom line: there is no issue with how pydocstyle behaves, but I agree that we can add some warning in the documentation about this, which I will do today 😺

Cheers,
Shachar.

shacharoo added a commit to shacharoo/pydocstyle that referenced this issue Oct 14, 2018
@craiga
Copy link

craiga commented Oct 15, 2018

Well, that's a little embarrassing. Thanks for your patience.

@Malachov
Copy link

Finally found solution - at least for VS Code (but don't ask me why it works though :)

"python.linting.pydocstyleArgs": ["--match=^((?!test).)*$"],

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests