Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 5 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
contents: read

env:
GO_VERSION: 1.22
GO_VERSION: 1.24

jobs:
clippy-lint:
Expand Down Expand Up @@ -47,8 +47,7 @@ jobs:

- uses: actions/checkout@v4

- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.61.0
args: --timeout 15m
- name: run linting
id: lint
run: |
make lint
10 changes: 5 additions & 5 deletions .github/workflows/local-interchain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: go mod tidy && make install

- name: Upload localic artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: local-ic
path: ~/go/bin/local-ic
Expand All @@ -52,7 +52,7 @@ jobs:
uses: actions/checkout@v4

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: local-ic
path: /tmp
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
override: true

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: local-ic
path: /tmp
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
- run: pip install -r python/requirements.txt --break-system-packages

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: local-ic
path: /tmp
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
run: cd ts && npm ci

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: local-ic
path: /tmp
Expand Down
148 changes: 79 additions & 69 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,84 @@
version: "2"
run:
timeout: 10m
tests: true

# These linter checks can be modified on a per project basis.
# Simply remove them from the enable list to disable them.
linters:
disable-all: true
default: none
enable:
- asciicheck
- bidichk
- bodyclose
- copyloopvar
- decorder
- dupl
- dupword
- errcheck
- errchkjson
- errname
- exhaustive
- forbidigo
- gci
- goconst
- gocritic
- godot
- gofumpt
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
- ineffassign
- loggercheck
- misspell
# - nilerr disabled because we return nil when there are errors in places that need to keep running e.g. polling/waiting for a condition
# - nilnil disabled because we return nil, nil when polling but waiting for a conditional
- noctx
- staticcheck
- stylecheck
- testifylint
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace

linters-settings:
gci:
custom-order: true
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(cosmossdk.io)
- prefix(github.com/cosmos)
- prefix(github.com/cosmos/cosmos-sdk)
- prefix(github.com/cometbft/cometbft)
- prefix(github.com/cosmos/interchaintest)
gosec:
excludes:
- G404 # disables checks on insecure random number source
- G115 # disables checks on type conversions between signed and unsigned integers
- G306 # disables checks on WriteFile perms. Not an issue since we are writing configs/logs in a local test env
gocritic:
disabled-checks:
- appendAssign # we use append to build cmds from a config and always assign to a new slice to not overwrite cfg

- asciicheck
- bidichk
- bodyclose
- copyloopvar
- decorder
- dupl
- dupword
- errcheck
- errchkjson
- errname
- exhaustive
- forbidigo
- goconst
- gocritic
- godot
- gosec
- gosmopolitan
- govet
- grouper
- ineffassign
- loggercheck
- misspell
- noctx
- staticcheck
- testifylint
- thelper
- tparallel
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
settings:
gocritic:
disabled-checks:
- appendAssign
gosec:
excludes:
- G404
- G115
- G306
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-issues-per-linter: 0
formatters:
enable:
- gci
- gofumpt
settings:
gci:
sections:
- standard
- default
- blank
- dot
- prefix(cosmossdk.io)
- prefix(github.com/cosmos)
- prefix(github.com/cosmos/cosmos-sdk)
- prefix(github.com/cometbft/cometbft)
- prefix(github.com/cosmos/interchaintest)
custom-order: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
18 changes: 5 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
DOCKER := $(shell which docker)
protoVer=0.13.2
protoVer=0.17.1
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
golangci_lint_cmd=golangci-lint
golangci_version=v1.61.0
golangci_version=v2.1.6
gofumpt_cmd=gofumpt
gofumpt_version=v0.7.0

Expand Down Expand Up @@ -60,22 +60,14 @@ proto-gen: ## Generate code from protos
lint: ## Lint the repository
@echo "--> Running linter"
@if ! $(golangci_lint_cmd) --version 2>/dev/null | grep -q $(golangci_version); then \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version); \
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(golangci_version); \
fi
@$(golangci_lint_cmd) run ./... --timeout 15m

.PHONY: lint-fix
lint-fix: ## Lint the repository and fix warnings (if applicable)
@echo "--> Running linter and fixing issues"
@if ! $(golangci_lint_cmd) --version 2>/dev/null | grep -q $(golangci_version); then \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version); \
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(golangci_version); \
fi
@$(golangci_lint_cmd) run ./... --fix --timeout 15m

.PHONY: gofumpt
gofumpt: ## Format the code with gofumpt
@echo "--> Running gofumpt"
@if ! $(gofumpt_cmd) -version 2>/dev/null | grep -q $(gofumpt_version); then \
go install mvdan.cc/gofumpt@$(gofumpt_version); \
fi
@gofumpt -l -w .
@$(golangci_lint_cmd) run ./... --fix --timeout 15m
8 changes: 0 additions & 8 deletions blockdb/chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ func validChain(t *testing.T, db *sql.DB) *Chain {
}

func TestChain_SaveBlock(t *testing.T) {
t.Parallel()

var (
ctx = context.Background()
tx1 = Tx{Data: []byte(`{"test":0}`)}
Expand All @@ -47,8 +45,6 @@ func TestChain_SaveBlock(t *testing.T) {
)

t.Run("happy path", func(t *testing.T) {
t.Parallel()

db := migratedDB()
defer db.Close()

Expand Down Expand Up @@ -121,8 +117,6 @@ ORDER BY tendermint_event_attr.id`)
})

t.Run("idempotent", func(t *testing.T) {
t.Parallel()

db := migratedDB()
defer db.Close()

Expand Down Expand Up @@ -156,8 +150,6 @@ ORDER BY tendermint_event_attr.id`)
})

t.Run("zero state", func(t *testing.T) {
t.Parallel()

db := migratedDB()
defer db.Close()

Expand Down
2 changes: 0 additions & 2 deletions blockdb/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
)

func TestMigrate(t *testing.T) {
t.Parallel()

db := emptyDB()
defer db.Close()

Expand Down
8 changes: 3 additions & 5 deletions blockdb/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
var txsFixture []byte

func TestQuery_CurrentSchemaVersion(t *testing.T) {
t.Parallel()

db := emptyDB()
defer db.Close()

Expand Down Expand Up @@ -148,17 +146,17 @@ func TestQuery_CosmosMessages(t *testing.T) {

first := results[0]
require.EqualValues(t, 1, first.Height)
require.EqualValues(t, 0, first.Index)
require.Equal(t, 0, first.Index)
require.Equal(t, "/ibc.core.client.v1.MsgCreateClient", first.Type)

second := results[1]
require.EqualValues(t, 2, second.Height)
require.EqualValues(t, 0, second.Index)
require.Equal(t, 0, second.Index)
require.Equal(t, "/ibc.core.client.v1.MsgUpdateClient", second.Type)

third := results[2]
require.EqualValues(t, 2, third.Height)
require.EqualValues(t, 1, third.Index)
require.Equal(t, 1, third.Index)
require.Equal(t, "/ibc.core.connection.v1.MsgConnectionOpenInit", third.Type)

for _, res := range results {
Expand Down
2 changes: 0 additions & 2 deletions blockdb/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ func TestDB_Concurrency(t *testing.T) {
t.Skip("skipping due to short mode")
}

t.Parallel()

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down
12 changes: 0 additions & 12 deletions blockdb/test_case_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ import (
)

func TestCreateTestCase(t *testing.T) {
t.Parallel()

ctx := context.Background()

t.Run("happy path", func(t *testing.T) {
t.Parallel()

db := migratedDB()
defer db.Close()

Expand All @@ -41,22 +37,16 @@ func TestCreateTestCase(t *testing.T) {
})

t.Run("errors", func(t *testing.T) {
t.Parallel()

db := emptyDB()
_, err := CreateTestCase(ctx, db, "fail", "")
require.Error(t, err)
})
}

func TestTestCase_AddChain(t *testing.T) {
t.Parallel()

ctx := context.Background()

t.Run("happy path", func(t *testing.T) {
t.Parallel()

db := migratedDB()
defer db.Close()

Expand Down Expand Up @@ -86,8 +76,6 @@ func TestTestCase_AddChain(t *testing.T) {
})

t.Run("errors", func(t *testing.T) {
t.Parallel()

db := migratedDB()
defer db.Close()

Expand Down
Loading
Loading