Skip to content
Commit 2cdb246f authored by Graeme Coupar's avatar Graeme Coupar
Browse files

Smart newlines no longer skips multi-line string assignments

Prior to this change, the smart newline code was doing the wrong thing when
faced with code like this:

```
from x import y

something = """
test"""

class Blah():
    pass
```

The smartnew lines code attempts to find the first construct after the import
block, and uses the `_skip_line` function to determine where that construct
starts.  However, `_skip_line` seems to incorrectly assume that a line ending
with `"""` is a docstring.   It then goes on to treat `class Blah` as the first
construct, and adds 2 new lines after imports instead of the 1 that should be
chosen.

I've fixed this by updating `_skip_lines` to stop iterating over the characters
of a line if it finds something that is neither whitespace, the start of a
string or a comment.
parent a88e2a6e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment