Skip to content
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

Files not ignored when linting from standard input #4354

Closed
christoph-blessing opened this issue Apr 14, 2021 · 3 comments · Fixed by #7220
Closed

Files not ignored when linting from standard input #4354

christoph-blessing opened this issue Apr 14, 2021 · 3 comments · Fixed by #7220
Labels
Bug 🪲 Command line Related to command line interface Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@christoph-blessing
Copy link
Contributor

The ignore-patterns option can be used to ignore certain files based on the specified pattern. For example:

echo "def somefunc():\n    pass" > file.py; pylint --ignore-patterns 'file\.py' file.py

Here there would be no output because the input is ignored. This does not work when reading the input from standard in instead of from a file. This is problematic when using pylint as an on-the-fly linter (e.g. in vim) because there is no good way to ignore certain inputs.

Steps to reproduce

echo "def somefunc():\n    pass" | pylint --ignore-patterns 'file\.py' --from-stdin file.py

Current behavior

Input is linted.

Expected behavior

Input is ignored.

pylint --version output

Result of pylint --version output:

pylint 2.7.2
astroid 2.5.1
Python 3.9.3 (default, Apr  8 2021, 23:35:02)
[GCC 10.2.0]
@hippo91 hippo91 added Bug 🪲 Command line Related to command line interface labels May 13, 2021
@twmr
Copy link
Contributor

twmr commented Oct 28, 2021

Hi. I've just seen this report and I'll take care of fixing the issue. thx for reporting it!

@Pierre-Sassoulas
Copy link
Member

@thisch do you still want to fix this issue ?

@Pierre-Sassoulas Pierre-Sassoulas added the Needs PR This issue is accepted, sufficiently specified and now needs an implementation label Jul 4, 2022
@twmr
Copy link
Contributor

twmr commented Jul 6, 2022

@Pierre-Sassoulas Well I tried fixing this but had problems with the implementation, which I unfortunately didn't report here. Now I no longer know what the problems were :-/

@twmr twmr removed their assignment Jul 6, 2022
christoph-blessing added a commit to christoph-blessing/pylint that referenced this issue Jul 22, 2022
christoph-blessing added a commit to christoph-blessing/dotfiles that referenced this issue Jul 28, 2022
Due to a bug in pylint it is currently not possible to ignore files
while linting from stdin. This leads to a lot of diagnostics being
displayed in ignored files.
(pylint-dev/pylint#4354)
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.15.1 milestone Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 Command line Related to command line interface Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants