Documentation
¶
Overview ¶
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
The `noreferences` linter ensures that field names use 'Ref'/'Refs' instead of 'Reference'/'References'. By default, `noreferences` is enabled and enforces this naming convention. The linter checks that 'Reference' is present at the beginning or end of the field name, and replaces it with 'Ref'. Similarly, 'References' anywhere in field names is replaced with 'Refs'.
Example configuration: Default behavior (allow Ref/Refs in field names):
lintersConfig: noreferences: policy: PreferAbbreviatedReference
Strict mode (forbid Ref/Refs in field names):
lintersConfig: noreferences: policy: NoReferences
When `policy` is set to `PreferAbbreviatedReference` (the default), fields containing 'Ref' or 'Refs' are allowed. The policy can be set to `NoReferences` to also report errors for 'Ref' or 'Refs' in field names.
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initializer ¶
func Initializer() initializer.AnalyzerInitializer
Initializer returns the AnalyzerInitializer for this Analyzer so that it can be added to the registry.
Types ¶
type Config ¶
type Config struct {
// policy controls how reference-related words are handled in field names.
// When set to PreferAbbreviatedReference (default), Reference/References are replaced with Ref/Refs.
// When set to NoReferences, all reference-related words are suggested to be removed.
Policy Policy `json:"policy,omitempty"`
}
Config represents the configuration for the noreferences linter.
type Policy ¶
type Policy string
Policy defines the policy for handling references in field names.
const ( // PolicyPreferAbbreviatedReference allows abbreviated forms (Ref/Refs) in field names. // It suggests replacing Reference/References with Ref/Refs. PolicyPreferAbbreviatedReference Policy = "PreferAbbreviatedReference" // PolicyNoReferences forbids any reference-related words in field names. // It suggests removing Ref/Refs/Reference/References entirely. PolicyNoReferences Policy = "NoReferences" )