mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
Merge pull request #135122 from itzPranshul/liner-enablement
Enable optionalfields rule for Kube API linter
This commit is contained in:
@@ -161,7 +161,22 @@ linters:
|
||||
path: "staging/src/k8s.io/api/events/(v1|v1beta1)/types.go"
|
||||
- text: 'notimestamp: naming convention "notimestamp": field AllocationResult.AllocationTimestamp: prefer use of the term ''time'' over ''timestamp'''
|
||||
path: "staging/src/k8s.io/api/resource/(v1|v1beta1|v1beta2)/types.go"
|
||||
|
||||
# optionalfields - Ignore optionalfields issues for existing API group
|
||||
# TODO: For each existing API group, we aim to remove it over time.
|
||||
- text: "optionalfields: field .* should (?:be a pointer|have the omitempty tag)\\."
|
||||
path: "staging/src/k8s.io/api/(admission|admissionregistration|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|imagepolicy|networking|node|policy|rbac|resource|scheduling|storage|storagemigration)"
|
||||
- text: "optionalfields: field StorageVersionCondition.ObservedGeneration should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Spec should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Status should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersionCondition.LastTransitionTime should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Spec should have the omitempty tag."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Status should have the omitempty tag."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
# Pre-existing issues from the conflictmarkers linter
|
||||
# The Error field in some older API types is marked as both optional and required.
|
||||
# This is incorrect, but cannot be changed without breaking changes.
|
||||
@@ -417,7 +432,7 @@ linters:
|
||||
- "nonullable" # Ensure fields are not marked as nullable.
|
||||
# - "nophase" # Ensure field names do not have the word "phase" in them.
|
||||
- "notimestamp" # Ensure fields are not named "timestamp", prefer "time".
|
||||
# - "optionalfields" # Ensure fields marked optional have omitempty and pointers.
|
||||
- "optionalfields" # Ensure fields marked optional have omitempty and pointers.
|
||||
- "optionalorrequired" # Every field should be marked as `+optional` xor `+required`.
|
||||
# - "requiredfields" # Required fields should only be pointers when required based on the validity of the zero value, they should always have `omitempty`.
|
||||
- "ssatags" # Ensure lists have a listType tag.
|
||||
|
||||
@@ -176,7 +176,22 @@ linters:
|
||||
path: "staging/src/k8s.io/api/events/(v1|v1beta1)/types.go"
|
||||
- text: 'notimestamp: naming convention "notimestamp": field AllocationResult.AllocationTimestamp: prefer use of the term ''time'' over ''timestamp'''
|
||||
path: "staging/src/k8s.io/api/resource/(v1|v1beta1|v1beta2)/types.go"
|
||||
|
||||
# optionalfields - Ignore optionalfields issues for existing API group
|
||||
# TODO: For each existing API group, we aim to remove it over time.
|
||||
- text: "optionalfields: field .* should (?:be a pointer|have the omitempty tag)\\."
|
||||
path: "staging/src/k8s.io/api/(admission|admissionregistration|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|imagepolicy|networking|node|policy|rbac|resource|scheduling|storage|storagemigration)"
|
||||
- text: "optionalfields: field StorageVersionCondition.ObservedGeneration should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Spec should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Status should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersionCondition.LastTransitionTime should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Spec should have the omitempty tag."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Status should have the omitempty tag."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
# Pre-existing issues from the conflictmarkers linter
|
||||
# The Error field in some older API types is marked as both optional and required.
|
||||
# This is incorrect, but cannot be changed without breaking changes.
|
||||
@@ -430,7 +445,7 @@ linters:
|
||||
- "nonullable" # Ensure fields are not marked as nullable.
|
||||
# - "nophase" # Ensure field names do not have the word "phase" in them.
|
||||
- "notimestamp" # Ensure fields are not named "timestamp", prefer "time".
|
||||
# - "optionalfields" # Ensure fields marked optional have omitempty and pointers.
|
||||
- "optionalfields" # Ensure fields marked optional have omitempty and pointers.
|
||||
- "optionalorrequired" # Every field should be marked as `+optional` xor `+required`.
|
||||
# - "requiredfields" # Required fields should only be pointers when required based on the validity of the zero value, they should always have `omitempty`.
|
||||
- "ssatags" # Ensure lists have a listType tag.
|
||||
|
||||
@@ -37,7 +37,22 @@
|
||||
path: "staging/src/k8s.io/api/events/(v1|v1beta1)/types.go"
|
||||
- text: 'notimestamp: naming convention "notimestamp": field AllocationResult.AllocationTimestamp: prefer use of the term ''time'' over ''timestamp'''
|
||||
path: "staging/src/k8s.io/api/resource/(v1|v1beta1|v1beta2)/types.go"
|
||||
|
||||
# optionalfields - Ignore optionalfields issues for existing API group
|
||||
# TODO: For each existing API group, we aim to remove it over time.
|
||||
- text: "optionalfields: field .* should (?:be a pointer|have the omitempty tag)\\."
|
||||
path: "staging/src/k8s.io/api/(admission|admissionregistration|apps|authentication|authorization|autoscaling|batch|certificates|coordination|core|discovery|events|extensions|flowcontrol|imagepolicy|networking|node|policy|rbac|resource|scheduling|storage|storagemigration)"
|
||||
- text: "optionalfields: field StorageVersionCondition.ObservedGeneration should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Spec should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Status should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersionCondition.LastTransitionTime should be a pointer."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Spec should have the omitempty tag."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
- text: "optionalfields: field StorageVersion.Status should have the omitempty tag."
|
||||
path: "staging/src/k8s.io/api/apiserverinternal/v1alpha1/types.go"
|
||||
# Pre-existing issues from the conflictmarkers linter
|
||||
# The Error field in some older API types is marked as both optional and required.
|
||||
# This is incorrect, but cannot be changed without breaking changes.
|
||||
|
||||
@@ -16,7 +16,7 @@ linters:
|
||||
- "nonullable" # Ensure fields are not marked as nullable.
|
||||
# - "nophase" # Ensure field names do not have the word "phase" in them.
|
||||
- "notimestamp" # Ensure fields are not named "timestamp", prefer "time".
|
||||
# - "optionalfields" # Ensure fields marked optional have omitempty and pointers.
|
||||
- "optionalfields" # Ensure fields marked optional have omitempty and pointers.
|
||||
- "optionalorrequired" # Every field should be marked as `+optional` xor `+required`.
|
||||
# - "requiredfields" # Required fields should only be pointers when required based on the validity of the zero value, they should always have `omitempty`.
|
||||
- "ssatags" # Ensure lists have a listType tag.
|
||||
|
||||
Reference in New Issue
Block a user