wemake-services / wemake-python-styleguide

The strictest and most opinionated python linter ever!
https://wemake-python-styleguide.rtfd.io
MIT License
2.53k stars 378 forks source link

IndexError on first run #3020

Closed rixx closed 3 months ago

rixx commented 3 months ago

What's wrong

flake8 .
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.12/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8/checker.py", line 83, in _mp_run
    ).run_checks()
      ^^^^^^^^^^^^
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8/checker.py", line 526, in run_checks
    self.run_ast_checks()
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8/checker.py", line 428, in run_ast_checks
    for line_number, offset, text, _ in runner:
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8_commas/_base.py", line 333, in run
    for error in get_comma_errors(tokens):
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8_commas/_base.py", line 306, in get_comma_errors
    (token.type == COLON and stack[-1].comma == LAMBDA_EXPR)
                             ~~~~~^^^^
IndexError: list index out of range
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/rixx/.local/share/virtualenvs/pretalx/bin/flake8", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8/main/application.py", line 187, in _run
    self.run_checks()
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8/main/application.py", line 103, in run_checks
    self.file_checker_manager.run()
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8/checker.py", line 236, in run
    self.run_parallel()
  File "/home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/flake8/checker.py", line 205, in run_parallel
    self.results = list(pool.imap_unordered(_mp_run, self.filenames))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/multiprocessing/pool.py", line 873, in next
    raise value
IndexError: list index out of range

How it should be

-

Flake8 version and plugins

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.12.4",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "darglint",
      "version": "1.8.1"
    },
    {
      "plugin": "flake8-bandit",
      "version": "4.1.1"
    },
    {
      "plugin": "flake8-broken-line",
      "version": "1.0.0"
    },
    {
      "plugin": "flake8-bugbear",
      "version": "24.4.26"
    },
    {
      "plugin": "flake8-commas",
      "version": "2.1.0"
    },
    {
      "plugin": "flake8-comprehensions",
      "version": "3.15.0"
    },
    {
      "plugin": "flake8-debugger",
      "version": "4.1.2"
    },
    {
      "plugin": "flake8-docstrings",
      "version": "1.7.0"
    },
    {
      "plugin": "flake8-eradicate",
      "version": "1.5.0"
    },
    {
      "plugin": "flake8-isort",
      "version": "6.1.1"
    },
    {
      "plugin": "flake8-quotes",
      "version": "3.4.0"
    },
    {
      "plugin": "flake8-rst-docstrings",
      "version": "0.3.0"
    },
    {
      "plugin": "flake8-string-format",
      "version": "0.3.0"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pep8-naming",
      "version": "0.13.3"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.12.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.2.0"
    },
    {
      "plugin": "wemake-python-styleguide",
      "version": "0.19.2"
    }
  ],
  "version": "7.1.0"
}

pip information

pip 24.0 from /home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/pip (python 3.12)
DEPRECATION: Loading egg at /home/rixx/.local/share/virtualenvs/pretalx/lib/python3.12/site-packages/dnspython-2.6.1-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
amqp==5.2.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
asgiref==3.8.1
astor==0.8.1
attrs==23.2.0
bandit==1.7.9
beautifulsoup4==4.12.3
billiard==4.2.0
black==24.4.2
bleach==6.1.0
build==1.2.1
celery==5.4.0
certifi==2024.6.2
cffi==1.16.0
chardet==5.2.0
charset-normalizer==3.3.2
check-manifest==0.49
click==8.1.7
click-didyoumean==0.3.1
click-plugins==1.1.1
click-repl==0.3.0
coverage==7.5.3
cryptography==42.0.8
css-inline==0.14.1
csscompressor==0.9.5
cssutils==2.10.3
darglint==1.8.1
defusedcsv==2.0.0
defusedxml==0.7.1
Django==4.2.13
django-appconf==1.0.6
django-bootstrap4==3.0.1
django-compressor==4.4
django-countries==7.6.1
django-filter==24.2
django-formset-js-improved==0.5.0.3
django-formtools==2.5.1
django-hierarkey==1.1.0
django-i18nfield==1.9.4
django-jquery-js==3.1.1
django-libsass==0.9
django-redis==5.4.0
django-scopes==2.0.0
django_context_decorator==1.6.1
django_csp==3.8
djangorestframework==3.15.2
djhtml==3.0.6
dnspython==2.6.1
docutils==0.21.2
eradicate==2.3.0
execnet==2.1.1
Faker==25.8.0
flake8==7.1.0
flake8-bandit==4.1.1
flake8-broken-line==1.0.0
flake8-bugbear==24.4.26
flake8-commas==2.1.0
flake8-comprehensions==3.15.0
flake8-debugger==4.1.2
flake8-docstrings==1.7.0
flake8-eradicate==1.5.0
flake8-isort==6.1.1
flake8-quotes==3.4.0
flake8-rst-docstrings==0.3.0
flake8-string-format==0.3.0
freezegun==1.5.1
idna==3.7
importlib_metadata==8.0.0
iniconfig==2.0.0
isort==5.13.2
jaraco.classes==3.4.0
jaraco.context==5.3.0
jaraco.functools==4.0.1
jeepney==0.8.0
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
keyring==25.2.1
kombu==5.3.7
libsass==0.23.0
lxml==5.2.2
Markdown==3.6
markdown-it-py==3.0.0
mccabe==0.7.0
mdurl==0.1.2
more-itertools==10.3.0
mypy-extensions==1.0.0
nh3==0.2.17
packaging==24.1
pathspec==0.12.1
pbr==6.0.0
pep8-naming==0.13.3
pillow==10.3.0
pkginfo==1.10.0
platformdirs==4.2.2
pluggy==1.5.0
-e git+ssh://git@github.com/pretalx/pretalx@84a4e2ed971a9a26922b0dba2b869dc63fb12cb9#egg=pretalx
-e git+ssh://git@github.com/rixx/pretalx-com.git@0ae5108a1aebe6b36ed16def0164b828a325c504#egg=pretalx_com
prompt_toolkit==3.0.47
psycopg2-binary==2.9.9
publicsuffixlist==0.10.1.20240618
pycodestyle==2.12.0
pycparser==2.22
pydocstyle==6.3.0
pyflakes==3.2.0
Pygments==2.18.0
pypng==0.20220715.0
pyproject_hooks==1.1.0
pytest==8.2.2
pytest-cov==5.0.0
pytest-django==4.8.0
pytest-mock==3.14.0
pytest-rerunfailures==14.0
pytest-sugar==1.0.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
pywatchman==2.0.0
PyYAML==6.0.1
qrcode==7.4.2
rcssmin==1.1.1
readme_renderer==43.0
redis==5.0.6
referencing==0.35.1
reportlab==4.2.0
requests==2.31.0
requests-toolbelt==1.0.0
responses==0.25.3
restructuredtext_lint==1.4.0
rfc3986==2.0.0
rich==13.7.1
rjsmin==1.2.1
rpds-py==0.18.1
rules==3.3
SecretStorage==3.3.3
setuptools==70.1.0
six==1.16.0
snowballstemmer==2.2.0
soupsieve==2.5
sqlparse==0.5.0
stevedore==5.2.0
termcolor==2.4.0
twine==5.1.1
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.2
urlman==2.0.2
vine==5.1.0
vobject==0.9.7
wcwidth==0.2.13
webencodings==0.5.1
wemake-python-styleguide==0.19.2
whitenoise==6.6.0
zipp==3.19.2
zxcvbn==4.4.28

OS information

Linux 6.9.10-arch1-1

rixx commented 3 months ago

Hmm, the issue seems to stem from flake8-commas, actually, which was pulled in by wemake-python-styleguide. Sorry for the noise.