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

Error in Google order style (I100) #80

Closed pferate closed 8 years ago

pferate commented 8 years ago

A change in the 0.9 release broke the Google order style, at least for I100. It looks like it is not ignoring the case of letters anymore.

According to the Google Python Style Guide

Within each grouping, imports should be sorted lexicographically, ignoring case, according to each module's full package path.

Here is an example that worked in 0.8, but is flagging I100 in 0.9:

import os
import StringIO
import sys

This (incorrect) example passes in 0.9:

import StringIO
import os
import sys
pgjones commented 8 years ago

Thanks, will fix shortly.

pgjones commented 8 years ago

Should be fixed by 3f371dded0b19dba24e0287786fc615cfe3624cd, can you confirm?

pferate commented 8 years ago

Looks like that works. Thanks!

pgjones commented 8 years ago

Thanks, released 0.9.1.

pferate commented 8 years ago

Thanks! Works great.

wjwwood commented 8 years ago

I think this might not be fixed for from ... import ... statements:

% cat ./from_import_order_bug.py
from foo import bar
from foo import Baz

% flake8 - < ./from_import_order_bug.py
stdin:1:1: F401 'foo.bar' imported but unused
stdin:2:1: I100 Import statements are in the wrong order. from foo should be before from foo
stdin:2:1: F401 'foo.Baz' imported but unused

I'm using Python 3.5:

% python3 -m pip freeze | grep flake8
flake8==3.0.4
flake8-import-order==0.10

I believe my colleague @dirk-thomas might be looking into a patch.

wjwwood commented 8 years ago

https://github.com/PyCQA/flake8-import-order/pull/95

pgjones commented 8 years ago

The further issues should be fixed following ab53d0fa8e23de11bd572a9cb74d719076fc0ae5