Skip to content

fix: if-return and early-return (backport #2215)#2216

Merged
melekes merged 3 commits intov1.xfrom
mergify/bp/v1.x/pr-2215
Feb 1, 2024
Merged

fix: if-return and early-return (backport #2215)#2216
melekes merged 3 commits intov1.xfrom
mergify/bp/v1.x/pr-2215

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Feb 1, 2024

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

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

You are currently cherry-picking commit eda385c6c.
  (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:   abci/example/kvstore/kvstore.go
	modified:   internal/blocksync/pool.go
	modified:   internal/consensus/types/height_vote_set.go
	modified:   internal/flowrate/io.go
	modified:   internal/store/store.go
	modified:   light/client.go
	modified:   privval/signer_dialer_endpoint.go
	modified:   rpc/jsonrpc/client/decode.go
	modified:   rpc/jsonrpc/client/ws_client.go
	modified:   rpc/jsonrpc/server/http_uri_handler.go
	modified:   test/e2e/app/state.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   test/e2e/pkg/infra/docker/docker.go

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

This is cherry-picked from:

* #1907

There were a number of opportunities to simplify code in comet by using
revive's if-return and early-return linters. This PR does not enable the
linters as default, but instead just applies the fixes suggested by
them.

There are two cases where I've marked conditionals with //nolint --
they're both a little bit odd and it may make sense to look deeper into
weather it is possible to benefit from early returns.

As we've seen in the break statements in #1907 using a linter can help
to enforce good practices across the entire repository and uncover
issues.

## inspired by

* #2156

---

#### PR checklist

- [x] Tests written/updated
- [x] 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
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

---------

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
(cherry picked from commit eda385c)

# Conflicts:
#	test/e2e/pkg/infra/docker/docker.go
@mergify mergify bot requested a review from a team as a code owner February 1, 2024 07:46
@mergify mergify bot requested a review from a team February 1, 2024 07:46
@mergify mergify bot added the conflicts label Feb 1, 2024
@melekes melekes merged commit f672693 into v1.x Feb 1, 2024
@melekes melekes deleted the mergify/bp/v1.x/pr-2215 branch February 1, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants