mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-06 22:23:56 -05:00
Restructure golangci-lint config: explicit opt-in (#15744)
* update golangci-lint configuration to enable basic linters only * Add back formatter * feedback * Add nolint
This commit is contained in:
1
.github/workflows/go.yml
vendored
1
.github/workflows/go.yml
vendored
@@ -56,7 +56,6 @@ jobs:
|
|||||||
uses: golangci/golangci-lint-action@v8
|
uses: golangci/golangci-lint-action@v8
|
||||||
with:
|
with:
|
||||||
version: v2.4
|
version: v2.4
|
||||||
only-new-issues: true
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
|
|||||||
@@ -2,72 +2,13 @@ version: "2"
|
|||||||
run:
|
run:
|
||||||
go: 1.23.5
|
go: 1.23.5
|
||||||
linters:
|
linters:
|
||||||
default: all
|
enable:
|
||||||
disable:
|
- errcheck
|
||||||
- asasalint
|
- ineffassign
|
||||||
- bodyclose
|
|
||||||
- containedctx
|
|
||||||
- contextcheck
|
|
||||||
- cyclop
|
|
||||||
- depguard
|
|
||||||
- dogsled
|
|
||||||
- dupl
|
|
||||||
- durationcheck
|
|
||||||
- err113
|
|
||||||
- errname
|
|
||||||
- exhaustive
|
|
||||||
- exhaustruct
|
|
||||||
- forbidigo
|
|
||||||
- forcetypeassert
|
|
||||||
- funlen
|
|
||||||
- gochecknoglobals
|
|
||||||
- gochecknoinits
|
|
||||||
- goconst
|
|
||||||
- gocritic
|
|
||||||
- gocyclo
|
|
||||||
- godot
|
|
||||||
- godox
|
|
||||||
- gomoddirectives
|
|
||||||
- gosec
|
|
||||||
- govet
|
- govet
|
||||||
- inamedparam
|
disable:
|
||||||
- interfacebloat
|
|
||||||
- intrange
|
|
||||||
- ireturn
|
|
||||||
- lll
|
|
||||||
- maintidx
|
|
||||||
- makezero
|
|
||||||
- mnd
|
|
||||||
- musttag
|
|
||||||
- nakedret
|
|
||||||
- nestif
|
|
||||||
- nilnil
|
|
||||||
- nlreturn
|
|
||||||
- noctx
|
|
||||||
- noinlineerr
|
|
||||||
- nolintlint
|
|
||||||
- nonamedreturns
|
|
||||||
- nosprintfhostport
|
|
||||||
- perfsprint
|
|
||||||
- prealloc
|
|
||||||
- predeclared
|
|
||||||
- promlinter
|
|
||||||
- protogetter
|
|
||||||
- recvcheck
|
|
||||||
- revive
|
|
||||||
- spancheck
|
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- tagalign
|
- unused
|
||||||
- tagliatelle
|
|
||||||
- thelper
|
|
||||||
- unparam
|
|
||||||
- usetesting
|
|
||||||
- varnamelen
|
|
||||||
- wrapcheck
|
|
||||||
- wsl
|
|
||||||
settings:
|
|
||||||
gocognit:
|
|
||||||
min-complexity: 65
|
|
||||||
exclusions:
|
exclusions:
|
||||||
generated: lax
|
generated: lax
|
||||||
presets:
|
presets:
|
||||||
@@ -83,6 +24,7 @@ linters:
|
|||||||
- third_party$
|
- third_party$
|
||||||
- builtin$
|
- builtin$
|
||||||
- examples$
|
- examples$
|
||||||
|
|
||||||
formatters:
|
formatters:
|
||||||
enable:
|
enable:
|
||||||
- gofmt
|
- gofmt
|
||||||
@@ -96,4 +38,4 @@ formatters:
|
|||||||
- tools/analyzers
|
- tools/analyzers
|
||||||
- third_party$
|
- third_party$
|
||||||
- builtin$
|
- builtin$
|
||||||
- examples$
|
- examples$
|
||||||
3
changelog/ttsao_simplify-golangci-config.md
Normal file
3
changelog/ttsao_simplify-golangci-config.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
### Ignored
|
||||||
|
|
||||||
|
- Update golangci-lint config to enable only basic linters that currently pass
|
||||||
@@ -90,6 +90,7 @@ func (r *runner) run(ctx context.Context) {
|
|||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
log.Info("Context canceled, stopping validator")
|
log.Info("Context canceled, stopping validator")
|
||||||
|
//nolint:govet
|
||||||
return // Exit if context is canceled.
|
return // Exit if context is canceled.
|
||||||
case slot := <-v.NextSlot():
|
case slot := <-v.NextSlot():
|
||||||
if !r.healthMonitor.IsHealthy() {
|
if !r.healthMonitor.IsHealthy() {
|
||||||
@@ -98,7 +99,7 @@ func (r *runner) run(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deadline := v.SlotDeadline(slot)
|
deadline := v.SlotDeadline(slot)
|
||||||
slotCtx, cancel := context.WithDeadline(ctx, deadline)
|
slotCtx, cancel := context.WithDeadline(ctx, deadline) //nolint:govet
|
||||||
|
|
||||||
var span trace.Span
|
var span trace.Span
|
||||||
slotCtx, span = prysmTrace.StartSpan(slotCtx, "validator.processSlot")
|
slotCtx, span = prysmTrace.StartSpan(slotCtx, "validator.processSlot")
|
||||||
@@ -131,7 +132,7 @@ func (r *runner) run(ctx context.Context) {
|
|||||||
|
|
||||||
// Start fetching domain data for the next epoch.
|
// Start fetching domain data for the next epoch.
|
||||||
if slots.IsEpochEnd(slot) {
|
if slots.IsEpochEnd(slot) {
|
||||||
domainCtx, _ := context.WithDeadline(ctx, deadline)
|
domainCtx, _ := context.WithDeadline(ctx, deadline) //nolint:govet
|
||||||
go v.UpdateDomainDataCaches(domainCtx, slot+1)
|
go v.UpdateDomainDataCaches(domainCtx, slot+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ func (r *runner) run(ctx context.Context) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// performRoles calls span.End()
|
// performRoles calls span.End()
|
||||||
rolesCtx, _ := context.WithDeadline(ctx, deadline)
|
rolesCtx, _ := context.WithDeadline(ctx, deadline) //nolint:govet
|
||||||
performRoles(rolesCtx, allRoles, v, slot, &wg, span)
|
performRoles(rolesCtx, allRoles, v, slot, &wg, span)
|
||||||
case e := <-v.EventsChan():
|
case e := <-v.EventsChan():
|
||||||
v.ProcessEvent(ctx, e)
|
v.ProcessEvent(ctx, e)
|
||||||
|
|||||||
Reference in New Issue
Block a user