Skip to content

chore: update, tighten and modernize linters#8496

Merged
gjermundgaraba merged 26 commits intomainfrom
gjermund/lint-update
Jun 22, 2025
Merged

chore: update, tighten and modernize linters#8496
gjermundgaraba merged 26 commits intomainfrom
gjermund/lint-update

Conversation

@gjermundgaraba
Copy link
Contributor

@gjermundgaraba gjermundgaraba commented Jun 7, 2025

Description

closes: IBCGO-2354, IBCGO-33

This PR cleans up linting by removing unnecessary exclusions that most likely were put in place to avoid having to do a larger cleanup. There are still some that we should consider tackling eventually, as they seem to be code smells.

The linting rules that have caused the most change in code are:

  • Consistent receiver type
    • One rather large side effect of this is that some keepers can no longer be passed by value to functions that expect an interface (see https://go.dev/wiki/MethodSets for more information on the technical reasons for this)
  • No named returns
  • Correct testify usage
  • Max length receiver name = 4

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Include changelog entry when appropriate (e.g. chores should be omitted from changelog).
  • Wrote unit and integration tests if relevant.
  • Updated documentation (docs/) if anything is changed.
  • Added godoc comments if relevant.
  • Self-reviewed Files changed in the GitHub PR explorer.
  • Provide a conventional commit message to follow the repository standards.

@linear
Copy link

linear bot commented Jun 7, 2025

@codecov
Copy link

codecov bot commented Jun 7, 2025

Codecov Report

Attention: Patch coverage is 82.71028% with 37 lines in your changes missing coverage. Please review.

Project coverage is 57.58%. Comparing base (f0587cd) to head (923fce3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
e2e/testsuite/testconfig.go 0.00% 5 Missing ⚠️
modules/apps/callbacks/testing/simapp/export.go 0.00% 5 Missing ⚠️
e2e/testsuite/testsuite.go 0.00% 4 Missing ⚠️
...27-interchain-accounts/controller/keeper/keeper.go 87.50% 3 Missing ⚠️
...es/apps/packet-forward-middleware/keeper/keeper.go 40.00% 3 Missing ⚠️
modules/apps/transfer/keeper/relay.go 57.14% 3 Missing ⚠️
e2e/dockerutil/dockerutil.go 0.00% 2 Missing ⚠️
...interchain-accounts/controller/keeper/handshake.go 0.00% 2 Missing ⚠️
modules/apps/transfer/module.go 50.00% 2 Missing ⚠️
e2e/testsuite/diagnostics/diagnostics.go 0.00% 1 Missing ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8496      +/-   ##
==========================================
+ Coverage   57.57%   57.58%   +0.01%     
==========================================
  Files         317      317              
  Lines       22673    22666       -7     
==========================================
- Hits        13053    13052       -1     
+ Misses       9012     9006       -6     
  Partials      608      608              
Flag Coverage Δ
08-wasm 65.99% <ø> (-0.15%) ⬇️
e2e 1.13% <0.00%> (ø)
ibc-go 63.00% <87.62%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

simapp/app.go Outdated
@@ -392,7 +392,7 @@ func NewSimApp(
)

// Packet Forward Middleware keeper
app.PFMKeeper = packetforwardkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[packetforwardtypes.StoreKey]), app.TransferKeeper, app.IBCKeeper.ChannelKeeper, app.BankKeeper, app.ICAControllerKeeper.GetICS4Wrapper(), authtypes.NewModuleAddress(govtypes.ModuleName).String())
app.PFMKeeper = packetforwardkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[packetforwardtypes.StoreKey]), &app.TransferKeeper, app.IBCKeeper.ChannelKeeper, app.BankKeeper, app.ICAControllerKeeper.GetICS4Wrapper(), authtypes.NewModuleAddress(govtypes.ModuleName).String())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the side-effects of using consistent pointer receiver type, the value type does not implement the interface anymore. For more information, see https://go.dev/wiki/MethodSets

Copy link
Contributor

@johnnylarner johnnylarner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this big ol' chore. I have one question in the comments, otherwise lgtm!

Copy link
Contributor

@DeshErBojhaa DeshErBojhaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work 🎉
I appreciate the huge effort it took to push it over the line.
Left some comments, but not a blocker.

utACK!! 🎊


```go
s.NoError(err)
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@faddat
Copy link
Contributor

faddat commented Jun 14, 2025

This is a really great pull request, but you need to understand that the general public is not able to actually see what issues you are referencing. That's not great.

But seriously thank you for tightening up the linters.

@gjermundgaraba
Copy link
Contributor Author

This is a really great pull request, but you need to understand that the general public is not able to actually see what issues you are referencing. That's not great.

See #8526 (comment)

@linear
Copy link

linear bot commented Jun 17, 2025

@gjermundgaraba gjermundgaraba requested a review from Copilot June 21, 2025 22:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR refactors the test code and related migration files to modernize the code style by shortening receiver variable names (e.g. replacing “suite” with “s”), removing extraneous whitespace, and updating some function signatures for clarity and consistency.

  • Renames test suite receiver variables and related calls for improved style.
  • Cleans up diff hunks by removing unnecessary blank lines and redundant code.
  • Updates migration test files and associated client encoding/decoding functions to align with modern linting rules.

Reviewed Changes

Copilot reviewed 164 out of 300 changed files in this pull request and generated no comments.

Show a summary per file
File Description
modules/core/03-connection/types/params_test.go Removed unnecessary blank lines and improved loop formatting.
modules/core/03-connection/types/msgs_test.go Changed test receiver from “suite” to “s” for brevity and consistency.
modules/core/03-connection/types/connection_test.go Cleaned up test iteration style with minor whitespace removals.
modules/core/03-connection/keeper/verify_test.go Updated receiver alias and function call style for consistency.
modules/core/03-connection/keeper/keeper_test.go Replaced “suite” alias with “s” and updated corresponding test calls.
modules/core/03-connection/keeper/keeper.go Changed receiver type from value to pointer for the Logger method.
modules/core/03-connection/keeper/handshake_test.go Updated test receiver alias and formatting consistency.
modules/core/03-connection/keeper/grpc_query_test.go Updated receiver alias and formatting in query tests.
modules/core/03-connection/keeper/events_test.go Modified receiver alias and cleaned up assertions in event tests.
modules/core/02-client/v2/types/* Consistently updated receiver alias and formatting in test files.
modules/core/02-client/migrations/v7/* Updated migration tests and helper functions to use the new naming style.
modules/core/02-client/keeper/migrations_test.go Refactored migration test receiver alias from “suite” to “s”.

@gjermundgaraba gjermundgaraba merged commit 1dae432 into main Jun 22, 2025
60 checks passed
@gjermundgaraba gjermundgaraba deleted the gjermund/lint-update branch June 22, 2025 08:45
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.

5 participants