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 109 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/scripts/build_test_matrix.go
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
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
26 changes: 26 additions & 0 deletions .github/workflows/golangci.yml
@@ -0,0 +1,26 @@
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:
version: latest
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
args: --timeout 5m
21 changes: 5 additions & 16 deletions .golangci.yml
@@ -1,53 +1,42 @@
run:
tests: false
# # timeout for analysis, e.g. 30s, 5m, default is 1m
# timeout: 5m
timeout: 5m

linters:
disable-all: true
enable:
- bodyclose
- 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
41 changes: 23 additions & 18 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions RELEASES.md
Expand Up @@ -23,13 +23,13 @@ We ensure all major releases are supported by relayers ([hermes](https://github.

## Release cycle

IBC-Go follows a traditional release cycle involving an alpha, beta, and rc (release candidate) releases before finalizing a new version. As ibc-go works in a non-traditional area, we apply our own interpretation to each release type. We reserve the right to make both go API breaking changes and state machine breaking changes throughout the entire release cycle. The stable release guarentees do not go into affect until a final release is performed.
IBC-Go follows a traditional release cycle involving an alpha, beta, and rc (release candidate) releases before finalizing a new version. As ibc-go works in a non-traditional area, we apply our own interpretation to each release type. We reserve the right to make both go API breaking changes and state machine breaking changes throughout the entire release cycle. The stable release guarantees do not go into affect until a final release is performed.

It is never advisable to use a non-final release in production.

### Alpha

Alpha releases are intended to make available new features as soon as they are functional. No correctness guarentees are made and alpha releases **may** contain serious security vulnerabilities, bugs, and lack of user tooling, so long as they don't affect the core functionality.
Alpha releases are intended to make available new features as soon as they are functional. No correctness guarantees are made and alpha releases **may** contain serious security vulnerabilities, bugs, and lack of user tooling, so long as they don't affect the core functionality.

Initial users of alpha releases are expected to be advanced, patient, and capable of handling unusual errors. Very basic integration testing will be performed by the ibc-go development team before alpha releases.

Expand Down
2 changes: 1 addition & 1 deletion docs/migrations/v2-to-v3.md
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
9 changes: 4 additions & 5 deletions e2e/fee_middleware_test.go
Expand Up @@ -2,6 +2,8 @@ package e2e

import (
"context"
"e2e/testsuite"
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
"e2e/testvalues"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -11,9 +13,6 @@ import (
"github.com/strangelove-ventures/ibctest/test"
"github.com/stretchr/testify/suite"

"e2e/testsuite"
"e2e/testvalues"

feetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"
transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
Expand All @@ -30,7 +29,8 @@ type FeeMiddlewareTestSuite struct {

// RegisterCounterPartyPayee broadcasts a MsgRegisterCounterpartyPayee message.
func (s *FeeMiddlewareTestSuite) RegisterCounterPartyPayee(ctx context.Context, chain *cosmos.CosmosChain,
user broadcast.User, portID, channelID, relayerAddr, counterpartyPayeeAddr string) (sdk.TxResponse, error) {
user broadcast.User, portID, channelID, relayerAddr, counterpartyPayeeAddr string,
) (sdk.TxResponse, error) {
msg := feetypes.NewMsgRegisterCounterpartyPayee(portID, channelID, relayerAddr, counterpartyPayeeAddr)
return s.BroadcastMessages(ctx, chain, user, msg)
}
Expand All @@ -42,7 +42,6 @@ func (s *FeeMiddlewareTestSuite) QueryCounterPartyPayee(ctx context.Context, cha
ChannelId: channelID,
Relayer: relayerAddress,
})

if err != nil {
return "", err
}
Expand Down
3 changes: 1 addition & 2 deletions e2e/testsuite/relayer.go
@@ -1,9 +1,8 @@
package testsuite

import (
"testing"

"e2e/testconfig"
"testing"
faddat marked this conversation as resolved.
Show resolved Hide resolved

dockerclient "github.com/docker/docker/client"
"github.com/strangelove-ventures/ibctest"
Expand Down
3 changes: 1 addition & 2 deletions e2e/testsuite/testsuite.go
Expand Up @@ -2,13 +2,12 @@ package testsuite

import (
"context"
"e2e/testconfig"
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
"fmt"
"io/ioutil"
"strings"
"time"

"e2e/testconfig"

sdk "github.com/cosmos/cosmos-sdk/types"
dockerclient "github.com/docker/docker/client"
"github.com/strangelove-ventures/ibctest"
Expand Down
Expand Up @@ -22,16 +22,16 @@ var (
// TODO: Cosmos-SDK ADR-28: Update crypto.AddressHash() when sdk uses address.Module()
// https://github.com/cosmos/cosmos-sdk/issues/10225
//
// TestAccAddress defines a resuable bech32 address for testing purposes
// TestAccAddress defines a reusable bech32 address for testing purposes
TestAccAddress = icatypes.GenerateAddress(sdk.AccAddress(crypto.AddressHash([]byte(icatypes.ModuleName))), ibctesting.FirstConnectionID, TestPortID)

// TestOwnerAddress defines a reusable bech32 address for testing purposes
TestOwnerAddress = "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs"

// TestPortID defines a resuable port identifier for testing purposes
// TestPortID defines a reusable port identifier for testing purposes
TestPortID, _ = icatypes.NewControllerPortID(TestOwnerAddress)

// TestVersion defines a resuable interchainaccounts version string for testing purposes
// TestVersion defines a reusable interchainaccounts version string for testing purposes
TestVersion = string(icatypes.ModuleCdc.MustMarshalJSON(&icatypes.Metadata{
Version: icatypes.Version,
ControllerConnectionId: ibctesting.FirstConnectionID,
Expand Down
Expand Up @@ -16,16 +16,16 @@ var (
// TODO: Cosmos-SDK ADR-28: Update crypto.AddressHash() when sdk uses address.Module()
// https://github.com/cosmos/cosmos-sdk/issues/10225
//
// TestAccAddress defines a resuable bech32 address for testing purposes
// TestAccAddress defines a reusable bech32 address for testing purposes
TestAccAddress = icatypes.GenerateAddress(sdk.AccAddress(crypto.AddressHash([]byte(icatypes.ModuleName))), ibctesting.FirstConnectionID, TestPortID)

// TestOwnerAddress defines a reusable bech32 address for testing purposes
TestOwnerAddress = "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs"

// TestPortID defines a resuable port identifier for testing purposes
// TestPortID defines a reusable port identifier for testing purposes
TestPortID, _ = icatypes.NewControllerPortID(TestOwnerAddress)

// TestVersion defines a resuable interchainaccounts version string for testing purposes
// TestVersion defines a reusable interchainaccounts version string for testing purposes
TestVersion = string(icatypes.ModuleCdc.MustMarshalJSON(&icatypes.Metadata{
Version: icatypes.Version,
ControllerConnectionId: ibctesting.FirstConnectionID,
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.

6 changes: 3 additions & 3 deletions modules/apps/27-interchain-accounts/host/ibc_module_test.go
Expand Up @@ -24,16 +24,16 @@ var (
// TODO: Cosmos-SDK ADR-28: Update crypto.AddressHash() when sdk uses address.Module()
// https://github.com/cosmos/cosmos-sdk/issues/10225
//
// TestAccAddress defines a resuable bech32 address for testing purposes
// TestAccAddress defines a reusable bech32 address for testing purposes
TestAccAddress = icatypes.GenerateAddress(sdk.AccAddress(crypto.AddressHash([]byte(icatypes.ModuleName))), ibctesting.FirstConnectionID, TestPortID)

// TestOwnerAddress defines a reusable bech32 address for testing purposes
TestOwnerAddress = "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs"

// TestPortID defines a resuable port identifier for testing purposes
// TestPortID defines a reusable port identifier for testing purposes
TestPortID, _ = icatypes.NewControllerPortID(TestOwnerAddress)

// TestVersion defines a resuable interchainaccounts version string for testing purposes
// TestVersion defines a reusable interchainaccounts version string for testing purposes
TestVersion = string(icatypes.ModuleCdc.MustMarshalJSON(&icatypes.Metadata{
Version: icatypes.Version,
ControllerConnectionId: ibctesting.FirstConnectionID,
Expand Down
Expand Up @@ -16,16 +16,16 @@ var (
// TODO: Cosmos-SDK ADR-28: Update crypto.AddressHash() when sdk uses address.Module()
// https://github.com/cosmos/cosmos-sdk/issues/10225
//
// TestAccAddress defines a resuable bech32 address for testing purposes
// TestAccAddress defines a reusable bech32 address for testing purposes
TestAccAddress = icatypes.GenerateAddress(sdk.AccAddress(crypto.AddressHash([]byte(icatypes.ModuleName))), ibctesting.FirstConnectionID, TestPortID)

// TestOwnerAddress defines a reusable bech32 address for testing purposes
TestOwnerAddress = "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs"

// TestPortID defines a resuable port identifier for testing purposes
// TestPortID defines a reusable port identifier for testing purposes
TestPortID, _ = icatypes.NewControllerPortID(TestOwnerAddress)

// TestVersion defines a resuable interchainaccounts version string for testing purposes
// TestVersion defines a reusable interchainaccounts version string for testing purposes
TestVersion = string(icatypes.ModuleCdc.MustMarshalJSON(&icatypes.Metadata{
Version: icatypes.Version,
ControllerConnectionId: ibctesting.FirstConnectionID,
Expand Down
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
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.

Expand Up @@ -18,7 +18,7 @@ var (
// TestOwnerAddress defines a reusable bech32 address for testing purposes
TestOwnerAddress = "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs"

// TestPortID defines a resuable port identifier for testing purposes
// TestPortID defines a reusable port identifier for testing purposes
TestPortID, _ = types.NewControllerPortID(TestOwnerAddress)
)

Expand Down