Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Jun 18, 2024
1 parent 8aa19f3 commit 8931202
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 186 deletions.
133 changes: 93 additions & 40 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,4 @@
run:
<<<<<<< HEAD
tests: false
# # timeout for analysis, e.g. 30s, 5m, default is 1m
# timeout: 5m

linters:
disable-all: false
enable:
- gofmt
- goconst
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- prealloc
- staticcheck
- stylecheck
- typecheck
- unconvert
- unused
- unparam
- misspell
disable:
- gocritic
- errcheck
- interfacer
- wsl
- nolintlint

issues:
=======
tests: true
timeout: 15m
allow-parallel-runners: true
Expand Down Expand Up @@ -88,7 +54,6 @@ issues:
- ".*\\.pb\\.gw\\.go$"
- ".*\\.pulsar\\.go$"
- crypto/keys/secp256k1/internal/*
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
exclude-rules:
- text: "Use of weak random number generator"
linters:
Expand All @@ -112,17 +77,105 @@ issues:
text: "SA1019: token."
linters:
- staticcheck
- path: "legacy"
text: "SA1019:"
linters:
- staticcheck
- text: "SA1019: codec.NewAminoCodec is deprecated" # TODO remove once migration path is set out
linters:
- staticcheck
- text: "SA1019: legacybech32.MustMarshalPubKey" # TODO remove once ready to remove from the sdk
linters:
- staticcheck
- text: "SA1019: legacybech32.MarshalPubKey" # TODO remove once ready to remove from the sdk
linters:
- staticcheck
- text: "SA1019: legacybech32.UnmarshalPubKey" # TODO remove once ready to remove from the sdk
linters:
- staticcheck
- text: "SA1019: params.SendEnabled is deprecated" # TODO remove once ready to remove from the sdk
linters:
- staticcheck
- text: "SA1019: \"github.com/golang/protobuf/proto\" is deprecated" # TODO remove once ready to remove from the sdk
linters:
- staticcheck
- text: "SA1019: vote.Option is deprecated" # TODO remove once ready to remove from the sdk
linters:
- staticcheck
- text: "SA1019: types.QueryNextAccountNumberRequest is deprecated" # TODO remove once ready to remove from the sdk
linters:
- staticcheck
- text: "leading space"
linters:
- nolintlint
- path: _test\.go
linters:
- goconst
max-issues-per-linter: 10000
max-same-issues: 10000

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.
- prefix(github.com/Finschia/finschia-sdk)
revive:
rules:
- name: redefines-builtin-id
disabled: true

gosec:
includes:
# - G101 # Look for hard coded credentials
- G102 # Bind to all interfaces
- G103 # Audit the use of unsafe block
- G104 # Audit errors not checked
- G106 # Audit the use of ssh.InsecureIgnoreHostKey
- G107 # Url provided to HTTP request as taint input
- G108 # Profiling endpoint automatically exposed on /debug/pprof
- G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32
- G110 # Potential DoS vulnerability via decompression bomb
- G111 # Potential directory traversal
- G112 # Potential slowloris attack
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
- G114 # Use of net/http serve function that has no support for setting timeouts
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G203 # Use of unescaped data in HTML templates
- G204 # Audit use of command execution
- G301 # Poor file permissions used when creating a directory
- G302 # Poor file permissions used with chmod
- G303 # Creating tempfile using a predictable path
- G304 # File path provided as taint input
- G305 # File traversal when extracting zip/tar archive
- G306 # Poor file permissions used when writing to a new file
- G307 # Deferring a method which returns an error
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G501 # Import blocklist: crypto/md5
- G502 # Import blocklist: crypto/des
- G503 # Import blocklist: crypto/rc4
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
- G601 # Implicit memory aliasing of items from a range statement
misspell:
locale: US
gofumpt:
extra-rules: true
dogsled:
<<<<<<< HEAD
max-blank-identifiers: 3
=======
max-blank-identifiers: 6
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
nolintlint:
allow-unused: false
require-explanation: false
require-specific: false
require-specific: false
gosimple:
checks: ["all"]
gocritic:
disabled-checks:
- regexpMust
- appendAssign
- ifElseChain
35 changes: 3 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,9 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements
* (x/fswap) [\#1415](https://github.com/Finschia/finschia-sdk/pull/1415) add more testcases for fswap module

* (style) [\#1426](https://github.com/Finschia/finschia-sdk/pull/1426) Improve code quality with new linters

### Bug Fixes
<<<<<<< HEAD
=======
* chore(deps) [\#1141](https://github.com/Finschia/finschia-sdk/pull/1141) Bump github.com/cosmos/ledger-cosmos-go from 0.12.2 to 0.13.2 to fix ledger signing issue
* (x/auth, x/slashing) [\#1179](https://github.com/Finschia/finschia-sdk/pull/1179) modify missing changes of converting to tendermint
* (x/auth) [#1274](https://github.com/Finschia/finschia-sdk/pull/1274) `ModuleAccount.Validate` now reports a nil `.BaseAccount` instead of panicking.
* (x/collection) [\#1276](https://github.com/Finschia/finschia-sdk/pull/1276) eliminates potential risk for Insufficient Sanity Check of tokenID in Genesis
* (x/foundation) [\#1277](https://github.com/Finschia/finschia-sdk/pull/1277) add init logic of foundation module accounts to InitGenesis in order to eliminate potential panic
* (x/collection, x/token) [\#1288](https://github.com/Finschia/finschia-sdk/pull/1288) use accAddress to compare in validatebasic function in collection & token modules
* (x/collection) [\#1268](https://github.com/Finschia/finschia-sdk/pull/1268) export x/collection params into genesis
* (x/collection) [\#1294](https://github.com/Finschia/finschia-sdk/pull/1294) reject NFT coins on FT APIs
* (sec) [\#1302](https://github.com/Finschia/finschia-sdk/pull/1302) remove map iteration non-determinism with keys + sorting
* (client) [\#1303](https://github.com/Finschia/finschia-sdk/pull/1303) fix possible overflow in BuildUnsignedTx
* (types) [\#1299](https://github.com/Finschia/finschia-sdk/pull/1299) add missing nil checks
* (x/staking) [\#1301](https://github.com/Finschia/finschia-sdk/pull/1301) Use bytes instead of string comparison in delete validator queue (backport cosmos/cosmos-sdk#12303)
* (x/gov) [\#1304](https://github.com/Finschia/finschia-sdk/pull/1304) fetch a failed proposal tally from proposal.FinalTallyResult in the gprc query
* (x/staking) [\#1306](https://github.com/Finschia/finschia-sdk/pull/1306) add validation for potential slashing evasion during re-delegation
* (client/keys) [#1312](https://github.com/Finschia/finschia-sdk/pull/1312) ignore error when key not found in `keys delete`
* (store) [\#1310](https://github.com/Finschia/finschia-sdk/pull/1310) fix app-hash mismatch if upgrade migration commit is interrupted(backport cosmos/cosmos-sdk#13530)
* (types) [\#1313](https://github.com/Finschia/finschia-sdk/pull/1313) fix correctly coalesce coins even with repeated denominations(backport cosmos/cosmos-sdk#13265)
* (x/crypto) [\#1316](https://github.com/Finschia/finschia-sdk/pull/1316) error if incorrect ledger public key (backport cosmos/cosmos-sdk#14460, cosmos/cosmos-sdk#19691)
* (x/auth) [#1319](https://github.com/Finschia/finschia-sdk/pull/1319) prevent signing from wrong key in multisig
* (x/mint, x/slashing) [\#1323](https://github.com/Finschia/finschia-sdk/pull/1323) add missing nil check for params validation
* (x/server) [\#1337](https://github.com/Finschia/finschia-sdk/pull/1337) fix panic when defining minimum gas config as `100stake;100uatom`. Use a `,` delimiter instead of `;`. Fixes the server config getter to use the correct delimiter (backport cosmos/cosmos-sdk#18537)
* (x/fbridge) [\#1361](https://github.com/Finschia/finschia-sdk/pull/1361) Fixes fbridge auth checking bug
* (x/fswap) [\#1365](https://github.com/Finschia/finschia-sdk/pull/1365) fix update swap keys for possibly overlapped keys(`(hello,world) should be different to (hel,loworld)`)
* (x/fswap, x/fbridge) [\#1378](https://github.com/Finschia/finschia-sdk/pull/1378) Fix bug where amino is not supported in fswap and fbridge
* (x/fswap) [\#1379](https://github.com/Finschia/finschia-sdk/pull/1379) add missing router registration
* (x/fswap) [\#1385](https://github.com/Finschia/finschia-sdk/pull/1385) add accidentally deleted event emissions(EventSetSwap, EventAddDenomMetadata)
* (x/fswap) [\#1392](https://github.com/Finschia/finschia-sdk/pull/1392) fix dummy denom coin data for test in fswap
* (style) [\#1414](https://github.com/Finschia/finschia-sdk/pull/1414) improve code quality with new linters
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))

### Removed

Expand All @@ -88,4 +58,5 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Build, CI
* (build, ci) [\#1410](https://github.com/Finschia/finschia-sdk/pull/1410) Bump Go from 1.20 to 1.22
* (build) [\#1413](https://github.com/Finschia/finschia-sdk/pull/1413) Update outdated dependencies for v0.49.x

### Document Updates
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,7 @@ lint: golangci-lint
find . -name '*.go' -type f -not -path "*.git*" | xargs gofmt -d -s

golangci-lint:
<<<<<<< HEAD
@go install github.com/golangci/golangci-lint/cmd/[email protected]
=======
@go install github.com/golangci/golangci-lint/cmd/[email protected]
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))

lint-fix: golangci-lint
golangci-lint run --fix --out-format=tab --issues-exit-code=0
Expand Down
9 changes: 0 additions & 9 deletions server/oc_cmds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package server
import (
"bytes"
"context"
"errors"
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -33,11 +32,7 @@ func TestShowValidator(t *testing.T) {
serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD:server/oc_cmds_test.go
if err := testCommon.cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := testCommon.cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414)):server/tm_cmds_test.go
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand All @@ -58,11 +53,7 @@ func TestShowValidatorWithKMS(t *testing.T) {
serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD:server/oc_cmds_test.go
if err := testCommon.cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := testCommon.cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414)):server/tm_cmds_test.go
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand Down
42 changes: 5 additions & 37 deletions server/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ func TestInterceptConfigsPreRunHandlerCreatesConfigFilesWhenMissing(t *testing.T

serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)
<<<<<<< HEAD
if err := cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand Down Expand Up @@ -120,11 +116,7 @@ func TestInterceptConfigsPreRunHandlerReadsConfigToml(t *testing.T) {
serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD
if err := cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand Down Expand Up @@ -161,11 +153,7 @@ func TestInterceptConfigsPreRunHandlerReadsAppToml(t *testing.T) {
serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD
if err := cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand Down Expand Up @@ -193,11 +181,7 @@ func TestInterceptConfigsPreRunHandlerReadsFlags(t *testing.T) {
serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD
if err := cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand All @@ -222,17 +206,17 @@ func TestInterceptConfigsPreRunHandlerReadsEnvVars(t *testing.T) {
basename = strings.ReplaceAll(basename, ".", "_")
// This is added by ostracon
envVarName := fmt.Sprintf("%s_RPC_LADDR", strings.ToUpper(basename))
t.Setenv(envVarName, testAddr)
os.Setenv(envVarName, testAddr)
t.Cleanup(func() {
os.Unsetenv(envVarName)
})

cmd.PreRunE = preRunETestImpl

serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD
if err := cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand Down Expand Up @@ -336,11 +320,7 @@ func TestInterceptConfigsPreRunHandlerPrecedenceFlag(t *testing.T) {
serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD
if err := testCommon.cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := testCommon.cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand All @@ -356,11 +336,7 @@ func TestInterceptConfigsPreRunHandlerPrecedenceEnvVar(t *testing.T) {
serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD
if err := testCommon.cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := testCommon.cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand All @@ -376,11 +352,7 @@ func TestInterceptConfigsPreRunHandlerPrecedenceConfigFile(t *testing.T) {
serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD
if err := testCommon.cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := testCommon.cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand All @@ -396,11 +368,7 @@ func TestInterceptConfigsPreRunHandlerPrecedenceConfigDefault(t *testing.T) {
serverCtx := &Context{}
ctx := context.WithValue(context.Background(), ServerContextKey, serverCtx)

<<<<<<< HEAD
if err := testCommon.cmd.ExecuteContext(ctx); err != cancelledInPreRun {
=======
if err := testCommon.cmd.ExecuteContext(ctx); !errors.Is(err, errCancelledInPreRun) {
>>>>>>> d60e44aa6 (style: Improve code quality with new linters (#1414))
t.Fatalf("function failed with [%T] %v", err, err)
}

Expand Down
Loading

0 comments on commit 8931202

Please sign in to comment.