Closed PaulCharlton closed 3 days ago
shfmt can be used locally to coerce a file to cooperate by overwriting it with the desired format as follows:
shfmt -d -i 2 -ci -sr -kp -s -sr -w foo.sh
Nobody asked for this and now I'm annoyed that you're spamming our bug tracker with duplicate issues (presumably with some kind of script).
toil: update all shell scripts to pass static analysis with shfmt
I imagine there may be several round trips on this issue to get an agreed style guide.
at the moment, the formatting required is configured as follows:
and
whilst
shellcheck
has a lot of knobs to twiddle for various styles and usage, the default enforces POSIX bash definition fairly well.however,
shfmt
has very few knobs, mostly via command line arguments, and the default above represents: 1) output diff between existing and desired format 2) 2 spaces per indent instead of tabs 3) indents inside of case statement 4) space around redirects which pretty much just adds spaces after redirect stream operators 5) "simplify" which eliminates redundant operators such as: 1) "$" prefix on variable names inside of "((...))"related: #307