-
Notifications
You must be signed in to change notification settings - Fork 405
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
Add golangci lint check on pull requests #645
Add golangci lint check on pull requests #645
Conversation
@alpe This is ready for review whenever you are free. |
Thanks for this contribution. It seems GitHub actions are not run on this repo. |
Codecov Report
@@ Coverage Diff @@
## master #645 +/- ##
==========================================
- Coverage 60.22% 59.95% -0.28%
==========================================
Files 48 48
Lines 5315 5324 +9
==========================================
- Hits 3201 3192 -9
- Misses 1890 1906 +16
- Partials 224 226 +2
|
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.
One tip to ensure this is run in the CI.
Then I will see the results of the CI run.
Thanks for hooking this up.
@@ -60,6 +60,17 @@ jobs: | |||
paths: | |||
- ".git" | |||
|
|||
lint: |
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.
I was surprised it didn't show up on the PR. But then realised it is missing a section like this: https://github.com/CosmWasm/wasmd/pull/645/files#diff-78a8a19706dbd2a4425dd72bdab0502ed7a2cef16365ab7030a5a0588927bf47L194-L196
Can you add 3 lines to workflow (running after setup-dependencies makes sense to me), and I can see the results in the CI.
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.
Sweet, that makes sense I was wondering why it wasn't running. I just pushed a change adding it to the workflow like you said. Thank you!
I added all the changes from running |
Personally, I would revert the last 2 commits (or move them to another PR on top of this). I could merge the CI changes alone (that is a clear unit) and then there can be multiple "cleanup" PRs. |
Can you ping me when you revert those 2 and I can merge |
@ethanfrey sounds good, lets merge: #648 first to take care of those two commits and it looks like there are still a couple issues I need to fix with the golinter so I will work on those in the meantime. |
This is now passing ci and is ready for review once #648 has been merged into master and then master is merged into this pr |
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.
Very nice start. This was a lot of work I guess. Thanks a lot! 💐
The linter also worked well and I discovered some 🐛 in the code that we should be addressed.
If you don't have the time/capacity then please let me know.
@fkneeland-figure would you rebase this on top of master? As I wrote there are some bugs in the original code that I would like to address soon. If you don't have time/capacity at the moment then please let me know so that I start another linter branch. |
@alpe I am available to work on this today and will try to get those bug fixes in quickly. Thanks! |
_, _ = app.distrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) | ||
_, err := app.distrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) | ||
if err != nil { | ||
panic(err) |
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.
@alpe I added these to address these errors being ignored, but idk if this is desired behavior?
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 was copied from the SDk: https://github.com/cosmos/cosmos-sdk/blob/v0.42.10/simapp/export.go#L75
We should stay with their defaults here. I looked a the code and there are 2 cases that can cause an error:
- accumulated commission is 0
- SendCoinsFromModuleToAccount returns error
The first case is more likely. I will address this in a new PR
Thanks for the contributions @channa-figure This is passing the lint test now and I believe we have addressed all of your comments @alpe whenever you get the chance to do another review of this. Thank you! |
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.
Very nice! Thanks a lot for your contribution and addressing all my review comments. I appreciate your work a lot. 💯
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofmt -w -s | ||
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w | ||
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/CosmWasm/wasmd | ||
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -path "*.pb.go" | xargs gofmt -w -s |
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.
Formatting the auto generated files is completely fine. I was only concerned about manual changes that we need to avoid.
I will revert these modification in a new PR as the generated files do not match the formatted files in this PR anymore.
* added golangci lint check on pull requests * changelog update * updated to use circleci instead of github actions * testing a golang change * added workflow * updated how we find the golangci command in the make file * using orb for golangci * Added golangci install make command * use docker image for golangci * stop using make in circleci * reverted golang change to trigger ci * gofmt * make fmt * fixed a few things * updated version on golintci * fixed all the lint errors * check version * skipped wrongly failing lint * Revert generated file changes * fix import grouping, return errors on failures, initialization of arrays revert * fixed a few lint errors * addressed more code review comments * updated with error check * increased timeout for golangci-lint * dont format autogenerated files Co-authored-by: Carlton Hanna <channa@figure.com>
Resolves #620
I added a github action to run the golangci lint test on all non-test golang files when a pr is created.