Skip to content
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

Modify rule S117: Add exception to kubernetes language #4558

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions rules/S117/kubernetes/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@
:identifier: local variable and function parameter
:identifier_plural: local variables and function parameters
:identifier_or: local variable or function parameter
:regex: ^[a-z][a-zA-Z0-9]*$
:regex: ^\$[a-z][a-zA-Z0-9]*$

include::../rule.adoc[]

include::../introduction.adoc[]

include::../why-is-this-an-issue.adoc[]

=== Exceptions

The rule does not raise an issue on the usages of the blank identifier `$_` or the root context `$`.

include::../what-is-the-potential-impact.adoc[]

include::../how-to-fix-it.adoc[]

As a default, we suggest using the camelCase naming convention, as this is widely adopted for variables in Helm.


=== Code examples

==== Noncompliant code example
Expand Down Expand Up @@ -51,11 +63,20 @@ data:
{{ $keyC }}: {{ $valC | quote }}
{{- end }}
----

[source,text]
----
# Usage of blank identifier
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className -}}

# Usage of root context
{{- $ := . -}}
----
== Resources

=== Documentation


* Helm documentation - https://helm.sh/docs/chart_template_guide/variables/[Helm - Variables]
* Go documentation - https://go.dev/doc/effective_go#names[Effective Go - Names]
* Wikipedia - https://en.wikipedia.org/wiki/Naming_convention_(programming)[Naming Convention (programming)]

Expand Down
Loading