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

Make case-sensitivity optional #146

Closed immerrr closed 5 years ago

immerrr commented 6 years ago

Hi and thank you for a nice package.

I have a minor problem with it. I'm using isort to format imports automatically and it ends up sorting from ... import ... imports in case-sensitive manner, ie. from ... import Baz, bar which is then reported by flake8 as incorrect. It just so happens that isort doesn't have an option to switch case-sensitivity either, so I'm kinda stuck.

pgjones commented 6 years ago

The styles have defined case sensitivity though, which doesn't help here. Do you have any thoughts on how to make #99 work?

immerrr commented 6 years ago

I don't think I have experience hacking flake8, sorry.

Regarding case-sensitivity, I'm not sure it's harmful to add a configuration parameter that by default produces output as defined by certain "styles" and can be configured to do a slightly different thing. If you really care about styles being set in stone from the dawn of time you could add a family of {style}_cs styles enabling case sensitivity MySQL style, but not even touching the already existing options.

immerrr commented 6 years ago

While I was preparing a case for isort project, I couldn't but notice that google style guide doesn't explicitly touch case sensitivity on imports from the same module. It only mentions being case-insensitive w.r.t different import statements, because multiple imports from the same module are forbidden altogether.

pgjones commented 5 years ago

There is flake8-isort that might solve this exact issue.

sigmavirus24 commented 5 years ago

It might, but it's also GPL v2 which is often a problem for people