PyCQA / PyCQA/pycodestyle

W504: Relax when operator is only thing on a line

Open
#815 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.2k
Forks
754
PR merge metrics
No merged PRs in 30d

Description

The python formatter black will occasionally decide to put a binary operator by itself on a line (example). This triggers the newly-added W504 warning. I believe that W504 (and W503, but that warning is already incompatible with black) should be relaxed to permit a newline after binary operators if that operator is the only thing on the line.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the W504 warning behavior against the linked Tornado example, where a binary operator appears alone on a line, and compare the stated relationship with W503. Done means W504 permits this specific layout without broadly suppressing other W504 warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.