PyCQA / PyCQA/pycodestyle

E131: Inconsistent handling of kwarg with binary operator expression as value

Open
#673 0 comments 1 reaction 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

I think pycodestyle's handling of binary operator expressions that are the values of kwargs could be improved.

There is a case that is a little ambiguous to me as to whether it should be a style error or not. Should calls where the binary operator subexpressions are aligned with the = of the kwarg be errors? Currently, this triggers E131.

call(
  kwarg=a +
        b +
        c
)

On the other side, dropping the lines indentation to the same as the kwarg is considered valid, which seems to me to go against the spirit of the pep8 guidelines.

call(
  kwarg=a +
  b +
  c
)

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

Start by reproducing the two keyword-argument examples in pycodestyle and trace the E131 handling that classifies their indentation. The issue does not specify which behavior should change, so confirm the intended rule and define tests for the accepted and rejected forms before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.