Closed heston closed 10 years ago
Hey @heston. We've made quite a lot of changes to our desired style since you filed this issue.
We are much less close to the Google style guide now and are more strict about some sections it is vague on. I need to update the README now we've stabilised a bit but if you look here https://github.com/public/flake8-import-order/blob/master/tests/test_cases/complete.py you can see our ideal example ordering.
The "correct" order as of 0.4 is this
import datetime
from collections import OrderedDict, namedtuple
import coffin.template.loader
from django.core import validators
from django.utils.functional import SimpleLazyObject, cached_property
import lib.forms
import lib.models
The "correct" import order mentioned in the previous comment is in no way "correct". The Google style guide says "imports should be sorted lexicographically, ignoring case, according to each module's full package path". collections
comes before datetime
(and both in stdlib). The Google style guide does not differentiate between from foo import bar
and import foo
for grouping like this checker does.
Since I couldn't reopen this issue, I opened #26
I have the following imports at the top of one of my files:
However, when I run
flake8
on it, I get the following warning:This looks lexigraphically sorted to me, and
coffin
is certainly in my site-packages.Also, I would expect to see a warning for line 6, since
cached_property
should sort beforeSimpleLazyObject
according to the Google Styleguide ("imports should be sorted lexicographically, ignoring case").