Skip to content

Flake8 3.1.0 to 3.3.0 ignoring errors for radon violations, pre 3.1.0 versions display errors correctly #579

@asottile

Description

@asottile

In GitLab by @robert.peteuil on Apr 28, 2017, 13:40

Environment

flake8 installed via pip, along with pyflakes, pycodestyle, radon and mccabe as seen here:

$flake8 --version
3.3.0 (mccabe: 0.6.1, pycodestyle: 2.0.0, pyflakes: 1.5.0, radon: <property object at 0x109ae1520>) CPython 2.7.10 on Darwin

Problem

  • Running flake8 with the --radon-max-cc=1 parameter does not display radon errors
  • The -vv results show that it finds them, but ignores them.
  • This can be easily reproduced as in the Error Example session.

Error Example

Flake8 3.3.0 results for command flake8 awss/__init__.py --radon-max-cc=1 -v:

  • Note: only relevant portion of output included.
flake8.checker            MainProcess    291 INFO     Making checkers
flake8.checker            MainProcess    298 INFO     Checking 1 files
flake8.main.application   MainProcess    502 INFO     Finished running
flake8.main.application   MainProcess    502 INFO     Reporting errors
flake8.main.application   MainProcess    502 INFO     Found a total of 10 violations and reported 0

Flake8 3.3.0 -vv results for the same command:

Each error is in the log, yet does not get reported. In the log, the errors have the suffix of "is not inline ignored"

  • Note: only relevant portion of output included.
flake8.main.application   MainProcess   1472 INFO     Finished running
flake8.main.application   MainProcess   1472 INFO     Reporting errors
flake8.style_guide        MainProcess   1473 DEBUG    Deciding if "R701:" should be reported
flake8.style_guide        MainProcess   1473 DEBUG    The user configured "R701:" to be "Ignored.Implicitly", "Selected.Implicitly"
flake8.style_guide        MainProcess   1473 DEBUG    "R701:" will be "Decision.Ignored"
flake8.style_guide        MainProcess   1473 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=147, column_number=1, text="'cmd_list' is too complex (2)", physical_line='def cmd_list(options):\n') is not inline ignored
flake8.style_guide        MainProcess   1473 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=165, column_number=1, text="'cmd_startstop' is too complex (2)", physical_line='def cmd_startstop(options):\n') is not inline ignored
flake8.style_guide        MainProcess   1473 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=194, column_number=1, text="'cmd_ssh' is too complex (3)", physical_line='def cmd_ssh(options):\n') is not inline ignored
flake8.style_guide        MainProcess   1473 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=238, column_number=1, text="'qry_check' is too complex (2)", physical_line='def qry_check(qry_string):\n') is not inline ignored
flake8.style_guide        MainProcess   1473 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=255, column_number=1, text="'qry_create' is too complex (4)", physical_line='def qry_create(options):\n') is not inline ignored
flake8.style_guide        MainProcess   1473 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=305, column_number=1, text="'qry_helper' is too complex (4)", physical_line='def qry_helper(flag_filt, qry_string, title_out, flag_id=False, filt_st=""):\n') is not inline ignored
flake8.style_guide        MainProcess   1473 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=324, column_number=1, text="'list_instances' is too complex (4)", physical_line='def list_instances(title_out, i_info, numbered="no"):\n') is not inline ignored
flake8.style_guide        MainProcess   1474 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=358, column_number=1, text="'det_instance' is too complex (3)", physical_line='def det_instance(command, i_info, title_out):\n') is not inline ignored
flake8.style_guide        MainProcess   1474 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=388, column_number=1, text="'user_picklist' is too complex (2)", physical_line='def user_picklist(title_out, i_info, command):\n') is not inline ignored
flake8.style_guide        MainProcess   1474 DEBUG    Error(code='R701:', filename='awss/__init__.py', line_number=421, column_number=1, text="'user_entry' is too complex (4)", physical_line='def user_entry(entry_raw, command, maxqty):\n') is not inline ignored
flake8.main.application   MainProcess   1474 INFO     Found a total of 10 violations and reported 0'

Expected Results obtained by using Flake8 3.0.4 with -vv:

Reverted to older version & retest:

  • pip uninstall flake8
  • pip install flake8==3.0.4
  • flake8 awss/__init__.py --radon-max-cc=1 -vv

Output using flake8 3.0.4

This displays properly displays the errors.

flake8.main.application   MainProcess    436 INFO     Finished running
flake8.checker            MainProcess    436 INFO     Joining Process-1 to the main process
flake8.checker            MainProcess    436 INFO     Joining Process-2 to the main process
flake8.checker            MainProcess    436 INFO     Joining Process-3 to the main process
flake8.checker            MainProcess    436 INFO     Joining Process-4 to the main process
flake8.checker            MainProcess    436 INFO     Joining Process-5 to the main process
flake8.checker            MainProcess    436 INFO     Joining Process-6 to the main process
flake8.checker            MainProcess    437 INFO     Joining Process-7 to the main process
flake8.checker            MainProcess    437 INFO     Joining Process-8 to the main process
flake8.main.application   MainProcess    437 INFO     Reporting errors
awss/__init__.py:147:1: R701: 'cmd_list' is too complex (2)
awss/__init__.py:165:1: R701: 'cmd_startstop' is too complex (2)
awss/__init__.py:194:1: R701: 'cmd_ssh' is too complex (3)
awss/__init__.py:238:1: R701: 'qry_check' is too complex (2)
awss/__init__.py:255:1: R701: 'qry_create' is too complex (4)
awss/__init__.py:305:1: R701: 'qry_helper' is too complex (4)
awss/__init__.py:324:1: R701: 'list_instances' is too complex (4)
awss/__init__.py:358:1: R701: 'det_instance' is too complex (3)
awss/__init__.py:388:1: R701: 'user_picklist' is too complex (2)
awss/__init__.py:421:1: R701: 'user_entry' is too complex (4)
flake8.main.application   MainProcess    437 INFO     Found a total of 10 violations and reported 10

This is easily reproducible:

  • Install 3.3.0, and run flake8 example.py --radon-max-cc=1 -v - no errors displayed
  • Uninstall 3.3.0, install 3.0.4, run the same command, errors displayed
  • Uninstall 3.0.4, install 3.3.0, no errors displayed

Output of flake8 --bug-report

Here's the flake8 --bug-report output:

Traceback (most recent call last):
  File "/usr/local/bin/flake8", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/Library/Python/2.7/site-packages/flake8/main/application.py", line 328, in run
    self._run(argv)
  File "/Library/Python/2.7/site-packages/flake8/main/application.py", line 315, in _run
    self.initialize(argv)
  File "/Library/Python/2.7/site-packages/flake8/main/application.py", line 299, in initialize
    self.parse_configuration_and_cli(argv)
  File "/Library/Python/2.7/site-packages/flake8/main/application.py", line 168, in parse_configuration_and_cli
    self.option_manager, argv
  File "/Library/Python/2.7/site-packages/flake8/options/aggregator.py", line 35, in aggregate_options
    original_values, original_args = manager.parse_args(arglist)
  File "/Library/Python/2.7/site-packages/flake8/options/manager.py", line 274, in parse_args
    options, xargs = self.parser.parse_args(args, values)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/optparse.py", line 1400, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/optparse.py", line 1440, in _process_args
    self._process_long_opt(rargs, values)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/optparse.py", line 1515, in _process_long_opt
    option.process(opt, value, values, self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/optparse.py", line 789, in process
    self.action, self.dest, opt, value, values, parser)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/optparse.py", line 809, in take_action
    self.callback(self, opt, value, parser, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/flake8/main/debug.py", line 36, in print_information
    print(json.dumps(information(option_manager), indent=2, sort_keys=True))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 250, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 209, in encode
    chunks = list(chunks)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 434, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
    for chunk in chunks:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 442, in _iterencode
    o = _default(o)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <property object at 0x105f085d0> is not JSON serializable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions