-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flake plugin? #6
Comments
Hi @frejonb! making this a flake8-plugin would be a big win for usability, but it's made tricky because AFAIK flake8-plugins need to work without importing the actual source code. So to make this into a plugin, I'd have be duplicate all Python's import logic. Which is reasonably complex in normal circumstances, but many libraries define conditional imports, star imports, re-exports and metaclasses. tricky examples: try:
from place import Foo
except ImportError:
from other_place mport Foo
class Bla(Foo):
...
class Qux(Base1 of SOME_FEATURE_FLAG else Base2):
...
class Foo(metaclass=Bar): # a metaclass making slots maybe?
...
from somewhere import * # what now???? For the initial version, I decided to go the import route. I'll keep this issue open because it's definitely worth investigating. I will also address this in the README. I think many other people have the same question. |
Just a suggestion, but what about just making it possible to run as a pre-commit hook instead? That would only require a |
Awesome! I'm tracking that in #13 |
@sondrelg |
Added 'help wanted' label: if anybody knows a way to trace complex class inheritance statically, let me know. Otherwise this issue will remain on hold. |
Due to the complexities involved (tracing complex imports, class decorators, metaclasses) I've decided this feature is not feasible. |
Nice idea! What are the chances of wrapping it as a flake8 plugin?
The text was updated successfully, but these errors were encountered: