Skip to content

Commit ab8b31f

Browse files
committed
correct docs and comments
Signed-off-by: sivchari <shibuuuu5@gmail.com>
1 parent f346928 commit ab8b31f

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

pkg/analysis/duplicatemarkers/doc.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,24 @@ limitations under the License.
1616

1717
/*
1818
duplicatemarkers is an analyzer that checks for duplicate markers in the API types.
19+
It reports exact matches for marker definitions.
1920
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:
2322
2423
type Foo struct {
2524
// +kubebuilder:validation:MaxLength=10
2625
// +kubebuilder:validation:MaxLength=11
27-
Field string `json:"field"`
26+
type Bar string
2827
}
2928
30-
// +kubebuilder:validation:MaxLength=10
31-
// +kubebuilder:validation:MaxLength=11
32-
type Bar string
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
35+
}
3336
34-
About the duplicated markers which has different value, it requires specific rule for each marker, these are processed by its corresponding linter.
37+
would be reported.
3538
*/
3639
package duplicatemarkers

pkg/analysis/duplicatemarkers/testdata/src/a/a.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ type DuplicatedMaxLength int // want "DuplicatedMaxLength has duplicated markers
2222
// +kubebuilder:object:root=true
2323
type DuplicateMarkerSpec struct { // want "DuplicateMarkerSpec has duplicated markers kubebuilder:object:root"
2424
// +kubebuilder:validation:Required
25-
// shpuld be ignored since it only has single marker
26-
UniqueRequired string `json:"uniqueRequired"`
25+
// should be ignored since it only has single marker
26+
Required string `json:"required"`
2727

2828
// +listType=map
2929
// +listMapKey=primaryKey

pkg/analysis/duplicatemarkers/testdata/src/a/a.go.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ type DuplicatedMaxLength int // want "DuplicatedMaxLength has duplicated markers
1919
// +kubebuilder:subresource:status
2020
type DuplicateMarkerSpec struct { // want "DuplicateMarkerSpec has duplicated markers kubebuilder:object:root"
2121
// +kubebuilder:validation:Required
22-
// shpuld be ignored since it only has single marker
23-
UniqueRequired string `json:"uniqueRequired"`
22+
// should be ignored since it only has single marker
23+
Required string `json:"required"`
2424

2525
// +listType=map
2626
// +listMapKey=primaryKey

0 commit comments

Comments
 (0)