sort static analyzers, add more, fix violations (#13441)

This commit is contained in:
Preston Van Loon 2024-01-09 17:29:36 -06:00 committed by GitHub
parent 2aef7a3ec5
commit 98e3f2b80f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 66 additions and 35 deletions

View File

@ -194,33 +194,6 @@ nogo(
config = ":nogo_config_with_excludes", config = ":nogo_config_with_excludes",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"@org_golang_x_tools//go/analysis/passes/unsafeptr:go_default_library",
"@org_golang_x_tools//go/analysis/passes/unreachable:go_default_library",
"@org_golang_x_tools//go/analysis/passes/unmarshal:go_default_library",
"@org_golang_x_tools//go/analysis/passes/tests:go_default_library",
"@org_golang_x_tools//go/analysis/passes/structtag:go_default_library",
"@org_golang_x_tools//go/analysis/passes/stdmethods:go_default_library",
"@org_golang_x_tools//go/analysis/passes/shift:go_default_library",
# "@org_golang_x_tools//go/analysis/passes/shadow:go_default_library",
"@org_golang_x_tools//go/analysis/passes/printf:go_default_library",
"@org_golang_x_tools//go/analysis/passes/pkgfact:go_default_library",
"@org_golang_x_tools//go/analysis/passes/nilness:go_default_library",
"@org_golang_x_tools//go/analysis/passes/nilfunc:go_default_library",
"@org_golang_x_tools//go/analysis/passes/loopclosure:go_default_library",
"@org_golang_x_tools//go/analysis/passes/httpresponse:go_default_library",
"@org_golang_x_tools//go/analysis/passes/findcall:go_default_library",
"@org_golang_x_tools//go/analysis/passes/deepequalerrors:go_default_library",
"@org_golang_x_tools//go/analysis/passes/ctrlflow:go_default_library",
"@org_golang_x_tools//go/analysis/passes/copylock:go_default_library",
# "@org_golang_x_tools//go/analysis/passes/cgocall:go_default_library",
"@org_golang_x_tools//go/analysis/passes/buildtag:go_default_library",
"@org_golang_x_tools//go/analysis/passes/buildssa:go_default_library",
"@org_golang_x_tools//go/analysis/passes/bools:go_default_library",
"@org_golang_x_tools//go/analysis/passes/atomicalign:go_default_library",
"@org_golang_x_tools//go/analysis/passes/atomic:go_default_library",
"@org_golang_x_tools//go/analysis/passes/assign:go_default_library",
"@org_golang_x_tools//go/analysis/passes/inspect:go_default_library",
"@org_golang_x_tools//go/analysis/passes/asmdecl:go_default_library",
"//tools/analyzers/comparesame:go_default_library", "//tools/analyzers/comparesame:go_default_library",
"//tools/analyzers/cryptorand:go_default_library", "//tools/analyzers/cryptorand:go_default_library",
"//tools/analyzers/errcheck:go_default_library", "//tools/analyzers/errcheck:go_default_library",
@ -236,6 +209,53 @@ nogo(
"//tools/analyzers/shadowpredecl:go_default_library", "//tools/analyzers/shadowpredecl:go_default_library",
"//tools/analyzers/slicedirect:go_default_library", "//tools/analyzers/slicedirect:go_default_library",
"//tools/analyzers/uintcast:go_default_library", "//tools/analyzers/uintcast:go_default_library",
"@org_golang_x_tools//go/analysis/passes/appends:go_default_library",
"@org_golang_x_tools//go/analysis/passes/asmdecl:go_default_library",
"@org_golang_x_tools//go/analysis/passes/assign:go_default_library",
"@org_golang_x_tools//go/analysis/passes/atomic:go_default_library",
"@org_golang_x_tools//go/analysis/passes/atomicalign:go_default_library",
"@org_golang_x_tools//go/analysis/passes/bools:go_default_library",
"@org_golang_x_tools//go/analysis/passes/buildssa:go_default_library",
"@org_golang_x_tools//go/analysis/passes/buildtag:go_default_library",
# cgocall disabled
#"@org_golang_x_tools//go/analysis/passes/cgocall:go_default_library",
"@org_golang_x_tools//go/analysis/passes/copylock:go_default_library",
"@org_golang_x_tools//go/analysis/passes/ctrlflow:go_default_library",
"@org_golang_x_tools//go/analysis/passes/deepequalerrors:go_default_library",
"@org_golang_x_tools//go/analysis/passes/defers:go_default_library",
"@org_golang_x_tools//go/analysis/passes/directive:go_default_library",
# fieldalignment disabled
#"@org_golang_x_tools//go/analysis/passes/fieldalignment:go_default_library",
"@org_golang_x_tools//go/analysis/passes/findcall:go_default_library",
"@org_golang_x_tools//go/analysis/passes/framepointer:go_default_library",
"@org_golang_x_tools//go/analysis/passes/httpmux:go_default_library",
"@org_golang_x_tools//go/analysis/passes/httpresponse:go_default_library",
"@org_golang_x_tools//go/analysis/passes/ifaceassert:go_default_library",
"@org_golang_x_tools//go/analysis/passes/inspect:go_default_library",
"@org_golang_x_tools//go/analysis/passes/loopclosure:go_default_library",
"@org_golang_x_tools//go/analysis/passes/nilfunc:go_default_library",
"@org_golang_x_tools//go/analysis/passes/nilness:go_default_library",
"@org_golang_x_tools//go/analysis/passes/pkgfact:go_default_library",
"@org_golang_x_tools//go/analysis/passes/printf:go_default_library",
"@org_golang_x_tools//go/analysis/passes/reflectvaluecompare:go_default_library",
# shadow disabled
#"@org_golang_x_tools//go/analysis/passes/shadow:go_default_library",
"@org_golang_x_tools//go/analysis/passes/shift:go_default_library",
"@org_golang_x_tools//go/analysis/passes/sigchanyzer:go_default_library",
"@org_golang_x_tools//go/analysis/passes/slog:go_default_library",
"@org_golang_x_tools//go/analysis/passes/sortslice:go_default_library",
"@org_golang_x_tools//go/analysis/passes/stdmethods:go_default_library",
"@org_golang_x_tools//go/analysis/passes/stringintconv:go_default_library",
"@org_golang_x_tools//go/analysis/passes/structtag:go_default_library",
"@org_golang_x_tools//go/analysis/passes/testinggoroutine:go_default_library",
"@org_golang_x_tools//go/analysis/passes/tests:go_default_library",
"@org_golang_x_tools//go/analysis/passes/timeformat:go_default_library",
"@org_golang_x_tools//go/analysis/passes/unmarshal:go_default_library",
"@org_golang_x_tools//go/analysis/passes/unreachable:go_default_library",
"@org_golang_x_tools//go/analysis/passes/unsafeptr:go_default_library",
"@org_golang_x_tools//go/analysis/passes/unusedresult:go_default_library",
"@org_golang_x_tools//go/analysis/passes/unusedwrite:go_default_library",
"@org_golang_x_tools//go/analysis/passes/usesgenerics:go_default_library",
] + select({ ] + select({
# nogo checks that fail with coverage enabled. # nogo checks that fail with coverage enabled.
":coverage_enabled": [], ":coverage_enabled": [],

View File

@ -154,7 +154,6 @@ func TestServer_GetBeaconBlock_Altair(t *testing.T) {
SyncAggregate: &ethpb.SyncAggregate{SyncCommitteeBits: scBits[:], SyncCommitteeSignature: make([]byte, 96)}, SyncAggregate: &ethpb.SyncAggregate{SyncCommitteeBits: scBits[:], SyncCommitteeSignature: make([]byte, 96)},
}, },
}, },
Signature: genesis.Signature,
} }
blkRoot, err := genAltair.Block.HashTreeRoot() blkRoot, err := genAltair.Block.HashTreeRoot()
@ -244,7 +243,6 @@ func TestServer_GetBeaconBlock_Bellatrix(t *testing.T) {
}, },
}, },
}, },
Signature: genesis.Signature,
} }
blkRoot, err := blk.Block.HashTreeRoot() blkRoot, err := blk.Block.HashTreeRoot()
@ -371,7 +369,6 @@ func TestServer_GetBeaconBlock_Capella(t *testing.T) {
}, },
}, },
}, },
Signature: genesis.Signature,
} }
blkRoot, err := blk.Block.HashTreeRoot() blkRoot, err := blk.Block.HashTreeRoot()
@ -483,7 +480,6 @@ func TestServer_GetBeaconBlock_Deneb(t *testing.T) {
}, },
}, },
}, },
Signature: genesis.Signature,
} }
blkRoot, err := blk.Block.HashTreeRoot() blkRoot, err := blk.Block.HashTreeRoot()

View File

@ -338,7 +338,7 @@ func TestRoundTripDenebSave(t *testing.T) {
require.NoError(t, undo()) require.NoError(t, undo())
}() }()
parentRoot := [32]byte{} parentRoot := [32]byte{}
c := blobsTestCase{nblocks: 10} c := blobsTestCase{}
chain, clock := defaultMockChain(t) chain, clock := defaultMockChain(t)
c.chain = chain c.chain = chain
c.clock = clock c.clock = clock

View File

@ -606,8 +606,6 @@ func TestBlocksFetcher_WaitForBandwidth(t *testing.T) {
p1.Connect(p2) p1.Connect(p2)
require.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected") require.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected")
req := &ethpb.BeaconBlocksByRangeRequest{ req := &ethpb.BeaconBlocksByRangeRequest{
StartSlot: 100,
Step: 1,
Count: 64, Count: 64,
} }

View File

@ -1074,7 +1074,6 @@ func TestRPCBeaconBlocksByRange_FilterBlocks(t *testing.T) {
func TestRPCBeaconBlocksByRange_FilterBlocks_PreviousRoot(t *testing.T) { func TestRPCBeaconBlocksByRange_FilterBlocks_PreviousRoot(t *testing.T) {
req := &ethpb.BeaconBlocksByRangeRequest{ req := &ethpb.BeaconBlocksByRangeRequest{
StartSlot: 100, StartSlot: 100,
Step: 1,
Count: uint64(flags.Get().BlockBatchLimit) * 2, Count: uint64(flags.Get().BlockBatchLimit) * 2,
} }

View File

@ -190,5 +190,23 @@
"external/.*": "Third party code", "external/.*": "Third party code",
"rules_go_work-.*": "Third party code" "rules_go_work-.*": "Third party code"
} }
},
"reflectvaluecompare": {
"exclude_files": {
"external/.*": "Third party code",
"rules_go_work-.*": "Third party code"
}
},
"unusedwrite": {
"exclude_files": {
"external/.*": "Third party code",
"rules_go_work-.*": "Third party code"
}
},
"stringintconv": {
"exclude_files": {
"external/.*": "Third party code",
"rules_go_work-.*": "Third party code"
}
} }
} }