Implement import tracking
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 123
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 5
Description
I think false positives like those reported in #356 (and probably some false negatives as well) are prevalent across multiple lints and one way to solve them would be to use some form of import tracking.
I've come up with some examples below, but this is just a very rough draft.
from itertools import groupby
imported_modules = {
"itertools": {
"name": "itertools",
"imports": {
"groupby": "groupby"
}
}
}
from itertools import groupby as groupby_as
imported_modules = {
"itertools": {
"name": "itertools",
"imports": {
"groupby": "groupby_as"
}
}
}
import itertools
imported_modules = {
"itertools": {
"name": "itertools"
}
}
import itertools as itertools_as
imported_modules = {
"itertools": {
"name": "itertools"
}
}
Then in the lint to get the itertools id you'd use imported_modules["itertools"]["name"], and to get the groupby id you'd use imported_modules["itertools"]["imports"]["groupby"].
Is this something that we would be interested in adding?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the false-positive and false-negative examples in this issue and the related report in #356. Determine which lints need import information and agree on the tracking representation and integration scope; done means the proposal is specific enough to implement and its behavior is covered by examples or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100