-
Notifications
You must be signed in to change notification settings - Fork 577
Bring KAL up to date and enable new linters #2554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,9 @@ linters: | |
| settings: | ||
| linters: | ||
| enable: | ||
| - forbiddenmarkers | ||
| - maxlength | ||
| - namingconventions | ||
| - nobools | ||
| - nomaps | ||
| - statussubresource | ||
|
|
@@ -20,6 +22,13 @@ linters: | |
| isFirstField: Warn | ||
| usePatchStrategy: Ignore | ||
| useProtobuf: Ignore | ||
| forbiddenmarkers: | ||
| markers: | ||
| - identifier: "openshift:enable:FeatureSets" | ||
| - identifier: "openshift:validation:FeatureSetAwareEnum" | ||
| - identifier: "openshift:validation:FeatureSetAwareXValidation" | ||
| - identifier: "kubebuilder:validation:UniqueItems" | ||
| - identifier: "kubebuilder:validation:Pattern" # Use CEL expressions instead | ||
| optionalfields: | ||
| pointers: | ||
| preference: WhenRequired | ||
|
|
@@ -33,7 +42,7 @@ linters: | |
| # This will force omitzero on optional struct fields. | ||
| # This means they can be omitted correctly and prevents the need for pointers to structs. | ||
| policy: SuggestFix | ||
| requiredFields: | ||
| requiredfields: | ||
| pointers: | ||
| # This will force pointers when the field is required, but only when the zero | ||
| # value is a valid user choice, and has a semantic difference to being omitted (e.g. replicas allows 0). | ||
|
|
@@ -47,7 +56,18 @@ linters: | |
| # This will force omitzero on required struct fields. | ||
| # This means they can be omitted correctly and prevents the need for pointers to structs. | ||
| policy: SuggestFix | ||
| uniqueMarkers: | ||
| namingconventions: | ||
| conventions: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it would make sense to add one for https://github.com/openshift/enhancements/blob/master/dev-guide/api-conventions.md#use-resource-name-rather-than-kind-in-object-references ? I think this could have a violation matcher that catches There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good shout |
||
| - name: norefs | ||
| violationMatcher: "(?i)ref(erence)?s?$" | ||
| operation: Drop | ||
| message: "reference fields should not need to be named ref(s)/reference(s)" | ||
| - name: nokind | ||
| violationMatcher: "^Kind$" | ||
| operation: Replacement | ||
| replacement: "Resource" | ||
| message: "API Kinds can be ambiguous and should be replaced with Resource" | ||
| uniquemarkers: | ||
| customMarkers: | ||
| - identifier: "openshift:validation:FeatureGateAwareEnum" | ||
| attributes: | ||
|
|
||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kubebuilder:validation:Patternas we prefer using CEL expressions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kubebuilder:validation:UniqueItemsas well? IIRC this marker doesn't actually work right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah those are both good suggestions