Closed
Description
When pylint
calculates the correct indentation of a line following a multi-line string it uses the last non-space character in the multi-line string rather than basing it off of the code preceding the string. In the following example, I would expect the indentation of some
and string
to be four spaces, because that's the correct indentation based off of the _ = """Dear Guido,
line. But pylint
wants it to be four spaces beyond the start of Bill"""
, which makes the code less readable IMO.
Steps to reproduce
1. cat > /tmp/z.py
_ = """Dear Guido,
Python is pretty awesome, but there's something annoying with the linter.
Sincerely,
Bill""".format(
some=variable_with_a_long_name,
strings=another_variable_with_a_really_long_name)
2. pylint /tmp/z.py
Current behavior
Outputs the following message:
************* Module z
C: 7, 0: Wrong hanging indentation (add 33 spaces).
some=variable_with_a_long_name,
^ | (bad-continuation)
C: 8, 0: Wrong hanging indentation (add 33 spaces).
strings=another_variable_with_a_really_long_name)
^ | (bad-continuation)
Expected behavior
This should have been acceptable.
pylint --version output
$ pylint --version
pylint 2.0.0,
astroid 1.5.0
Python 3.5.0 (default, Nov 18 2015, 12:09:02)
[GCC 4.8.4]