Skip to content

Files not ignored when linting from standard input #4354

Closed
@christoph-blessing

Description

@christoph-blessing

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🪲Command lineRelated to command line interfaceNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions