Skip to content
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

🧹 Linting #1418

Merged
merged 120 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
5d7da1c
update linters so we don't have deprecated linters, and fix linter er…
faddat May 23, 2022
47b665d
Merge branch 'main' into linter
faddat May 23, 2022
bf04920
Update CHANGELOG.md
faddat May 23, 2022
5501a2c
longer timeout
faddat May 23, 2022
adb6872
Merge branch 'main' into linter
faddat May 24, 2022
e80423a
Update golangci.yml
faddat May 24, 2022
8f2ff17
fumpt
faddat May 24, 2022
10838f9
Merge branch 'main' into linter
faddat May 24, 2022
5ef98e4
Merge branch 'main' into linter
faddat May 24, 2022
e80a1c8
Merge branch 'main' into linter
faddat May 26, 2022
2170acb
NewPacketId -> NewPacketID in keys_test.go
faddat May 26, 2022
ca3d343
Merge branch 'main' into linter
faddat Jun 2, 2022
3b0b1f2
update changelog per feedback
faddat Jun 2, 2022
23d559a
Merge branch 'main' into linter
faddat Jun 2, 2022
882e9f1
Update modules/apps/29-fee/ibc_middleware.go
faddat Jun 3, 2022
9261f37
Update modules/core/ante/ante.go
faddat Jun 3, 2022
e71e353
Merge branch 'main' into linter
faddat Jun 7, 2022
a950741
Revert "Update modules/apps/29-fee/ibc_middleware.go"
faddat Jun 7, 2022
f9519fa
add godoc linter
faddat Jun 7, 2022
5b0e597
add golint (deprecated) to check for godocs
faddat Jun 7, 2022
4e63e3e
alphebetize and add errcheck
faddat Jun 7, 2022
8a879b4
fumpt
faddat Jun 7, 2022
175e576
Added gofumpt linter
faddat Jun 7, 2022
858e71e
some error checks and one docs fix
faddat Jun 7, 2022
5157912
RedundancyDecorator
faddat Jun 7, 2022
0cb39b4
added errors, resolved an issue with RedundancyDecorator
faddat Jun 7, 2022
bd3fce6
resolve unnecessary line blank
faddat Jun 7, 2022
e4b9076
moved comment text inside else if
faddat Jun 7, 2022
f206324
update store
faddat Jun 7, 2022
72b9199
Update CHANGELOG.md
faddat Jun 7, 2022
b2a0824
Merge remote-tracking branch 'upstream/main' into linter
faddat Jun 22, 2022
4a973b8
newpacketID in ica test
faddat Jun 22, 2022
6829e91
gofumpt
faddat Jun 22, 2022
bda2873
assignOp: replace with
faddat Jun 22, 2022
eee47f1
Merge branch 'main' into linter
faddat Jun 27, 2022
02e3ce9
Merge branch 'linter' of https://github.com/notional-labs/ibc-go into…
faddat Jun 27, 2022
7c28fdb
merge main
faddat Jun 27, 2022
2ded56c
Merge branch 'main' into linter
faddat Jun 28, 2022
51b5cfc
Merge remote-tracking branch 'upstream/main' into linter
faddat Jul 2, 2022
6a4e2e7
lint keeper_test.go
faddat Jul 2, 2022
53a5ff5
Merge branch 'linter' of https://github.com/notional-labs/ibc-go into…
faddat Jul 2, 2022
d6ae552
Merge branch 'main' into linter
faddat Jul 5, 2022
ccf5754
Merge branch 'main' into linter
faddat Jul 5, 2022
cfa1f7d
fix error checking in client keeper
faddat Jul 5, 2022
54cb8d7
"works on my pc" ;).
faddat Jul 5, 2022
4a9f87c
use go1.18 for golangci-lint
faddat Jul 5, 2022
b125e45
Merge branch 'main' into linter
faddat Jul 7, 2022
5866dc8
Merge branch 'main' into linter
faddat Jul 9, 2022
f634228
fumpt
faddat Jul 9, 2022
ec587aa
Merge branch 'main' into linter
faddat Jul 12, 2022
9c4b820
Update modules/core/ante/ante.go
faddat Jul 14, 2022
efad5dc
Update testing/mock/ibc_app.go
faddat Jul 14, 2022
75d595d
Update modules/light-clients/07-tendermint/types/update.go
faddat Jul 14, 2022
0a1177b
Merge branch 'main' into linter
faddat Jul 14, 2022
ec8e88f
goimports
faddat Jul 14, 2022
02e1399
fumpt
faddat Jul 14, 2022
42c62d8
Update modules/core/02-client/abci.go
faddat Jul 14, 2022
bfb4cd1
goimports
faddat Jul 14, 2022
ea7dbba
Update golangci.yml
faddat Jul 14, 2022
4ea11e8
Merge remote-tracking branch 'upstream/main' into linter
faddat Jul 15, 2022
b3eb288
Merge branch 'linter' of https://github.com/notional-labs/ibc-go into…
faddat Jul 15, 2022
5f86b0d
Merge remote-tracking branch 'upstream/main' into linter
faddat Jul 15, 2022
adffa5b
fix newCosmosRelayer
faddat Jul 15, 2022
3aec211
try to fix abci codeql flagging
faddat Jul 15, 2022
bf9832a
Merge branch 'main' into linter
faddat Jul 16, 2022
1e1d59c
Merge remote-tracking branch 'upstream/main' into linter
faddat Jul 16, 2022
51d4e20
Merge branch 'linter' of https://github.com/notional-labs/ibc-go into…
faddat Jul 16, 2022
3dbed8c
Merge branch 'main' into linter
faddat Jul 19, 2022
cca4027
make ci same as main
faddat Jul 19, 2022
c290679
make format
faddat Jul 19, 2022
b34a460
make format
faddat Jul 19, 2022
ed8bac1
Merge branch 'linter' of https://github.com/notional-labs/ibc-go into…
faddat Jul 19, 2022
dfa1751
fmt and proto-gen
faddat Jul 19, 2022
2933f75
update linter settings
faddat Jul 19, 2022
f6899df
omit unnecessary type declaration ibctmtypes.Fraction
faddat Jul 19, 2022
4e8ec07
adjust golangci-lint timeout
faddat Jul 19, 2022
d14d530
use blank for SetUpgradedConsensusState
faddat Jul 19, 2022
5be7cfd
remove sdk_test.go
faddat Jul 20, 2022
2aaf670
Merge branch 'main' into linter
faddat Jul 21, 2022
5dffad9
Update modules/apps/29-fee/ibc_middleware.go
faddat Jul 21, 2022
980b3ff
Update CHANGELOG.md
faddat Jul 21, 2022
ac9e3cd
Update CHANGELOG.md
faddat Jul 21, 2022
8fd5b4e
Merge branch 'main' into linter
faddat Jul 21, 2022
b69d9f3
use declaration
faddat Jul 21, 2022
4b2e3a8
Update CHANGELOG.md
faddat Jul 21, 2022
fc15d16
remove unneded space
faddat Jul 21, 2022
61700a4
update changelog
faddat Jul 21, 2022
c2e5e86
gofumpt
faddat Jul 21, 2022
b1eee6f
fix spelling and trace.go
faddat Jul 21, 2022
c05fdae
Merge branch 'main' into linter
faddat Jul 21, 2022
e95c649
Merge branch 'main' into linter
faddat Jul 21, 2022
2e35554
Merge branch 'main' into linter
faddat Jul 22, 2022
46d6a66
we win
faddat Jul 22, 2022
9574847
Merge branch 'main' into linter
faddat Jul 23, 2022
56a4174
Merge branch 'main' into linter
faddat Jul 26, 2022
c92f6e6
Update mock.go
faddat Jul 26, 2022
e44018c
fumpt
faddat Jul 26, 2022
1d7f3a0
fumpt
faddat Jul 26, 2022
dbf4222
Merge branch 'main' into linter
faddat Jul 26, 2022
6fdc51e
Merge branch 'main' into linter
faddat Jul 26, 2022
19bce95
gofumpt -w -l -modpath github.com/cosmos/ibc-go/v4
faddat Jul 26, 2022
10a5515
write files
faddat Jul 26, 2022
9e60582
imports?
faddat Jul 26, 2022
bfe336b
Merge branch 'linter' of https://github.com/notional-labs/ibc-go into…
faddat Jul 26, 2022
efa7853
correct formatting of imports
faddat Jul 26, 2022
c022cb9
gofumpt
faddat Jul 26, 2022
2da8f35
fix metrics issue
faddat Jul 26, 2022
4b36cf6
add note about blank import of statik
faddat Jul 26, 2022
26cb0af
added note for blank import so we don't need nolint
faddat Jul 26, 2022
db496c2
e2e imports
faddat Jul 26, 2022
81cd7f0
give e2e a full module path
faddat Jul 26, 2022
75d4f77
use goimports
faddat Jul 26, 2022
e42313d
goimports
faddat Jul 26, 2022
144d5c7
Delete .gitpod.yml
faddat Jul 26, 2022
b204f86
Merge remote-tracking branch 'upstream/main' into linter
faddat Jul 27, 2022
9837d0b
update module paths
faddat Jul 27, 2022
5f7a2ac
linting
faddat Jul 27, 2022
1b1cf3a
update proto
vuong177 Jul 27, 2022
7b440bb
*.go
faddat Jul 27, 2022
da21b1a
Merge branch 'main' into linter
faddat Jul 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/scripts/build_test_matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func getGithubActionMatrixForTests(e2eRootDirectory string) (GithubActionTestMat

return nil
})

if err != nil {
return GithubActionTestMatrix{}, err
}
Expand Down
1 change: 0 additions & 1 deletion .github/scripts/build_test_matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func assertGithubActionTestMatricesEqual(t *testing.T, expected, actual GithubAc
}

func goTestFileContents(suiteName, fnName1, fnName2 string) string {

replacedSuiteName := strings.ReplaceAll(`package foo

func TestSuiteName(t *testing.T) {
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
colin-axner marked this conversation as resolved.
Show resolved Hide resolved

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --timeout 5m

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
17 changes: 5 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
run:
tests: false
# # timeout for analysis, e.g. 30s, 5m, default is 1m
# timeout: 5m
timeout: 5m

linters:
disable-all: true
Expand All @@ -10,44 +10,37 @@ linters:
- deadcode
- depguard
- dogsled
# - errcheck
- exportloopref
- errcheck
- goconst
- gocritic
- gofmt
- gofumpt
- goimports
- golint
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- maligned
- misspell
- nakedret
- prealloc
- scopelint
- staticcheck
- structcheck
- stylecheck
- revive
- typecheck
- unconvert
- unused
- unparam
- misspell
# - wsl
- nolintlint

issues:
exclude-rules:
- text: "Use of weak random number generator"
linters:
- gosec
- text: "comment on exported var"
linters:
- golint
- text: "don't use an underscore in package name"
linters:
- golint
faddat marked this conversation as resolved.
Show resolved Hide resolved
- text: "ST1003:"
linters:
- stylecheck
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking

* (core/04-channel) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) NewPacketId has been renamed to NewPacketID to comply with go linting rules.
faddat marked this conversation as resolved.
Show resolved Hide resolved
* (core/ante) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) AnteDecorator has been renamed to RedundancyDecorator to comply with go linting rules and to give more clarity to the purpose of the Decorator.
faddat marked this conversation as resolved.
Show resolved Hide resolved
* (testing) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) MockIBCApp has been renamed to IBCApp and MockEmptyAcknowledgement has been renamed to EmptyAcknowledgement to comply with go linting rules
faddat marked this conversation as resolved.
Show resolved Hide resolved
* (modules/core/03-connection) [\#1672](https://github.com/cosmos/ibc-go/pull/1672) Remove crossing hellos from connection handshakes. The `PreviousConnectionId` in `MsgConnectionOpenTry` has been deprecated.
* (modules/core/04-channel) [\#1317](https://github.com/cosmos/ibc-go/pull/1317) Remove crossing hellos from channel handshakes. The `PreviousChannelId` in `MsgChannelOpenTry` has been deprecated.
* (transfer) [\#1250](https://github.com/cosmos/ibc-go/pull/1250) Deprecate `GetTransferAccount` since the `transfer` module account is never used.
Expand All @@ -59,8 +62,12 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* (linting) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) Fix linting errors, resulting compatiblity with go1.18 linting style, golangci-lint 1.46.2 and the revivie linter. This caused breaking changes in core/04-channel, core/ante, and the testing library.
* (cleanup) [\#1335](https://github.com/cosmos/ibc-go/pull/1335/) `gofumpt -w -l .` to standardize the code layout more strictly than `go fmt ./...`
* (middleware) [\#1022](https://github.com/cosmos/ibc-go/pull/1022) Add `GetAppVersion` to the ICS4Wrapper interface. This function should be used by IBC applications to obtain their own version since the version set in the channel structure may be wrapped many times by middleware.
* (modules/core/04-channel) [\#1160](https://github.com/cosmos/ibc-go/pull/1160) Improve `uint64 -> string` performance in `Logger`.
* (modules/core/04-channel) [\#1232](https://github.com/cosmos/ibc-go/pull/1232) Updating params on `NewPacketID` and moving to bottom of file.
* (modules/core/04-channel) [\#1279](https://github.com/cosmos/ibc-go/pull/1279) Add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse. Emit channel version during OpenInit/OpenTry
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
* (modules/core/04-channel) [\#1232](https://github.com/cosmos/ibc-go/pull/1232) Updating params on `NewPacketId` and moving to bottom of file.
* (app/29-fee) [\#1305](https://github.com/cosmos/ibc-go/pull/1305) Change version string for fee module to `ics29-1`
* (app/29-fee) [\#1341](https://github.com/cosmos/ibc-go/pull/1341) Check if the fee module is locked and if the fee module is enabled before refunding all fees
Expand Down
2 changes: 1 addition & 1 deletion docs/migrations/v2-to-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The migration code required may look like:
icaGenesisState := icatypes.NewGenesisState(controllerGenesisState, hostGenesisState)

// set new ics27 genesis state
appState[icatypes.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(icaGenesisState)
appState[icatypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(icaGenesisState)
```

### Ante decorator
Expand Down
3 changes: 1 addition & 2 deletions e2e/fee_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/strangelove-ventures/ibctest/ibc"
"github.com/stretchr/testify/suite"

"e2e/testsuite"
"github.com/cosmos/ibc-go/v4/e2e/testsuite"
)

func TestFeeMiddlewareTestSuite(t *testing.T) {
Expand All @@ -24,7 +24,6 @@ func (s *FeeMiddlewareTestSuite) TestPlaceholder() {
s.T().Run("start relayer", func(t *testing.T) {
s.StartRelayer(r)
})

}

// feeMiddlewareChannelOptions configures both of the chains to have fee middleware enabled.
Expand Down
3 changes: 1 addition & 2 deletions e2e/testsuite/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ const (
// newCosmosRelayer returns an instance of the go relayer.
func newCosmosRelayer(t *testing.T, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer {
return ibctest.NewBuiltinRelayerFactory(ibc.CosmosRly, logger, relayer.CustomDockerImage(cosmosRelayerRepository, "main")).Build(
t, dockerClient, network,
)
t, dockerClient, network, cosmosRelayerRepository)
}
2 changes: 1 addition & 1 deletion e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zaptest"

"e2e/testconfig"
"github.com/cosmos/ibc-go/v4/e2e/testconfig"
)

const (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions modules/apps/27-interchain-accounts/host/types/host.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions modules/apps/27-interchain-accounts/host/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions modules/apps/27-interchain-accounts/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) {

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the interchain accounts module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
controllertypes.RegisterQueryHandlerClient(context.Background(), mux, controllertypes.NewQueryClient(clientCtx))
hosttypes.RegisterQueryHandlerClient(context.Background(), mux, hosttypes.NewQueryClient(clientCtx))
err := controllertypes.RegisterQueryHandlerClient(context.Background(), mux, controllertypes.NewQueryClient(clientCtx))
if err != nil {
panic(err)
}
err = hosttypes.RegisterQueryHandlerClient(context.Background(), mux, hosttypes.NewQueryClient(clientCtx))
if err != nil {
panic(err)
}
}

// GetTxCmd implements AppModuleBasic interface
Expand Down
7 changes: 4 additions & 3 deletions modules/apps/27-interchain-accounts/types/account.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions modules/apps/27-interchain-accounts/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions modules/apps/27-interchain-accounts/types/metadata.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions modules/apps/27-interchain-accounts/types/packet.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions modules/apps/29-fee/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func GetCmdIncentivizedPacket() *cobra.Command {
return err
}

packetID := channeltypes.NewPacketId(portID, channelID, seq)
packetID := channeltypes.NewPacketID(portID, channelID, seq)

if err := packetID.Validate(); err != nil {
return err
Expand Down Expand Up @@ -122,7 +122,7 @@ func GetCmdTotalRecvFees() *cobra.Command {
return err
}

packetID := channeltypes.NewPacketId(portID, channelID, seq)
packetID := channeltypes.NewPacketID(portID, channelID, seq)

if err := packetID.Validate(); err != nil {
return err
Expand Down Expand Up @@ -168,7 +168,7 @@ func GetCmdTotalAckFees() *cobra.Command {
return err
}

packetID := channeltypes.NewPacketId(portID, channelID, seq)
packetID := channeltypes.NewPacketID(portID, channelID, seq)

if err := packetID.Validate(); err != nil {
return err
Expand Down Expand Up @@ -214,7 +214,7 @@ func GetCmdTotalTimeoutFees() *cobra.Command {
return err
}

packetID := channeltypes.NewPacketId(portID, channelID, seq)
packetID := channeltypes.NewPacketID(portID, channelID, seq)

if err := packetID.Validate(); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/29-fee/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func NewPayPacketFeeAsyncTxCmd() *cobra.Command {
return err
}

packetID := channeltypes.NewPacketId(args[0], args[1], seq)
packetID := channeltypes.NewPacketID(args[0], args[1], seq)

recvFeeStr, err := cmd.Flags().GetString(flagRecvFee)
if err != nil {
Expand Down
Loading