Merge branch 'bug/354' into 'master'

Fix regression in --select behaviour in v3.4.0

Closes #354

See merge request !195
This commit is contained in:
Ian Cordasco 2017-07-28 11:21:22 +00:00
commit a4f2135c77
13 changed files with 75 additions and 16 deletions

4
.mailmap Normal file
View file

@ -0,0 +1,4 @@
Ian Stapleton Cordasco <graffatcolmingov@gmail.com> Ian Cordasco <graffatcolmingov@gmail.com>
Ian Stapleton Cordasco <graffatcolmingov@gmail.com> Ian Cordasco <sigmavirus24@users.noreply.github.com>
Ian Stapleton Cordasco <graffatcolmingov@gmail.com> Ian Cordasco <ian.cordasco@rackspace.com>
Ian Stapleton Cordasco <graffatcolmingov@gmail.com> Ian Cordasco <icordasc+bitbucket@coglib.com>

View file

@ -54,8 +54,8 @@ master_doc = 'index'
# General information about the project.
project = u'flake8'
copyright = u'2016, Ian Cordasco'
author = u'Ian Cordasco'
copyright = u'2016, Ian Stapleton Cordasco'
author = u'Ian Stapleton Cordasco'
import flake8
# The version info for the project you're documenting, acts as replacement for
@ -235,7 +235,7 @@ latex_elements = {
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'flake8.tex', u'flake8 Documentation',
u'Ian Cordasco', 'manual'),
u'Ian Stapleton Cordasco', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of

View file

@ -19,8 +19,8 @@ Code of Conduct
===============
|Flake8| adheres to the `Python Code Quality Authority's Code of Conduct`_.
Any violations of the Code of Conduct should be reported to Ian Cordasco
(graffatcolmingov [at] gmail [dot] com).
Any violations of the Code of Conduct should be reported to Ian Stapleton
Cordasco (graffatcolmingov [at] gmail [dot] com).
Setting Up A Development Environment

View file

@ -1,4 +1,4 @@
3.4.0 -- 2017-xx-xx
3.4.0 -- 2017-07-27
-------------------
You can view the `3.4.0 milestone`_ on GitLab for more details.
@ -12,6 +12,14 @@ You can view the `3.4.0 milestone`_ on GitLab for more details.
- Filter out empty select and ignore codes, e.g., ``--ignore E123,,E234``.
(See also `GitLab#330`_)
- Specify dependencies appropriately in ``setup.py`` (See also `Gitlab#341_`)
- Fix bug in parsing ``--quiet`` and ``--verbose`` from config files.
(See also `GitLab!193`_)
- Remove unused import of ``os`` in the git hook template (See also
`GitLab!194`_)
.. all links
.. _3.4.0 milestone:
https://gitlab.com/pycqa/flake8/milestones/18
@ -23,5 +31,11 @@ You can view the `3.4.0 milestone`_ on GitLab for more details.
https://gitlab.com/pycqa/flake8/issues/329
.. _GitLab#330:
https://gitlab.com/pycqa/flake8/issues/330
.. _GitLab#341:
https://gitlab.com/pycqa/flake8/issues/341
.. merge request links
.. _GitLab!193:
https://gitlab.com/pycqa/flake8/merge_requests/193
.. _GitLab!194:
https://gitlab.com/pycqa/flake8/merge_requests/194

View file

@ -0,0 +1,17 @@
3.4.1 -- 2017-07-28
-------------------
You can view the `3.4.1 milestone`_ on GitLab for more details.
- Fix minor regression when users specify only a ``--select`` list with items
in the enabled/extended select list. (See also `GitLab#354`_)
.. all links
.. _3.4.1 milestone:
https://gitlab.com/pycqa/flake8/milestones/19
.. issue links
.. _GitLab#354:
https://gitlab.com/pycqa/flake8/issues/354
.. merge request links

View file

@ -9,6 +9,7 @@ with the newest releases first.
==================
.. toctree::
3.4.1
3.4.0
3.3.0
3.2.1

View file

@ -58,7 +58,7 @@ setuptools.setup(
long_description=get_long_description(),
author="Tarek Ziade",
author_email="tarek@ziade.org",
maintainer="Ian Cordasco",
maintainer="Ian Stapleton Cordasco",
maintainer_email="graffatcolmingov@gmail.com",
url="https://gitlab.com/pycqa/flake8",
package_dir={"": "src"},

View file

@ -27,7 +27,7 @@ LOG.addHandler(NullHandler())
# Clean up after LOG config
del NullHandler
__version__ = '3.3.0'
__version__ = '3.4.1'
__version_info__ = tuple(int(i) for i in __version__.split('.') if i.isdigit())

View file

@ -183,7 +183,8 @@ class MergedConfigParser(object):
# Use the appropriate method to parse the config value
method = config_parser.get
if option.type in self.GETINT_TYPES:
if (option.type in self.GETINT_TYPES or
option.action in self.GETINT_TYPES):
method = config_parser.getint
elif option.action in self.GETBOOL_ACTIONS:
method = config_parser.getboolean

View file

@ -263,6 +263,9 @@ class DecisionEngine(object):
if (select is None and
(extra_select is None or not self.using_default_ignore)):
return Decision.Ignored
if ((select is None and not self.using_default_select) and
(ignore is None and self.using_default_ignore)):
return Decision.Ignored
return Decision.Selected
def make_decision(self, code):

View file

@ -7,3 +7,5 @@ exclude =
foo/,
bar/,
bogus/
verbose = 2
quiet = 1

View file

@ -162,11 +162,10 @@ def test_decision_for(select_list, ignore_list, error_code, expected):
style_guide.Decision.Ignored),
(defaults.SELECT, ['E126'], [], ['I'], 'I101',
style_guide.Decision.Selected),
# This next one should exercise the catch-all return and yes, this is
# a *very* odd combination but users find much odder combinations
# anyway.
(['E', 'W'], defaults.IGNORE, ['I'], [], 'I101',
style_guide.Decision.Selected),
style_guide.Decision.Ignored),
# TODO(sigmavirus24) Figure out how to exercise the final catch-all
# return statement
]
)
def test_more_specific_decision_for_logic(select, ignore, extend_select,

View file

@ -47,6 +47,10 @@ def test_parse_cli_config(optmanager):
normalize_paths=True)
optmanager.add_option('--ignore', parse_from_config=True,
comma_separated_list=True)
optmanager.add_option('--verbose', parse_from_config=True,
action='count')
optmanager.add_option('--quiet', parse_from_config=True,
action='count')
parser = config.MergedConfigParser(optmanager)
parsed_config = parser.parse_cli_config(
@ -58,7 +62,9 @@ def test_parse_cli_config(optmanager):
os.path.abspath('foo/'),
os.path.abspath('bar/'),
os.path.abspath('bogus/'),
]
],
'verbose': 2,
'quiet': 1,
}
@ -81,6 +87,10 @@ def test_parse_user_config(optmanager):
normalize_paths=True)
optmanager.add_option('--ignore', parse_from_config=True,
comma_separated_list=True)
optmanager.add_option('--verbose', parse_from_config=True,
action='count')
optmanager.add_option('--quiet', parse_from_config=True,
action='count')
parser = config.MergedConfigParser(optmanager)
with mock.patch.object(parser.config_finder, 'user_config_file') as usercf:
@ -93,7 +103,9 @@ def test_parse_user_config(optmanager):
os.path.abspath('foo/'),
os.path.abspath('bar/'),
os.path.abspath('bogus/'),
]
],
'verbose': 2,
'quiet': 1,
}
@ -104,6 +116,10 @@ def test_parse_local_config(optmanager):
normalize_paths=True)
optmanager.add_option('--ignore', parse_from_config=True,
comma_separated_list=True)
optmanager.add_option('--verbose', parse_from_config=True,
action='count')
optmanager.add_option('--quiet', parse_from_config=True,
action='count')
parser = config.MergedConfigParser(optmanager)
config_finder = parser.config_finder
@ -119,7 +135,9 @@ def test_parse_local_config(optmanager):
os.path.abspath('foo/'),
os.path.abspath('bar/'),
os.path.abspath('bogus/'),
]
],
'verbose': 2,
'quiet': 1,
}