mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-07 13:36:54 +00:00
FIX: Change how partial-path file patterns match
Previously, filenames with path separators in them will be made absolute before matching. However, this causes files specified in a configuration file to match different files based on where in the code base you are running flake8 from. This changes to pre-pending a '*' to anything with a path in it. This restores the behavior of per-file-ignores plugin matching.
This commit is contained in:
parent
4d7bd088e1
commit
8ca7025256
1 changed files with 9 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import functools
|
|||
import itertools
|
||||
import linecache
|
||||
import logging
|
||||
import os.path
|
||||
|
||||
from flake8 import defaults
|
||||
from flake8 import statistics
|
||||
|
|
@ -447,7 +448,14 @@ class StyleGuide(object):
|
|||
self.decider = decider or DecisionEngine(options)
|
||||
self.filename = filename
|
||||
if self.filename:
|
||||
self.filename = utils.normalize_path(self.filename)
|
||||
path = self.filename
|
||||
separator = os.path.sep
|
||||
# NOTE(sigmavirus24): os.path.altsep may be None
|
||||
alternate_separator = os.path.altsep or ""
|
||||
if separator in path or (
|
||||
alternate_separator and alternate_separator in path
|
||||
):
|
||||
self.filename = '*' + path
|
||||
self._parsed_diff = {}
|
||||
|
||||
def __repr__(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue