False-positive python:OneStatementPerLine with black's new 2024 style for stubs

  • What language is this for? Python
  • Which rule? python:OneStatementPerLine
  • Why do you believe it’s a false-positive/false-negative? Because I do not consider ... a statement. It’s also black’s 2024 style to place ... in the same line in stubs.
  • Are you using
    • SonarLint - which IDE/version? VS Code, v4.3.0
      • in connected mode with SonarQube or SonarCloud? no
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
def f(): ...

Hello @bers,

First of all, thanks for your report.

It’s true that Black recently introduced changes for dummy class and function implementations formatting.

We’ve created the SONARPY-1635 ticket to align these changes for the rule.

Thanks,
Maksim Grebeniuk

1 Like