-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore clause not ignoring directories #2686
Comments
The problem seems to be in if os.path.basename(something) in black_list:
continue
if _basename_in_blacklist_re(os.path.basename(something), black_list_re):
continue Here |
Hi @geajack Thanks for reporting an issue. That behaviour it's probably not intended, I think we definitely need to fix this to allow ignoring directories as well. |
@geajack @PCManticore Is there a work around to force pylint to ignore directories? I've tried |
Has there been any progress on this issue? It's still apparent in |
@bgehman Right now ignoring directories is not supported, as per this issue suggests. We should add support for ignoring directories to @Michionlion There was no progress on this issue, as you can see there are 400 issues opened, so depending on my time, it's entirely possible that an issue could stay open for months or years. Feel free to tackle a PR if you need this fixed sooner. |
Relates to #2541 |
I also meet this problem. |
workaround... add this to your .pylintrc:
then create
|
When will we get a fix for this issue? |
This is still broken, one and a half year later... The documentation still claims that these parameters can ignore directories. |
@jw-lilly Thank you! Saved me a ton of time. But... you have linting errors in your script 😝 |
@digitaldavenyc You're welcome! I don't know whether to be happy or sad that I've recruited others to join me in monkeypatching... :-/ |
Thanks @jw-lilly |
Here is a find workaround to ignore a particular subfolder when running pylint:
It essentially asks "Give me all .py file except those that have the string /migrations in their path". |
It seems to me that the workaround proposed by @jw-lilly broke recently (on 2021-04-03, from version 2.8.0 on) with commit 63ca059 as the @Pierre-Sassoulas Do you think it is a possibility to revert that commit to make this workaround work again or to merge #3266 for supporting this natively? |
Hello, thank you for bringing this to my attention. I'd prefer to relaunch #3266, it seems it i's blocked because the original implementer does not have time to rebase it. I'd be glad to review and merge it. Basically all mainteners participated in it at some point so this is not a controversial change. |
As an aside it's possible to use pylint through pre-commit (which has its own exclude system) . |
I relaunched the PR as #4516, rebased the corresponding branch on top of master, adjusted the changes to match the ones introduced with 63ca059 and the renaming from black- to ignore-list. |
@fdamken how do we use that PR? I used to have this in my # SEE: https://github.com/PyCQA/pylint/issues/2686#issuecomment-621927895
# Python code to execute, usually for sys.path manipulation such as pygtk.require().
init-hook = """
sys.path.append(os.getcwd());
from pylint_ignore import PylintIgnorePaths;
PylintIgnorePaths("relative/path/to/directory/to/ignore");
""" How do I integrate the new Also, thank you for fixing this, it's awesome. |
@jamesbraza yes, of course: The So too ignore any directory |
Thank you for the response @fdamken, I have tried a lot of stuff and am still having trouble. Are you sure Check out this GitHub search and the example config in examples/pylintrc. I am not sure if the location within Also, when using in ignore-paths = ["unittest_.*"]
# or
ignore-paths = "unittest_.*" I have tried many permutations of possible regexes. My current regex checks out on regex101: And I still can't get it to work :( any further help is much appreciated. |
Hi @jamesbraza,
So you separate multiple regular expressions using commas and the path is matched starting from the working directory. For
Best regards and sorry again! |
Hello @fdamken ! Thank you for detailing out how to use it. It seems https://github.com/PyCQA/pylint/pull/4623/files#diff-81fbdb16099ef5c97297b1a8dbd9a6a629906cab99950094742298d574573de3R24 added this to the example Your comment:
pointed out my error.... I wasn't using the version of pylint your PR was merged to! (facepalm) Now that pylint 2.9 is released, I am using this in my code, and it works great! Thank you for implementing this fix. |
This is a different issue to issues/908.
Steps to reproduce
test
and within that a directorystuff
.test/a.py
andtest/stuff/b.py
. Put syntax errors in both.test
, runpylint *.py **/*.py --ignore stuff
.Current behavior
Pylint does not ignore
stuff/b.py
, producing the messageExpected behavior
Pylint ignores the file
stuff/b.py
.pylint --version output
The text was updated successfully, but these errors were encountered: