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

Linter: revive, Rule: redundant-import-alias - warns on redundant import aliases. Should we enable it? #15825

Open
zak-pawel opened this issue Sep 2, 2024 · 0 comments · May be fixed by #15836
Labels

Comments

@zak-pawel
Copy link
Collaborator

Description

This issue starts a discussion about enabling:

  • linter: revive - Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. Revive provides a framework for development of custom rules, and lets you define a strict preset for enhancing your development & code review processes.
  • rule: redundant-import-alias - This rule warns on redundant import aliases. This happens when the alias used on the import statement matches the imported package name.

Example configuration:

      - name: redundant-import-alias

Expected output

Decision about enabling or not enabling this rule.

Findings

For this rule (with above configuration), the following findings were found in the current codebase:

plugins/inputs/kube_inventory/daemonset.go:6:2                                  revive  redundant-import-alias: Import alias "v1" is redundant
plugins/inputs/kube_inventory/daemonset_test.go:9:2                             revive  redundant-import-alias: Import alias "v1" is redundant
plugins/inputs/kube_inventory/deployment.go:6:2                                 revive  redundant-import-alias: Import alias "v1" is redundant
plugins/inputs/kube_inventory/deployment_test.go:9:2                            revive  redundant-import-alias: Import alias "v1" is redundant
plugins/inputs/kube_inventory/endpoint_test.go:7:2                              revive  redundant-import-alias: Import alias "v1" is redundant
plugins/inputs/kube_inventory/statefulset.go:6:2                                revive  redundant-import-alias: Import alias "v1" is redundant
plugins/inputs/kube_inventory/statefulset_test.go:9:2                           revive  redundant-import-alias: Import alias "v1" is redundant
plugins/inputs/kubernetes/kubernetes.go:15:2                                    revive  redundant-import-alias: Import alias "v1" is redundant
plugins/inputs/mysql/mysql.go:23:2                                              revive  redundant-import-alias: Import alias "v1" is redundant
plugins/inputs/mysql/mysql.go:24:2                                              revive  redundant-import-alias: Import alias "v2" is redundant
plugins/outputs/application_insights/mocks/diagnostics_message_listener.go:3:8  revive  redundant-import-alias: Import alias "mock" is redundant
plugins/outputs/http/http.go:18:2                                               revive  redundant-import-alias: Import alias "v4" is redundant
plugins/outputs/prometheus_client/prometheus_client.go:27:2                     revive  redundant-import-alias: Import alias "v1" is redundant
plugins/outputs/prometheus_client/prometheus_client.go:28:2                     revive  redundant-import-alias: Import alias "v2" is redundant
@srebhan srebhan removed their assignment Sep 3, 2024
@DStrand1 DStrand1 removed their assignment Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants