Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Lint v4 (#51)
Browse files Browse the repository at this point in the history
* Add v2 migrations

* lint v4

* add golangci config

* golangci in github actions

* apptypes -> transfertypes

* apptypes -> transfertypes

* linting complete

* sdk 4513, ibc 430, tendermint 0.34.25

* apptypes to transfertypes

* lint

---------

Co-authored-by: Andrew Gouin <[email protected]>
  • Loading branch information
faddat and agouin authored Apr 12, 2023
1 parent ac89f66 commit 07ccf2c
Show file tree
Hide file tree
Showing 13 changed files with 672 additions and 18 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
- 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.19
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
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
66 changes: 66 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
run:
tests: true
timeout: 10m
sort-results: true
allow-parallel-runners: true
exclude-dir: testutil/testdata_pulsar
concurrency: 4

linters:
disable-all: true
enable:
- depguard
- dogsled
- exportloopref
- goconst
- gocritic
- gofumpt
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- nolintlint
- staticcheck
- revive
- stylecheck
- typecheck
- unconvert
- unused

issues:
exclude-rules:
- text: "Use of weak random number generator"
linters:
- gosec
- text: "ST1003:"
linters:
- stylecheck
# FIXME: Disabled until golangci-lint updates stylecheck with this fix:
# https://github.com/dominikh/go-tools/issues/389
- text: "ST1016:"
linters:
- stylecheck
- path: "migrations"
text: "SA1019:"
linters:
- staticcheck
- text: "leading space"
linters:
- nolintlint

max-issues-per-linter: 10000
max-same-issues: 10000

linters-settings:
dogsled:
max-blank-identifiers: 3
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
require-specific: false
2 changes: 2 additions & 0 deletions router/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) {
// Initialize store refund path for forwarded packets in genesis state that have not yet been acked.
store := ctx.KVStore(k.storeKey)
for key, value := range state.InFlightPackets {
key := key
value := value
bz := k.cdc.MustMarshal(&value)
store.Set([]byte(key), bz)
}
Expand Down
2 changes: 1 addition & 1 deletion router/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func (k *Keeper) RetryTimeout(

denom := transfertypes.ParseDenomTrace(data.Denom).IBCDenom()

var token = sdk.NewCoin(denom, amount)
token := sdk.NewCoin(denom, amount)

// srcPacket and srcPacketSender are empty because inFlightPacket is non-nil.
return k.ForwardTransferPacket(
Expand Down
Loading

0 comments on commit 07ccf2c

Please sign in to comment.