On 23 Nov 2018, at 09:17, Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:
>I think that the standard functionality – telling user to write a
>nicer code – isn't a good one for Zshell. For example: telling user to
>use `if' instead of [[ ... ]] && { ... ((1)); } || { ... } – I think
>this is wrong for Zshell, where the "density" of code increases as
>skills increase
ShellCheck doesn't tell you to avoid the `foo && bar || baz` construction
because `if` is less dense, it's because many people mistakenly assume that it's
equivalent to `if foo; then bar; else baz; fi`, and their script fails in
unexpected ways as a result. The linter obv has no way of knowing what the
person who wrote the code actually meant, all it can do is warn them that it's
dangerous. Just like `if ( foo = bar ) { ... }` in C-like languages
Anyway, i can't think of any ShellCheck warnings that aren't suitable for zsh,
aside from the ones that are obviously functionally/syntactically irrelevant
(must use [@] with arrays, can't use `{1..$n}`, must quote parameter expansions
to prevent globbing, &c.). All of the other stuff about escaping, and quoting,
and not trying to parse ls, and not doing `echo $(cmd)`, and so on, is just as
valid when writing zsh scripts
dana