From 98b9946a7893824779d87120d5c13ea2eace72c8 Mon Sep 17 00:00:00 2001 From: Shinya Kawaguchi Date: Sat, 22 Jul 2017 16:06:47 +0900 Subject: [PATCH 1/6] Reproduce quiet/verbose config problem --- tests/fixtures/config_files/cli-specified.ini | 2 ++ tests/unit/test_merged_config_parser.py | 24 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/fixtures/config_files/cli-specified.ini b/tests/fixtures/config_files/cli-specified.ini index 753604a..c67e1e9 100644 --- a/tests/fixtures/config_files/cli-specified.ini +++ b/tests/fixtures/config_files/cli-specified.ini @@ -7,3 +7,5 @@ exclude = foo/, bar/, bogus/ +verbose = 2 +quiet = 1 diff --git a/tests/unit/test_merged_config_parser.py b/tests/unit/test_merged_config_parser.py index 1541df4..1bc2bbe 100644 --- a/tests/unit/test_merged_config_parser.py +++ b/tests/unit/test_merged_config_parser.py @@ -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, } From 55e85b4b50a1d3ee89a2f803f33e2efdd677f4f8 Mon Sep 17 00:00:00 2001 From: Shinya Kawaguchi Date: Sat, 22 Jul 2017 16:21:32 +0900 Subject: [PATCH 2/6] Fix quiet/verbose config problem --- src/flake8/options/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py index 59bf60f..a6ac63f 100644 --- a/src/flake8/options/config.py +++ b/src/flake8/options/config.py @@ -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 From 69eaa28da2142c405174ce327e4d2470bbce2e87 Mon Sep 17 00:00:00 2001 From: Ian Stapleton Cordasco Date: Thu, 27 Jul 2017 18:47:38 -0500 Subject: [PATCH 3/6] Update name across the project post-marriage --- .mailmap | 4 ++++ docs/source/conf.py | 6 +++--- docs/source/internal/contributing.rst | 4 ++-- setup.py | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 .mailmap diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..07d8d50 --- /dev/null +++ b/.mailmap @@ -0,0 +1,4 @@ +Ian Stapleton Cordasco Ian Cordasco +Ian Stapleton Cordasco Ian Cordasco +Ian Stapleton Cordasco Ian Cordasco +Ian Stapleton Cordasco Ian Cordasco diff --git a/docs/source/conf.py b/docs/source/conf.py index 0c0b8de..355e6ff 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -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 diff --git a/docs/source/internal/contributing.rst b/docs/source/internal/contributing.rst index 80ff9ac..023a553 100644 --- a/docs/source/internal/contributing.rst +++ b/docs/source/internal/contributing.rst @@ -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 diff --git a/setup.py b/setup.py index 7606633..de350a8 100644 --- a/setup.py +++ b/setup.py @@ -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"}, From 0239f15dcce323357f316a66225b0d4d2308de28 Mon Sep 17 00:00:00 2001 From: Ian Stapleton Cordasco Date: Thu, 27 Jul 2017 18:57:29 -0500 Subject: [PATCH 4/6] Release v3.4.0 --- docs/source/release-notes/3.4.0.rst | 16 +++++++++++++++- src/flake8/__init__.py | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/source/release-notes/3.4.0.rst b/docs/source/release-notes/3.4.0.rst index 8c08160..08ee558 100644 --- a/docs/source/release-notes/3.4.0.rst +++ b/docs/source/release-notes/3.4.0.rst @@ -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 diff --git a/src/flake8/__init__.py b/src/flake8/__init__.py index e9c5d30..0ee1d99 100644 --- a/src/flake8/__init__.py +++ b/src/flake8/__init__.py @@ -27,7 +27,7 @@ LOG.addHandler(NullHandler()) # Clean up after LOG config del NullHandler -__version__ = '3.3.0' +__version__ = '3.4.0' __version_info__ = tuple(int(i) for i in __version__.split('.') if i.isdigit()) From a44a09f87a783ddfb15634ed0cf9aba76138f991 Mon Sep 17 00:00:00 2001 From: Ian Stapleton Cordasco Date: Fri, 28 Jul 2017 06:10:12 -0500 Subject: [PATCH 5/6] Remediate one wafer thing decision logic bug Previously we were hitting the catch-all return that decided the error was selected. Instead, let's add specific logic since we now know how we would hit that and we actually don't want it to be selected. Closes #354 --- src/flake8/style_guide.py | 3 +++ tests/unit/test_decision_engine.py | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/flake8/style_guide.py b/src/flake8/style_guide.py index 91423de..00eb1a5 100644 --- a/src/flake8/style_guide.py +++ b/src/flake8/style_guide.py @@ -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): diff --git a/tests/unit/test_decision_engine.py b/tests/unit/test_decision_engine.py index db9c270..354dc69 100644 --- a/tests/unit/test_decision_engine.py +++ b/tests/unit/test_decision_engine.py @@ -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, From 411edfa6f945b90c2e007b104297e2e17d5ba425 Mon Sep 17 00:00:00 2001 From: Ian Stapleton Cordasco Date: Fri, 28 Jul 2017 06:15:49 -0500 Subject: [PATCH 6/6] Bump version to 3.4.1 and add release notes --- docs/source/release-notes/3.4.1.rst | 17 +++++++++++++++++ docs/source/release-notes/index.rst | 1 + src/flake8/__init__.py | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 docs/source/release-notes/3.4.1.rst diff --git a/docs/source/release-notes/3.4.1.rst b/docs/source/release-notes/3.4.1.rst new file mode 100644 index 0000000..81d0eef --- /dev/null +++ b/docs/source/release-notes/3.4.1.rst @@ -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 diff --git a/docs/source/release-notes/index.rst b/docs/source/release-notes/index.rst index 3b145f0..b15d937 100644 --- a/docs/source/release-notes/index.rst +++ b/docs/source/release-notes/index.rst @@ -9,6 +9,7 @@ with the newest releases first. ================== .. toctree:: + 3.4.1 3.4.0 3.3.0 3.2.1 diff --git a/src/flake8/__init__.py b/src/flake8/__init__.py index 0ee1d99..80fe44e 100644 --- a/src/flake8/__init__.py +++ b/src/flake8/__init__.py @@ -27,7 +27,7 @@ LOG.addHandler(NullHandler()) # Clean up after LOG config del NullHandler -__version__ = '3.4.0' +__version__ = '3.4.1' __version_info__ = tuple(int(i) for i in __version__.split('.') if i.isdigit())