question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invoking in flakehell results in exception

See original GitHub issue

Bug report

What’s wrong

When invoking flakehell baseline I get following traceback. I can only guess that I have bad annotations somewhere in code, but cannot tell where. Would be happy to provide more info.
Traceback:

Traceback (most recent call last):
  File "/Users/ynblagoveshenskiy/Library/Caches/pypoetry/virtualenvs/complex-sync-CQECTYHO-py3.7/lib/python3.7/site-packages/wemake_python_styleguide/checker.py", line 154, in run
    visitor.run()
  File "/Users/ynblagoveshenskiy/Library/Caches/pypoetry/virtualenvs/complex-sync-CQECTYHO-py3.7/lib/python3.7/site-packages/wemake_python_styleguide/visitors/base.py", line 191, in run
    self.visit(self.tree)
  File "/Users/ynblagoveshenskiy/Library/Caches/pypoetry/virtualenvs/complex-sync-CQECTYHO-py3.7/lib/python3.7/site-packages/wemake_python_styleguide/visitors/base.py", line 186, in visit
    return route_visit(self, tree)
  File "/Users/ynblagoveshenskiy/.pyenv/versions/3.7.6/lib/python3.7/ast.py", line 271, in visit
    return visitor(node)
  File "/Users/ynblagoveshenskiy/.pyenv/versions/3.7.6/lib/python3.7/ast.py", line 279, in generic_visit
    self.visit(item)
  File "/Users/ynblagoveshenskiy/Library/Caches/pypoetry/virtualenvs/complex-sync-CQECTYHO-py3.7/lib/python3.7/site-packages/wemake_python_styleguide/visitors/base.py", line 186, in visit
    return route_visit(self, tree)
  File "/Users/ynblagoveshenskiy/.pyenv/versions/3.7.6/lib/python3.7/ast.py", line 271, in visit
    return visitor(node)
  File "/Users/ynblagoveshenskiy/.pyenv/versions/3.7.6/lib/python3.7/ast.py", line 279, in generic_visit
    self.visit(item)
  File "/Users/ynblagoveshenskiy/Library/Caches/pypoetry/virtualenvs/complex-sync-CQECTYHO-py3.7/lib/python3.7/site-packages/wemake_python_styleguide/visitors/base.py", line 186, in visit
    return route_visit(self, tree)
  File "/Users/ynblagoveshenskiy/.pyenv/versions/3.7.6/lib/python3.7/ast.py", line 271, in visit
    return visitor(node)
  File "/Users/ynblagoveshenskiy/Library/Caches/pypoetry/virtualenvs/complex-sync-CQECTYHO-py3.7/lib/python3.7/site-packages/wemake_python_styleguide/visitors/ast/complexity/annotations.py", line 34, in visit_any_function
    self._check_function_annotations_complexity(node)
  File "/Users/ynblagoveshenskiy/Library/Caches/pypoetry/virtualenvs/complex-sync-CQECTYHO-py3.7/lib/python3.7/site-packages/wemake_python_styleguide/visitors/ast/complexity/annotations.py", line 58, in _check_function_annotations_complexity
    self._check_annotations_complexity(node, annotations)
  File "/Users/ynblagoveshenskiy/Library/Caches/pypoetry/virtualenvs/complex-sync-CQECTYHO-py3.7/lib/python3.7/site-packages/wemake_python_styleguide/visitors/ast/complexity/annotations.py", line 67, in _check_annotations_complexity
    complexity = get_annotation_compexity(annotation)
  File "/Users/ynblagoveshenskiy/Library/Caches/pypoetry/virtualenvs/complex-sync-CQECTYHO-py3.7/lib/python3.7/site-packages/wemake_python_styleguide/logic/complexity/annotations.py", line 30, in get_annotation_compexity
    ).body[0].value
IndexError: list index out of range

How is that should be

System information

flake8 information

Contents of flake8 --bug-report:

{
  "dependencies": [],
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.7.6",
    "system": "Darwin"
  },
  "plugins": [
    {
      "is_local": false,
      "plugin": "flake8-bandit",
      "version": "2.1.2"
    },
    {
      "is_local": false,
      "plugin": "flake8-broken-line",
      "version": "0.2.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-bugbear",
      "version": "19.8.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-comprehensions",
      "version": "3.2.3"
    },
    {
      "is_local": false,
      "plugin": "flake8-darglint",
      "version": "1.5.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-debugger",
      "version": "3.2.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-docstrings",
      "version": "1.5.0, pydocstyle: 5.0.2"
    },
    {
      "is_local": false,
      "plugin": "flake8-eradicate",
      "version": "0.3.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-string-format",
      "version": "0.2.3"
    },
    {
      "is_local": false,
      "plugin": "flake8_commas",
      "version": "2.0.0"
    },
    {
      "is_local": false,
      "plugin": "flake8_isort",
      "version": "2.9.1"
    },
    {
      "is_local": false,
      "plugin": "flake8_quotes",
      "version": "2.1.2"
    },
    {
      "is_local": false,
      "plugin": "mccabe",
      "version": "0.6.1"
    },
    {
      "is_local": false,
      "plugin": "naming",
      "version": "0.9.1"
    },
    {
      "is_local": false,
      "plugin": "pycodestyle",
      "version": "2.6.0"
    },
    {
      "is_local": false,
      "plugin": "pyflakes",
      "version": "2.2.0"
    },
    {
      "is_local": false,
      "plugin": "pylint",
      "version": "2.5.3"
    },
    {
      "is_local": false,
      "plugin": "rst-docstrings",
      "version": "0.0.12"
    },
    {
      "is_local": false,
      "plugin": "wemake_python_styleguide",
      "version": "0.14.0"
    }
  ],
  "version": "3.8.3"
}

pip information

Contents of pip freeze:

aadict==0.2.3
aioamqp==0.11.0
aioelasticsearch==0.5.2
aiofiles==0.5.0
aiohttp==3.6.2
aioresponses==0.6.0
apispec==0.39.0
asset==0.6.13
astor==0.8.1
astroid==2.4.2
async-timeout==3.0.1
asyncpg==0.20.1
asynctest==0.13.0
atomicwrites==1.4.0
attrs==19.3.0
bandit==1.6.2
chardet==3.0.4
click==7.1.2
crontab==0.22.6
Cython==0.29.20
darglint==1.5.1
deepdiff==3.3.0
docutils==0.16
elasticsearch==6.8.1
entrypoints==0.3
envparse==0.2.0
eradicate==1.0
expiringdict==1.1.4
flake8==3.8.3
flake8-bandit==2.1.2
flake8-broken-line==0.2.1
flake8-bugbear==19.8.0
flake8-commas==2.0.0
flake8-comprehensions==3.2.3
flake8-debugger==3.2.1
flake8-docstrings==1.5.0
flake8-eradicate==0.3.0
flake8-isort==2.9.1
flake8-polyfill==1.0.2
flake8-quotes==2.1.2
flake8-rst-docstrings==0.0.12
flake8-string-format==0.2.3
flakehell==0.5.0
freezegun==0.3.10
gitdb==4.0.5
GitPython==3.1.7
globre==0.1.5
idna==2.10
importlib-metadata==1.7.0
iniherit==0.3.9
isort==4.3.21
jsonpickle==1.4.1
jsonschema==3.0.2
lazy-object-proxy==1.4.3
lxml==4.5.1
marshmallow==2.18.0
mccabe==0.6.1
more-itertools==8.4.0
multidict==4.7.6
packaging==20.4
pbr==5.4.5
pep8-naming==0.9.1
pluggy==0.13.1
psycopg2-binary==2.8.3
py==1.9.0
pycodestyle==2.6.0
pydantic==1.5.1
pydocstyle==5.0.2
pyflakes==2.2.0
Pygments==2.6.1
pyhocon==0.3.55
PyJWT==1.6.4
pylint==2.5.3
pyparsing==2.4.7
pyrsistent==0.16.0
pytest==5.1.2
pytest-asyncio==0.10.0
python-dateutil==2.6.1
python-slugify==1.2.6
pytz==2019.3
PyYAML==5.3.1
raven==6.10.0
raven-aiohttp==0.7.0
restructuredtext-lint==1.3.1
sanic==0.8.3
Sanic-Cors==0.9.9.post4
Sanic-Plugins-Framework==0.8.2.post1
schematics==2.0.1
six==1.15.0
smmap==3.0.4
snowballstemmer==2.0.0
stevedore==3.1.0
termcolor==1.1.0
testfixtures==6.14.1
text-unidecode==1.3
toml==0.10.1
typed-ast==1.4.1
typer==0.1.1
typing-extensions==3.7.4.2
ujson==1.35
Unidecode==1.1.1
urllib3==1.25.9
uvloop==0.14.0
wait==0.0.3
wcwidth==0.2.5
websockets==5.0.1
wemake-python-styleguide==0.14.0
wrapt==1.12.1
yarl==1.2.6
yoyo-migrations==6.1.0
zipp==3.1.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
orsiniumcommented, Jul 28, 2020

Also, flakehell has --safe argument to suppress exceptions from plugins. It can work as a temporary solution.

1reaction
sobolevncommented, Jul 16, 2020

Oups, please replace returns with your folder name:

find $YOUR_PROJECT_DIR -name '*.py' -exec bash -c 'echo {}; flake8 {}' \;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Invoking in flakehell results in exception #1511 - Issuehunt
When invoking flakehell baseline I get following traceback. I can only guess that I have bad annotations somewhere in code, but cannot tell...
Read more >
FlakeHell was archived · Issue #1817 - GitHub
I've been using that branch for a few months locally now, and it works pretty well. 1
Read more >
Config — FlakeHell 0.8.0 documentation
Everything you've specified for Flake8 will work for FlakeHell. The only exception is list of checks, it must be explicitly specified in FlakeHell's...
Read more >
flakehell._cli.main Example - Program Talk
python code examples for flakehell. ... def test_help(flag, capsys): result = main([flag]) assert result == (0, '') captured = capsys.readouterr() assert ...
Read more >
Specify per-file-ignores with pyproject.toml and flake8
I am using flake8 (with flakehell but that should not interfere) and keep its ... And in my case I should use flakehell...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found