mgechev / revive

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

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

Closed chavacava closed 11 months ago

chavacava commented 11 months ago

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 commented 11 months ago

Closed by #907