Relax E127 with dictionary values: allow extra indent

Open
#785 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by locating pycodestyle's E127 handling and the tests covering continuation indentation. Reproduce the dictionary example, then add coverage for the allowed extra indentation while preserving existing E127 checks. Done means the example no longer reports E127 and unrelated over-indentation cases still do.

Written by the indexing model from the issue text.

Description

Currently pycodestyle will complain about the following:

mydict = {12345:
              'foo'}

t-61.py:2:15: E127 continuation line over-indented for visual indent

We are about to change this in https://github.com/Vimjas/vim-python-pep8-indent/pull/61, and there has been some discussion in https://github.com/python/peps/pull/113 - resulting in keeping this out of PEP8 itself (i.e. undefined).

I think pycodestyle should handle this in a relaxed way, and allow for an extra indentation level for dictionary values (after : on the previous line).

Dominant language
Python
Stars
5.2k
Forks
765
Avg merge
1d 20h
Merged PRs (30d)
1

Getting set up

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.

More from PyCQA/pycodestyle

All issues in PyCQA/pycodestyle

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.