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
Copy file name to clipboardExpand all lines: pkg/analysis/duplicatemarkers/doc.go
+14-8Lines changed: 14 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -16,21 +16,27 @@ limitations under the License.
16
16
17
17
/*
18
18
duplicatemarkers is an analyzer that checks for duplicate markers in the API types.
19
+
It reports exact matches for marker definitions.
19
20
20
-
It reports only if the marker and value together are completely unique now. For example, the `duplicatemarkers` will not diagnose the field has kubebuilder:validation:MaxLength=10 and kubebuilder:validation:MaxLength=11
21
-
22
-
Example:
21
+
For example, something like:
23
22
24
23
type Foo struct {
25
24
// +kubebuilder:validation:MaxLength=10
26
25
// +kubebuilder:validation:MaxLength=11
27
-
Field string `json:"field"`
26
+
type Bar string
27
+
}
28
+
29
+
would not be reported while something like:
30
+
31
+
type Foo struct {
32
+
// +kubebuilder:validation:MaxLength=10
33
+
// +kubebuilder:validation:MaxLength=10
34
+
type Bar string
28
35
}
29
36
30
-
// +kubebuilder:validation:MaxLength=10
31
-
// +kubebuilder:validation:MaxLength=11
32
-
type Bar string
37
+
would be reported.
33
38
34
-
About the duplicated markers which has different value, it requires specific rule for each marker, these are processed by its corresponding linter.
39
+
This linter also be able to automatically fix all markers that are exact match to another markers.
40
+
If there are duplicates across fields and their underlying type, the marker on the type will be preferred and the marker on the field will be removed.
0 commit comments