Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix redunant-import-alias rule - unused alias is also redundant #950
fix redunant-import-alias rule - unused alias is also redundant #950
Changes from 1 commit
03826dd
bb05fd3
918f65a
0ef6c87
45cfdc6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Can you please improve the wording? It's not really clear for me what exactly is to be ignored.
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.
import apiv2 "cloud.google.com/go/run/apiv2"
import v1 "https://pkg.go.dev/k8s.io/api/core/v1"
technically above aliases are correct if they are used min one time later in code. What is your sugestion to describe that flag?
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.
The problem here is that if it's not used, the code won't compile.
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.
no no no, your case is not that case, because this code is not used and make "noise" after compile
but in case mentioned in #936:
above code is working well, but linter shows warning:
after set ignoreUsed = true
linter dont produce warnings that is the case :)
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.
It is indeed redundant. This is the purpose of the linter. If you think it's fine for your project, you should just disable this linter rule.
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.
Yes i know, it is specific case, because in one way you should think how you use packages and aliases for them. On the other side we can leave this rule with that argument for more flexibility, but this is not my decision, what you think @chavacava
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.
What is specific about this case?
ignoreUsed
seems to be essentially disabling the rule.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.
@denisvmedia ok, I think that issue #936 and this pull request is to close, because in standard scenario this rule is used to detect redundant aliases, and results should used to fix/cleanup codebase of your project (change redundant aliases to proper form)