PyCQA / flake8-import-order

Flake8 plugin that checks import order against various Python Style Guides
GNU Lesser General Public License v3.0
278 stars 72 forks source link

I202 errors for multiline imports #135

Closed philtay closed 6 years ago

philtay commented 6 years ago

The following snippet triggers an I202 error:

from .foo import (
    bar,
    baz,
)

from .zoo import (
    mux,
    mox,
)

I think that a blank line should be allowed when a single import spans multiple lines.

pgjones commented 6 years ago

Isn't the I202 due to the newline between these two imports in this case? If so (depending on the style you are using) it is likely correct.

philtay commented 6 years ago

Yes, it's the newline between the imports. Look how ugly it is without:

from .foo import (
    bar,
    baz,
)
from .zoo import (
    mux,
    mox,
)
from .moo import (
    yux,
    yox,
)

I think that multiline imports should be allowed to be separated by a newline.

pgjones commented 6 years ago

Fair enough, however all the styles in this package expect the newlines to be absent. I think your best bet is to write your own style with the newlines expected or simply ignore the I202 error.