This rule raises an issue when template directives do not have a whitespace after the opening braces and before the closing braces.
It's based on best practices in Helm and emphasizes the importance of maintaining this whitespace for better readability and understanding of the code.

== Why is this an issue?
The absence of whitespace in template directives in Helm can lead to several issues:

*Readability*: Code is read more often than it is written.
When template directives are tightly packed without whitespaces, it can be challenging to distinguish between the braces and the content inside.
This can slow down the process of understanding the code, especially for those who are new to the codebase.

*Maintainability*: Hard-to-read code is also hard to maintain.
If a developer struggles to understand what a piece of code does due to poor formatting, they may introduce bugs when they try to modify it.

In summary, not having a whitespace after the opening brace and before the closing brace in template directives can make the code harder to read, understand, and maintain.

== How to fix it in Helm

To fix this issue, add a whitespace after the opening braces `{{` and before the closing braces `}}` in template directives.

=== Code examples

==== Noncompliant code example

[source,yaml,diff-id=1,diff-type=noncompliant]
----
apiVersion: v1
kind: Pod
metadata:
  name: {{.Values.podName}} # Noncompliant
spec:
  containers:
  - name: containerName
----

==== Compliant solution

[source,yaml,diff-id=1,diff-type=compliant]
----
apiVersion: v1
kind: Pod
metadata:
  name: {{ .Values.podName }}
spec:
  containers:
  - name: containerName
----

== Resources
=== Documentation
* Helm Best Practices - https://helm.sh/docs/chart_best_practices/templates/#formatting-templates[Formatting Templates]
* Go Documentation - https://pkg.go.dev/text/template?utm_source=godoc#hdr-Text_and_spaces[Text and spaces]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

If possible try to display a specific message tailored to the issue.

* Add a whitespace after `{{` in the template directive.
* Add a whitespace before `}}` in the template directive.

=== Highlighting

* Highlight the template directive that does not have a whitespace after opening braces `{{` or before closing braces `}}`.

endif::env-github,rspecator-view[]
