From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 54b41008 for ; Fri, 23 Nov 2018 19:20:06 +0000 (UTC) Received: (qmail 17074 invoked by alias); 23 Nov 2018 19:19:51 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43839 Received: (qmail 6428 invoked by uid 1010); 23 Nov 2018 19:19:51 -0000 X-Qmail-Scanner-Diagnostics: from mail-it1-f181.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(209.85.166.181):SA:0(-3.4/5.0):. Processed in 4.570612 secs); 23 Nov 2018 19:19:51 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8DGHGrjPOMTyeOBAvthW8CwetUSoWp27+aX3OWsKIBs=; b=k4owDRhIXNU6Vn10enoEAhHkixMyVu6ODrbTA/eWXvnz7z/w5gDXnMBw+884yBrWJK kAHzsdKgs2riiGoUXPN0riVSellDXClIaVbRm1XD5bP9YhmP6c2Nooxfi4+pa6fTTZ4u OJZT4s1Calh0l4KOnggFAWGy9ahsdqlc7/8YgjRQnL6U6AQd5YrfiVmyWyMvfgwSMA+9 TCLdWt0mB6C5CvQcjvLmvALgwY3SC0T4BbYUanqiGLB6gaGfEQHQmlVZncv7FSo5lAlf Lj5iPvWBfHL9SnfXkrNrrLsG+rL81mcit2NBCNxKc/tTrtbaBWI/wsU+ZTdkBm0s3vF3 qpng== X-Gm-Message-State: AA+aEWa9XX742lpTEVY5v2/fWfhWfUny4C4yJeMhs2G+xBzo+xD0nKTG OpVSD3IXVovCt1y6+H4jENMKmA== X-Google-Smtp-Source: AFSGD/WFaqFxTyFe+LIDd1ae4dZx7Dn0VbWxUTN3T5LyGpFiQBRwJ+20/We86/yj/r73vKsiwFqpwQ== X-Received: by 2002:a02:2586:: with SMTP id g128-v6mr14671812jag.122.1543000783033; Fri, 23 Nov 2018 11:19:43 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: Re: What a Zsh linter should do? From: dana In-Reply-To: Date: Fri, 23 Nov 2018 13:19:41 -0600 Cc: Zsh hackers list Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Sebastian Gniazdowski X-Mailer: Apple Mail (2.3445.100.39) On 23 Nov 2018, at 09:17, Sebastian Gniazdowski = wrote: >I think that the standard functionality =E2=80=93 telling user to write = a >nicer code =E2=80=93 isn't a good one for Zshell. For example: telling = user to >use `if' instead of [[ ... ]] && { ... ((1)); } || { ... } =E2=80=93 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 =3D 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