lint: add review dog (#4652)

* lint: add review dog

- golangci is being deprecated on the 15th

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
This commit is contained in:
Marko
2020-04-07 10:28:26 +02:00
committed by GitHub
parent 6aa469d008
commit 499f9ed153
6 changed files with 24 additions and 13 deletions

12
.github/workflows/lint.yaml vendored Normal file
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

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) {
}

View File

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

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)

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

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"