Skip to content

Commit 28c69a9

Browse files
committed
lint
1 parent d9bcc42 commit 28c69a9

11 files changed

+27
-36
lines changed

.github/workflows/golangci_lint.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Golangci-lint
1+
name: Lint MultiNode
22

33
on: [push]
44

@@ -19,14 +19,8 @@ jobs:
1919
go-version: '1.19'
2020

2121
- name: Lint multinode
22-
working-directory: ./multinode
23-
uses: smartcontractkit/.github/actions/ci-lint-go@2ac9d97a83a5edded09af7fcf4ea5bce7a4473a4
24-
with:
25-
golangci-lint-version: v1.62.2
26-
27-
- name: Lint evm-chain-bindings
28-
working-directory: ./tools/evm-chain-bindings
29-
uses: smartcontractkit/.github/actions/ci-lint-go@2ac9d97a83a5edded09af7fcf4ea5bce7a4473a4
30-
with:
31-
golangci-lint-version: v1.62.2
32-
22+
run: |
23+
cd ./multinode
24+
golangci-lint run
25+
env:
26+
GOLANGCI_LINT_VERSION: v1.62.2

.golangci.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,27 @@ linters:
44
enable:
55
- containedctx
66
- depguard
7-
- errname
8-
- errorlint
7+
#- errorlint
98
- exhaustive
10-
- exportloopref
9+
#- exportloopref
1110
- fatcontext
1211
- ginkgolinter
13-
- gocritic
12+
#- gocritic
1413
- goimports
15-
- gosec
14+
#- gosec
1615
- loggercheck
1716
- mirror
1817
- misspell
1918
- noctx
2019
- nolintlint
21-
- perfsprint
22-
- prealloc
20+
#- prealloc
2321
- revive
2422
- rowserrcheck
2523
- spancheck
2624
- sqlclosecheck
27-
- testifylint
25+
#- testifylint
2826
- unconvert
29-
- whitespace
27+
#- whitespace
3028
linters-settings:
3129
exhaustive:
3230
default-signifies-exhaustive: true

multinode/node_fsm_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func (fm *fnMock) AssertNotCalled(t *testing.T) {
1919
}
2020

2121
func (fm *fnMock) AssertCalled(t *testing.T) {
22-
assert.Greater(t, fm.calls, 0)
22+
assert.Positive(t, fm.calls)
2323
}
2424

2525
func TestUnit_Node_StateTransitions(t *testing.T) {

multinode/node_lifecycle_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ func TestUnit_NodeLifecycle_start(t *testing.T) {
14471447

14481448
rpc.On("Dial", mock.Anything).Return(errors.New("failed to dial"))
14491449
err := node.Start(tests.Context(t))
1450-
assert.NoError(t, err)
1450+
require.NoError(t, err)
14511451
tests.AssertLogEventually(t, observedLogs, "Dial failed: Node is unreachable")
14521452
tests.AssertEventually(t, func() bool {
14531453
return node.State() == nodeStateUnreachable
@@ -1470,7 +1470,7 @@ func TestUnit_NodeLifecycle_start(t *testing.T) {
14701470
assert.Equal(t, nodeStateDialed, node.State())
14711471
}).Return(nodeChainID, errors.New("failed to get chain id"))
14721472
err := node.Start(tests.Context(t))
1473-
assert.NoError(t, err)
1473+
require.NoError(t, err)
14741474
tests.AssertLogEventually(t, observedLogs, "Failed to verify chain ID for node")
14751475
tests.AssertEventually(t, func() bool {
14761476
return node.State() == nodeStateUnreachable
@@ -1491,7 +1491,7 @@ func TestUnit_NodeLifecycle_start(t *testing.T) {
14911491

14921492
rpc.On("ChainID", mock.Anything).Return(rpcChainID, nil)
14931493
err := node.Start(tests.Context(t))
1494-
assert.NoError(t, err)
1494+
require.NoError(t, err)
14951495
tests.AssertEventually(t, func() bool {
14961496
return node.State() == nodeStateInvalidChainID
14971497
})
@@ -1539,7 +1539,7 @@ func TestUnit_NodeLifecycle_start(t *testing.T) {
15391539
rpc.On("ChainID", mock.Anything).Return(nodeChainID, nil)
15401540
rpc.On("IsSyncing", mock.Anything).Return(true, nil)
15411541
err := node.Start(tests.Context(t))
1542-
assert.NoError(t, err)
1542+
require.NoError(t, err)
15431543
tests.AssertEventually(t, func() bool {
15441544
return node.State() == nodeStateSyncing
15451545
})
@@ -1560,7 +1560,7 @@ func TestUnit_NodeLifecycle_start(t *testing.T) {
15601560
setupRPCForAliveLoop(t, rpc)
15611561

15621562
err := node.Start(tests.Context(t))
1563-
assert.NoError(t, err)
1563+
require.NoError(t, err)
15641564
tests.AssertEventually(t, func() bool {
15651565
return node.State() == nodeStateAlive
15661566
})
@@ -1591,15 +1591,15 @@ func TestUnit_NodeLifecycle_outOfSyncWithPool(t *testing.T) {
15911591
t.Run("skip if nLiveNodes is not configured", func(t *testing.T) {
15921592
node := newTestNode(t, testNodeOpts{})
15931593
outOfSync, liveNodes := node.isOutOfSyncWithPool()
1594-
assert.Equal(t, false, outOfSync)
1594+
assert.False(t, outOfSync)
15951595
assert.Equal(t, 0, liveNodes)
15961596
})
15971597
t.Run("skip if syncThreshold is not configured", func(t *testing.T) {
15981598
node := newTestNode(t, testNodeOpts{})
15991599
poolInfo := newMockPoolChainInfoProvider(t)
16001600
node.SetPoolChainInfoProvider(poolInfo)
16011601
outOfSync, liveNodes := node.isOutOfSyncWithPool()
1602-
assert.Equal(t, false, outOfSync)
1602+
assert.False(t, outOfSync)
16031603
assert.Equal(t, 0, liveNodes)
16041604
})
16051605
t.Run("panics on invalid selection mode", func(t *testing.T) {

multinode/node_selector_highest_head_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
func TestHighestHeadNodeSelectorName(t *testing.T) {
1010
selector := newNodeSelector[ID, RPCClient[ID, Head]](NodeSelectionModeHighestHead, nil)
11-
assert.Equal(t, selector.Name(), NodeSelectionModeHighestHead)
11+
assert.Equal(t, NodeSelectionModeHighestHead, selector.Name())
1212
}
1313

1414
func TestHighestHeadNodeSelector(t *testing.T) {

multinode/node_selector_priority_level_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
func TestPriorityLevelNodeSelectorName(t *testing.T) {
1010
selector := newNodeSelector[ID, RPCClient[ID, Head]](NodeSelectionModePriorityLevel, nil)
11-
assert.Equal(t, selector.Name(), NodeSelectionModePriorityLevel)
11+
assert.Equal(t, NodeSelectionModePriorityLevel, selector.Name())
1212
}
1313

1414
func TestPriorityLevelNodeSelector(t *testing.T) {

multinode/node_selector_round_robin_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
func TestRoundRobinNodeSelectorName(t *testing.T) {
1010
selector := newNodeSelector[ID, RPCClient[ID, Head]](NodeSelectionModeRoundRobin, nil)
11-
assert.Equal(t, selector.Name(), NodeSelectionModeRoundRobin)
11+
assert.Equal(t, NodeSelectionModeRoundRobin, selector.Name())
1212
}
1313

1414
func TestRoundRobinNodeSelector(t *testing.T) {

multinode/node_selector_total_difficulty_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func TestTotalDifficultyNodeSelectorName(t *testing.T) {
1111
selector := newNodeSelector[ID, RPCClient[ID, Head]](NodeSelectionModeTotalDifficulty, nil)
12-
assert.Equal(t, selector.Name(), NodeSelectionModeTotalDifficulty)
12+
assert.Equal(t, NodeSelectionModeTotalDifficulty, selector.Name())
1313
}
1414

1515
func TestTotalDifficultyNodeSelector(t *testing.T) {

multinode/poller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,6 @@ func Test_Poller_Unsubscribe(t *testing.T) {
189189
require.NoError(t, err)
190190

191191
poller.Unsubscribe()
192-
require.Equal(t, <-channel, nil)
192+
require.Nil(t, <-channel)
193193
})
194194
}

multinode/send_only_node_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func TestStartSendOnlyNode(t *testing.T) {
128128

129129
defer func() { assert.NoError(t, s.Close()) }()
130130
err := s.Start(tests.Context(t))
131-
assert.NoError(t, err)
131+
require.NoError(t, err)
132132
tests.AssertEventually(t, func() bool {
133133
return s.State() == nodeStateAlive
134134
})

0 commit comments

Comments
 (0)