From 601702294270dd34aa5f7f19abe1dfead911fee9 Mon Sep 17 00:00:00 2001 From: "Eric N. Vander Weele" Date: Sat, 12 Oct 2019 12:30:53 +0200 Subject: [PATCH] options: Remove parsing `--verbose` from the configuration file The `--verbose` option is only used by `flake8`, itself,` when parsing and handling preliminary options. After parsing and merging options from the configuration file, there is no other behavioral impact to the core of `flake8`. In other words, setting `verbose = ...` in a configuration file doesn't change the logging verbosity. While the `FileProcessor` does expose a `verbose` attribute, obtained from the parsed options, the verbosity of the core of `flake8` should be consistent with how a plugin may respond to the attribute's value. --- docs/source/user/options.rst | 8 +------- src/flake8/main/options.py | 1 - tests/fixtures/config_files/cli-specified.ini | 1 - tests/unit/test_merged_config_parser.py | 9 --------- 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/docs/source/user/options.rst b/docs/source/user/options.rst index ce0cf18..ab5cf29 100644 --- a/docs/source/user/options.rst +++ b/docs/source/user/options.rst @@ -155,13 +155,7 @@ Options and their Descriptions flake8 -vv - This **can** be specified in config files. - - Example config file usage: - - .. code-block:: ini - - verbose = 2 + This **can not** be specified in config files. .. option:: -q, --quiet diff --git a/src/flake8/main/options.py b/src/flake8/main/options.py index 75d2c8f..223f4a4 100644 --- a/src/flake8/main/options.py +++ b/src/flake8/main/options.py @@ -48,7 +48,6 @@ def register_default_options(option_manager): "--verbose", default=0, action="count", - parse_from_config=True, help="Print more information about what is happening in flake8." " This option is repeatable and will increase verbosity each " "time it is repeated.", diff --git a/tests/fixtures/config_files/cli-specified.ini b/tests/fixtures/config_files/cli-specified.ini index c67e1e9..75c5f23 100644 --- a/tests/fixtures/config_files/cli-specified.ini +++ b/tests/fixtures/config_files/cli-specified.ini @@ -7,5 +7,4 @@ 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 1112a0d..56ee893 100644 --- a/tests/unit/test_merged_config_parser.py +++ b/tests/unit/test_merged_config_parser.py @@ -27,8 +27,6 @@ def test_parse_cli_config(optmanager, config_finder): 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) @@ -43,7 +41,6 @@ def test_parse_cli_config(optmanager, config_finder): os.path.abspath('bar/'), os.path.abspath('bogus/'), ], - 'verbose': 2, 'quiet': 1, } @@ -68,8 +65,6 @@ def test_parse_user_config(optmanager, config_finder): 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) @@ -85,7 +80,6 @@ def test_parse_user_config(optmanager, config_finder): os.path.abspath('bar/'), os.path.abspath('bogus/'), ], - 'verbose': 2, 'quiet': 1, } @@ -97,8 +91,6 @@ def test_parse_local_config(optmanager, config_finder): 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) @@ -116,7 +108,6 @@ def test_parse_local_config(optmanager, config_finder): os.path.abspath('bar/'), os.path.abspath('bogus/'), ], - 'verbose': 2, 'quiet': 1, }