Skip to content

Commit 8872ccf

Browse files
authored
fix: lint rule ENUM_ZERO_VALUE_PREFIX) (#90)
1 parent 31b2d69 commit 8872ccf

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

easyp.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ lint:
5454
- RPC_NO_CLIENT_STREAMING
5555
- RPC_NO_SERVER_STREAMING
5656

57-
enum_zero_value_suffix: _NONE
57+
enum_zero_value_suffix: NONE
5858

5959
service_suffix: API
6060

internal/lint/rules/enum_zero_value_suffix.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (e *EnumZeroValueSuffix) Validate(protoInfo lint.ProtoInfo) ([]lint.Issue,
2323

2424
for _, enum := range protoInfo.Info.ProtoBody.Enums {
2525
zeroValue := enum.EnumBody.EnumFields[0]
26-
if zeroValue.Ident != pascalToUpperSnake(enum.EnumName)+e.Suffix {
26+
if zeroValue.Ident != pascalToUpperSnake(enum.EnumName)+"_"+e.Suffix {
2727
res = lint.AppendIssue(
2828
res,
2929
e,

internal/lint/rules/enum_zero_value_suffix_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestEnumZeroValueSuffix_Validate(t *testing.T) {
7575
r, protos := start(t)
7676

7777
rule := rules.EnumZeroValueSuffix{
78-
Suffix: "_NONE",
78+
Suffix: "NONE",
7979
}
8080
issues, err := rule.Validate(protos[tc.fileName])
8181
r.ErrorIs(err, tc.wantErr)

0 commit comments

Comments
 (0)