mgechev / revive

🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
https://revive.run
MIT License
4.74k stars 276 forks source link

feat: add rule for redundant import alias #854

Closed damif94 closed 1 year ago

damif94 commented 1 year ago

PR for issue https://github.com/mgechev/revive/issues/853

A new rule redundant-import-alias that would warn upon redundant import aliases, i.e., when the imported package name matches the alias names.

damif94 commented 1 year ago

Hi, thanks for the rule idea and its PR! I've left some comments, please let me know what do you think about them.

I agree with your suggestions, "redundant" seems like more appropriate. I already did the changes.

What's your view on making this rule as default? It seems like a pretty unquestionable linting rule, but on the other hand I got fear of retrocompatibility on upgrading versions and not sure on what's the project policies on upgrades.

chavacava commented 1 year ago

Hi, thanks for the rule idea and its PR! I've left some comments, please let me know what do you think about them.

I agree with your suggestions, "redundant" seems like more appropriate. I already did the changes.

What's your view on making this rule as default? It seems like a pretty unquestionable linting rule, but on the other hand I got fear of retrocompatibility on upgrading versions and not sure on what's the project policies on upgrades.

Thanks for the modifications. About making this rule default: historically, revive default rules were those of golint. I propose to let the new rule out of the defaults and actvite it through the config.

chavacava commented 1 year ago

Thanks @damif94 !