diff --git a/.golangci.yml b/.golangci.yml index 8fc2ee8eeb..99076e3acd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,6 +18,7 @@ linters: - govet - importas - ineffassign + - misspell - noctx - staticcheck - structcheck diff --git a/pkg/engine/utils.go b/pkg/engine/utils.go index 4f9a732f72..3605b60a86 100644 --- a/pkg/engine/utils.go +++ b/pkg/engine/utils.go @@ -295,7 +295,7 @@ func MatchesResourceDescription(resourceRef unstructured.Unstructured, ruleRef k reasonsForFailure = append(reasonsForFailure, fmt.Errorf("no resource matched")) } } else if len(rule.MatchResources.All) > 0 { - // include object if ALL of the criterias match + // include object if ALL of the criteria match for _, rmr := range rule.MatchResources.All { reasonsForFailure = append(reasonsForFailure, matchesResourceDescriptionMatchHelper(rmr, admissionInfo, resource, dynamicConfig, namespaceLabels)...) } @@ -305,12 +305,12 @@ func MatchesResourceDescription(resourceRef unstructured.Unstructured, ruleRef k } if len(rule.ExcludeResources.Any) > 0 { - // exclude the object if ANY of the criterias match + // exclude the object if ANY of the criteria match for _, rer := range rule.ExcludeResources.Any { reasonsForFailure = append(reasonsForFailure, matchesResourceDescriptionExcludeHelper(rer, admissionInfo, resource, dynamicConfig, namespaceLabels)...) } } else if len(rule.ExcludeResources.All) > 0 { - // exlcude the object if ALL the criterias match + // exclude the object if ALL the criteria match excludedByAll := true for _, rer := range rule.ExcludeResources.All { // we got no errors inplying a resource did NOT exclude it @@ -321,7 +321,7 @@ func MatchesResourceDescription(resourceRef unstructured.Unstructured, ruleRef k } } if excludedByAll { - reasonsForFailure = append(reasonsForFailure, fmt.Errorf("resource excluded since the combination of all criterias exclude it")) + reasonsForFailure = append(reasonsForFailure, fmt.Errorf("resource excluded since the combination of all criteria exclude it")) } } else { rer := kyverno.ResourceFilter{UserInfo: rule.ExcludeResources.UserInfo, ResourceDescription: rule.ExcludeResources.ResourceDescription} @@ -368,7 +368,7 @@ func matchesResourceDescriptionExcludeHelper(rer kyverno.ResourceFilter, admissi excludeErrs := doesResourceMatchConditionBlock(rer.ResourceDescription, rer.UserInfo, admissionInfo, resource, dynamicConfig, namespaceLabels) // it was a match so we want to exclude it if len(excludeErrs) == 0 { - errs = append(errs, fmt.Errorf("resource excluded since one of the criterias excluded it")) + errs = append(errs, fmt.Errorf("resource excluded since one of the criteria excluded it")) errs = append(errs, excludeErrs...) } } diff --git a/pkg/openapi/validation.go b/pkg/openapi/validation.go index 8382a38d18..ce84098212 100644 --- a/pkg/openapi/validation.go +++ b/pkg/openapi/validation.go @@ -46,7 +46,7 @@ type Controller struct { kindToAPIVersions concurrentMap } -// apiVersions stores all available gvks for a kind, a gvk is "/" seperated string +// apiVersions stores all available gvks for a kind, a gvk is "/" separated string type apiVersions struct { serverPreferredGVK string gvks []string diff --git a/pkg/policy/validate.go b/pkg/policy/validate.go index b9e8354075..68fd42e66f 100644 --- a/pkg/policy/validate.go +++ b/pkg/policy/validate.go @@ -926,7 +926,7 @@ func validateImageRegistry(entry kyverno.ContextEntry) error { // Replace all variables to prevent validation failing on variable keys. ref := variables.ReplaceAllVars(entry.ImageRegistry.Reference, func(s string) string { return "kyvernoimageref" }) - // it's no use validating a refernce that contains a variable + // it's no use validating a reference that contains a variable if !strings.Contains(ref, "kyvernoimageref") { _, err := reference.Parse(ref) if err != nil {