Browse Source

lint: enable nolintlinter, disable on tests

## Description
- enable nolintlint
- disable linting on tests

Closes: #XXX
pull/4787/head
Marko 4 years ago
committed by GitHub
parent
commit
b7c2d7a977
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 13 additions and 28 deletions
  1. +2
    -1
      .github/workflows/lint.yaml
  2. +6
    -12
      .golangci.yml
  3. +1
    -1
      abci/types/application.go
  4. +0
    -1
      blockchain/v2/reactor.go
  5. +0
    -1
      blockchain/v2/routine.go
  6. +1
    -1
      consensus/wal.go
  7. +0
    -1
      crypto/ed25519/ed25519.go
  8. +0
    -1
      crypto/merkle/result.go
  9. +0
    -2
      crypto/xchacha20poly1305/xchachapoly.go
  10. +0
    -2
      libs/kv/result.go
  11. +0
    -1
      libs/pubsub/query/peg.go
  12. +1
    -1
      mempool/cache_test.go
  13. +0
    -1
      statesync/snapshots_test.go
  14. +2
    -2
      types/block_test.go

+ 2
- 1
.github/workflows/lint.yaml View File

@ -6,7 +6,8 @@ jobs:
steps:
- uses: actions/checkout@master
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v1
uses: reviewdog/action-golangci-lint@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
golangci_lint_flags: "--timeout 30m"

+ 6
- 12
.golangci.yml View File

@ -38,6 +38,7 @@ linters:
# - whitespace
# - wsl
# - gocognit
# - nolintlint
disable:
- errcheck
@ -46,6 +47,7 @@ issues:
- linters:
- lll
source: "https://"
max-same-issues: 50
linters-settings:
dogsled:
@ -56,15 +58,7 @@ linters-settings:
# check-shadowing: true
golint:
min-confidence: 0
# gocyclo:
# min-complexity: 10
# misspell:
# locale: US
# gocritic:
# enabled-tags:
# - performance
# - style
# - experimental
# disabled-checks:
# - wrapperFunc
# - commentFormatting # https://github.com/go-critic/go-critic/issues/755
# gocyclo:
# min-complexity: 10
# misspell:
# locale: US

+ 1
- 1
abci/types/application.go View File

@ -1,4 +1,4 @@
package types // nolint: goimports
package types
import (
context "golang.org/x/net/context"


+ 0
- 1
blockchain/v2/reactor.go View File

@ -149,7 +149,6 @@ type blockVerifier interface {
VerifyCommit(chainID string, blockID types.BlockID, height int64, commit *types.Commit) error
}
//nolint:deadcode
type blockApplier interface {
ApplyBlock(state state.State, blockID types.BlockID, block *types.Block) (state.State, int64, error)
}


+ 0
- 1
blockchain/v2/routine.go View File

@ -43,7 +43,6 @@ func newRoutine(name string, handleFunc handleFunc, bufferSize int) *Routine {
}
}
// nolint: unused
func (rt *Routine) setLogger(logger log.Logger) {
rt.logger = logger
}


+ 1
- 1
consensus/wal.go View File

@ -392,7 +392,7 @@ func (dec *WALDecoder) Decode() (*TimedWALMessage, error) {
return nil, DataCorruptionError{fmt.Errorf("checksums do not match: read: %v, actual: %v", crc, actualCRC)}
}
var res = new(TimedWALMessage) // nolint: gosimple
var res = new(TimedWALMessage)
err = cdc.UnmarshalBinaryBare(data, res)
if err != nil {
return nil, DataCorruptionError{fmt.Errorf("failed to decode data: %v", err)}


+ 0
- 1
crypto/ed25519/ed25519.go View File

@ -160,7 +160,6 @@ func (pubKey PubKeyEd25519) String() string {
return fmt.Sprintf("PubKeyEd25519{%X}", pubKey[:])
}
// nolint: golint
func (pubKey PubKeyEd25519) Equals(other crypto.PubKey) bool {
if otherEd, ok := other.(PubKeyEd25519); ok {
return bytes.Equal(pubKey[:], otherEd[:])


+ 0
- 1
crypto/merkle/result.go View File

@ -1,4 +1,3 @@
// nolint: dupl
package merkle
import (


+ 0
- 2
crypto/xchacha20poly1305/xchachapoly.go View File

@ -47,12 +47,10 @@ func New(key []byte) (cipher.AEAD, error) {
return ret, nil
}
// nolint
func (c *xchacha20poly1305) NonceSize() int {
return NonceSize
}
// nolint
func (c *xchacha20poly1305) Overhead() int {
return TagSize
}


+ 0
- 2
libs/kv/result.go View File

@ -1,5 +1,3 @@
// nolint: dupl
// dupl is reading this as the same file as crypto/merkle/result.go
package kv
import (


+ 0
- 1
libs/pubsub/query/peg.go View File

@ -1,4 +1,3 @@
// nolint
package query
//go:generate peg -inline -switch query.peg

+ 1
- 1
mempool/cache_test.go View File

@ -20,7 +20,7 @@ func TestCacheRemove(t *testing.T) {
for i := 0; i < numTxs; i++ {
// probability of collision is 2**-256
txBytes := make([]byte, 32)
rand.Read(txBytes) // nolint: gosec
rand.Read(txBytes)
txs[i] = txBytes
cache.Push(txBytes)
// make sure its added to both the linked list and the map


+ 0
- 1
statesync/snapshots_test.go View File

@ -213,7 +213,6 @@ func TestSnapshotPool_Reject(t *testing.T) {
assert.True(t, added)
}
// nolint: dupl
func TestSnapshotPool_RejectFormat(t *testing.T) {
stateProvider := &mocks.StateProvider{}
stateProvider.On("AppHash", mock.Anything).Return([]byte("app_hash"), nil)


+ 2
- 2
types/block_test.go View File

@ -173,8 +173,8 @@ func makeBlockIDRandom() BlockID {
blockHash = make([]byte, tmhash.Size)
partSetHash = make([]byte, tmhash.Size)
)
rand.Read(blockHash) //nolint: gosec
rand.Read(partSetHash) //nolint: gosec
rand.Read(blockHash)
rand.Read(partSetHash)
return BlockID{blockHash, PartSetHeader{123, partSetHash}}
}


Loading…
Cancel
Save