Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port flake-commas #2641

Open
Day0Dreamer opened this issue May 3, 2023 · 3 comments
Open

Port flake-commas #2641

Day0Dreamer opened this issue May 3, 2023 · 3 comments

Comments

@Day0Dreamer
Copy link

Day0Dreamer commented May 3, 2023

https://github.com/PyCQA/flake8-commas is now read-only.
It would be a good idea to include their code to our project, because we rely on it.

@Day0Dreamer Day0Dreamer changed the title Integration with Ruff, how to do it properly? Submitted by mistake May 3, 2023
@sobolevn sobolevn changed the title Submitted by mistake Port flake-commas May 31, 2023
@sobolevn
Copy link
Member

I've changed your issue to be a completely different one, because github is broken and I cannot post new issues for some reason.

@bmakan
Copy link

bmakan commented Oct 24, 2023

I've just updated to Python 3.12 and flake8 is crashing due to error in flake8-commas. I'll just uninstall it, but it's possibly a blocker for adding python3.12 support.

Edit: I have since reinitialized venv and the error did not reoccur. Maybe I just missed something the first time.

@VelikiiNehochuha
Copy link

VelikiiNehochuha commented Feb 16, 2024

same here, I've got the error.

python3.12

pip install wemake-python-styleguide==0.18.0
(venv) ➜  flake8_bug pip freeze
astor==0.8.1
attrs==23.2.0
bandit==1.7.7
darglint==1.8.1
docutils==0.20.1
eradicate==2.3.0
flake8==7.0.0
flake8-bandit==4.1.1
flake8-broken-line==1.0.0
flake8-bugbear==23.12.2
flake8-commas==2.1.0
flake8-comprehensions==3.14.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
isort==5.13.2
markdown-it-py==3.0.0
mccabe==0.7.0
mdurl==0.1.2
pbr==6.0.0
pep8-naming==0.13.3
pycodestyle==2.11.1
pydocstyle==6.3.0
pyflakes==3.2.0
Pygments==2.17.2
PyYAML==6.0.1
restructuredtext_lint==1.4.0
rich==13.7.0
setuptools==69.1.0
snowballstemmer==2.2.0
stevedore==5.1.0
typing_extensions==4.9.0
wemake-python-styleguide==0.18.0
BLANK = ""
hashmap = {}


def replace_blank_labels(labels: list[str]) -> list[str]:
    for index, label in enumerate(labels):
        if label == BLANK:
            label = hashmap[index]
            hashmap[index] = f"[blank][{label}]"
        else:
            label = hashmap[index]
            hashma[index] = f"[label]{label}]"
Unable to find qualified name for module: sample.py
Traceback (most recent call last):
  File "/Users/vn/venv/bin/flake8", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/vn/venv/lib/python3.12/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "/Users/vn/venv/lib/python3.12/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "/Users/vn/venv/lib/python3.12/site-packages/flake8/main/application.py", line 187, in _run
    self.run_checks()
  File "/Users/vn/venv/lib/python3.12/site-packages/flake8/main/application.py", line 103, in run_checks
    self.file_checker_manager.run()
  File "/Users/vn/venv/lib/python3.12/site-packages/flake8/checker.py", line 238, in run
    self.run_serial()
  File "/Users/vn/venv/lib/python3.12/site-packages/flake8/checker.py", line 221, in run_serial
    ).run_checks()
      ^^^^^^^^^^^^
  File "/Users/vn/venv/lib/python3.12/site-packages/flake8/checker.py", line 526, in run_checks
    self.run_ast_checks()
  File "/Users/vn/venv/lib/python3.12/site-packages/flake8/checker.py", line 428, in run_ast_checks
    for line_number, offset, text, _ in runner:
  File "/Users/vn/venv/lib/python3.12/site-packages/flake8_commas/_base.py", line 333, in run
    for error in get_comma_errors(tokens):
  File "/Users/vn/venv/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

it works fine with python3.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants