Skip to content
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

Add new complexity rule for max imported names for a single module #1151

Closed
sobolevn opened this issue Feb 12, 2020 · 3 comments · Fixed by #1157
Closed

Add new complexity rule for max imported names for a single module #1151

sobolevn opened this issue Feb 12, 2020 · 3 comments · Fixed by #1157
Assignees
Labels
help wanted Extra attention is needed level:starter Good for newcomers pr-merged rule request Adding a new rule

Comments

@sobolevn
Copy link
Member

Rule request

Thesis

Currently TooManyImportedNamesViolation only works on module level.

So, you can import up to 50 names from a single package! Like this:

from some import (
    name1,
    name2,
    ...
    name50,
)

And it won't be an issue.

This needs to be fixed. I suggest to add TooManyImportedModuleNamesViolation that will enforce to have less than 7? names per each module.

Good: import some and some.name1, some.name50
Bad: example above

This rule needs to be configurable.

@sobolevn sobolevn added help wanted Extra attention is needed level:starter Good for newcomers rule request Adding a new rule labels Feb 12, 2020
@sobolevn sobolevn added this to the Version 0.15 milestone Feb 12, 2020
@skarzi
Copy link
Collaborator

skarzi commented Feb 16, 2020

Can I take it?

@skarzi
Copy link
Collaborator

skarzi commented Feb 16, 2020

Do you suggest to add this check to ImportMembersVisitor or WrongImportVisitor ?

@sobolevn
Copy link
Member Author

Assigned! Thanks a lot!
I guess ImportMembersVisitor suits better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed level:starter Good for newcomers pr-merged rule request Adding a new rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants