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

flake8 E704 Errors Triggered by Inline Ellipsis Formatting in Newer black Versions #1926

Closed
camilamacedo86 opened this issue Mar 22, 2024 · 1 comment

Comments

@camilamacedo86
Copy link

camilamacedo86 commented Mar 22, 2024

how did you install flake8?

pip install -r file.txt
With the following versions


black==24.3.0
flake8==7.0.0
Flake8-pyproject==1.2.3

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.11.8",
    "system": "Darwin"
  },
  "plugins": [
    {
      "plugin": "Flake8-pyproject",
      "version": "1.2.3"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.11.1"
    },
    {
      "plugin": "pyflakes",
      "version": "3.2.0"
    }
  ],
  "version": "7.0.0"
}

describe the problem

what I expected to happen

I expected that updating to newer versions of black would maintain compatibility with flake8 by avoiding the E704: multiple statements on one line (def) error, consistent with the behavior observed in previous versions.

PS: Earlier versions of black (e.g., 22.6.0) formatted the ellipsis (...) on the next line, thereby avoiding the E704 error in flake8.

sample code

Before Update (black==22.6.0)
In the previous version of black, the formatter would automatically place the ellipsis (...) on a separate line when formatting functions or methods, like so:

def example_function(arg1: int, arg2: str) -> None:
    ...

After Update (black==24.3.0)
With the update to black version 24.3.0, the formatting behavior changed. Now, the ellipsis is placed on the same line as the function or method declaration:

def example_function(arg1: int, arg2: str) -> None: ...

commands ran

$ flake8
fileA.py:1440:5: E704 multiple statements on one line (def)
fileB.py:1444:5: E704 multiple statements on one line (def)
fileC.py:52:5: E704 multiple statements on one line (def)
fileD.py:55:5: E704 multiple statements on one line (def)
fileE.py:86:5: E704 multiple statements on one line (def)
fileF.py:90:5: E704 multiple statements on one line (def)
fileG.py:337:5: E704 multiple statements on one line (def)
fileH.py:341:5: E704 multiple statements on one line (def)
@camilamacedo86 camilamacedo86 changed the title E704 is now conflicting with new black formatting rules flake8 E704 Errors Triggered by Inline Ellipsis Formatting in Newer black Versions Mar 22, 2024
@sigmavirus24
Copy link
Member

Duplicate of #1925

@sigmavirus24 sigmavirus24 marked this as a duplicate of #1925 Mar 22, 2024
@sigmavirus24 sigmavirus24 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 22, 2024
@PyCQA PyCQA locked and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants