mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 10:46:54 +00:00
Merge branch 'bug/194' into 'master'
Re-allow for relative paths for exclude *Description of changes* Use the directory that the configuration file is found in as the parent (instead of the current working directory) when normalizing paths. *Related to:* #194 See merge request !109
This commit is contained in:
commit
b02855769b
4 changed files with 34 additions and 15 deletions
|
|
@ -4,21 +4,25 @@
|
|||
- Disable ``--jobs`` for any version of Python on Windows.
|
||||
(See also `this Python bug report`_)
|
||||
|
||||
- Fix ``# noqa`` comments followed by a ``:`` and explanation broken by
|
||||
3.0.0 (See also `GitLab#178`_)
|
||||
|
||||
- Fix issue where users were unable to ignore plugin errors that were on
|
||||
by default. (See also `GitLab#195`_)
|
||||
|
||||
- Raise exception when entry_point in plugin not callable.
|
||||
This raises an informative error when a plugin fails to load because its
|
||||
entry_point is not callable, which can happen with a plugin which is buggy or
|
||||
not updated for the current version of flake8. This is nicer than raising a
|
||||
`PicklingError` about failing to pickle a module (See also `GitLab#164`_)
|
||||
|
||||
- Fix ``# noqa`` comments followed by a ``:`` and explanation broken by
|
||||
3.0.0 (See also `GitLab#178`_)
|
||||
|
||||
- Always open our output file in append mode so we do not overwrite log
|
||||
messages. (See also `GitLab#193`_)
|
||||
|
||||
- When normalizing path values read from configuration, keep in context the
|
||||
directory where the configuration was found so that relative paths work.
|
||||
(See also `GitLab#194`_)
|
||||
|
||||
- Fix issue where users were unable to ignore plugin errors that were on
|
||||
by default. (See also `GitLab#195`_)
|
||||
|
||||
|
||||
.. links
|
||||
.. _GitLab#164:
|
||||
|
|
@ -27,6 +31,8 @@
|
|||
https://gitlab.com/pycqa/flake8/issues/178
|
||||
.. _GitLab#193:
|
||||
https://gitlab.com/pycqa/flake8/issues/193
|
||||
.. _GitLab#194:
|
||||
https://gitlab.com/pycqa/flake8/issues/193
|
||||
.. _GitLab#195:
|
||||
https://gitlab.com/pycqa/flake8/issues/195
|
||||
.. _this Python bug report:
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ class ConfigFileFinder(object):
|
|||
# List of filenames to find in the local/project directory
|
||||
self.project_filenames = ('setup.cfg', 'tox.ini', self.program_config)
|
||||
|
||||
self.local_directory = os.path.abspath(os.curdir)
|
||||
|
||||
if not args:
|
||||
args = ['.']
|
||||
self.parent = self.tail = os.path.abspath(os.path.commonprefix(args))
|
||||
|
|
@ -78,6 +80,7 @@ class ConfigFileFinder(object):
|
|||
if os.path.exists(filename):
|
||||
yield filename
|
||||
found_config_files = True
|
||||
self.local_directory = parent
|
||||
(parent, tail) = os.path.split(parent)
|
||||
|
||||
def local_config_files(self):
|
||||
|
|
@ -160,9 +163,11 @@ class MergedConfigParser(object):
|
|||
self.config_finder = ConfigFileFinder(self.program_name, self.args,
|
||||
self.extra_config_files)
|
||||
|
||||
@staticmethod
|
||||
def _normalize_value(option, value):
|
||||
final_value = option.normalize(value)
|
||||
def _normalize_value(self, option, value):
|
||||
final_value = option.normalize(
|
||||
value,
|
||||
self.config_finder.local_directory,
|
||||
)
|
||||
LOG.debug('%r has been normalized to %r for option "%s"',
|
||||
value, final_value, option.config_name)
|
||||
return final_value
|
||||
|
|
|
|||
|
|
@ -121,14 +121,14 @@ class Option(object):
|
|||
return self.long_option_name[2:].replace('-', '_')
|
||||
return self.short_option_name[1]
|
||||
|
||||
def normalize(self, value):
|
||||
def normalize(self, value, *normalize_args):
|
||||
"""Normalize the value based on the option configuration."""
|
||||
if self.normalize_paths:
|
||||
# Decide whether to parse a list of paths or a single path
|
||||
normalize = utils.normalize_path
|
||||
if self.comma_separated_list:
|
||||
normalize = utils.normalize_paths
|
||||
return normalize(value)
|
||||
return normalize(value, *normalize_args)
|
||||
elif self.comma_separated_list:
|
||||
return utils.parse_comma_separated_list(value)
|
||||
return value
|
||||
|
|
|
|||
16
tox.ini
16
tox.ini
|
|
@ -138,10 +138,18 @@ commands =
|
|||
# Once Flake8 3.0 is released and in a good state, we can use both and it will
|
||||
# work well \o/
|
||||
ignore = D203
|
||||
# NOTE(sigmavirus24): Once we release 3.0.0 this exclude option can be specified
|
||||
# across multiple lines. Presently it cannot be specified across multiple lines.
|
||||
# :-(
|
||||
exclude = .tox,.git,__pycache__,docs/source/conf.py,build,dist,tests/fixtures/*,*.pyc,*.egg-info,./.cache,./.eggs
|
||||
exclude =
|
||||
.tox,
|
||||
.git,
|
||||
__pycache__,
|
||||
docs/source/conf.py,
|
||||
build,
|
||||
dist,
|
||||
tests/fixtures/*,
|
||||
*.pyc,
|
||||
*.egg-info,
|
||||
.cache,
|
||||
.eggs
|
||||
max-complexity = 10
|
||||
import-order-style = google
|
||||
application-import-names = flake8
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue