-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pylint and flake8 fighting over continued indentation #747
Comments
In this case it seems that flake8 is right, with respect to what PEP 8 says: "The closing brace/bracket/parenthesis on multi-line constructs may either line up under the first non-whitespace character of the last line of list or it may be lined up under the first character of the line that starts the multi-line construct". |
Actually, both of your examples are wrong. Wrong: to.append(t.format(name=pkg.name,
base=pkg.packagebase,
# […]
)
) Wrong: to.append(t.format(name=pkg.name,
base=pkg.packagebase,
# […]
)
) Right (lined up under the first non-whitespace character of the last line of list): to.append(t.format(name=pkg.name,
base=pkg.packagebase,
# […]
)) Right (lined up under the first character of the line that starts the multi-line construct): to.append(t.format(name=pkg.name,
base=pkg.packagebase,
# […]
)) So pylint and flake8 are each catching different wrong indentations. |
I am seeing the same issue with This is the current code that passes pep8:
Whereas this is what pylint wants to see which is incorrect:
|
There is some discrepency between pep8 and pylint for line continuation (pylint-dev/pylint#747) but with some minor layout changes both can pass and code looks fine, if not better in places.
There is some discrepency between pep8 and pylint for line continuation (pylint-dev/pylint#747) but with some minor layout changes both can pass and code looks fine, if not better in places.
Seeing pep-0008#indentation
@PCManticore |
To me it seems that pylint is incorrect here. Further evidence is this exact same discussion of the issue in yapf #26 and they changed to follow PEP8. For this particular issue, it is not explicitly mentioned in PEP8 where the closing bracket should be nor shown in those example code snippets. However this is my interpretation based on this code example:
You can extrapolate it using the interpretation that the closing parenthesis is
Therefore further extrapolating to this:
|
There is some discrepency between pep8 and pylint for line continuation (pylint-dev/pylint#747) but with some minor layout changes both can pass and code looks fine, if not better in places.
There is some discrepency between pep8 and pylint for line continuation (pylint-dev/pylint#747) but with some minor layout changes both can pass and code looks fine, if not better in places.
|
With this input:
pylint complains:
So, I “fixed” this. flake8 now says:
Which linter is right?
The text was updated successfully, but these errors were encountered: