chmeliik / checkton

Runs ShellCheck on Tekton yaml files (and other yaml files, but mainly Tekton)
6 stars 0 forks source link

var is referenced but not assigned for env variables #45

Open johnbieren opened 4 months ago

johnbieren commented 4 months ago

The shellchecker reports var is referenced but not assigned. when you define something in the tekton step env. For example, this

      env:
        - name: gwCert
           valueFrom:
            secretKeyRef:
              name: $(params.gwSecret)
              key: cert

results in shellchecker reporting

SC2154
gwCert is referenced but not assigned.
chmeliik commented 4 months ago

Would using UPPER_CASE variable naming work for you? That's the shellcheck convention for variables coming from outside the script itself.

Lowercase external variables will be reported as undefined unless you assert otherwise (e.g. with a declare statement or a # shellcheck: disable <error-code>)

johnbieren commented 4 months ago

Ah, I did not know that. Just confirmed, using uppercase naming leads to shellchecker no longer reporting an issue. That is sufficient for me - I will leave it up to you if you want to leave this open for supporting it even if not uppercase or just close it