-
-
Notifications
You must be signed in to change notification settings - Fork 398
The introduction of golangci-lint during the CI #24
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
Conversation
arduino/cores/cores.go
Outdated
// or nil if not found. | ||
func (platform *Platform) GetRelease(version *semver.Version) *PlatformRelease { | ||
func (platform *Platform) GetReleaseVersion(version *semver.Version) *PlatformRelease { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this change, may you explain it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I suppress the warning othewise I have to replace the type *semver.Version with fmt.Stringer
https://github.com/mvdan/interfacer#suppressing-warnings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that the method has been renamed from GetRelease
to GetReleaseVersion
, what's exactly the warning you suppressed with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the error form the linter interfacer
arduino/cores/cores.go:116:38: `version` can be `fmt.Stringer` (interfacer)
func (platform *Platform) GetRelease(version *semver.Version) *PlatformRelease {
If you want to remove this error you have to use the interface instead the specific struct.
In this way
func (platform *Platform) GetRelease(version fmt.Stringer) *PlatformRelease {
return platform.Releases[version.String()]
}
Choose the solution that seems better for you, I thought that is necessary use the semver.Version so I prefer to rename the method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now I understand, changing to fmt.Stringer doesn't look like a great improvement to me.
My problem is that GetReleaseVersion
looks like a method to get the Version
of a Platform
, instead this is a method to find a PlatformRelease
with a specific version. Let's call it FindReleaseWithVersion
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 9ecd7dd
commands/config/dump.go
Outdated
//var dumpFlags struct { | ||
// _default bool // If false, ask questions to the user about setting configuration properties, otherwise use default configuration. | ||
// location string // The custom location of the file to create. | ||
//} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 833ded1
commands/lib/uninstall.go
Outdated
//const ( | ||
// versionAll string = "all" | ||
// versionLatest string = "latest" | ||
//) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 833ded1
commands/config/init.go
Outdated
initCommand.Flags().StringVar(&initFlags.location, | ||
"save-as", | ||
"", | ||
"Sets where to save the configuration file [default is ./.cli-config.yml].") | ||
return initCommand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these newline changes makes the commands Flags()
initialization different with 3 different styles across the codebase:
STYLE 1 (all in one line):
command.Flags().StringVar(&flags.vidPid, "vid-pid", "", "When specified, VID/PID specific build properties are used, if boards supports them.")
STYLE 2 (break on the description):
command.Flags().StringVar(&flags.vidPid, "vid-pid", "",
"When specified, VID/PID specific build properties are used, if boards supports them.")
STYLE 3 (break on all parameters):
initCommand.Flags().BoolVar(&initFlags._default,
 "default",
 false,
 "If omitted, ask questions to the user about setting configuration properties, otherwise use default configuration.")
IMHO we should change all of them, in the commands/xxxx
modules (maybe to STYLE 2 since the line break is likely to happen on the description).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 191cfc3
…ace when is possible) These warnings were suppressed by putting the type in the name of the method
f2c6bc8
to
35cb251
Compare
Restructured logging procedures - updated logging levels per message type (more in the future) - cleaned up redundancies - increased performances - messages only printed during change of state (once) * - added WiFi Firmware version check and update message - tested on MKR1000 and MKR1010 NOTE: WiFINina wrongly reports "1.2.0" when WiFi.firmwareVersion() is invoked, although version "1.2.1" is set in the source files
Move library.properties schema to dedicated folder
This PR introduce golangci-lint in the pipeline to improve the code quality through the code static analysis.
I fixed the problems reported by the linters:
These linters should be enable after fix the problems