cloudfoundry-incubator / kubecf

Cloud Foundry on Kubernetes
Apache License 2.0
115 stars 62 forks source link

Enable option shellcheck rules: quote-safe-variables and require-variable-braces #1069

Open jandubois opened 4 years ago

jandubois commented 4 years ago

I thought both rules were already part of our coding style, but they are not enforced by our shellcheck config:

name:    quote-safe-variables
desc:    Suggest quoting variables without metacharacters
example: var=hello; echo $var
fix:     var=hello; echo "$var"

name:    require-variable-braces
desc:    Suggest putting braces around all variable references
example: var=hello; echo $var
fix:     var=hello; echo ${var}

@mook-as agreed that we should enable them.

Describe the solution you'd like

This simply requires enabling both options from the commandline:

shellcheck --enable quote-safe-variables --enable require-variable-braces ...

The bigger work will be bringing all the files in the repo in compliance with these rules. 😄

viovanov commented 4 years ago

+1 Anything missing from this guide? https://google.github.io/styleguide/shellguide.html

Would also like to understand what the github superlinter brings to the table here.