Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Code cleanup: remove or rename unused parameters and receivers #904

Closed
chavacava opened this issue Sep 23, 2023 · 1 comment
Closed

Code cleanup: remove or rename unused parameters and receivers #904

chavacava opened this issue Sep 23, 2023 · 1 comment

Comments

@chavacava
Copy link
Collaborator

The source code of revive has unused parameters and receivers.

Running revive on its own code source with the following configuration

ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 0
warningCode = 0
# enableAllRules = true
[rule.unused-parameter]
[rule.unused-receiver]

results in

revivelib/core_internal_test.go:46:24: parameter 'file' seems to be unused, consider removing or renaming it as _
revivelib/core_internal_test.go:46:41: parameter 'arguments' seems to be unused, consider removing or renaming it as _
rule/deleteme.go:18:47: parameter 'arguments' seems to be unused, consider removing or renaming it as _
rule/datarace.go:56:7: method receiver 'w' is not referenced in method's body, consider removing or renaming it as _
rule/constant-logical-expr.go:14:7: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _
rule/constant-logical-expr.go:66:7: method receiver 'w' is not referenced in method's body, consider removing or renaming it as _
rule/deleteme.go:18:7: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _
rule/constant-logical-expr.go:75:7: method receiver 'w' is not referenced in method's body, consider removing or renaming it as _
rule/enforce-map-style.go:144:7: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _
rule/constant-logical-expr.go:84:7: method receiver 'w' is not referenced in method's body, consider removing or renaming it as _
rule/enforce-slice-style.go:168:7: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _
rule/indent-error-flow.go:22:7: method receiver 'e' is not referenced in method's body, consider removing or renaming it as _
rule/superfluous-else.go:23:7: method receiver 'e' is not referenced in method's body, consider removing or renaming it as _
rule/early-return.go:25:7: method receiver 'e' is not referenced in method's body, consider removing or renaming it as _
rule/add-constant.go:108:7: method receiver 'w' is not referenced in method's body, consider removing or renaming it as _

Fix these issues in order to get no messages when running revive on its own code with the above configuration.

@chavacava
Copy link
Collaborator Author

Closed by #907

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant