Browse Source

lint: add review dog (#4652)

* lint: add review dog

- golangci is being deprecated on the 15th

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
pull/4653/head
Marko 5 years ago
committed by GitHub
parent
commit
499f9ed153
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 13 deletions
  1. +12
    -0
      .github/workflows/lint.yaml
  2. +3
    -7
      blockchain/v2/reactor_test.go
  3. +1
    -2
      lite2/client.go
  4. +3
    -1
      state/execution.go
  5. +4
    -2
      state/store_test.go
  6. +1
    -1
      types/validator_set_test.go

+ 12
- 0
.github/workflows/lint.yaml View File

@ -0,0 +1,12 @@
name: Lint
on: [pull_request]
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check

+ 3
- 7
blockchain/v2/reactor_test.go View File

@ -77,7 +77,9 @@ type mockBlockApplier struct {
}
// XXX: Add whitelist/blacklist?
func (mba *mockBlockApplier) ApplyBlock(state sm.State, blockID types.BlockID, block *types.Block) (sm.State, int64, error) {
func (mba *mockBlockApplier) ApplyBlock(
state sm.State, blockID types.BlockID, block *types.Block,
) (sm.State, int64, error) {
state.LastBlockHeight++
return state, 0, nil
}
@ -121,12 +123,6 @@ func (sio *mockSwitchIo) trySwitchToConsensus(state sm.State, blocksSynced int)
sio.switchedToConsensus = true
}
func (sio *mockSwitchIo) hasSwitchedToConsensus() bool {
sio.mtx.Lock()
defer sio.mtx.Unlock()
return sio.switchedToConsensus
}
func (sio *mockSwitchIo) broadcastStatusRequest(base int64, height int64) {
}


+ 1
- 2
lite2/client.go View File

@ -140,8 +140,7 @@ type Client struct {
// See ConfirmationFunction option
confirmationFn func(action string) bool
routinesWaitGroup sync.WaitGroup
quit chan struct{}
quit chan struct{}
logger log.Logger
}


+ 3
- 1
state/execution.go View File

@ -123,7 +123,9 @@ func (blockExec *BlockExecutor) ValidateBlock(state State, block *types.Block) e
// It's the only function that needs to be called
// from outside this package to process and commit an entire block.
// It takes a blockID to avoid recomputing the parts hash.
func (blockExec *BlockExecutor) ApplyBlock(state State, blockID types.BlockID, block *types.Block) (State, int64, error) {
func (blockExec *BlockExecutor) ApplyBlock(
state State, blockID types.BlockID, block *types.Block,
) (State, int64, error) {
if err := blockExec.ValidateBlock(state, block); err != nil {
return state, 0, ErrInvalidBlock(err)


+ 4
- 2
state/store_test.go View File

@ -81,8 +81,10 @@ func TestPruneStates(t *testing.T) {
"error when from == to": {100, 3, 3, true, nil, nil, nil},
"error when to does not exist": {100, 1, 101, true, nil, nil, nil},
"prune all": {100, 1, 100, false, []int64{93, 100}, []int64{95, 100}, []int64{100}},
"prune some": {10, 2, 8, false, []int64{1, 3, 8, 9, 10}, []int64{1, 5, 8, 9, 10}, []int64{1, 8, 9, 10}},
"prune across checkpoint": {100001, 1, 100001, false, []int64{99993, 100000, 100001}, []int64{99995, 100001}, []int64{100001}},
"prune some": {10, 2, 8, false, []int64{1, 3, 8, 9, 10},
[]int64{1, 5, 8, 9, 10}, []int64{1, 8, 9, 10}},
"prune across checkpoint": {100001, 1, 100001, false, []int64{99993, 100000, 100001},
[]int64{99995, 100001}, []int64{100001}},
}
for name, tc := range testcases {
tc := tc


+ 1
- 1
types/validator_set_test.go View File

@ -3,7 +3,6 @@ package types
import (
"bytes"
"fmt"
"github.com/stretchr/testify/require"
"math"
"sort"
"strings"
@ -12,6 +11,7 @@ import (
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"


Loading…
Cancel
Save