Skip to content

ci: run golangci-lint linters for all files (not only ones which were modified) (backport #2250)#2265

Merged
melekes merged 10 commits intov1.xfrom
mergify/bp/v1.x/pr-2250
Feb 8, 2024
Merged

ci: run golangci-lint linters for all files (not only ones which were modified) (backport #2250)#2265
melekes merged 10 commits intov1.xfrom
mergify/bp/v1.x/pr-2250

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Feb 8, 2024

This is an automatic backport of pull request #2250 done by Mergify.
Cherry-pick of a03158b has failed:

On branch mergify/bp/v1.x/pr-2250
Your branch is up to date with 'origin/v1.x'.

You are currently cherry-picking commit a03158b85.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   .github/workflows/lint.yml
	modified:   .pre-commit-config.yaml
	modified:   mempool/clist_mempool_test.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   .golangci.yml

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 refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

… modified) (#2250)

on modified files.
See https://pre-commit.com/hooks.html

cc @greg-szabo

(cherry picked from commit a03158b)

# Conflicts:
#	.golangci.yml
@mergify mergify bot requested a review from a team as a code owner February 8, 2024 07:50
@mergify mergify bot added the conflicts label Feb 8, 2024
@mergify mergify bot requested a review from a team February 8, 2024 07:50
melekes and others added 4 commits February 8, 2024 12:29
* 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>
Daniel and others added 2 commits February 8, 2024 13:08
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 melekes merged commit 80fda4f into v1.x Feb 8, 2024
@melekes melekes deleted the mergify/bp/v1.x/pr-2250 branch February 8, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants