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

fix: redundant-import-alias with confidence 0.95 #856

Closed damif94 closed 1 year ago

damif94 commented 1 year ago

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

Interacting with the new rule redundant-import-alias on my company projects, it has turned out really useful. But in some rare occasions, the warning is not accurate. Indeed, when the package name does not match the folder name (I guess this is too rare in any go project).

The proper solution is to actually check that the alias matches the package name, but meeting that requirement would trade-off performance and memory usage. So, I guess a more humble fix is to reduce de Confidence parameter inside the failure.

damif94 commented 1 year ago

@mgechev

chavacava commented 1 year ago

Hi @damif94 thanks for the PR. As you say, the case of false positives is sufficiently rare to keep the rule as is (moreover, setting the confidence to .95 will not have actual effects on the use of revive on IDEs, the use case you described in the original issue) I'll close the PR and, if there a real need (too much false positives) we can re-open it. Thanks again.