Skip to content

Conversation

@johnhany97
Copy link
Member

Before this PR

Given a Python file like:

def hello():
    print("Python", ("Hello",
                                     "World"))

The diagnostics report of pycodestyle is:

[{'source': 'pycodestyle', 'range': {'start': {'line': 2, 'character': 37}, 'end': {'line': 2, 'character': 47}}, 'message': 'E127 21', 'code': 'E127', 'severity': 2}]

Root cause & Description

While the error code, E127, is expected, this is not the expected error message.
This is because autopep8 overrides pycodestyle's implementation of continued_indentation which is the check used to determine this error code, among others. autopep8's implementation however returns a different thing than what we expect out of the pycodestyle implementation, leading to a scenario where the diagnostics report contains an unuseful error message.

After this PR

The output is as expected:

[{'source': 'pycodestyle', 'range': {'start': {'line': 2, 'character': 37}, 'end': {'line': 2, 'character': 47}}, 'message': 'E127 continuation line over-indented for visual indent', 'code': 'E127', 'severity': 2}]

@ccordoba12 ccordoba12 added this to the 0.31.4 milestone Dec 24, 2019
Copy link
Contributor

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @johnhany97!

@ccordoba12 ccordoba12 merged commit 0114c6c into palantir:develop Dec 24, 2019
@afflux
Copy link

afflux commented Mar 27, 2020

Unfortunately, this change breaks formatting when a document has continuation lines.

Try formatting this:

def foo():
    print('asdf',
    file=None
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants