-
Notifications
You must be signed in to change notification settings - Fork 258
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
Switch from golint to staticcheck #457
Switch from golint to staticcheck #457
Conversation
run_test.go:618:6: func passingStepDefWithoutReturn is unused (U1000)
suite.go:421:6: func isEmptyFeature is unused (U1000)
test_context_test.go:45:66: unnecessary use of fmt.Sprintf (S1039) test_context_test.go:46:61: unnecessary use of fmt.Sprintf (S1039)
d427b45
to
04aa1a4
Compare
I've enabled staticcheck in CI. There are a few errors. Plan: |
I'm currently pairing with @carleeto on this. It's tricky for him to get feedback as I have to press the "Approve" button each time he pushes! I'm confident he's going to be a useful member of the team so I've pre-empted the commit-bit bot and added him to the |
Maybe let's try downloading |
We seem to have a weird issue where the We've tried reproducing locally on a v1.16 go and it seems to work fine. |
Co-authored-by: Viacheslav Poturaev <nanopeni@gmail.com>
@vearutop, @mattwynne: go vet checks in the 1.16 build are failing because the _examples folder is its own Go module (the folder has its own go.mod and go sum files - https://github.com/cucumber/godog/blob/main/_examples/go.mod). I'd like to understand the reasoning behind this. |
Codecov Report
@@ Coverage Diff @@
## main #457 +/- ##
==========================================
+ Coverage 81.47% 81.58% +0.11%
==========================================
Files 27 27
Lines 2186 2183 -3
==========================================
Hits 1781 1781
+ Misses 312 309 -3
Partials 93 93
Continue to review full report at Codecov.
|
I think I understand why - its an example of how a user would use godog, so it needed to be its own sub-module. Am I right? |
Also add a note to CONTRIBUTING.md about the _examples module
Co-authored-by: Viacheslav Poturaev <nanopeni@gmail.com>
I would have expected that each folder within the examples directory would have it's own So, yeah, I don't really understand the way it is right now. |
I have stored the linux binary for staticcheck in a bin folder at the repo root. Happy to move it somewhere else if necessary. |
Have you thought using https://pre-commit.com and handle the static checks there? Then the same checks would be done at CI level than at local one On the other hand, storing the binary in the project seems not a common pattern. Go has the tools.go approach, as described here: https://play-with-go.dev/tools-as-dependencies_go115_en/ |
I started with tools.go and switched to storing a binary based on a suggestion by @vearutop. Personally, I prefer the tools.go approach, because it guarantees that CI and developers' machines run the exact same checks on all supported platforms. That said, if I could get a decision on the approach to be used, I'll go with it. |
If I understand correctly, the intent is to run a pre-commit check so that code that is committed is well formed. If that's the case, then the same can be accomplished using vanilla .githooks and Go. From what I understand, pre-commit.com would add a python dependency, which doesn't really seem to add value. |
The intend would be running the very same "hooks" across any member of the team including contributors. And a hook could be running whatever thing: we use it to check your shell scripts format, yml indent... Or even run the unit test if needed (depending of course the amount of time they take).
|
Thanks for the suggestion @mdelapenya! I suggest that, to keep things moving, we keep the scope of this PR to moving from |
@vearutop do you have any comments on the way Carl's include the binary for |
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.
Looks good to me 👍
Examples try to represent realistic cases and for that they have extra dependencies (for example In the past each example had its own module and a dependency on already released version of |
Thanks @carleeto and welcome to the Godog contributors team! 🎉 |
Cheers @mattwynne. Thanks @vearutop and @mdelapenya for the review too. |
Description
This PR switches static checking from the deprecated tool golint to staticcheck
Motivation & context
It switches static linting from a deprecated tool to a recommended one.
Fixes #448
Type of change
Checklist: