mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
Rule guard linter enable (#3168)
This commit is contained in:
parent
d45325c324
commit
f3973afee8
@ -23,16 +23,17 @@ linters-settings:
|
||||
gocritic:
|
||||
# Which checks should be enabled; can't be combined with 'disabled-checks';
|
||||
# See https://go-critic.github.io/overview#checks-overview
|
||||
# To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`
|
||||
# To check which checks are enabled run `GL_DEBUG=gocritic ./build/bin/golangci-lint run`
|
||||
# By default list of stable checks is used.
|
||||
enabled-checks:
|
||||
- ruleguard
|
||||
- truncateCmp
|
||||
# - defaultCaseOrder
|
||||
# - defaultCaseOrder
|
||||
|
||||
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
|
||||
disabled-checks:
|
||||
- regexpMust
|
||||
- appendAssign
|
||||
# - hugeParam
|
||||
- rangeValCopy
|
||||
- exitAfterDefer
|
||||
@ -44,17 +45,22 @@ linters-settings:
|
||||
- captLocal
|
||||
- commentFormatting
|
||||
- ifElseChain
|
||||
- appendAssign
|
||||
- importShadow
|
||||
- paramTypeCombine
|
||||
- builtinShadow
|
||||
- typeUnparen
|
||||
|
||||
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
|
||||
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
|
||||
enabled-tags:
|
||||
- performance
|
||||
- diagnostic
|
||||
- opinionated
|
||||
disabled-tags:
|
||||
- experimental
|
||||
ruleguard:
|
||||
rules: "rules.go"
|
||||
settings:
|
||||
ruleguard:
|
||||
rules: "rules.go"
|
||||
hugeParam:
|
||||
# size in bytes that makes the warning trigger (default 80)
|
||||
sizeThreshold: 1000
|
||||
|
1
Makefile
1
Makefile
@ -143,6 +143,7 @@ clean:
|
||||
go clean -cache
|
||||
rm -fr build/*
|
||||
cd libmdbx/ && make clean
|
||||
./build/bin/golangci-lint cache clean
|
||||
|
||||
# The devtools target installs tools required for 'go generate'.
|
||||
# You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
|
||||
|
@ -401,7 +401,7 @@ func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi.CallArgs,
|
||||
if res.Err != nil {
|
||||
errString = res.Err.Error()
|
||||
}
|
||||
return &accessListResult{Accesslist: &accessList, Error: errString, GasUsed: (hexutil.Uint64)(res.UsedGas)}, nil
|
||||
return &accessListResult{Accesslist: &accessList, Error: errString, GasUsed: hexutil.Uint64(res.UsedGas)}, nil
|
||||
}
|
||||
prevTracer = tracer
|
||||
}
|
||||
|
@ -56,19 +56,3 @@ func HashData(data []byte) (Hash, error) {
|
||||
}
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
func HashTo(data []byte, to []byte) {
|
||||
h := NewHasher()
|
||||
defer ReturnHasherToPool(h)
|
||||
h.Sha.Reset()
|
||||
|
||||
_, err := h.Sha.Write(data)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = h.Sha.Read(to)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func FileExist(filePath string) bool {
|
||||
}
|
||||
|
||||
// AbsolutePath returns datadir + filename, or filename if it is absolute.
|
||||
func AbsolutePath(datadir string, filename string) string {
|
||||
func AbsolutePath(datadir, filename string) string {
|
||||
if filepath.IsAbs(filename) {
|
||||
return filename
|
||||
}
|
||||
|
@ -259,7 +259,9 @@ func UnwindCallTraces(u *UnwindState, s *StageState, tx kv.RwTx, cfg CallTracesC
|
||||
|
||||
func DoUnwindCallTraces(logPrefix string, db kv.RwTx, from, to uint64, ctx context.Context, tmpdir string) error {
|
||||
froms := etl.NewCollector(logPrefix, tmpdir, etl.NewOldestEntryBuffer(etl.BufferOptimalSize))
|
||||
defer froms.Close()
|
||||
tos := etl.NewCollector(logPrefix, tmpdir, etl.NewOldestEntryBuffer(etl.BufferOptimalSize))
|
||||
defer tos.Close()
|
||||
|
||||
logEvery := time.NewTicker(30 * time.Second)
|
||||
defer logEvery.Stop()
|
||||
@ -359,7 +361,9 @@ func pruneCallTraces(tx kv.RwTx, logPrefix string, pruneTo uint64, ctx context.C
|
||||
defer logEvery.Stop()
|
||||
|
||||
froms := etl.NewCollector(logPrefix, tmpdir, etl.NewOldestEntryBuffer(etl.BufferOptimalSize))
|
||||
defer froms.Close()
|
||||
tos := etl.NewCollector(logPrefix, tmpdir, etl.NewOldestEntryBuffer(etl.BufferOptimalSize))
|
||||
defer tos.Close()
|
||||
|
||||
{
|
||||
traceCursor, err := tx.CursorDupSort(kv.CallTraceSet)
|
||||
|
@ -160,11 +160,9 @@ func readPlainStateOnce(
|
||||
bufferSize := etl.BufferOptimalSize
|
||||
|
||||
accCollector := etl.NewCollector(logPrefix, tmpdir, etl.NewSortableBuffer(bufferSize))
|
||||
defer accCollector.Close()
|
||||
storageCollector := etl.NewCollector(logPrefix, tmpdir, etl.NewSortableBuffer(bufferSize))
|
||||
defer func() {
|
||||
accCollector.Close()
|
||||
storageCollector.Close()
|
||||
}()
|
||||
defer storageCollector.Close()
|
||||
|
||||
t := time.Now()
|
||||
logEvery := time.NewTicker(30 * time.Second)
|
||||
|
@ -222,10 +222,10 @@ func HeadersPOS(
|
||||
prevProgress := headerNumber
|
||||
|
||||
headerCollector := etl.NewCollector(logPrefix, cfg.tmpdir, etl.NewSortableBuffer(etl.BufferOptimalSize))
|
||||
defer headerCollector.Close()
|
||||
cfg.hd.SetHeadersCollector(headerCollector)
|
||||
// Cleanup after we finish backward sync
|
||||
defer func() {
|
||||
headerCollector.Close()
|
||||
cfg.hd.SetHeadersCollector(nil)
|
||||
cfg.hd.Unsync()
|
||||
cfg.hd.SetFetching(false)
|
||||
|
2
rules.go
2
rules.go
@ -1,8 +1,10 @@
|
||||
//go:build gorules
|
||||
// +build gorules
|
||||
|
||||
package gorules
|
||||
|
||||
// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
|
||||
// to apply changes in this file, please do: ./build/bin/golangci-lint cache clean
|
||||
import (
|
||||
"github.com/quasilyte/go-ruleguard/dsl"
|
||||
//quasilyterules "github.com/quasilyte/ruleguard-rules-test"
|
||||
|
Loading…
Reference in New Issue
Block a user