Skip to content

per-file-ignores not respected when overlapping files via globs #1369

@paw-lu

Description

@paw-lu

Please describe how you installed Flake8

Example:

$ python -m pip install flake8

Please provide the exact, unmodified output of flake8 --bug-report

% flake8 --bug-report
Usage: flake8 [OPTIONS] [PY_FILE]...
Try 'flake8 --help' for help.

Error: no such option: --bug-report

(what went wrong here?)

Please describe the problem or feature

If is specified twice in per-file-ignores—one explicitly one implicitly via globs (*), the ignored violation codes are not respected.

If this is a bug report, please explain with examples (and example code) what you expected to happen and what actually happened.

With a project of the format:

.
├── dir
│  ├── bar.py
│  └── foo.py
└── .flake8
"""foo.py"""
a = (1,2)
"""bar.py"""
import os

a = (1,2)
# .flake8
[flake8]
per-file-ignores = 
    dir/*:E231
    dir/bar.py:F401

What I expect

I expect E231 to be ignored in both files, and F401 to be ignored in bar.py.

What happens

% flake8 dir/*
dir/bar.py:3:7: E231 missing whitespace after ','

Only F401 is ignored in bar.py, but not not E231.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions