Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: What a Zsh linter should do?
- X-seq: zsh-workers 43839
- From: dana <dana@xxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: What a Zsh linter should do?
- Date: Fri, 23 Nov 2018 13:19:41 -0600
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8DGHGrjPOMTyeOBAvthW8CwetUSoWp27+aX3OWsKIBs=; b=zSKwZ6+lk9SHpE0S/OfuCtVayJufcj0+m2AKQ5Q/K2cxRRn2LecoeN2aJam6MCNGyw FxoPdHUMpOkIsoYdT9DYbnGbSDtFMt8LBD13ey5d9AkCTAxSRIXYkVK2XWmKGA9s5L1v JVNWkeMVmcPSWhfNzY7mSXtig18WYf+wrKn0MSQRaJzXzaFkQ6HQdOtfju6wrWL8+m0Q AL9dpZ1Up+zLzY4Q6fxRrV0F/F0Y2vA3rBVBmNgk9evHmIBt8TqwI9yo3ThXOn9eBawu L6Uw0ajqm5age9q9oGdhgO4DUHHK3paGlDwKskLHKzc/vasF0+x+eaPTLlTMxEk4bVs4 Lohg==
- In-reply-to: <CAKc7PVBrvLLF1w9WQeH2FjOSDV6gkyuPnG4nkG55B8kEmZPAWw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVBrvLLF1w9WQeH2FjOSDV6gkyuPnG4nkG55B8kEmZPAWw@mail.gmail.com>
On 23 Nov 2018, at 09:17, Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author