Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Add import alias detection to BadModuleAttributeUseLinter #2

Closed
mschwager opened this issue May 20, 2019 · 0 comments
Closed

Add import alias detection to BadModuleAttributeUseLinter #2

mschwager opened this issue May 20, 2019 · 0 comments

Comments

@mschwager
Copy link
Collaborator

Python supports import aliasing, e.g.

import foo.bar.baz as qux
from foo.bar import baz as qux

This use case isn't very common, but we should support its detection in BadModuleAttributeUseLinter.

We currently detect:

from foo.bar import bad_function

bad_function(...)

But not:

from foo.bar import bad_function as aliased_bad_function

aliased_bad_function(...)

This shouldn't be too difficult to accomplish. We can maintain some additional state similar to illegal_module_attributes that tracks alias' and then detects bad use accordingly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant