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

Possible bug? #100

Closed skorokithakis closed 7 years ago

skorokithakis commented 7 years ago

I'm seeing flake8-import-order complain about this:

import pychromecast
import youtube_dl

It's saying that it needs a newline before youtube_dl. Should that be so? Why should I need to insert a newline there?

pgjones commented 7 years ago

This looks suspicious, but I'll need more information. What version are you using, have you set the application import names if so to what? Do you have a reproducible example? Thanks.

skorokithakis commented 7 years ago

Yes, sorry. Here:

13:47:11 $ flake8 --version
3.2.1 (naming: 0.4.1, mccabe: 0.5.3, pyflakes: 1.3.0, flake8-tidy-imports: 1.0.3, import-order: 0.11, pycodestyle: 2.2.0) CPython 2.7.11+ on Linux

13:47:33 $ cat test.py 
import pychromecast
import youtube_dl

pychromecast.test(youtube_dl)

13:47:58 $ flake8 test.py 
test.py:2:1: I201 Missing newline before sections or imports.
pgjones commented 7 years ago

Ah, I see. This is the correct response for the cryptography style which is the default. This style requires that each 3rd party import has its own section. I suspect you may want to use the google style, import-order-style = google.

Here is an example google and cryptography set.

I'll close this, but feel free to comment/open if needed.

skorokithakis commented 7 years ago

Ahh, I didn't realize that, thank you!

aidanrussell commented 6 years ago

But where is this option set?

skorokithakis commented 6 years ago

In setup.cfg.

pgjones commented 6 years ago

@aidanrussell take a look at http://flake8.pycqa.org/en/latest/user/configuration.html