You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varerrUnexpectedInitializerType=errors.New("expected namingconventions.Initializer() to be of type initializer.ConfigurableAnalyzerInitializer, but was not")
34
+
35
+
funcnewAnalyzer() *analysis.Analyzer {
36
+
cfg:=&namingconventions.Config{
37
+
Conventions: []namingconventions.Convention{
38
+
{
39
+
Name: "notimestamp",
40
+
ViolationMatcher: "(?i)timestamp",
41
+
Operation: namingconventions.OperationReplace,
42
+
Message: "prefer use of the term 'time' over 'timestamp'",
Copy file name to clipboardExpand all lines: pkg/analysis/notimestamp/testdata/src/a/a.go
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -8,36 +8,36 @@ import (
8
8
9
9
typeNoTimeStampTestStructstruct {
10
10
// +optional
11
-
TimeStamp*time.Time`json:"timeStamp,omitempty"`// want "field TimeStamp: prefer use of the term time over timestamp"
11
+
TimeStamp*time.Time`json:"timeStamp,omitempty"`// want `naming convention "notimestamp": prefer use of the term 'time' over 'timestamp'`
12
12
13
13
// +optional
14
-
Timestamp*time.Time`json:"timestamp,omitempty"`// want "field Timestamp: prefer use of the term time over timestamp"
14
+
Timestamp*time.Time`json:"timestamp,omitempty"`// want `naming convention "notimestamp": prefer use of the term 'time' over 'timestamp'`
15
15
16
16
// +optional
17
-
FooTimeStamp*time.Time`json:"fooTimeStamp,omitempty"`// want "field FooTimeStamp: prefer use of the term time over timestamp"
17
+
FooTimeStamp*time.Time`json:"fooTimeStamp,omitempty"`// want `naming convention "notimestamp": prefer use of the term 'time' over 'timestamp'`
18
18
19
19
// +optional
20
-
FootimeStamp*time.Time`json:"footimeStamp,omitempty"`// want "field FootimeStamp: prefer use of the term time over timestamp"
20
+
FootimeStamp*time.Time`json:"footimeStamp,omitempty"`// want `naming convention "notimestamp": prefer use of the term 'time' over 'timestamp'`
21
21
22
22
// +optional
23
-
BarTimestamp*time.Time`json:"barTimestamp,omitempty"`// want "field BarTimestamp: prefer use of the term time over timestamp"
23
+
BarTimestamp*time.Time`json:"barTimestamp,omitempty"`// want `naming convention "notimestamp": prefer use of the term 'time' over 'timestamp'`
24
24
25
25
// +optional
26
-
FootimestampBar*time.Time`json:"fooTimestampBar,omitempty"`// want "field FootimestampBar: prefer use of the term time over timestamp"
26
+
FootimestampBar*time.Time`json:"fooTimestampBar,omitempty"`// want `naming convention "notimestamp": prefer use of the term 'time' over 'timestamp'`
27
27
28
28
// +optional
29
-
FooTimestampBarTimeStamp*time.Time`json:"fooTimestampBarTimeStamp,omitempty"`// want "field FooTimestampBarTimeStamp: prefer use of the term time over timestamp"
29
+
FooTimestampBarTimeStamp*time.Time`json:"fooTimestampBarTimeStamp,omitempty"`// want `naming convention "notimestamp": prefer use of the term 'time' over 'timestamp'`
30
30
31
31
// +optional
32
-
MetaTimeStamp*metav1.Time`json:"metaTimeStamp,omitempty"`// want "field MetaTimeStamp: prefer use of the term time over timestamp"
32
+
MetaTimeStamp*metav1.Time`json:"metaTimeStamp,omitempty"`// want `naming convention "notimestamp": prefer use of the term 'time' over 'timestamp'`
33
33
}
34
34
35
35
// DoNothing is used to check that the analyser doesn't report on methods.
36
36
func (NoTimeStampTestStruct) DoNothing() {}
37
37
38
38
typeNoSubTimeStampTestStructstruct {
39
39
// +optional
40
-
FooTimeStamp*time.Time`json:"fooTimeStamp,omitempty"`// want "field FooTimeStamp: prefer use of the term time over timestamp"
40
+
FooTimeStamp*time.Time`json:"fooTimeStamp,omitempty"`// want `naming convention "notimestamp": prefer use of the term 'time' over 'timestamp'`
0 commit comments