-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Description
The problems in the current code base detected by the linters that have been integrated in #62 through GolangCI should be handled by refactoring the affected implementations.
This helps to improve the overall code quality and prevents possible errors.
- Remove unused function parameters detected by unparam.
(*cmdOptions).prepare-cmdis unused: cmd/snowsaw/bootstrap/bootstrap.go:51:30func (o *cmdOptions) prepare(cmd *cobra.Command, args []string) { ^
(*cmdOptions).run-cmdis unused: cmd/snowsaw/bootstrap/bootstrap.go💯26func (o *cmdOptions) run(cmd *cobra.Command, args []string) { ^
(*cmdOptions).run-argsis unused: cmd/snowsaw/bootstrap/bootstrap.go💯46func (o *cmdOptions) run(cmd *cobra.Command, args []string) { ^
- Improve function names and code flows detected by golint.
- func
NewJsonEncodershould beNewJSONEncoder: pkg/config/encoder/json/json.go:34:6func NewJsonEncoder() Encoder { ^
- var
ExtensionsJsonshould beExtensionsJSON: pkg/config/encoder/constants.go:26:2ExtensionsJson = "json" ^
- if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary): pkg/prt/printer.go:121:9
} else { ^
- exported func Load returns unexported type *builder.builder, which can be annoying to use: pkg/config/builder/builder.go:39:32
func Load(files ...*file.File) *builder { ^
- func
- Improve code style smells detected by gocritic.
- assignOp: replace
format = format + "\n"withformat += "\n": pkg/prt/printer.go:179:4format = format + "\n" ^
- paramTypeCombine:
func(v Verbosity, w io.Writer, prefix string, format string, args ...interface{})could be replaced withfunc(v Verbosity, w io.Writer, prefix, format string, args ...interface{}): pkg/prt/printer.go:176:1func (p *printerConfig) withNewLine(v Verbosity, w io.Writer, prefix string, format string, args ...interface{}) { ^
- emptyStringTest: replace
len(parts[0]) == 0withparts[0] == "": pkg/snowblock/task/shell/shell.go:165:5if len(parts[0]) == 0 { ^
- elseif: can replace 'else {if cond {}}' with 'else if cond {}': cmd/snowsaw/bootstrap/bootstrap.go:57:9
} else { ^
- assignOp: replace
- Remove unnecessary type conversions detected by unconvert.
- unnecessary conversion: pkg/prt/printer.go:132:16
*v = Verbosity(l) ^
- unnecessary conversion: pkg/prt/printer.go:132:16