-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
chore: use canonical golangci-lint github action #12134
Conversation
- uses: technote-space/[email protected] | ||
id: git_diff | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum |
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.
we usually opt to have this to not run this position of ci when there are no changes to the go code.
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 recommend that we run it all the time since the compute to do that costs nothing and the previous setup resulted in not linting at all.
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.
But there's no sense in running it if there are zero code changes.
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.
Yeah I can roll with it, I’ll make that change I’m just worried that I could introduce another bug that reproduces the prior state
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.
please revert this change, after this we can look at merging
- name: golangci-lint | ||
if: env.GIT_DIFF | ||
uses: golangci/golangci-lint-action@v3 |
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 think we have to migrate away from this action since it doesn't support workspaces or multiple go.mods in a single repo for now.
Co-authored-by: Marko <[email protected]>
Co-authored-by: Marko <[email protected]>
## Description This PR works towards #12133 and does a fumpt for consistency once sdk.Int is merged. The suggested merge order is to begin with sdk.Int, merge in the various linter PR's one by one, and then finally merge the changes to CI from #12134 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
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.
We should be running make lint
instead of using this job IMO. I say this because it uses a consistent version that both devs and CI will use. If we go with the job approach, the version thats used via make lint
can differ from CI.
@alexanderbez not if we change the makefile to The golangci-lint team makes very clear recommendations around using their github action, and the goals of this PR are:
Because we used the diff github action in the past, I was able to solve hundreds of linter errors today. No exaggeration. Then, our code practices here in the sdk filter into other ecosystem projects like gaia. |
We can use |
@alexanderbez I'm going to posit: the current situation fixed by this PR is more serious than synced versions. We effectively got no feedback from the linters. Thousands of commits happened, without the linters doing what they should do. So my preference here is to strictly follow the guidelines given by golangci-lint so that we end up getting that feedback in the future and can act on it |
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
I may revert the changes to the cmd folder... |
… I'll fix, as soon as I can remember how to.
This should now be complete. Once again I would like to note that there were a few items I was unsure how to handle. For example, do we want to change perfectly functional code that contains else if chains and could be refactored to be switch statements? The only thing I don't like is I can't currently remember the solution to the filepath.Join(dir) <- only one argument, it isnt a join... problem. I know I have solved it somewhere, and will likely remember and bring the solution back here. |
Codecov Report
@@ Coverage Diff @@
## main #12134 +/- ##
==========================================
+ Coverage 66.13% 66.56% +0.42%
==========================================
Files 675 691 +16
Lines 71274 72535 +1261
==========================================
+ Hits 47137 48280 +1143
- Misses 21492 21575 +83
- Partials 2645 2680 +35
|
@@ -1789,6 +1790,7 @@ func (s *IntegrationTestSuite) TestAuxToFeeWithTips() { | |||
tc.feePayerArgs..., | |||
) | |||
|
|||
//nolint:gocritic // rewriting this as a switch statement didn't make sense. |
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 totally what I mean about codecov
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.
eg:
- comments aren't new code lacking test coverage
- nolint statements aren't new code lacking test coverage
.gitpod.yml
Outdated
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file) | ||
# and commit this file to your remote git repository to share the goodness with others. | ||
|
||
tasks: |
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.
please remove, this is out of scope for 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.
100%, sorry about that. It puts those there automatically, and is most annnoying part of gitpod.
a few more stragglers, do you want to complete then we can go ahead with the merge |
1 similar comment
a few more stragglers, do you want to complete then we can go ahead with the merge |
hey sorry about the delay! I thought no stragglers remained-- let me check er out now :) |
## Description This PR works towards #12133 and does a fumpt for consistency once sdk.Int is merged. The suggested merge order is to begin with sdk.Int, merge in the various linter PR's one by one, and then finally merge the changes to CI from #12134 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) (cherry picked from commit b7097c3) # Conflicts: # CHANGELOG.md # x/group/keeper/keeper.go
Description
This is the canonical github action for golangci-lint.
https://github.com/golangci/golangci-lint-action
It has been set to allow the version of the linters to "roll" which will reduce the matienance needed and ensure that linting is kept up to date automatically.
By eschewing the typical pattern where we use a github action that runs linters against only a diff, we ensure that as the linters are updated upstream, we apply those changes here.
In the series of PR's described in #12133 , this one should be merged last.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change