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

Error if same named type importable #8927

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

lukew3531
Copy link

Throws an error when there is a duplicate import in the same file.

lukew3531 and others added 4 commits August 7, 2024 17:25
Changed 'name' to match others - "duplicate-import-type".
Corrected the error code - "C4764".
Moved the register function to the end of the file with all of the other ones.
close added to reset when moving to the next file to ensure no false errors
Changes made so that the duplicates throw an error if they are in the same folder and not in an IF or other condition statement
@benbp
Copy link
Member

benbp commented Sep 4, 2024

@l0lawrence can you review/route?

@l0lawrence
Copy link
Member

/azp run tools - azure-pylint-guidelines-checker - ci

Copy link

Pull request contains merge conflicts.

lukew3531 and others added 5 commits September 6, 2024 09:13
Merge azure-sdk-tools main into main
# Conflicts:
#	tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py
#	tools/pylint-extensions/azure-pylint-guidelines-checker/tests/test_pylint_custom_plugins.py
Spaces in the syntax removed and a test for special cases added
@lukew3531
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Member

@l0lawrence l0lawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tests! Just a few comments :)

@@ -2902,10 +2957,12 @@ def register(linter):
linter.register_checker(DeleteOperationReturnStatement(linter))
linter.register_checker(ClientMethodsHaveTracingDecorators(linter))
linter.register_checker(DoNotImportLegacySix(linter))
linter.register_checker(DoNotImportAsyncio(linter))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit this got deleted :)

msgs = {
"C4764": (
"Type %s is imported multiple times from the same module: %s",
"duplicate-import-type",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we align this with the name above and make that also duplicate-import-type

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

Successfully merging this pull request may close these issues.

4 participants