Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 22 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ linters:
settings:
linters:
enable:
- forbiddenmarkers
- maxlength
- namingconventions
- nobools
- nomaps
- statussubresource
Expand All @@ -20,6 +22,13 @@ linters:
isFirstField: Warn
usePatchStrategy: Ignore
useProtobuf: Ignore
forbiddenmarkers:
markers:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubebuilder:validation:Pattern as we prefer using CEL expressions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubebuilder:validation:UniqueItems as well? IIRC this marker doesn't actually work right?

Copy link
Contributor Author

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

- 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
Expand All @@ -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).
Expand All @@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

The 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 Kind naming and suggest a fix that it should be Resource instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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:
Expand Down
181 changes: 94 additions & 87 deletions tools/go.mod

Large diffs are not rendered by default.

492 changes: 209 additions & 283 deletions tools/go.sum

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions tools/vendor/cloud.google.com/go/auth/CHANGES.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions tools/vendor/cloud.google.com/go/auth/auth.go

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.

Loading