From: dana <dana@dana.is>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: What a Zsh linter should do?
Date: Fri, 23 Nov 2018 13:19:41 -0600 [thread overview]
Message-ID: <DEF24E0A-B066-4C05-96C4-12D47B193FFA@dana.is> (raw)
In-Reply-To: <CAKc7PVBrvLLF1w9WQeH2FjOSDV6gkyuPnG4nkG55B8kEmZPAWw@mail.gmail.com>
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
prev parent reply other threads:[~2018-11-23 19:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-23 15:17 Sebastian Gniazdowski
2018-11-23 19:19 ` dana [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DEF24E0A-B066-4C05-96C4-12D47B193FFA@dana.is \
--to=dana@dana.is \
--cc=sgniazdowski@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).