-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Clearer reimported
and new shadowed-import
messages for aliased import
#7756
Clearer reimported
and new shadowed-import
messages for aliased import
#7756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I would go further and rename reimported
to something like import-name-clash
or something clearer about what the problem is. "reimported" feel like what should be raised for:
from pathlib import Path
from pathlib import Path
Which is a lot less problematic than the problem we detect here.
tests/functional/r/reimported.py
Outdated
# pylint: disable=missing-docstring,unused-import,import-error, wildcard-import,unused-wildcard-import,redefined-builtin,no-name-in-module,ungrouped-imports,wrong-import-order,wrong-import-position,consider-using-from-import | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# pylint: disable=missing-docstring,unused-import,import-error, wildcard-import,unused-wildcard-import,redefined-builtin,no-name-in-module,ungrouped-imports,wrong-import-order,wrong-import-position,consider-using-from-import | |
# pylint: disable=missing-docstring,unused-import,import-error, wildcard-import,unused-wildcard-import,redefined-builtin,no-name-in-module | |
# pylint: disable=ungrouped-imports, wrong-import-order,wrong-import-position,consider-using-from-import |
Pull Request Test Coverage Report for Build 3452479310
π - Coveralls |
I realize by reading the issue that we already had this discussion. Now that I think about it again this feel like a new check, which should have a different message and probably also a different level (warning at least, while reimported is probably just a convention). |
I followed the conclusion of the issue. If maintainers would like to change scope, lmk I will close this. |
Let's pursue the discussion in the original issue. I feel that your implementation would permit to separate the two use case relatively easily though. |
This comment has been minimized.
This comment has been minimized.
Let's separate the two checks between from pandas._libs import (
algos as libalgos,
hashtable as ht,
)
import pandas.core.algorithms as algos But this should raise shadowed-import: from pandas._libs import (
algos,
hashtable as ht,
)
import pandas.core.algorithms as algos # [shadowed-import] And this should raise reimported: from pandas._libs import (
algos as libalgos,
hashtable as ht,
)
import pandas._libs.algos as algos # [reimported] |
As a principle, I don't like changing the scope of a PR after work that could be merged is complete. This PR could be merged as is, and through an iterative process, a new issue can be opened to then separate the two checks. Without this, you're asking a contributor to do more work than they initially signed up for in an issue. So not saying scope can't change -it always will. Just saying that we should manage it by cutting it with issues. |
Sorry about that but I don't think this is mergeable as is. This would make |
5539ccc
to
9e4e753
Compare
This comment has been minimized.
This comment has been minimized.
12a877c
to
dbec651
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty great π Some minor nitpicks and let's merge !
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit 4e58ebe |
reimported
and new shadowed-import
messages for aliased import
@@ -0,0 +1,3 @@ | |||
Update ``reimported`` help message for clarity and add a ``shadowed-import`` message for aliased imports. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should burry the new message in the bugfix
section. That's a case where to changelog entries would make sense. One bugfix
and one new_check
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type of Changes
Description
Closes #4836
Issue brought up the fact that the
reimported
message was confusing and hinted at something else, while also giving us more test cases to improve the check for imports using aliases.