Skip to content

Refactor spacing using nindent #205

@cognifloyd

Description

@cognifloyd

It's difficult to read through our templates with many layers of yaml vs template indentation.
Also, it's hard to quickly see if the correct indentation will result due to {{- space chomping, which if too aggressive could accidentally put two separate lines on the same line.

The situation would be much better if we used nindent instead of indent in various places so that we can keep our template indentation closer to the yaml indentation. nindent adds a newline at the start of the block, and then indents the block, which means you always know that the template will end up starting on the right line (not the previous line as when using {{-).
ie do this:

      imagePullSecrets:
      {{- if .Values.st2.packs.images }}
-{{- include "packs-pullSecrets" . | indent 6 }}
+       {{- include "packs-pullSecrets" . | nindent 6 }}
      {{- end }}

Such a change will invole a lot of whitespace change (which is the whole point), which would mean that any open PRs would need to be rebased to also use the improved template indentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions