plone / plone.recipe.codeanalysis

provides static code analysis for Buildout-based Python projects, including flake8, JSHint, CSS Lint, and other code checks
https://pypi.org/project/plone.recipe.codeanalysis/
11 stars 8 forks source link

getting flake8-commas to work with flake8 3.3.0 #200

Closed iham closed 7 years ago

iham commented 7 years ago

I am not sure, if flake8-commas are used in the plone community, or if this extension is useful by any means, but as it is documented as a recommend extras which are installed, i guess it should work.

After unpinning all versions of flake8 & related packages (some are really far behind) only flake8-commas seems to make troubles:

with the latest version of commas (0.4.0 & 0.4.1):

# ./bin/code-analysis-flake8
Flake8..........................[ FAILURE ] in 0.617s
Traceback (most recent call last):
  File "<myproject>/bin/flake8", line 39, in <module>
    sys.exit(flake8.main.cli.main())
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/main/application.py", line 328, in run
    self._run(argv)
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/main/application.py", line 316, in _run
    self.run_checks()
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/main/application.py", line 246, in run_checks
    self.file_checker_manager.run()
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/checker.py", line 317, in run
    self.run_parallel()
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/checker.py", line 286, in run_parallel
    for ret in pool_map:
  File "<mysandbox>/buildout.python/parts/opt/lib/python2.7/multiprocessing/pool.py", line 659, in next
    raise value
AttributeError: 'tuple' object has no attribute 'type'

after deactivating multiprocessing (not preferable):

# ./bin/code-analysis-flake8
Flake8..........................[ FAILURE ] in 0.487s
Traceback (most recent call last):
  File "<myproject>/bin/flake8", line 39, in <module>
    sys.exit(flake8.main.cli.main())
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/main/application.py", line 328, in run
    self._run(argv)
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/main/application.py", line 316, in _run
    self.run_checks()
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/main/application.py", line 246, in run_checks
    self.file_checker_manager.run()
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/checker.py", line 319, in run
    self.run_serial()
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/checker.py", line 303, in run_serial
    checker.run_checks()
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/checker.py", line 573, in run_checks
    self.run_ast_checks()
  File "<myproject>/eggs/flake8-3.3.0-py2.7.egg/flake8/checker.py", line 487, in run_ast_checks
    for (line_number, offset, text, check) in runner:
  File "<myproject>/eggs/flake8_commas-0.4.1-py2.7.egg/flake8_commas/_base.py", line 262, in run
    for error in get_comma_errors(tokens):
  File "<myproject>/eggs/flake8_commas-0.4.1-py2.7.egg/flake8_commas/_base.py", line 198, in get_comma_errors
    for token in tokens:
  File "<myproject>/eggs/flake8_commas-0.4.1-py2.7.egg/flake8_commas/_base.py", line 122, in simple_tokens
    token = next(tokens)
  File "<myproject>/eggs/flake8_commas-0.4.1-py2.7.egg/flake8_commas/_base.py", line 120, in <genexpr>
    tokens = (t for t in tokens if t.type != tokenize.COMMENT)
AttributeError: 'tuple' object has no attribute 'type'

every other package works unpinned in its latest versions:

hvelarde commented 7 years ago

this problem has nothing to do with this package; it's a known issue on flake8-commas:

https://github.com/flake8-commas/flake8-commas/issues/35