ci: run golangci-lint linters for all files (not only ones which were modified) (backport #2250)#2265
Merged
ci: run golangci-lint linters for all files (not only ones which were modified) (backport #2250)#2265
Conversation
… modified) (#2250) on modified files. See https://pre-commit.com/hooks.html cc @greg-szabo (cherry picked from commit a03158b) # Conflicts: # .golangci.yml
* golangci-lint: enable all the linters by default * fix scanWhile * bring back getKeys * update mocks * fix labels * bring back getKeys * bring back makeAddrs * remove unused tag * remove extra slash
* remove unused linters that produced a warning and ensure that unparam is enabled * apply the linters to tests * additional autofixes * test helpers * all helper functions start from t.Helper() * mainly assert -> require and other hygene changes * further updates and attempts at fixes * further cleanups * fix double declaration * b.helper() * use stdlib http methods * Fix test assertions in various test files * Fix validation test assertions * Fix test assertions and clean up code * Fix field element comparison in TestGenPrivKeySecp256k1 * Fix various test failures and errors in the code * Fix assertion in TestClientReplacesPrimaryWithWitnessIfPrimaryIsUnavailable * Fix error handling and add arguments to execAnsible function * as a piece of Free software, cometbft does NOT need to support digitalocean. * Revert "b.helper()" This reverts commit ba108c6. * error handling * reactor_test.go removed in master * fix a bug from removing an error that is always nil * use correct require calls * begin reversing expected and equal values * complete reversing expected and actual * favor require.NoError over require.Nil * fix issue with len in kvstore test * use the correct numeral type in TestBlockStoreSaveLoadBlock * Fix test assertions in rpc/jsonrpc/client/args_test.go, mempool/clist_mempool_test.go, crypto/merkle/proof_test.go, and internal/store/store_test.go * Fix assertions in test cases * Fix test assertions in rpc/client/helpers_test.go and types/block_test.go * revert a store test fix that was causing issues * Fix test assertions in state_test.go, cache_test.go, clist_mempool_test.go, helpers_test.go, and status_test.go * assert.Gerater * Fix assert statements in test files * Fix assertion order in TestBlockFetchAtHeight * fix regressions * Fix test assertions in various test files * Fix test assertions in detector_test.go, netaddress_test.go, addrbook_test.go, and switch_test.go * Add gofmt linter and update assertions in tests * Fix test helper functions * Refactor code to use strconv.Itoa instead of fmt.Sprintf * Fix assertion errors in unit tests * Fix test assertions in types_test.go, secp256k1_internal_test.go, group_test.go, pool_test.go, verify_test.go, and state_test.go * Fix test cases and update provider configuration * Fix ValidateBasic assertion in http_test.go * attempt to fix a regression * Refactor assert functions in verify_test.go * remove gocritic linter and update assertions in tests * Fix error handling in state_test.go and validator_set_test.go * Fix test assertions in store_test.go, http_test.go, and validation_test.go * Fix test assertions in unit tests * Fix test assertions in unit tests * Fix test assertions in store_test.go, setup_test.go, http_test.go, netaddress_test.go, rpc_test.go, http_json_handler_test.go, and tx_test.go * attempt to fix http test * Fix test assertions in peer_test.go, event_test.go, status_test.go, rpc_test.go, http_json_handler_test.go, parse_test.go, and results_test.go * Fix various test assertions * Fix test assertions in state_test.go, chunks_test.go, store_test.go, clist_mempool_test.go, peer_set_test.go, addrbook.go, switch_test.go, rpc_test.go, and validator_set_test.go * Fix test assertions and remove unused import statements * Fix test assertions in state_test.go and pruner_test.go * Fix makeValidCommit function signature * Fix assert statements and require.NoError usage in tests * Fix test assertions and error handling * Fix type conversion in TestSetValidBlockOnDelayedPrevote * Fix test assertions in rpc/client/rpc_test.go and rpc/jsonrpc/server/parse_test.go * Fix empty result assertion in TestTxSearch * Fix variable initialization and remove unnecessary error handling * remove unused code * finished :D * Fix reactorPairs initialization in TestBadBlockStopsPeer * Fix empty result assertion in TestTxSearch * Fix duplicate channel creation in TestNodeInfoValidate * Fix typos and add comments to address book functionality * Update field names in TestStruct * Fix randGenesisDoc function signature and update function calls This commit fixes the signature of the `randGenesisDoc` function in the `byzantine_test.go`, `common_test.go`, `mempool_test.go`, and `reactor_test.go` files. The function now takes an additional boolean parameter `randPower` to determine whether to generate random validator powers or not. The function calls in these files have been updated accordingly. * Add helper function for counting old and new addresses in selection * Refactor calcOldBucket function in addrbook.go * Fix code formatting and remove unused code * Fix linter configuration * test if this is a ci flake by adding some godoc * fix lint issues in ci jobs * add a godoc to fix tests * unclog * Update internal/state/state_test.go Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com> * re-add reactor test * Update internal/state/state_test.go Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com> * revert changes to db.go * disable unparam * lint * linter autofix * reduce same issues and same linter significantly * Update .golangci.yml Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com> * Update internal/consensus/state_test.go Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com> * Update .golangci.yml Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com> * print index * remove extra err msg * print err * print err * print err * print err * fix assert * remove extra msg * remove extra msg * remove extra Sprintf * remove extra Sprintf * remove needless Sprintf * bring back err msg * Revert "as a piece of Free software, cometbft does NOT need to support digitalocean." This reverts commit fb5abd2. * fix remaining errors * remove changelog entry * fix TestReactorTxSendersLocal --------- Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
In #1838, I've set (or reset) dependencies order to default: https://golangci-lint.run/usage/linters/#gci ``` sections: - standard # Standard section: captures all standard packages. - default # Default section: contains all imports that could not be matched to another section type. ``` This PR updates dependencies ordering to `custom`, which matches more with what we previously had. ``` gci: sections: - standard # Standard section: captures all standard packages. - default # Default section: contains all imports that could not be matched to another section type. - blank # blank imports - dot # dot imports - prefix(github.com/cometbft/cometbft, github.com/cometbft/cometbft-db) custom-order: true ``` Sorry for the back and forth. --- - [ ] ~~Tests written/updated~~ - [ ] ~~Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog)~~ - [x] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: Daniel <daniel.cason@informal.systems>
Collaborator
Addresses #1999. --- #### PR checklist - [x] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments
melekes
approved these changes
Feb 8, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an automatic backport of pull request #2250 done by Mergify.
Cherry-pick of a03158b has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
Mergify commands and options
More conditions and actions can be found in the documentation.
You can also trigger Mergify actions by commenting on this pull request:
@Mergifyio refreshwill re-evaluate the rules@Mergifyio rebasewill rebase this PR on its base branch@Mergifyio updatewill merge the base branch into this PR@Mergifyio backport <destination>will backport this PR on<destination>branchAdditionally, on Mergify dashboard you can:
Finally, you can contact us on https://mergify.com