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/maxlength/testdata/src/a/c.go
+10-3Lines changed: 10 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -58,14 +58,21 @@ type DVMaxLength struct {
58
58
MapWithNoMaxPropertiesmap[string]string// want `field DVMaxLength.MapWithNoMaxProperties must have a maximum properties, add kubebuilder:validation:MaxProperties marker`
59
59
60
60
// Non-string-keyed map — should NOT lint.
61
-
// DV +k8s:maxProperties only supports string-keyed maps; linter mirrors this constraint.
61
+
// Map maxProperties validation only supports string-keyed maps; linter mirrors this constraint.
62
62
MapWithIntKeymap[int]string
63
63
64
64
// DV maxLength applied to []byte — SHOULD lint.
65
-
// +k8s:maxLength (counts chars) is not the correct DV tag for []byte;
66
-
// +k8s:maxBytes (counts bytes) should be used instead.
65
+
// k8s:maxLength (counts chars) is not the correct DV tag for []byte;
66
+
// k8s:maxBytes (counts bytes) should be used instead.
67
67
// +k8s:maxLength=256
68
68
ByteSliceWithWrongDVMarker []byte// want `field DVMaxLength.ByteSliceWithWrongDVMarker must have a maximum length, add kubebuilder:validation:MaxLength marker`
69
+
70
+
// Map with string-alias key — should lint for maxProperties.
71
+
MapWithStringAliasKeymap[StringAliasDVMaxLength]string// want `field DVMaxLength.MapWithStringAliasKey must have a maximum properties, add kubebuilder:validation:MaxProperties marker`
72
+
73
+
// Map with string-alias key with marker — should NOT lint.
Copy file name to clipboardExpand all lines: pkg/analysis/maxlength/testdata/src/b/b.go
+10-3Lines changed: 10 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ type DVPreferredMaxLength struct {
15
15
// +k8s:maxBytes=512
16
16
ByteSliceWithDVMaxBytes []byte// satisfied by k8s:maxBytes — no lint
17
17
18
-
ByteSliceWithoutMax []byte// want `field DVPreferredMaxLength.ByteSliceWithoutMax must have a maximum length, add k8s:maxLength marker`
18
+
ByteSliceWithoutMax []byte// want `field DVPreferredMaxLength.ByteSliceWithoutMax must have a maximum length, add k8s:maxBytes marker`
19
19
20
20
// +k8s:maxItems=128
21
21
ArrayWithDVMaxItems []int// satisfied by k8s:maxItems — no lint
@@ -60,10 +60,10 @@ type DVPreferredMaxLength struct {
60
60
// +kubebuilder:validation:Format:=duration
61
61
KubebuilderDurationStringstring// kubebuilder format also exempts in DV-preferred mode — no lint
62
62
63
-
// +k8s:maxLength=256 on a []byte field is the WRONG DV marker; +k8s:maxBytes should be used.
63
+
// k8s:maxLength=256 on a []byte field is the WRONG DV marker; k8s:maxBytes should be used.
64
64
// The linter must still report the field as missing a valid max-length constraint.
65
65
// +k8s:maxLength=256
66
-
ByteSliceWithWrongDVMarker []byte// want `field DVPreferredMaxLength.ByteSliceWithWrongDVMarker must have a maximum length, add k8s:maxLength marker`
66
+
ByteSliceWithWrongDVMarker []byte// want `field DVPreferredMaxLength.ByteSliceWithWrongDVMarker must have a maximum length, add k8s:maxBytes marker`
67
67
68
68
// Raw []string — needs both MaxItems and items:MaxLength.
69
69
// +k8s:maxItems=16
@@ -74,6 +74,13 @@ type DVPreferredMaxLength struct {
74
74
StringArrayWithMaxItemsWithoutElementLength []string// want `field DVPreferredMaxLength.StringArrayWithMaxItemsWithoutElementLength array element must have a maximum length, add kubebuilder:validation:items:MaxLength`
75
75
76
76
StringArrayWithoutMaxItemsOrElementLength []string// want `field DVPreferredMaxLength.StringArrayWithoutMaxItemsOrElementLength must have a maximum items, add k8s:maxItems marker` `field DVPreferredMaxLength.StringArrayWithoutMaxItemsOrElementLength array element must have a maximum length, add kubebuilder:validation:items:MaxLength`
77
+
78
+
// Map with string-alias key — should lint for maxProperties.
79
+
MapWithStringAliasKeymap[StringAliasDVMaxLength]string// want `field DVPreferredMaxLength.MapWithStringAliasKey must have a maximum properties, add k8s:maxProperties marker`
80
+
81
+
// Map with string-alias key with marker — should NOT lint.
0 commit comments