Skip to content

Commit a5fcf54

Browse files
authored
CI: add docnametypo linter and fix issues (#6493)
1 parent a51dbb4 commit a5fcf54

File tree

73 files changed

+128
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+128
-112
lines changed

.custom-gcl.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ plugins:
88
- module: fillmore-labs.com/errortype
99
import: fillmore-labs.com/errortype/gclplugin
1010
version: v0.0.7
11+
- module: github.com/cce/docnametypo
12+
import: github.com/cce/docnametypo/gclplugin
13+
version: v0.2.0

.golangci-warnings.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,23 @@ run:
44
linters:
55
default: none
66
enable:
7+
- docnametypo
8+
- errortype
79
- gosec
810
- partitiontest
9-
- errortype
1011
settings:
1112
gosec:
1213
excludes: [G101, G103, G104, G107, G112, G114, G115, G202, G204, G301, G302, G303, G304, G306, G307, G404]
1314
custom:
14-
partitiontest:
15-
type: "module"
16-
description: This custom linter ensures test functions call 'partitiontest.PartitionTest(t)'
15+
docnametypo:
16+
type: module
17+
description: "docnametypo catches doc comments with mismatched function names"
18+
original-url: "https://github.com/cce/docnametypo"
19+
settings:
20+
include-exported: true
21+
include-types: true
22+
include-generated: false
23+
allowed-prefixes: asm,op
1724
errortype:
1825
type: module
1926
description: "errortype helps prevent subtle bugs in error handling."
@@ -24,6 +31,9 @@ linters:
2431
check-is: true
2532
unchecked-assert: false
2633
check-unused: true
34+
partitiontest:
35+
type: "module"
36+
description: This custom linter ensures test functions call 'partitiontest.PartitionTest(t)'
2737
exclusions:
2838
generated: lax
2939
rules:

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ modernize:
112112
lint: deps
113113
$(GOBIN)/golangci-lint run -c .golangci.yml
114114

115+
warninglint: custom-golangci-lint
116+
./custom-golangci-lint run -c .golangci-warnings.yml
117+
115118
expectlint:
116119
cd test/e2e-go/cli/goal/expect && python3 expect_linter.py *.exp
117120

@@ -423,6 +426,5 @@ include ./scripts/release/mule/Makefile.mule
423426
archive:
424427
aws s3 cp tmp/node_pkgs s3://algorand-internal/channel/$(CHANNEL)/$(FULLBUILDNUMBER) --recursive --exclude "*" --include "*$(FULLBUILDNUMBER)*"
425428

426-
build_custom_linters:
429+
custom-golangci-lint: .custom-gcl.yml
427430
golangci-lint custom -v
428-
./custom-golangci-lint --version

agreement/bundle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type bundle struct {
5252
EquivocationVotes []equivocationVote `codec:"eqv,allocbound=bounds.MaxVoteThreshold"`
5353
}
5454

55-
// voteAuthenticators omit the Round, Period, Step, and Proposal for compression
55+
// voteAuthenticator omits the Round, Period, Step, and Proposal for compression
5656
// and to simplify checking logic.
5757
type voteAuthenticator struct {
5858
_struct struct{} `codec:""` // not omitempty

agreement/cryptoRequestContext.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type roundRequestsContext struct {
4646
periods map[cryptoRequestCtxKey]periodRequestsContext
4747
}
4848

49-
// pendingRequests keeps the context for all pending requests
49+
// pendingRequestsContext keeps the context for all pending requests
5050
//
5151
//msgp:ignore pendingRequestsContext
5252
type pendingRequestsContext map[round]roundRequestsContext

agreement/events_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/stretchr/testify/require"
2626
)
2727

28-
// TestSerializableErrorBackwardCompatible ensures Err field of type serializableError can be
28+
// TestSerializableErrorBackwardCompatibility ensures Err field of type serializableError can be
2929
// properly decoded from ConsensusVersionView.
3030
// This test is only needed for agreement state serialization switch from reflection to msgp.
3131
func TestSerializableErrorBackwardCompatibility(t *testing.T) {

agreement/fuzzer/catchupFilter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func MakeCatchupFilterFactory(config *CatchupFilterConfig) *CatchupFilter {
104104
}
105105
}
106106

107-
// Unmarshall CatchupFilter
107+
// Unmarshal CatchupFilter
108108
func (n *CatchupFilter) Unmarshal(b []byte) NetworkFilterFactory {
109109
type catchupFilterJSON struct {
110110
Name string

agreement/fuzzer/clockedFilter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (n *ClockedFilter) Tick(newClockTime int) bool {
8686
return n.upstream.Tick(int(n.localClock))
8787
}
8888

89-
// Unmarshall ClockedFilter
89+
// Unmarshal ClockedFilter
9090
func (n *ClockedFilter) Unmarshal(b []byte) NetworkFilterFactory {
9191
type clockedFilterJSON struct {
9292
Name string

agreement/fuzzer/dropMessageFilter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (n *DropMessageFilter) Marshal() (bytes []byte, err error) {
9696

9797
}
9898

99-
// Unmarshall DropMessageFilter
99+
// Unmarshal DropMessageFilter
100100
func (n *DropMessageFilter) Unmarshal(b []byte) NetworkFilterFactory {
101101
type dropMessageFilterJSON struct {
102102
Name string

agreement/fuzzer/messageDecoderFilter_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package fuzzer
1919
import (
2020
"bytes"
2121
"encoding/json"
22+
2223
"github.com/algorand/go-deadlock"
2324

2425
//"github.com/algorand/go-algorand/agreement"
@@ -107,7 +108,7 @@ type (
107108
EquivocationVotes []equivocationVote `codec:"eqv"`
108109
}
109110

110-
// voteAuthenticators omit the Round, Period, Step, and Proposal for compression
111+
// voteAuthenticator omits the Round, Period, Step, and Proposal for compression
111112
// and to simplify checking logic.
112113
voteAuthenticator struct {
113114
Sender basics.Address `codec:"snd"`
@@ -324,7 +325,7 @@ func (n *MessageDecoderFilter) getDecodedMessageCounts(tag protocol.Tag) int {
324325
return -1
325326
}
326327

327-
// Unmarshall MessageDecoderFilter
328+
// Unmarshal MessageDecoderFilter
328329
func (n *MessageDecoderFilter) Unmarshal(b []byte) NetworkFilterFactory {
329330
type messageDecoderFilterJSON struct {
330331
Name string

0 commit comments

Comments
 (0)