GNU bug report logs - #57884
[PATCH] Flymake backend using the shellcheck program

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Augusto Stoffel <arstoffel@HIDDEN>; Keywords: patch; dated Sat, 17 Sep 2022 16:49:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 19 Sep 2022 07:34:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 19 03:34:05 2022
Received: from localhost ([127.0.0.1]:52144 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oaBI5-0004oC-Kc
	for submit <at> debbugs.gnu.org; Mon, 19 Sep 2022 03:34:05 -0400
Received: from mail-ed1-f52.google.com ([209.85.208.52]:45976)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1oaBI2-0004nf-1r
 for 57884 <at> debbugs.gnu.org; Mon, 19 Sep 2022 03:34:03 -0400
Received: by mail-ed1-f52.google.com with SMTP id m3so20141855eda.12
 for <57884 <at> debbugs.gnu.org>; Mon, 19 Sep 2022 00:34:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date;
 bh=//6fvi3tNG6Oz11pa4AOCwrHjDiUUhNgeT6Tlw0lcsE=;
 b=T1peftUc9ubFeHKyoOQNRWWmdqd3vTgxpEWdhxe2dOa5ssHupCj7hdLPzE3vlipEjP
 98hhm13TX/2CKduHB/1q2K4sqq4cMC6bQ6fjs2K7JGQHd/Rw52yMMu9XKGcktmMg2GTb
 fKuIuAwKiw7sEZSb0yohzHCs4Ehk9qvlbzUuoVu2srkaEmZpyaqwWVIpR2uUa/0dqIrH
 cO8+I27hjpjXBm4iik88irL7zDMJqaCmEyerhje9r4TuG/fyBIKJtnCQ3BnAu/hfaASW
 +EIctGIXd3LIE57mFqeICjEFrt00C6fmTj3A9e1PAH52PHpOcoPbV1sUR7sPRGyAzaIj
 jjzg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date;
 bh=//6fvi3tNG6Oz11pa4AOCwrHjDiUUhNgeT6Tlw0lcsE=;
 b=lqRdu5KZByBkWtyQyaOeVxK42lEcSeyqyW1WiRijlQcac9rn36VHJdDdw7OxlRaTyd
 NmV7gcLkY/2O6GfkBNvX5FfVdPcmJHOtfzlItR4oatZ9mmKQoXZpWgL1tLFDmRu5t3RZ
 e1ZUdqtgV7Cm6Yx3RZqYNZw1enr1dFnylVastOlYrqJ0ieBqRQaIuU18W2jdhkX3+4lk
 +fWpG7NdEtuQZ0Xyr0A10RllzV85fJYbf7JZ1MmHg4dVCjkcN4d5G4BZgwM1gDc5p5fj
 BzdDlBbUuqdE4Kija+aWXP47L2nmFJsn1TplKVz0R6rF+1G8n3OAQ/3nIhilWmN+PEAj
 kyTA==
X-Gm-Message-State: ACrzQf2ckO6l8RLtaukqW/BO1rssMeqJPB+5CS4/ODWa+6gk/QDqNhA/
 0vpxdy8b3sZigQD1+wxF+3o=
X-Google-Smtp-Source: AMsMyM5Z4E/t1iLMQ0VLu1HtpagKL1Tt0W7izUzSmg5xmtiftqHcoT6n+I3D+RIT7CtiJLhOcHAecA==
X-Received: by 2002:aa7:d617:0:b0:44e:d2de:3fe1 with SMTP id
 c23-20020aa7d617000000b0044ed2de3fe1mr14747710edr.104.1663572836092; 
 Mon, 19 Sep 2022 00:33:56 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8510])
 by smtp.gmail.com with ESMTPSA id
 z15-20020a170906434f00b007413360a48fsm4031246ejm.50.2022.09.19.00.33.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 19 Sep 2022 00:33:55 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <87sfko755f.fsf@HIDDEN> (Philip Kaludercic's message of "Sun, 
 18 Sep 2022 21:18:36 +0000")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN> <87zgewdhhd.fsf@HIDDEN>
 <87fsgoyi0l.fsf@HIDDEN> <87sfko4zjq.fsf@HIDDEN>
 <87edw8n71p.fsf@HIDDEN> <8735co4wxx.fsf@HIDDEN>
 <878rmgcw2e.fsf@HIDDEN> <87h7148mba.fsf@HIDDEN>
 <87sfko755f.fsf@HIDDEN>
Date: Mon, 19 Sep 2022 09:33:54 +0200
Message-ID: <87h713es2l.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sun, 18 Sep 2022 at 21:18, Philip Kaludercic wrote:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
>>> Anyway, I rewrote the backend to use the JSON output of shellcheck,
>>> which has the advantage that it provides the end position of each
>>> diagnostic, so Flymake doesn't have to guess it (which is by nature
>>> sometimes inaccurate).  Let me know what you think.
>>
>> LGTM, but I haven't tested it yet.
>
> I just tried it out and it behaves the way you advertised it.

Okay, so for whoever feels inclined to merge this, please consider the
patch in my message of Sun, 18 Sep 2022 21:38:17 +0200.

> BTW, this diff describes the changes required if you were to pull out
> the sentinel definition into a named function:
> [...]
> I still don't think it looks that bad, but I don't insist on it.

I still don't understand the motivation for this.  Closures are the
perfect tool for this job, and you seem to be just reinventing them. If
I wanted to create a helper function (which I don't really find
necessary from the code organization perspective in this case, although
it might well be in the proselint case), then I'd pass this as :sentinel
argument to make-process:

  (lambda (proc _event) (helper-function proc source report-fn))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 21:18:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 17:18:57 2022
Received: from localhost ([127.0.0.1]:51416 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oa1gk-0004N6-0c
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 17:18:57 -0400
Received: from mout02.posteo.de ([185.67.36.66]:57577)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1oa1ga-0004Mk-Kp
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 17:18:51 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 26734240108
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 23:18:38 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1663535919; bh=haQIXtEeNnXZrGdVyARqq4ZXq4rnYj605lMDzQmYvDE=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=m9I+KLU/+O+8BZdU0/34UM4NY57UePUBaeXAkxOiUb5JbfsDHiPg/VXExQSrVkxiQ
 hxrLiDVoFlPB/X7U8c9eZZVo24t4mCawNmXMV7DPXOfQPZmuXHt1zVgDL1gE0OnBmG
 blyt2T1xO1+XqZMIhuB71iX7Jccq3LbmUpwsRl4rUljPw7ygoM7o46f5phg97z+FS8
 gEjTA1cF/t/JYZF9OTQoKOwUdGdNDeJ4DNPSlqbHTW9j/fN1mivTVsylYBM85k9IaK
 yBuuHE0/6JpFXCRU1m4BEUteFqh/LnAJAusgsVI2oDUSnuOYSGK13Twy/GvwbQaSd8
 onB7jow2O96Og==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4MW0zJ62L4z9rxP;
 Sun, 18 Sep 2022 23:18:36 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <87h7148mba.fsf@HIDDEN> (Philip Kaludercic's message of "Sun, 
 18 Sep 2022 22:22:33 +0200")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN> <87zgewdhhd.fsf@HIDDEN>
 <87fsgoyi0l.fsf@HIDDEN> <87sfko4zjq.fsf@HIDDEN>
 <87edw8n71p.fsf@HIDDEN> <8735co4wxx.fsf@HIDDEN>
 <878rmgcw2e.fsf@HIDDEN> <87h7148mba.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sun, 18 Sep 2022 21:18:36 +0000
Message-ID: <87sfko755f.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Philip Kaludercic <philipk@HIDDEN> writes:

>> Anyway, I rewrote the backend to use the JSON output of shellcheck,
>> which has the advantage that it provides the end position of each
>> diagnostic, so Flymake doesn't have to guess it (which is by nature
>> sometimes inaccurate).  Let me know what you think.
>
> LGTM, but I haven't tested it yet.

I just tried it out and it behaves the way you advertised it.

BTW, this diff describes the changes required if you were to pull out
the sentinel definition into a named function:


--=-=-=
Content-Type: text/plain
Content-Disposition: inline

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 558b62b20a..d52e385b36 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -3129,50 +3129,49 @@ 'sh--json-read
     (require 'json)
     'json-read))
 
+(defun sh-shellcheck-sentinel (proc _event)
+  (when (memq (process-status proc) '(exit signal))
+    (unwind-protect
+        (if (with-current-buffer (process-get proc 'source)
+              (not (eq proc sh--shellcheck-process)))
+            (flymake-log :warning "Canceling obsolete check %s" proc)
+          (with-current-buffer (process-buffer proc)
+            (goto-char (point-min))
+            (thread-last
+              (sh--json-read)
+              (alist-get 'comments)
+              (seq-filter
+               (lambda (item)
+                 (let-alist item (string= .file "-"))))
+              (mapcar
+               (lambda (item)
+                 (let-alist item
+                   (flymake-make-diagnostic
+                    (process-get proc 'source)
+                    (cons .line .column)
+                    (unless (and (eq .line .endLine)
+                                 (eq .column .endColumn))
+                      (cons .endLine .endColumn))
+                    (pcase .level
+                      ("error" :error)
+                      ("warning" :warning)
+                      (_ :note))
+                    (format "SC%s: %s" .code .message)))))
+              (funcall (process-get proc 'report-fn)))))
+      (kill-buffer (process-buffer proc)))))
+
 (defun sh-shellcheck-flymake (report-fn &rest _args)
   "Flymake backend using the shellcheck program.
 Takes a Flymake callback REPORT-FN as argument, as expected of a
 member of `flymake-diagnostic-functions'."
   (when (process-live-p sh--shellcheck-process)
     (kill-process sh--shellcheck-process))
-  (let* ((source (current-buffer))
-         (dialect (named-let recur ((s sh-shell))
+  (let* ((dialect (named-let recur ((s sh-shell))
                     (pcase s
                       ((or 'bash 'dash 'sh) (symbol-name s))
                       ('ksh88 "ksh")
                       ((guard s)
-                       (recur (alist-get s sh-ancestor-alist))))))
-         (sentinel
-          (lambda (proc _event)
-            (when (memq (process-status proc) '(exit signal))
-              (unwind-protect
-                  (if (with-current-buffer source
-                        (not (eq proc sh--shellcheck-process)))
-                      (flymake-log :warning "Canceling obsolete check %s" proc)
-                    (with-current-buffer (process-buffer proc)
-                      (goto-char (point-min))
-                      (thread-last
-                        (sh--json-read)
-                        (alist-get 'comments)
-                        (seq-filter
-                         (lambda (item)
-                           (let-alist item (string= .file "-"))))
-                        (mapcar
-                         (lambda (item)
-                           (let-alist item
-                             (flymake-make-diagnostic
-                              source
-                              (cons .line .column)
-                              (unless (and (eq .line .endLine)
-                                           (eq .column .endColumn))
-                                (cons .endLine .endColumn))
-                              (pcase .level
-                                ("error" :error)
-                                ("warning" :warning)
-                                (_ :note))
-                              (format "SC%s: %s" .code .message)))))
-                        (funcall report-fn))))
-                (kill-buffer (process-buffer proc)))))))
+                       (recur (alist-get s sh-ancestor-alist)))))))
     (unless dialect
       (error "`sh-shellcheck-flymake' is not suitable for shell type `%s'"
              sh-shell))
@@ -3185,7 +3184,9 @@ sh-shellcheck-flymake
                       "-s" ,dialect
                       ,@sh-shellcheck-arguments
                       "-")
-           :sentinel sentinel))
+           :sentinel #'sh-shellcheck-sentinel))
+    (process-put sh--shellcheck-process 'source (current-buffer))
+    (process-put sh--shellcheck-process 'report-fn report-fn)
     (save-restriction
       (widen)
       (process-send-region sh--shellcheck-process (point-min) (point-max))

--=-=-=
Content-Type: text/plain


I still don't think it looks that bad, but I don't insist on it.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 20:22:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 16:22:55 2022
Received: from localhost ([127.0.0.1]:51380 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oa0oZ-0002yy-1N
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 16:22:55 -0400
Received: from mout02.posteo.de ([185.67.36.66]:38905)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1oa0oV-0002yg-Vw
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 16:22:54 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 8B6F924010B
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 22:22:44 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1663532564; bh=YRqjtMhu0fT//y5yqyWbi4RfIV93SYA5GMwiu7SQ86k=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=aKj+NTZfK9xpMMeb5O0Buel8waTUMMfPmAGMZZzR+rDVxbkWPMBy5GWzDYlw27ZzG
 ChoMb6rMTyDJDOnzm+gGuS+Ug/ctvYlVi/NfgcFWo/sPavxKrIhzBoJ+r959PoYqnh
 mftt7/tNKdjkcn3fivQDtKJfbpG7wWTRCvK1lmPElnTyrA6/tFJshkhdn9UKUi2G2y
 aTsOqrvvPR9QCWNpHcZd+17Asbe3fAE2k3wI06dJV4AHNGVOeVqPUL3xShzSVffzzY
 whpyuRvnLzorqYwCapa+OPJwTPfme5LgiDiJrkZtTup7AyIPx4HRiCFxBopKwuVjG1
 yPBI5RS7nw+bw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4MVzkd6dZZz9rxW;
 Sun, 18 Sep 2022 22:22:33 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <878rmgcw2e.fsf@HIDDEN> (Augusto Stoffel's message of "Sun, 18
 Sep 2022 21:38:17 +0200")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN> <87zgewdhhd.fsf@HIDDEN>
 <87fsgoyi0l.fsf@HIDDEN> <87sfko4zjq.fsf@HIDDEN>
 <87edw8n71p.fsf@HIDDEN> <8735co4wxx.fsf@HIDDEN>
 <878rmgcw2e.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sun, 18 Sep 2022 20:22:33 +0000
Message-ID: <87h7148mba.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Augusto Stoffel <arstoffel@HIDDEN> writes:

> On Sun, 18 Sep 2022 at 13:46, Philip Kaludercic wrote:
>
>>> I like in your backend that you read a JSON output, which presumably
>>> provides the start _and end_ of the diagnostic region.  How did you
>>> convert from line/column to buffer position?
>>
>> I didn't do that, Flymake takes care of that if you give it the buffer
>> position (unless I misunderstood something, but it appears to be working
>> for me).
>
> Okay, perhaps the docstring of `flymake-make-diagnostic' is easy to
> misinterpret, but apparently it works fine if one passes a (LINE . COL)
> cons for BEG and END, even if LOCUS is a buffer.  This would also mean
> that the call to `flymake-diag-region` in the example backend of the
> Flymake manual is unnecessary, so I'm a bit suspicious here.

The example backend in the manual has had issues before so I wouldn't be
surprised if this were the case.

> Anyway, I rewrote the backend to use the JSON output of shellcheck,
> which has the advantage that it provides the end position of each
> diagnostic, so Flymake doesn't have to guess it (which is by nature
> sometimes inaccurate).  Let me know what you think.

LGTM, but I haven't tested it yet.

> PS: What is the best practice w.r.t. the fact that json-serialize might
> not be available?  It seems that every library that needs to parse JSON
> has to define a new alias similar to sh--json-read here.  This is rather
> suboptimal...

All I can add is this: I've re-implemented the native-json functions in
Elisp for Compat[0], and it turns out to be more complicated than I had
initially expected -- though not impossible.  If anyone has Compat
installed these definitions will also be loaded even if the user is
running Emacs 27.1+, since the test case it uses to check if the
definition should be installed is:

        (not (condition-case nil
                 (equal (json-serialize '()) "{}")
               (:success t)
               (void-function nil)
               (json-unavailable nil)))

As Compat is part of GNU ELPA, we could just copy these definitions as
fallback into json.el and replace the tests with (fboundp ...) checks.

[0] https://git.sr.ht/~pkal/compat/tree/e827a9f3e2ba585de8b07cd246534a15ec414a8b/item/compat-27.el#L137




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 19:38:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 15:38:28 2022
Received: from localhost ([127.0.0.1]:51365 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oa07Y-0001ru-CZ
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 15:38:28 -0400
Received: from mail-ed1-f43.google.com ([209.85.208.43]:39748)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1oa07V-0001rg-P2
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 15:38:26 -0400
Received: by mail-ed1-f43.google.com with SMTP id f20so33977869edf.6
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 12:38:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date;
 bh=MhQujCn2hyQrn4rG6Yivj01/JjXu7NvPBvIUwPD2qbk=;
 b=Q8ApxpbYJki9lFMTZKskE+UFon2dRT0q+WTpA0s5hd8IbtiAi+Nkxuxr2mGHIgFj8D
 KIkSIPt/zPGqhov24ZMe54abhv73CI0TKKDzxSTYOQMAId4tvsMx9O7DwkjUySqAuOsG
 RaqtgBfS3YjxKjqRcO6g1eWi8Bw43i6iE99Drwqc8xrv+hNbuE3mRa43NxY9O2/hs0sW
 GVlaciiv/Nnzf+CwsYo5JfnSBTiDPLfWUvGVzo4fR+RVtvmFLxBTzy1oUPIAaYuZJ54t
 EUlo9E+lhDPqxE5/i8lRQWx1pKgIW5KsAU/Kbg/iyfwmarn1gB5K5pKB9lzN9IwLXOIk
 048g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date;
 bh=MhQujCn2hyQrn4rG6Yivj01/JjXu7NvPBvIUwPD2qbk=;
 b=sq11Bw2pnN5MdmnIlPCUIfpsbvodu9rQ8D0368e+ksCCCIWgiuozO3Y6N7dBI7vbku
 BQK1jnT9f/1anmYXkYPsYGXSP4Em/a6JzsSeloGsPaSWNhBmvVQHOm92ahwwmydpaHRD
 DgP3lY0BXWZE3A7j8SGC1R0PDkJPzbeqdx0ZdELriqsGqF73pBDbEnuNTFetPM0pbcGV
 jps43Vx9t3i6nDgoMwtxAqNJ1J4VM89oM6juCgyxR2ppOidoDQ01lpXJqcI/Lij/qDPz
 vj+chLBZf3lnTTCCPrRjRMvo2Q130TkIV+XUNXZwD1XCD4xxUMo7DmalL+/4VtWZ3AMV
 V8uA==
X-Gm-Message-State: ACrzQf0gf8Q2Cc/pDbbxJnqGZn5blKggW5liZixxj0V7WQzxb7ZYxQLi
 FuAWyHqtK6lFJu0YfYZK5+o=
X-Google-Smtp-Source: AMsMyM7ym4q5acpnGrGdF9Jec7IUs0Qnn2SRalnKcvLcRPGKpvGQ6AZ5TOWleMx/Tz4ZyXgNO9GyrA==
X-Received: by 2002:a05:6402:2c6:b0:44e:7d0a:c231 with SMTP id
 b6-20020a05640202c600b0044e7d0ac231mr12480865edx.283.1663529899884; 
 Sun, 18 Sep 2022 12:38:19 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8510])
 by smtp.gmail.com with ESMTPSA id
 d9-20020a50fb09000000b0045393e56488sm5021899edq.58.2022.09.18.12.38.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 18 Sep 2022 12:38:18 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <8735co4wxx.fsf@HIDDEN> (Philip Kaludercic's message of "Sun, 
 18 Sep 2022 13:46:34 +0000")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN> <87zgewdhhd.fsf@HIDDEN>
 <87fsgoyi0l.fsf@HIDDEN> <87sfko4zjq.fsf@HIDDEN>
 <87edw8n71p.fsf@HIDDEN> <8735co4wxx.fsf@HIDDEN>
Date: Sun, 18 Sep 2022 21:38:17 +0200
Message-ID: <878rmgcw2e.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

On Sun, 18 Sep 2022 at 13:46, Philip Kaludercic wrote:

>> I like in your backend that you read a JSON output, which presumably
>> provides the start _and end_ of the diagnostic region.  How did you
>> convert from line/column to buffer position?
>
> I didn't do that, Flymake takes care of that if you give it the buffer
> position (unless I misunderstood something, but it appears to be working
> for me).

Okay, perhaps the docstring of `flymake-make-diagnostic' is easy to
misinterpret, but apparently it works fine if one passes a (LINE . COL)
cons for BEG and END, even if LOCUS is a buffer.  This would also mean
that the call to `flymake-diag-region` in the example backend of the
Flymake manual is unnecessary, so I'm a bit suspicious here.

Anyway, I rewrote the backend to use the JSON output of shellcheck,
which has the advantage that it provides the end position of each
diagnostic, so Flymake doesn't have to guess it (which is by nature
sometimes inaccurate).  Let me know what you think.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-New-Flymake-backend-using-the-shellcheck-program.patch

From 49fbfaf98cb6d11b877eaa4a72b116aa61646d75 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@HIDDEN>
Date: Sat, 17 Sep 2022 18:30:04 +0200
Subject: [PATCH] New Flymake backend using the shellcheck program

See bug#57884.

* lisp/progmodes/sh-script.el: Require let-alist and subr-x when
compiling.
(sh--json-read): Helper function to deal with possible absence of
json-parse-buffer.
(sh-shellcheck-program, sh--shellcheck-process,
sh-shellcheck-flymake): Variables and function defining a Flymake
backend.
(sh-mode): Add it to 'flymake-diagnostic-functions'.
---
 etc/NEWS                    |  4 ++
 lisp/progmodes/sh-script.el | 90 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 93 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index a6a8883593..5b2ed16063 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1320,6 +1320,10 @@ This controls how statements like the following are indented:
     foo &&
         bar
 
+*** New Flymake backend using the ShellCheck program
+It is enabled by default, but requires that the external "shellcheck"
+command is installed.
+
 ** Cperl Mode
 
 ---
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 517fbbd8e7..558b62b20a 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -31,6 +31,9 @@
 ;; available for filenames, variables known from the script, the shell and
 ;; the environment as well as commands.
 
+;; A Flymake backend using the "shellcheck" program is provided.  See
+;; https://www.shellcheck.net/ for installation instructions.
+
 ;;; Known Bugs:
 
 ;; - In Bourne the keyword `in' is not anchored to case, for, select ...
@@ -141,7 +144,9 @@
 (eval-when-compile
   (require 'skeleton)
   (require 'cl-lib)
-  (require 'comint))
+  (require 'comint)
+  (require 'let-alist)
+  (require 'subr-x))
 (require 'executable)
 
 (autoload 'comint-completion-at-point "comint")
@@ -1580,6 +1585,7 @@ sh-mode
 	 ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
          (t sh-shell-file))
    nil nil)
+  (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t)
   (add-hook 'hack-local-variables-hook
     #'sh-after-hack-local-variables nil t))
 
@@ -3103,6 +3109,88 @@ sh-delete-backslash
  	    (delete-region (1+ (point))
  			   (progn (skip-chars-backward " \t") (point)))))))
 
+;;; Flymake backend
+
+(defcustom sh-shellcheck-program "shellcheck"
+  "Name of the shellcheck executable."
+  :type 'string
+  :version "29.1")
+
+(defcustom sh-shellcheck-arguments nil
+  "Additional arguments to the shellcheck program."
+  :type '(repeat string)
+  :version "29.1")
+
+(defvar-local sh--shellcheck-process nil)
+
+(defalias 'sh--json-read
+  (if (fboundp 'json-parse-buffer)
+      (lambda () (json-parse-buffer :object-type 'alist))
+    (require 'json)
+    'json-read))
+
+(defun sh-shellcheck-flymake (report-fn &rest _args)
+  "Flymake backend using the shellcheck program.
+Takes a Flymake callback REPORT-FN as argument, as expected of a
+member of `flymake-diagnostic-functions'."
+  (when (process-live-p sh--shellcheck-process)
+    (kill-process sh--shellcheck-process))
+  (let* ((source (current-buffer))
+         (dialect (named-let recur ((s sh-shell))
+                    (pcase s
+                      ((or 'bash 'dash 'sh) (symbol-name s))
+                      ('ksh88 "ksh")
+                      ((guard s)
+                       (recur (alist-get s sh-ancestor-alist))))))
+         (sentinel
+          (lambda (proc _event)
+            (when (memq (process-status proc) '(exit signal))
+              (unwind-protect
+                  (if (with-current-buffer source
+                        (not (eq proc sh--shellcheck-process)))
+                      (flymake-log :warning "Canceling obsolete check %s" proc)
+                    (with-current-buffer (process-buffer proc)
+                      (goto-char (point-min))
+                      (thread-last
+                        (sh--json-read)
+                        (alist-get 'comments)
+                        (seq-filter
+                         (lambda (item)
+                           (let-alist item (string= .file "-"))))
+                        (mapcar
+                         (lambda (item)
+                           (let-alist item
+                             (flymake-make-diagnostic
+                              source
+                              (cons .line .column)
+                              (unless (and (eq .line .endLine)
+                                           (eq .column .endColumn))
+                                (cons .endLine .endColumn))
+                              (pcase .level
+                                ("error" :error)
+                                ("warning" :warning)
+                                (_ :note))
+                              (format "SC%s: %s" .code .message)))))
+                        (funcall report-fn))))
+                (kill-buffer (process-buffer proc)))))))
+    (unless dialect
+      (error "`sh-shellcheck-flymake' is not suitable for shell type `%s'"
+             sh-shell))
+    (setq sh--shellcheck-process
+          (make-process
+           :name "shellcheck" :noquery t :connection-type 'pipe
+           :buffer (generate-new-buffer " *flymake-shellcheck*")
+           :command `(,sh-shellcheck-program
+                      "--format=json1"
+                      "-s" ,dialect
+                      ,@sh-shellcheck-arguments
+                      "-")
+           :sentinel sentinel))
+    (save-restriction
+      (widen)
+      (process-send-region sh--shellcheck-process (point-min) (point-max))
+      (process-send-eof sh--shellcheck-process))))
+
 (provide 'sh-script)
 
 ;;; sh-script.el ends here
-- 
2.37.3


--=-=-=
Content-Type: text/plain


PS: What is the best practice w.r.t. the fact that json-serialize might
not be available?  It seems that every library that needs to parse JSON
has to define a new alias similar to sh--json-read here.  This is rather
suboptimal...

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 13:46:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 09:46:50 2022
Received: from localhost ([127.0.0.1]:48407 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZudF-000216-OW
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 09:46:50 -0400
Received: from mout01.posteo.de ([185.67.36.65]:34103)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1oZudC-00020W-Al
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 09:46:47 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 80BEC240026
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 15:46:37 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1663508800; bh=XoygVLMfew8f3FS8P2qnszF+EWAzjhGBsbHzkqGPgbk=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=hgK8JThLfCG0DEBEn5YdHZUWMiedZZz6a2fIyMSbz3+WsdAPNKV9wjBTkMY9hBQDS
 LGsiPfv+MiegxhCzYHbGtly3sgPjWQeYeUr5mEHe0lFHe7uv3dZswTiO4WVTRjnr58
 9tAMBN8B3Z7oe3AHtsqdxZ4rSek+nH/lyvh3R8neuypI6jAY0oIp7D+hF70C6tdW03
 0VEk2wAHc2rvk87yDk4O7zBNEKaZeXrQ9IwUTik6SdoNdNnnY7Nfso0xSwstGJNKqx
 SwPfSuGTEgwN2qtnGkBonhwcnHklIHJD6cm4GArIvQQZFXOkyG+aL6sqUThw5eVFEO
 lf+TZwOnzSghg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4MVpxk4B03z6tns;
 Sun, 18 Sep 2022 15:46:34 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <87edw8n71p.fsf@HIDDEN> (Augusto Stoffel's message of "Sun, 18
 Sep 2022 15:30:58 +0200")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN> <87zgewdhhd.fsf@HIDDEN>
 <87fsgoyi0l.fsf@HIDDEN> <87sfko4zjq.fsf@HIDDEN>
 <87edw8n71p.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sun, 18 Sep 2022 13:46:34 +0000
Message-ID: <8735co4wxx.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Augusto Stoffel <arstoffel@HIDDEN> writes:

> On Sun, 18 Sep 2022 at 12:50, Philip Kaludercic wrote:
>
>>>> I don't use `named-let' that much, but calling both the result and the
>>>> recursive function `dialect' seems confusing to me.
>>>>
>>>
>>> Welcome to Lisp-2...
>>
>> It is not so much that they share the same name, but that I don't
>> understand why you close to give the function the name "dialect".  From
>> what I have seen, named-let is usually given a self-referential call
>> like "next", "recur", "loop", etc.
>
> Yeah, I have no strong opinion about the name.
>
>>>> Wouldn't it be cleaner to pull this lambda out into a separate named function?
>>>>
>>>
>>> That's not possible, it needs to be in that lexical scope.
>>
>> Not if you use `process-put' and `process-get'.  I recently reworked
>> flymake-proselint and did the same thing.  IMO it doesn't look that bad:
>>
>> https://git.sr.ht/~manuel-uberti/flymake-proselint/commit/30c4baa08db32e73d956c978c81a9f79062c2e1d
>
> Honestly, I much prefer to have some state localized in a closure than
> in what is effective a global variable...

Not quite, you can only access the value if you have access to the
process object.  I guess you can argue that the process object is stored
as a file local variable which sort of makes it global...

> I like in your backend that you read a JSON output, which presumably
> provides the start _and end_ of the diagnostic region.  How did you
> convert from line/column to buffer position?

I didn't do that, Flymake takes care of that if you give it the buffer
position (unless I misunderstood something, but it appears to be working
for me).

> I think it would be nice to extend flymake-diag-region to have signature
>
>    (flymake-diag-region BUFFER LINE &optional COL LINE-END COL-END)
>
> If you provide LINE-END and COL-END, then those are converted to buffer
> positions and there's no guessing as to what they should be.
>
>>>> Also what happens if someone doesn't have shellcheck installed?
>>>
>>> Then Flymake logs a warning and disables the backend. The error message
>>> will be whatever make-process gives, which I find more than good enough.
>>
>> But isn't that rather late to detect the error.  Couldn't you also check
>> if "shellcheck" (or whatever the new option name will be) can be found
>> in the path before adding the hook in `shell-mode'?
>
> I think this is worse than not doing anything.  If you don't check and
> let the backend fail, it gets displayed as a disabled backend, and the
> user has the chance to look at the log buffer and try to figure out why
> it's not working.  If we did what we suggest, we'd have to reinvent the
> wheel to convey that information to the user, I think.

On the other hand there might be people who don't care about shellcheck
(say they just open a shell script once a year) and any error message
would just be an annoyance.

The most important part is having the ability to use shellcheck
prominently documented, the rest is probably just a matter of taste.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 13:31:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 09:31:10 2022
Received: from localhost ([127.0.0.1]:48389 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZuO5-0001da-Hi
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 09:31:10 -0400
Received: from mail-ej1-f50.google.com ([209.85.218.50]:34402)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1oZuO2-0001dF-3R
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 09:31:08 -0400
Received: by mail-ej1-f50.google.com with SMTP id y3so58968869ejc.1
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 06:31:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date;
 bh=dJSbpYtCYRsIripM63idmdy0q4kY9XKf9TlRZOeni24=;
 b=Ys4c9di+BTYuJvnI9ISM6rEkyx7zbRmWZ4XkGOGBM0f+6/uxylPC61n+zILkIS98qO
 xB9IR7YaZYATEjU4FpuKHLcTQ9xKGl7yKDRHOKB6uUccRhMPO0sg5JtkA5d9mlgzfmOO
 kB+HhtQNmPS37LRV0IRo9JWe7hGhFituLZSBqGsApEDcpCLvbVN/ZLWFBBhoQSfxijk9
 BX5GnsdW6iNcc57LLxo42kYcQeyB4WbWUvyYNYSopqwYBp73TNNAg4AmKKlSoMv/eJSX
 05SDtpiKrmYyCPghcPPBglBrsPVURDPX+5ivOOAK6NaNk5wWMz78Is6zHR3aGYeNs9L0
 muEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date;
 bh=dJSbpYtCYRsIripM63idmdy0q4kY9XKf9TlRZOeni24=;
 b=7AlwguFw0doceJExEua8H1dFR8cxI4PCWZjBwDvlQKiIeS7BSOT7iqzP9YKEkkCepa
 A6SuZxzonBnmxgRM8YT112bC7TppXhWIy5hWwL8S9jD+VtFJE67QzUVc5HbA/NjUXaxQ
 Z8x+2RBBQxtmgQYj/M7FUD4dXd+F8X7ChG1IH+luyicszN7YnQfy11WBYpVva6GxVcFD
 laFln8eJk1ErG6Vw6lm2Bvw852RBfJnFBAlWsaGz2uQVAfT2Vqq1rtQWgQ5vtpA/kcwu
 5deQsYShPFlE+SPuqUoZnIZ9d/9QYTI12Z5TsSsE6vo8XxUUOne67QJaKvz5mGXR/IGC
 CQHQ==
X-Gm-Message-State: ACrzQf3D7bOxQzcSVpk7Kklm8DO6j6x0YN0RZr1QfrSLrPVAbshYFLPo
 r7sAPqdiDx3w3P1MchsK478=
X-Google-Smtp-Source: AMsMyM7hd2UV9weryClAa7/Mws0gVxFwxGD29LYNtBcYbBwkUGIopK2/NJBIcu8GC5ADtjlMSTwXrg==
X-Received: by 2002:a17:907:3ea8:b0:77e:f9a2:6fcf with SMTP id
 hs40-20020a1709073ea800b0077ef9a26fcfmr9711851ejc.701.1663507860107; 
 Sun, 18 Sep 2022 06:31:00 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8510])
 by smtp.gmail.com with ESMTPSA id
 16-20020a170906301000b007306a4ecc9dsm14062527ejz.18.2022.09.18.06.30.59
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 18 Sep 2022 06:30:59 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <87sfko4zjq.fsf@HIDDEN> (Philip Kaludercic's message of "Sun, 
 18 Sep 2022 12:50:17 +0000")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN> <87zgewdhhd.fsf@HIDDEN>
 <87fsgoyi0l.fsf@HIDDEN> <87sfko4zjq.fsf@HIDDEN>
Date: Sun, 18 Sep 2022 15:30:58 +0200
Message-ID: <87edw8n71p.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sun, 18 Sep 2022 at 12:50, Philip Kaludercic wrote:

>>> I don't use `named-let' that much, but calling both the result and the
>>> recursive function `dialect' seems confusing to me.
>>>
>>
>> Welcome to Lisp-2...
>
> It is not so much that they share the same name, but that I don't
> understand why you close to give the function the name "dialect".  From
> what I have seen, named-let is usually given a self-referential call
> like "next", "recur", "loop", etc.

Yeah, I have no strong opinion about the name.

>>> Wouldn't it be cleaner to pull this lambda out into a separate named function?
>>>
>>
>> That's not possible, it needs to be in that lexical scope.
>
> Not if you use `process-put' and `process-get'.  I recently reworked
> flymake-proselint and did the same thing.  IMO it doesn't look that bad:
>
> https://git.sr.ht/~manuel-uberti/flymake-proselint/commit/30c4baa08db32e73d956c978c81a9f79062c2e1d

Honestly, I much prefer to have some state localized in a closure than
in what is effective a global variable...

I like in your backend that you read a JSON output, which presumably
provides the start _and end_ of the diagnostic region.  How did you
convert from line/column to buffer position?

I think it would be nice to extend flymake-diag-region to have signature

   (flymake-diag-region BUFFER LINE &optional COL LINE-END COL-END)

If you provide LINE-END and COL-END, then those are converted to buffer
positions and there's no guessing as to what they should be.

>>> Also what happens if someone doesn't have shellcheck installed?
>>
>> Then Flymake logs a warning and disables the backend. The error message
>> will be whatever make-process gives, which I find more than good enough.
>
> But isn't that rather late to detect the error.  Couldn't you also check
> if "shellcheck" (or whatever the new option name will be) can be found
> in the path before adding the hook in `shell-mode'?

I think this is worse than not doing anything.  If you don't check and
let the backend fail, it gets displayed as a disabled backend, and the
user has the chance to look at the log buffer and try to figure out why
it's not working.  If we did what we suggest, we'd have to reinvent the
wheel to convey that information to the user, I think.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 12:50:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 08:50:28 2022
Received: from localhost ([127.0.0.1]:48300 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZtkh-0000VP-Ri
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 08:50:28 -0400
Received: from mout01.posteo.de ([185.67.36.65]:42165)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1oZtkg-0000V3-GD
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 08:50:27 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id BFBA1240026
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 14:50:18 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1663505420; bh=0ZhRCxQxymhorFqR4l1llo6j0iFh7GsR46bOMGaUmz8=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=bg2MxP1reT+IUplGxFZ1zX/BUR278FfaOqRuDpUAgak2mhJuSAvtnEC3P/Tgk+82d
 kP0cW/Pl0Hf9Rkh0o+DKzbvUjzYOFO1hrabgvsd0twKz/hZNp/uSkl8zcyIJGggBWO
 ZgoYU2T1Ie/pXxkFocub+6A5AaUyft7tpKVgKfmJ3t6rDywC56J9Wz34V1Cewi7+1x
 thXHHRzciOxYUcUHyEYG41ygY5xd6saAmObTegjaO/JI4EHqQUf2Hubv/GRnwY/8hU
 kBb0C9jNIbkYcK4ovKH+uMbKeS0YWn9wn4kVa9g9t5V7xAv3QXAOUtD4/CoHjdQliF
 UFupP1hCt2XTA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4MVnhn5WTLz6tm6;
 Sun, 18 Sep 2022 14:50:17 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <87fsgoyi0l.fsf@HIDDEN> (Augusto Stoffel's message of "Sun, 18
 Sep 2022 14:38:34 +0200")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN> <87zgewdhhd.fsf@HIDDEN>
 <87fsgoyi0l.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sun, 18 Sep 2022 12:50:17 +0000
Message-ID: <87sfko4zjq.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Augusto Stoffel <arstoffel@HIDDEN> writes:

> With the attached patch I believe I've addressed all comments from this
> and previous messages.  (In case I missed some detail, the committer
> should feel free to make any desired copyediting.)
>
>
>
> On Sun, 18 Sep 2022 at 11:55, Philip Kaludercic wrote:
>
>> Augusto Stoffel <arstoffel@HIDDEN> writes:
>>
>>>
>>> I could split this into two defcustoms if you feel strongly about it,
>>> but it seems a bit of overengineering to me.  Not many people will want
>>>to customize the program name, and the switches would have to be
>>> provided as a list anyway, since we're not going to call this through a
>>> shell.
>>
>> I think it would be good, because then you could make the flags file
>> local in case you need something special, without having to worry about
>> some evil file that sets the command to
>>
>>      '("rm" "-rf" "--no-preserve-root" "/")
>>
>
> Well, fine then.  I've split this into two variables.
>
>> I don't use `named-let' that much, but calling both the result and the
>> recursive function `dialect' seems confusing to me.
>>
>
> Welcome to Lisp-2...

It is not so much that they share the same name, but that I don't
understand why you close to give the function the name "dialect".  From
what I have seen, named-let is usually given a self-referential call
like "next", "recur", "loop", etc.

>>> +         (pattern "^-:\\([0-9]+\\):\\([0-9]+\\): \\([^:]+\\): \\(.*\\)$")
>>
>> Do you think that that using `rx' would make this pattern more maintainable?
>>
>
> I use rx often, but I think this is still at a level where rx doesn't
> really help much.

OK.

>>> +         (sentinel
>>> +          (lambda (proc _event)
>>
>> Wouldn't it be cleaner to pull this lambda out into a separate named function?
>>
>
> That's not possible, it needs to be in that lexical scope.

Not if you use `process-put' and `process-get'.  I recently reworked
flymake-proselint and did the same thing.  IMO it doesn't look that bad:

https://git.sr.ht/~manuel-uberti/flymake-proselint/commit/30c4baa08db32e73d956c978c81a9f79062c2e1d

>>> +    (setq sh--shellcheck-process
>>> +          (make-process
>>> +           :name "luacheck" :noquery t :connection-type 'pipe
>>                     ^
>>                     Typo?
>>
>>> +           :buffer (generate-new-buffer " *flymake-luacheck*")
>>                                                       ^
>>                                                       same here
>
> Ouch, fixed.

1+

>> Also what happens if someone doesn't have shellcheck installed?
>
> Then Flymake logs a warning and disables the backend. The error message
> will be whatever make-process gives, which I find more than good enough.

But isn't that rather late to detect the error.  Couldn't you also check
if "shellcheck" (or whatever the new option name will be) can be found
in the path before adding the hook in `shell-mode'?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 12:38:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 08:38:50 2022
Received: from localhost ([127.0.0.1]:48246 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZtZR-000059-J8
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 08:38:50 -0400
Received: from mail-ed1-f53.google.com ([209.85.208.53]:37394)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1oZtZK-0008WD-JD
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 08:38:46 -0400
Received: by mail-ed1-f53.google.com with SMTP id a41so25714362edf.4
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 05:38:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date;
 bh=uPlgipz+03fYbHpfjtPpYxpsJWcgz0n0cV760n7YoFw=;
 b=fr6BbqwJCSP61OhC7iCMXt4KGvps0PuouTOFEUtIHLEMPcbYv8f4i651h/uKn2m5D2
 yCIiG4Qa5miHJwX/2X4uHl9X3pyGy65HHPO92nG3yk5ppSg6vmrzqDgwinA4JFVd45E7
 Os8oU/zTlPWVdqzbO1WSKCuEUBAONHMHbebdftypqNrJr3Kdrfe/KVIzvkK1ywBSsWAV
 6eDmzV9ndqVu+cbAHha/IHbZJsvnHEEJZISGWB/UPnp7rCUiTHGq5aAq+FZn11qL3Wv7
 a7HNoB2z3zuWM8ruAqJySQOCJT1hhKD5qWL+dbrR/4MNNpHJDJGy3oI+0S4Y1pP7XEif
 ZPBg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date;
 bh=uPlgipz+03fYbHpfjtPpYxpsJWcgz0n0cV760n7YoFw=;
 b=N2iWJtMKsY1KdcvmLt2KtLHUU3s4bg+9cRNrpbfwm70YuF4zxHI5zUgDscqGrVXij9
 p50pXNdkVP9wcz6v5X9+Q9grJeryWc6fG3XWdD23SrrxA54BGjN82W5otzF1u2hRVK03
 oI432M1Fx5jkt/hTSl5aGXkkdo4Z4rcnfRwD88x31xxfDafxvrLAKA8WYgjJNwj5V3Bp
 T3tsz21SywBEIRmNKgEVFTH4ELUBE8FaG8STHMvdA59L6MX/n+Lq7YnLABNhCFD/YZQQ
 DrUmqYzF8dLTc75BRVNNVU1RhcqCbJSJhayOTrwc2k/XxEeM5KuYeUQ2oyGv/0E4jN4+
 EHfw==
X-Gm-Message-State: ACrzQf2pellHW2kGj2xJUyk7BSF5gnGkv/o0yrsNl15oZ+8hVgMZ9Y7T
 NZT4LBsatx3bbfiMMwUO0+c=
X-Google-Smtp-Source: AMsMyM78YPT+8qMZebnsC14u3VcBaFaMyATB+RKc+ZLerwCTA3C978Qtex7+6G0cbXyj0eZwCTHy9Q==
X-Received: by 2002:a05:6402:26d2:b0:451:5a8c:346b with SMTP id
 x18-20020a05640226d200b004515a8c346bmr11208497edd.424.1663504716615; 
 Sun, 18 Sep 2022 05:38:36 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8510])
 by smtp.gmail.com with ESMTPSA id
 o18-20020a170906769200b007386a8b90c9sm14113295ejm.13.2022.09.18.05.38.35
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 18 Sep 2022 05:38:35 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <87zgewdhhd.fsf@HIDDEN> (Philip Kaludercic's message of "Sun, 
 18 Sep 2022 11:55:42 +0000")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN> <87zgewdhhd.fsf@HIDDEN>
Date: Sun, 18 Sep 2022 14:38:34 +0200
Message-ID: <87fsgoyi0l.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

With the attached patch I believe I've addressed all comments from this
and previous messages.  (In case I missed some detail, the committer
should feel free to make any desired copyediting.)


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-New-Flymake-backend-using-the-shellcheck-program.patch

From 1cadf763114eb733036a1c8182900fe2df17092c Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@HIDDEN>
Date: Sat, 17 Sep 2022 18:30:04 +0200
Subject: [PATCH] New Flymake backend using the shellcheck program

See bug#57884.

* lisp/progmodes/sh-script.el (sh-shellcheck-program,
sh--shellcheck-process, sh-shellcheck-flymake): Variables and function
defining a Flymake backend.
(sh-mode): Add it to 'flymake-diagnostic-functions'.
---
 etc/NEWS                    |  4 ++
 lisp/progmodes/sh-script.el | 76 +++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index a6a8883593..5b2ed16063 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1320,6 +1320,10 @@ This controls how statements like the following are indented:
     foo &&
         bar
 
+*** New Flymake backend using the ShellCheck program
+It is enabled by default, but requires that the external "shellcheck"
+command is installed.
+
 ** Cperl Mode
 
 ---
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 517fbbd8e7..dd36f92766 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -31,6 +31,9 @@
 ;; available for filenames, variables known from the script, the shell and
 ;; the environment as well as commands.
 
+;; A Flymake backend using the "shellcheck" program is provided.  See
+;; https://www.shellcheck.net/ for installation instructions.
+
 ;;; Known Bugs:
 
 ;; - In Bourne the keyword `in' is not anchored to case, for, select ...
@@ -1580,6 +1583,7 @@ sh-mode
 	 ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
          (t sh-shell-file))
    nil nil)
+  (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t)
   (add-hook 'hack-local-variables-hook
     #'sh-after-hack-local-variables nil t))
 
@@ -3103,6 +3107,78 @@ sh-delete-backslash
  	    (delete-region (1+ (point))
  			   (progn (skip-chars-backward " \t") (point)))))))
 
+;;; Flymake backend
+
+(defcustom sh-shellcheck-program "shellcheck"
+  "Name of the shellcheck executable."
+  :type 'string
+  :version "29.1")
+
+(defcustom sh-shellcheck-arguments nil
+  "Additional arguments to the shellcheck program."
+  :type '(repeat string)
+  :version "29.1")
+
+(defvar-local sh--shellcheck-process nil)
+
+(defun sh-shellcheck-flymake (report-fn &rest _args)
+  "Flymake backend using the shellcheck program.
+Takes a Flymake callback REPORT-FN as argument, as expected of a
+member of `flymake-diagnostic-functions'."
+  (when (process-live-p sh--shellcheck-process)
+    (kill-process sh--shellcheck-process))
+  (let* ((source (current-buffer))
+         (dialect (named-let dialect ((s sh-shell))
+                    (pcase s
+                      ((or 'bash 'dash 'sh) (symbol-name s))
+                      ('ksh88 "ksh")
+                      ((guard s)
+                       (dialect (alist-get s sh-ancestor-alist))))))
+         (pattern "^-:\\([0-9]+\\):\\([0-9]+\\): \\([^:]+\\): \\(.*\\)$")
+         (sentinel
+          (lambda (proc _event)
+            (when (memq (process-status proc) '(exit signal))
+              (unwind-protect
+                  (if (with-current-buffer source
+                        (not (eq proc sh--shellcheck-process)))
+                      (flymake-log :warning "Canceling obsolete check %s" proc)
+                    (with-current-buffer (process-buffer proc)
+                      (goto-char (point-min))
+                      (cl-loop
+                       while (search-forward-regexp pattern nil t)
+                       for msg = (match-string 4)
+                       for (beg . end) = (flymake-diag-region
+                                          source
+                                          (string-to-number (match-string 1))
+                                          (string-to-number (match-string 2)))
+                       for type = (pcase (match-string 3)
+                                    ("error" :error)
+                                    ("warning" :warning)
+                                    (_ :note))
+                       when (and beg end)
+                       collect (flymake-make-diagnostic source beg end type msg)
+                       into diags
+                       finally (funcall report-fn diags))))
+                (kill-buffer (process-buffer proc)))))))
+    (unless dialect
+      (error "`sh-shellcheck-flymake' is not suitable for shell type `%s'"
+             sh-shell))
+    (setq sh--shellcheck-process
+          (make-process
+           :name "shellcheck" :noquery t :connection-type 'pipe
+           :buffer (generate-new-buffer " *flymake-shellcheck*")
+           :command `(,sh-shellcheck-program
+                      "--format=gcc"
+                      "--color=never"
+                      "-s" ,dialect
+                      ,@sh-shellcheck-arguments
+                      "-")
+           :sentinel sentinel))
+    (save-restriction
+      (widen)
+      (process-send-region sh--shellcheck-process (point-min) (point-max))
+      (process-send-eof sh--shellcheck-process))))
+
 (provide 'sh-script)
 
 ;;; sh-script.el ends here
-- 
2.37.3


--=-=-=
Content-Type: text/plain


On Sun, 18 Sep 2022 at 11:55, Philip Kaludercic wrote:

> Augusto Stoffel <arstoffel@HIDDEN> writes:
>
>>
>> I could split this into two defcustoms if you feel strongly about it,
>> but it seems a bit of overengineering to me.  Not many people will want
>>to customize the program name, and the switches would have to be
>> provided as a list anyway, since we're not going to call this through a
>> shell.
>
> I think it would be good, because then you could make the flags file
> local in case you need something special, without having to worry about
> some evil file that sets the command to
>
>      '("rm" "-rf" "--no-preserve-root" "/")
>

Well, fine then.  I've split this into two variables.

> I don't use `named-let' that much, but calling both the result and the
> recursive function `dialect' seems confusing to me.
>

Welcome to Lisp-2...

>> +         (pattern "^-:\\([0-9]+\\):\\([0-9]+\\): \\([^:]+\\): \\(.*\\)$")
>
> Do you think that that using `rx' would make this pattern more maintainable?
>

I use rx often, but I think this is still at a level where rx doesn't
really help much.

>> +         (sentinel
>> +          (lambda (proc _event)
>
> Wouldn't it be cleaner to pull this lambda out into a separate named function?
>

That's not possible, it needs to be in that lexical scope.

>> +    (setq sh--shellcheck-process
>> +          (make-process
>> +           :name "luacheck" :noquery t :connection-type 'pipe
>                     ^
>                     Typo?
>
>> +           :buffer (generate-new-buffer " *flymake-luacheck*")
>                                                       ^
>                                                       same here

Ouch, fixed.

> Also what happens if someone doesn't have shellcheck installed?

Then Flymake logs a warning and disables the backend. The error message
will be whatever make-process gives, which I find more than good enough.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 11:58:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 07:58:19 2022
Received: from localhost ([127.0.0.1]:48169 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZswE-0007Fc-O4
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 07:58:18 -0400
Received: from mout02.posteo.de ([185.67.36.66]:50585)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1oZswC-0007FM-7s
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 07:58:17 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id B4679240101
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 13:58:10 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1663502290; bh=+uQyTpdX9dCWiO0FebOi0tx/0koL41IKgSPLkIimeoI=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=lBKN3OxjWS6M24ouWiVTMSrU/KxkYPS64obVL2DiAb6gQjy6HJ1kXx83JnBUUCFY3
 ttOwLGKT/+yvmMbC9Z56z0R1IMZ3ILMfxJTLKneYRqv9lnefvh8JDwwePICopk/6wR
 /RIPBVYuXGkWKqb9A9dRTxlSulsD8GaOQ+OEXLaPr+JaJbX7Ewq1JflOuAuA8VJuKz
 Uw9iPulC2hWlMzcdcqlSdkLp+yMO8rAT+5bbk3qi3M3+MrkokLDvIwWKIXKMhoUEX7
 BiQMPT5FvtihMJH+ThELlP7cl18wlMgx4MQQwtnI7HIkZCCP/wANkr7vsFznkfC6Cf
 aKrq+zQNkx5BQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4MVmXf1mjYz6tqm;
 Sun, 18 Sep 2022 13:58:09 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <871qs9c3er.fsf@HIDDEN> (Augusto Stoffel's message of "Sat, 17
 Sep 2022 19:32:44 +0200")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sun, 18 Sep 2022 11:58:08 +0000
Message-ID: <87wna0dhdb.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Augusto Stoffel <arstoffel@HIDDEN> writes:

> +  (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t)

[...]

> +    (setq sh--shellcheck-process
> +          (make-process
> +           :name "luacheck" :noquery t :connection-type 'pipe
> +           :buffer (generate-new-buffer " *flymake-luacheck*")
> +           :command `(,(car sh-shellcheck-command)
> +                      "--format=gcc"
> +                      "--color=never"
> +                      "-s" ,dialect
> +                      ,@(cdr sh-shellcheck-command)
> +                      "-")
> +           :sentinel sentinel))

Also what happens if someone doesn't have shellcheck installed?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 11:55:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 07:55:56 2022
Received: from localhost ([127.0.0.1]:48159 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZstw-0007Au-4e
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 07:55:56 -0400
Received: from mout02.posteo.de ([185.67.36.66]:53003)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1oZsts-0007Ab-Ov
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 07:55:54 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 06F79240105
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 13:55:44 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1663502147; bh=lGqlbeSxVZPZ0k5cCOLCbBiPEoeLUnFQ8WdGwgZfr5U=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=jbttdKUPmYyF6tEcFOAROOxFkzOF1EnRoXEZTaCWCTyV3R8HbGW8peU3wIPwjxK20
 DQIMOMZ/KMWJz0Qw4mufVhsbkEQb0uksmOdOWNuxBDJIdlFD8EY9+kuGzTHjBz+aTu
 T1aheb6D86ixbdA4knOLLWiVC7j7dpzz4Nwezmy9UCywFxIXCfN6o/icyQo4qB1d/D
 VhiucZb62lEZ+GkDDgm0qhYEtHGFIGYgLvzY/tviQ4kinj+XWBeWnugxpiXiG4T58Z
 uImuFrigSELX34kv6Q21Jfe5I9cxHfwhQ22vGVjtKVXja+Ctkqfb6ikfuld1wr7XBD
 XW1z8gdpdv1fA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4MVmTq53fNz9rxF;
 Sun, 18 Sep 2022 13:55:42 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <871qs9c3er.fsf@HIDDEN> (Augusto Stoffel's message of "Sat, 17
 Sep 2022 19:32:44 +0200")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sun, 18 Sep 2022 11:55:42 +0000
Message-ID: <87zgewdhhd.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Augusto Stoffel <arstoffel@HIDDEN> writes:

>
> I could split this into two defcustoms if you feel strongly about it,
> but it seems a bit of overengineering to me.  Not many people will want
>to customize the program name, and the switches would have to be
> provided as a list anyway, since we're not going to call this through a
> shell.

I think it would be good, because then you could make the flags file
local in case you need something special, without having to worry about
some evil file that sets the command to

     '("rm" "-rf" "--no-preserve-root" "/")

> Let me know what you think.
>
>>> +(defun sh-shellcheck-fmake (report-fn &rest _args)
>>> +  "Flymake backend using the shellchecprogram.
>>
>> The first line of a function's doc string should mtion its
>> arguments.
>
> It didn't fit the first line, so as per standd proceu it's in the
> body of the dctring.
>
>> And I think this warrants a NEWS entry.
>
> Dne.
>
>>From 7598653c31bc72a30bc7ed7ba28cc9b6c6b6c843Mo Sep 17 00:00:00 2001
> From: Augusto Stoffel <arstoffel@HIDDEN>
> Date: St17 Sep 2022 18:30:04 +0200
> Subject: [PATCH] New Flymake backend usinghe shellcheck program
>>See bug#57884.
>
> * lisp/progmodes/sh-scrpel (shsellcheck-program,
> sh--shellcheck-process, sh-shellcheck-flymake): Variles and function
> defining a Flymake backen
> (sh-mode): Add it to 'flymake-diagntic-functions'.
> ---
>  etc/NEWS                    |  5 +++
>  lsprogmodes/sh-sci.el | 71 +++++++++++++++++++++++++++++++++++++
>  2 fis changed, 76 insertions(+)
>
> diff --git a/etc/NEWS b/etc/NEWS
> indea6a8883593..60e171ad13 10064> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -1320,6 +1320, @@ is controls how statements like the foowing are indented:
>      foo &&
>          bar
>  
> ++++
> +*** New Fmake backend using the ShellCheck poam
> +It is enable by default, on requiring that ShellCheck is instald.
> +See https/www.shellchecket/ for details.
> +
>  ** Cperl Mode
>  
>  ---
> diff --git a/lisp/progmodes/sh-scrt.el b/lisp/ogmodes/sh-scptl
> iex 517fbbd8e7..9c0f6dabd5 100644
> --- a/lisp/progmodesh-script.el
> +++ b/lisp/progmodes/sh-script.el
> @@ -31,6 +31,9 @@
>  ;; available for filenames, variables known fromhe script, the shell and
>  ;; the environment as well as commands.
>  
> +;; A Flymake backend using the ShellCheck program is provided.  See
> +;; https://www.shellecnet/ for instalti instctions.
> +
>  ;;; Known Bugs:
>  
>  ;; - In Bourne the keyword `in' inot anchored to case, for, select ..> @@ -1580,6 +1583,7 @@ sh-mode
>  ((equal (file-name-nondirectory bfer-file-name) ".pfile") "sh")
>           (t sh-shell-file))
>     nil nil)
> +  (add-hook 'fmake-diagnostic-functions #'sh-shellchecklyke nil t)
>    (add-hook 'hack-local-variables-hook
>      #'sh-afterack-local-variables nil t))
>  
> @@ -3103,6 +3107,73 @@ sh-dele-ckslash
>   	    ele-region (1+ (point))
>   			   (progn (skip-chars-backward " \t") (point)))))
>  
> +;;; Flymake backend
> +
> +(defcustom sh-shellcheck-command '("shellcheck")
> +  "The shellcheck program followed by extra arguments."
> +  :type '(repeat string)
> +  :version "29.1")
> +
> +(defvar-local sh--shellcheck-process nil)
> +
> +(defun sh-shellcheck-flymake (report-fn &rest _args)
> +  "Flymake backend using the shellcheck program.
> +Takes a Flymake callback REPORT-FN as argument, as expected of a
> +member of `flymake-diagnostic-functions'."
> +  (when (process-live-p sh--shellcheck-process)
> +    (kill-process sh--shellcheck-process))
> +  (let* ((source (current-buffer))
> +         (dialect (named-let dialect ((s sh-shell))
> +                    (pcase s
> +                      ((or 'bash 'dash 'sh) (symbol-name s))
> +                      ('ksh88 "ksh")
> +                      ((guard s)
> +                       (dialect (alist-get s sh-ancestor-alist))))))

I don't use `named-let' that much, but calling both the result and the
recursive function `dialect' seems confusing to me.

> +         (pattern "^-:\\([0-9]+\\):\\([0-9]+\\): \\([^:]+\\): \\(.*\\)$")

Do you think that that using `rx' would make this pattern more maintainable?

> +         (sentinel
> +          (lambda (proc _event)

Wouldn't it be cleaner to pull this lambda out into a separate named function?

> +            (when (memq (process-status proc) '(exit signal))
> +              (unwind-protect
> +                  (if (with-current-buffer source
> +                        (not (eq proc sh--shellcheck-process)))
> +                      (flymake-log :warning "Canceling obsolete check %s" proc)
> +                    (with-current-buffer (process-buffer proc)
> +                      (goto-char (point-min))
> +                      (cl-loop
> +                       while (search-forward-regexp pattern nil t)
> +                       for msg = (match-string 4)
> +                       for (beg . end) = (flymake-diag-region
> +                                          source
> +                                          (string-to-number (match-string 1))
> +                                          (string-to-number (match-string 2)))
> +                       for type = (pcase (match-string 3)
> +                                    ("error" :error)
> +                                    ("warning" :warning)
> +                                    (_ :note))
> +                       when (and beg end)
> +                       collect (flymake-make-diagnostic source beg end type msg)
> +                       into diags
> +                       finally (funcall report-fn diags))))
> +                (kill-buffer (process-buffer proc)))))))
> +    (unless dialect
> +      (error "`sh-shellcheck-flymake' is not suitable for shell type `%s'"
> +             sh-shell))
> +    (setq sh--shellcheck-process
> +          (make-process
> +           :name "luacheck" :noquery t :connection-type 'pipe
                    ^
                    Typo?

> +           :buffer (generate-new-buffer " *flymake-luacheck*")
                                                      ^
                                                      same here
> +           :command `(,(car sh-shellcheck-command)
> +                      "--format=gcc"
> +                      "--color=never"
> +                      "-s" ,dialect
> +                      ,@(cdr sh-shellcheck-command)
> +                      "-")
> +           :sentinel sentinel))
> +    (save-restriction
> +      (widen)
> +      (process-send-region sh--shellcheck-process (point-min) (point-max))
> +      (process-send-eof sh--shellcheck-process))))
> +
>  (provide 'sh-script)
>  
>  ;;; sh-script.el ends here




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 07:52:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 03:52:43 2022
Received: from localhost ([127.0.0.1]:47708 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZp6Z-0008GI-1F
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2022 03:52:43 -0400
Received: from mail-ed1-f47.google.com ([209.85.208.47]:33514)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1oZp6V-0008G0-Lg
 for 57884 <at> debbugs.gnu.org; Sun, 18 Sep 2022 03:52:42 -0400
Received: by mail-ed1-f47.google.com with SMTP id b35so37102334edf.0
 for <57884 <at> debbugs.gnu.org>; Sun, 18 Sep 2022 00:52:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date;
 bh=7T0euHAb1k7wY04V+YQ5vThMQNYjZAxIZQBSFN2Ib3k=;
 b=Q2bgp8MMvT8GRc0dpw7aYW7aZY+Yr75xMWuWIezcOCnZ0RA33PK96Qw7Gi0h7q6ihZ
 1u5kXVaPzsEQkO7yLJKofI8fp31VQQL6Cr5OhkJolVzNDDXYoy4avmWxGiJmJgyifh6m
 Q+IUE9blO6zJ6WXYJjWpq5F1YxF4ioyQ8T4mHD8//zsRg8Jy7hGhWoXESMMta7zKxaGW
 0+/6s4uB4UYIZjG5w2ss237fUYrSqBFqJiWqxTLaBuJh72YYc8lin1ARKjsME/Cu2ZFj
 +KWgrZaQcorIIR3EiqK4zhi1/7rMCiLmMqHZMcEq5oApUwuIYlyiMcQoFRhWcn1vaER3
 p0AA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date;
 bh=7T0euHAb1k7wY04V+YQ5vThMQNYjZAxIZQBSFN2Ib3k=;
 b=c5GEf3T+pHKqvMqoMo0GShGL4Lant66W/a7fpD5woEHU2jXoRtBn44wr04QY8q+/BE
 CNF/Nf7I/66YtN5raufHUiU+n9xiG7Y1/h5J1FqYgPFKVEGD3DEzFfPwAc9J6c+7QVCA
 2RKsQVL0R0rLia5OG1VqCE1RIiTOV8tg062N5A6Fm8357TLW+H2FV2OHHvlReTkBGl+K
 T/J80VFTJm+ubFP8KTRSUUejTX2p7TAgcSpkZz6vnA4l/mlcb8sLD4n8FotwxuzWRS4z
 Hwzbi2y0owlCThVlOWvUBMKL+pe4MaID+3dHUevNuj+OAuJq7PK/kb14rqvIjpQBthIq
 sK+Q==
X-Gm-Message-State: ACrzQf3zuIzDiJIbE/D/Tt+8U6/mguVaVWogoq8fb5pSQjpe3mlZ+10x
 3iE+Tz1sizRARN3jFlH6DSn2oyA/ZU4ENw==
X-Google-Smtp-Source: AMsMyM6VzHcpFbMHjn1UqxTLZaGiR8+vVa9NpJyCKWHE3/S9SzgNEETE+2LAQhNc+rVyc9uElBGsjA==
X-Received: by 2002:a05:6402:5168:b0:44e:9ca8:bf6 with SMTP id
 d8-20020a056402516800b0044e9ca80bf6mr10704115ede.384.1663487553287; 
 Sun, 18 Sep 2022 00:52:33 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8510])
 by smtp.gmail.com with ESMTPSA id
 o23-20020a17090611d700b007341663d7ddsm13411982eja.96.2022.09.18.00.52.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 18 Sep 2022 00:52:32 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <CADwFkmkrUWNN2TUxje6qYBjSHemFuziuDm4rcGADjzUGv91VaQ@HIDDEN>
 (Stefan Kangas's message of "Sat, 17 Sep 2022 14:04:05 -0400")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN>
 <CADwFkmkrUWNN2TUxje6qYBjSHemFuziuDm4rcGADjzUGv91VaQ@HIDDEN>
Date: Sun, 18 Sep 2022 09:52:31 +0200
Message-ID: <875yhlt8zk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57884
Cc: Eli Zaretskii <eliz@HIDDEN>, 57884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sat, 17 Sep 2022 at 14:04, Stefan Kangas wrote:

> Augusto Stoffel <arstoffel@HIDDEN> writes:
>
>> I could split this into two defcustoms if you feel strongly about it,
>> but it seems a bit of overengineering to me.  Not many people will want
>> to customize the program name, and the switches would have to be
>> provided as a list anyway, since we're not going to call this through a
>> shell.
>
> FWIW, I tend to agree, unless we can point to any other "shellcheck"
> compatible programs out there.  For now, the code assumes that's what
> we're using, right?

Yes, this Flymake backend is specific to this particular program because
1. the output pattern is probably more or less unique, 2. it needs a
dynamically computed argument and 3. Flymake allows several backends to
in parallel, so if a new linter comes into being, it's up to the user to
decide whether to run one or the other or both.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 17 Sep 2022 18:18:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 17 14:18:02 2022
Received: from localhost ([127.0.0.1]:47178 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZcOA-0000JX-0M
	for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 14:18:02 -0400
Received: from mail-ot1-f48.google.com ([209.85.210.48]:44950)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1oZcO8-0000JH-E1
 for 57884 <at> debbugs.gnu.org; Sat, 17 Sep 2022 14:18:00 -0400
Received: by mail-ot1-f48.google.com with SMTP id
 x23-20020a056830409700b00655c6dace73so14794763ott.11
 for <57884 <at> debbugs.gnu.org>; Sat, 17 Sep 2022 11:18:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date;
 bh=AXi5PYSYhdYhlCvGR9iipGHyR5mjo+b7PwF1E/XdrQ8=;
 b=pFb8pF7BL7McehZr+OOfsKuV6W8YE/Y/A8nE4QbKZ/+lkgJ+aPStewYpz7K2kl5urD
 s4l5HPECnS60Yt4NTwl3r0ZC1SWEIcPD9rdjM1BNUJX1ttWxSQbg5w6euk2ddDFYId8W
 QhWfOY160MU/v0XxKgcO7xVMyS9BdoHN7gU2FuqblnEJL0Nnkn9mfJmFcg+m8eDNjNGv
 IV0/W0KdElVWMkvUuhve47TJdeUrRFkARSCjX6NUNFV+WxGmOEwEtilMCjShjxufqg4m
 LhGr0AuzPHlXJkwryKWKU3geSpV+Wa0g/ZFENal4s9dLS9qciMe9NRZwTzC4d9adJh6u
 +L8Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=AXi5PYSYhdYhlCvGR9iipGHyR5mjo+b7PwF1E/XdrQ8=;
 b=0hpWgaPFK85gTYnRyxGCUDXICQIgggCHdWPez0rFDFP3aOaqU8gnKnX58Hb0Fr+Vj4
 YwRsYqGvqzXKNsOhFvkacyCT3ppibyiaAqd6Wht7EkUN0t99SnsTP2GaoxiX5LHIoOnV
 08uPRW2JO89ci8ZVYBavcWARK2weCkZOYei0doNh5zzSChuv+9TUJyiNi8+Pfgx0E3E8
 5Oo/TNF2qFgWLiy4eAVgPilQpdUTcnObrEj3SN24ghfqWSVD+eEKgtfZe9LGpLY0fl7V
 0OstyB8K7NzZC5c3NNaJYLmIfPKvx8KxUy9Iub7Hm0L7vbGgMdxQx4qYSvCKXSF8jnGU
 ZCHw==
X-Gm-Message-State: ACrzQf2BD8p8T8yQjSyN+Ch01tEip2ztdulZ6m/+ZWEQLysEcLfeBoJS
 mSTNFxOBYjN0A2dH10Zp5wWUPlR8/erX8PO1Ddg=
X-Google-Smtp-Source: AMsMyM5b/sNYbEWdjWLMGgeeYqFIAOrdOHHdt4yT5YXvZqX9rspG5/7aI/yvXfqu6jbNwsL9yCSDKO+2InSGmzkLEHY=
X-Received: by 2002:a05:6830:3c1:b0:637:28be:7920 with SMTP id
 p1-20020a05683003c100b0063728be7920mr4755907otc.105.1663438674814; Sat, 17
 Sep 2022 11:17:54 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sat, 17 Sep 2022 14:17:54 -0400
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <837d2128io.fsf@HIDDEN>
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN> <837d2128io.fsf@HIDDEN>
X-Hashcash: 1:20:220917:arstoffel@HIDDEN::qVmlUKG4FQEVZ3yp:3XoB
MIME-Version: 1.0
Date: Sat, 17 Sep 2022 14:17:54 -0400
Message-ID: <CADwFkm=3v5TMyuMKnq-NDgWkOZRwJgKdcXjDn2t=LTfQc_sOMw@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
To: Eli Zaretskii <eliz@HIDDEN>, Augusto Stoffel <arstoffel@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57884
Cc: 57884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> If we don't expect users to customize this, maybe this shouldn't be a
> defcustom at all?  If and when we learn about an alternative program,
> we could at that time decide how best to allow its customization.

Makes sense.

> For example, if both programs don't need any command-line switches, we
> could offer a defcustom only for the program.

Maybe we should just make the flags into a defcustom, because there are
some useful ones like, from shellcheck(1):

   -i CODE1[,CODE2...], --include=CODE1[,CODE2...]
          Explicitly include only the specified codes in the report

   -e CODE1[,CODE2...], --exclude=CODE1[,CODE2...]
          Explicitly  exclude the specified codes from the report.

   --norc Don't try to look for .shellcheckrc configuration files.

   -s shell, --shell=shell
          Specify Bourne shell dialect.  Valid values are sh,  bash,  dash
          and  ksh.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 17 Sep 2022 18:04:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 17 14:04:20 2022
Received: from localhost ([127.0.0.1]:47152 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZcAq-0008PJ-55
	for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 14:04:20 -0400
Received: from mail-oa1-f54.google.com ([209.85.160.54]:45734)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1oZcAl-0008Oq-96
 for 57884 <at> debbugs.gnu.org; Sat, 17 Sep 2022 14:04:15 -0400
Received: by mail-oa1-f54.google.com with SMTP id
 586e51a60fabf-127dca21a7dso56486026fac.12
 for <57884 <at> debbugs.gnu.org>; Sat, 17 Sep 2022 11:04:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date;
 bh=+5fbzR7Iah/oElB0LftsvgwBvbgTFvgeKI4sPqH4Z64=;
 b=ZnTvUBlDECvtwoq3iW2yOxJqluj0PFN07QtluY75CsNpC1JS2wQY1Y6K9BKRJdcosf
 WiE/W+39HflUSBW+w1mNeFu3HraggUYH4ASW4Hev2OpdHM0UfvFV8qOuLZZAXQ3l/dyj
 w4e4Uc54DIYSyYKN33lMVndBb7PaP4VH+NCtzwM8ofXpnVrOFzieZ2ZCuYJPmLMDGJOc
 wodzNzoD5VR/W4jvWCKKweRdVJn12NavUkxrRb0BDOa2Cv2XOUn9wwUrs16qJrESAvm5
 wn7PoHrLDP4RGjZoGvdrjfwV7kY7Z2C/fnKM8iEphFjUegjrqqlwCAVtTCOBjgkW+sa7
 lyxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=+5fbzR7Iah/oElB0LftsvgwBvbgTFvgeKI4sPqH4Z64=;
 b=FET/jsaD2TzqgFB8LKWwNvFLjCOdMX+gqkbqclrnCsezxei0V1XrlEYkrtfgr8eB2c
 g4ny8xxYZnfQp75nJ3V0UlllLut652a1j6Xnqbo46KVOJtpa8kvA0sbBlxfX8bFcaxLs
 IQFPpbMyzED+R2FVkjBE+pMdIkSMMQK5uleMOhgMaKt7nyiyek5hd9pzb9Tb47IKPNZP
 P5aBDBkolhcKSnCqr2F2wibjHglrKMdcpCiGKZzXBh8Paj5UxYQOwlIEQRvQcC2RuSb+
 qjg/RFEw7QzC9QYZ0kM/L42CkB5/xb7EC82rM+yaFXwn/jHZRlgVRt3gX9O+6DaNOomU
 apmw==
X-Gm-Message-State: ACgBeo3fOwtj0gGHkmEaJKCk5r3w/oTKF+5dbEVLPCgf30zJZrcEt2p+
 iOnpwL9QvXCr9Rbh0L4JvMHyhDkrshjzSlcZSy8=
X-Google-Smtp-Source: AA6agR4i40HUdJC41azmeMj9jc2zNp1B80eRNQIwaFF/FqEOmTmzL2yWI52oyXI0UrHLezjCzONibz4VwYNeQs6P1vs=
X-Received: by 2002:a05:6870:5581:b0:11e:300:8189 with SMTP id
 n1-20020a056870558100b0011e03008189mr11637645oao.199.1663437845819; Sat, 17
 Sep 2022 11:04:05 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sat, 17 Sep 2022 14:04:05 -0400
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <871qs9c3er.fsf@HIDDEN>
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN>
X-Hashcash: 1:20:220917:57884 <at> debbugs.gnu.org::d0SqYOp9OGzfOLmW:2fu/
MIME-Version: 1.0
Date: Sat, 17 Sep 2022 14:04:05 -0400
Message-ID: <CADwFkmkrUWNN2TUxje6qYBjSHemFuziuDm4rcGADjzUGv91VaQ@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
To: Augusto Stoffel <arstoffel@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57884
Cc: 57884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Augusto Stoffel <arstoffel@HIDDEN> writes:

> I could split this into two defcustoms if you feel strongly about it,
> but it seems a bit of overengineering to me.  Not many people will want
> to customize the program name, and the switches would have to be
> provided as a list anyway, since we're not going to call this through a
> shell.

FWIW, I tend to agree, unless we can point to any other "shellcheck"
compatible programs out there.  For now, the code assumes that's what
we're using, right?

> ++++

Should probably be "---" as you didn't add documentation for it.

> +*** New Flymake backend using the ShellCheck program
> +It is enable by default, only requiring that ShellCheck is installed.
> +See https://www.shellcheck.net/ for details.

(Typo: "enabled".)

I'd suggest:

It is enabled by default, but requires that the external "shellcheck"
command is installed.

> +;; A Flymake backend using the ShellCheck program is provided.  See
> +;; https://www.shellcheck.net/ for installation instructions.

Maybe this should be "shellcheck" too?  The capitalization is not
necessarily helpful for finding the correct package to install.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 17 Sep 2022 17:56:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 17 13:56:06 2022
Received: from localhost ([127.0.0.1]:47145 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZc2v-0008CL-RT
	for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 13:56:06 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38540)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oZc2t-0008Bo-Hp
 for 57884 <at> debbugs.gnu.org; Sat, 17 Sep 2022 13:56:03 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:37232)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oZc2o-0006Sw-BK; Sat, 17 Sep 2022 13:55:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=LPTGFk5EdoxbzYkbtsXQbfwLx/ZzFbLKVp+5l/6i/9g=; b=r96xfMo6dXst
 W9pZxhDUrE4oq6eoJFdLKSxrG+E7wrfGi3KpdwKPsGNYJKYAWEYSia1qvvB+nfe5fqD3KWeqA3WEj
 9RpjY2XxAqXcT7Qhe/uSFN/kVDV5bt8WoBLZRodNCNYRdz0iTCJUg7Co80rRGLuovtDSwnc2sX0kE
 FOwoQEeqRuxyAj2gvduW9F47Auf71l10NO+yV9ko3/a6jBj1UW4X34yNzmQPN6gQTezJroCUR6FQS
 h4Z1+fChm8HTCQO4Z48sX+RA2lAVnkH5MiVG1m+m6mP8NbhB6qkk8HRVsWQsqpetj44GE5PYtKmyX
 +dY7+cM04emxvAYJeq15kg==;
Received: from [87.69.77.57] (port=3961 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oZc2n-0005WC-2N; Sat, 17 Sep 2022 13:55:58 -0400
Date: Sat, 17 Sep 2022 20:55:57 +0300
Message-Id: <835yhl28cy.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <871qs9c3er.fsf@HIDDEN> (message from Augusto Stoffel on Sat, 
 17 Sep 2022 19:32:44 +0200)
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57884
Cc: 57884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: 57884 <at> debbugs.gnu.org
> Date: Sat, 17 Sep 2022 19:32:44 +0200
> 
> ++++
> +*** New Flymake backend using the ShellCheck program
> +It is enable by default, only requiring that ShellCheck is installed.
         ^^^^^^
"enabled"

> +(defun sh-shellcheck-flymake (report-fn &rest _args)
> +  "Flymake backend using the shellcheck program.

I'd use

  Flymake backend using the shellcheck program and REPORT-FN as callback.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 17 Sep 2022 17:52:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 17 13:52:40 2022
Received: from localhost ([127.0.0.1]:47140 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZbzc-00087I-86
	for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 13:52:40 -0400
Received: from eggs.gnu.org ([209.51.188.92]:34936)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oZbzZ-000871-PT
 for 57884 <at> debbugs.gnu.org; Sat, 17 Sep 2022 13:52:38 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:56220)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oZbzU-0005s7-Dm; Sat, 17 Sep 2022 13:52:32 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=gz9wcD1GZL4RGy3b8jhAWsSrFYO3A7mt9g8AUn0UF74=; b=UIl0R/W3gZOo
 qaHGQgzBeZveYwiQGAbn3ul5OMrBo5nMVl75+lxNZNtra2nDocxqBhSOAZ9rC1lxGjsebNqjmBvYq
 1h967vv5lc0yr1/JOdmN2xdmoD2g2b7pqkLN5k6FCp457+QHP2kUwB1KmPEdtxf53cCD1DxHas4H7
 dFeo3NhRkUJ6zP+lwsnEZO+t7rVQGe3R+AxADz0AMwg6eR2k+AiB882FCLRHwzFlPnbZdTGAoqtMw
 YqEr2hFTfFf/nFsdaBMGwNtMj7OIk4kjgrDJdJjEqvK9WJtZEnXj8ZYuYukvwzVKE3f7RWO7Kpzly
 2HyXZ5eW3buHtegQUDRHDA==;
Received: from [87.69.77.57] (port=3750 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oZbzT-00054c-SN; Sat, 17 Sep 2022 13:52:32 -0400
Date: Sat, 17 Sep 2022 20:52:31 +0300
Message-Id: <837d2128io.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <871qs9c3er.fsf@HIDDEN> (message from Augusto Stoffel on Sat, 
 17 Sep 2022 19:32:44 +0200)
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
 <871qs9c3er.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57884
Cc: 57884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: 57884 <at> debbugs.gnu.org
> Date: Sat, 17 Sep 2022 19:32:44 +0200
> 
> > Also, wouldn't it be better to have separate user options for the
> > program and the switches?  That way, there won't be a need to require
> > users to provide a list as the value of the option.
> 
> I could split this into two defcustoms if you feel strongly about it,
> but it seems a bit of overengineering to me.  Not many people will want
> to customize the program name, and the switches would have to be
> provided as a list anyway, since we're not going to call this through a
> shell.
> 
> Let me know what you think.

If we don't expect users to customize this, maybe this shouldn't be a
defcustom at all?  If and when we learn about an alternative program,
we could at that time decide how best to allow its customization.  For
example, if both programs don't need any command-line switches, we
could offer a defcustom only for the program.

Anyway, let's hear what Lars and others think.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 17 Sep 2022 17:32:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 17 13:32:58 2022
Received: from localhost ([127.0.0.1]:47114 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZbgX-0007ab-P7
	for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 13:32:58 -0400
Received: from mail-ed1-f49.google.com ([209.85.208.49]:46864)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1oZbgS-0007aJ-SC
 for 57884 <at> debbugs.gnu.org; Sat, 17 Sep 2022 13:32:56 -0400
Received: by mail-ed1-f49.google.com with SMTP id z13so21726411edb.13
 for <57884 <at> debbugs.gnu.org>; Sat, 17 Sep 2022 10:32:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date;
 bh=Io6BLmas5crugaFhsvZ8PVTqZdoeRmk0tOPHYPFbzYs=;
 b=eRm1AcAZE0wAhb/b2jpsXPy9L3B1ESGjNxehnEAuN+jY9x1TH1nRgm60XIs5veP7JK
 KtAZlnpo3JZRC9KCEZPDfu2gf//MpKLZz97iIHDWxdOa47xdwUS3qv0cwZF6Q1K+8hIL
 pdIyR/Ssw6rZJvQC8bxSl8LZuuCyMJP+B59CZuHbq72+fwdKGRx3DBQT3kzlVwN5qYHg
 zZctkYZmjnmR+uqcnHY+rQt0qUF2NOWSlWDz6mvQQ3lz1WWQ17SLbgaVag/6CAoZri1H
 8gsW+mAD+E6CCyCEKgwvQgmSLdi6sOobHcacvFfojb6o1xsFAMNalcR2KxXMLseJCjqB
 FYyQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date;
 bh=Io6BLmas5crugaFhsvZ8PVTqZdoeRmk0tOPHYPFbzYs=;
 b=HTRjrqg48KbSESpa7Py7gkG2Qc3yu+9IynTQAOLWDTiIYKk1gSMzIahrluVV8L2iCe
 Tx1+fDpRTYWX+bWGN/l93TEg+IPluc/ExLK9OKiUZzuutmz+3rQsx3O4C89mokuN2nOm
 q7RgF7w1GIS2EMoeKvG/bwoyz877SDGF7wXeZys3hak3vN+3rMliXl3vQhPp1Mi8wbZr
 8aXQtCCqC8eFrZiSuWyN2bMEjELg22yxXfAbN/NC6SqiOOnJ6AD6Z/1uklJJdZ42mbmZ
 e8S1mB9RnKktROtXtjU2AgveU0prP8qKSlRx62uxo8MBbElxpT06Rle4dFXAO61qzryt
 wZTA==
X-Gm-Message-State: ACrzQf1LkvUrtlWEAGFqD16usIE9mRNcQW69rolgcnH+2UGHqMePgNKS
 guDllFgCR4GHyN37KSBxfiuRjsxVyBKswA==
X-Google-Smtp-Source: AMsMyM55jQP48qFlHmqa49et1ejvQCUY+xq1+mMMGP4cW+0433XwXnIG0cQA16eL0O30doMrRfQYUA==
X-Received: by 2002:a05:6402:1945:b0:446:692:8aeb with SMTP id
 f5-20020a056402194500b0044606928aebmr8436939edz.403.1663435966447; 
 Sat, 17 Sep 2022 10:32:46 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8510])
 by smtp.gmail.com with ESMTPSA id
 i20-20020aa7c9d4000000b00448176872f7sm15965358edt.81.2022.09.17.10.32.45
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 17 Sep 2022 10:32:45 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
In-Reply-To: <83bkre0w4m.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 17 Sep
 2022 20:05:29 +0300")
References: <87a66yaqwc.fsf@HIDDEN> <83bkre0w4m.fsf@HIDDEN>
Date: Sat, 17 Sep 2022 19:32:44 +0200
Message-ID: <871qs9c3er.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57884
Cc: 57884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

I've attached a new patch.  See my comments below.

On Sat, 17 Sep 2022 at 20:05, Eli Zaretskii wrote:

>> From: Augusto Stoffel <arstoffel@HIDDEN>
>> Date: Sat, 17 Sep 2022 18:48:19 +0200
>> 
>> See https://www.shellcheck.net/ for details on the ShellCheck program.
>> It seems to be the most usual linter for shell scripts.
>
> Thanks.
>
>> * lisp/progmodes/sh-script.el (sh-shellcheck-program,
>> sh--shellcheck-process, sh-shellcheck-flymake): Variables and function
>> defining a Flymake backend.
>> (sh-mode): Add it to 'flymake-diagnostic-functions'.
>
> Please mention the bug number in the log message.

Done.

>> +(defcustom sh-shellcheck-command '("shellcheck")
>> +  "The shellcheck program followed by extra arguments."
>> +  :type 'string)
>
> This lacks the :version tag.

Done (and fixed the :type).

> Also, wouldn't it be better to have separate user options for the
> program and the switches?  That way, there won't be a need to require
> users to provide a list as the value of the option.

I could split this into two defcustoms if you feel strongly about it,
but it seems a bit of overengineering to me.  Not many people will want
to customize the program name, and the switches would have to be
provided as a list anyway, since we're not going to call this through a
shell.

Let me know what you think.

>> +(defun sh-shellcheck-flymake (report-fn &rest _args)
>> +  "Flymake backend using the shellcheck program.
>
> The first line of a function's doc string should mention its
> arguments.

It didn't fit the first line, so as per standard procedure it's in the
body of the docstring.

> And I think this warrants a NEWS entry.

Done.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-New-Flymake-backend-using-the-shellcheck-program.patch

From 7598653c31bc72a30bc7ed7ba28cc9b6c6b6c843 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@HIDDEN>
Date: Sat, 17 Sep 2022 18:30:04 +0200
Subject: [PATCH] New Flymake backend using the shellcheck program

See bug#57884.

* lisp/progmodes/sh-script.el (sh-shellcheck-program,
sh--shellcheck-process, sh-shellcheck-flymake): Variables and function
defining a Flymake backend.
(sh-mode): Add it to 'flymake-diagnostic-functions'.
---
 etc/NEWS                    |  5 +++
 lisp/progmodes/sh-script.el | 71 +++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index a6a8883593..60e171ad13 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1320,6 +1320,11 @@ This controls how statements like the following are indented:
     foo &&
         bar
 
++++
+*** New Flymake backend using the ShellCheck program
+It is enable by default, only requiring that ShellCheck is installed.
+See https://www.shellcheck.net/ for details.
+
 ** Cperl Mode
 
 ---
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 517fbbd8e7..9c0f6dabd5 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -31,6 +31,9 @@
 ;; available for filenames, variables known from the script, the shell and
 ;; the environment as well as commands.
 
+;; A Flymake backend using the ShellCheck program is provided.  See
+;; https://www.shellcheck.net/ for installation instructions.
+
 ;;; Known Bugs:
 
 ;; - In Bourne the keyword `in' is not anchored to case, for, select ...
@@ -1580,6 +1583,7 @@ sh-mode
 	 ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
          (t sh-shell-file))
    nil nil)
+  (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t)
   (add-hook 'hack-local-variables-hook
     #'sh-after-hack-local-variables nil t))
 
@@ -3103,6 +3107,73 @@ sh-delete-backslash
  	    (delete-region (1+ (point))
  			   (progn (skip-chars-backward " \t") (point)))))))
 
+;;; Flymake backend
+
+(defcustom sh-shellcheck-command '("shellcheck")
+  "The shellcheck program followed by extra arguments."
+  :type '(repeat string)
+  :version "29.1")
+
+(defvar-local sh--shellcheck-process nil)
+
+(defun sh-shellcheck-flymake (report-fn &rest _args)
+  "Flymake backend using the shellcheck program.
+Takes a Flymake callback REPORT-FN as argument, as expected of a
+member of `flymake-diagnostic-functions'."
+  (when (process-live-p sh--shellcheck-process)
+    (kill-process sh--shellcheck-process))
+  (let* ((source (current-buffer))
+         (dialect (named-let dialect ((s sh-shell))
+                    (pcase s
+                      ((or 'bash 'dash 'sh) (symbol-name s))
+                      ('ksh88 "ksh")
+                      ((guard s)
+                       (dialect (alist-get s sh-ancestor-alist))))))
+         (pattern "^-:\\([0-9]+\\):\\([0-9]+\\): \\([^:]+\\): \\(.*\\)$")
+         (sentinel
+          (lambda (proc _event)
+            (when (memq (process-status proc) '(exit signal))
+              (unwind-protect
+                  (if (with-current-buffer source
+                        (not (eq proc sh--shellcheck-process)))
+                      (flymake-log :warning "Canceling obsolete check %s" proc)
+                    (with-current-buffer (process-buffer proc)
+                      (goto-char (point-min))
+                      (cl-loop
+                       while (search-forward-regexp pattern nil t)
+                       for msg = (match-string 4)
+                       for (beg . end) = (flymake-diag-region
+                                          source
+                                          (string-to-number (match-string 1))
+                                          (string-to-number (match-string 2)))
+                       for type = (pcase (match-string 3)
+                                    ("error" :error)
+                                    ("warning" :warning)
+                                    (_ :note))
+                       when (and beg end)
+                       collect (flymake-make-diagnostic source beg end type msg)
+                       into diags
+                       finally (funcall report-fn diags))))
+                (kill-buffer (process-buffer proc)))))))
+    (unless dialect
+      (error "`sh-shellcheck-flymake' is not suitable for shell type `%s'"
+             sh-shell))
+    (setq sh--shellcheck-process
+          (make-process
+           :name "luacheck" :noquery t :connection-type 'pipe
+           :buffer (generate-new-buffer " *flymake-luacheck*")
+           :command `(,(car sh-shellcheck-command)
+                      "--format=gcc"
+                      "--color=never"
+                      "-s" ,dialect
+                      ,@(cdr sh-shellcheck-command)
+                      "-")
+           :sentinel sentinel))
+    (save-restriction
+      (widen)
+      (process-send-region sh--shellcheck-process (point-min) (point-max))
+      (process-send-eof sh--shellcheck-process))))
+
 (provide 'sh-script)
 
 ;;; sh-script.el ends here
-- 
2.37.3


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at 57884 <at> debbugs.gnu.org:


Received: (at 57884) by debbugs.gnu.org; 17 Sep 2022 17:05:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 17 13:05:36 2022
Received: from localhost ([127.0.0.1]:47072 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZbG4-0006su-0c
	for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 13:05:36 -0400
Received: from eggs.gnu.org ([209.51.188.92]:45328)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oZbG2-0006si-KV
 for 57884 <at> debbugs.gnu.org; Sat, 17 Sep 2022 13:05:34 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:41346)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oZbFx-0007iZ-Ec; Sat, 17 Sep 2022 13:05:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=naV3kfYmzZI5vJQhmn1Xe5foFDRbsqTELVUTC1y0tDw=; b=GhfuoPRb1Ko6
 LjSPNsg7MYcPc1Bi/MYyP7LPpNx1B08HS/z6iKfTc4ij4P5lIatrzko/Y3bcYgUcbxsD4MofvzKUY
 EwafFbloPt+oi3U/GN8+qb4BfRgzfajTtd1wQjd7LairCZNgxF3puUs1qCd255BOiugelTcvkDH8X
 jsW/T4HgNlsdz6NDqPITBgYSZvVKtEc+0mexHZUK7kWQGrpNZVw+h4J2aDclAwJQkjay1PW7hH3I0
 4CiQKnCoLXeb4hBSQ4EVqfpqJJQZ3qBAl7FOACva3qZP99s8gZK9Fw1yisbZkiF4g/gXSc3dmm3Kw
 +EKRFVJGiX6anPX2W+oAvQ==;
Received: from [87.69.77.57] (port=4852 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oZbFw-0002mk-TC; Sat, 17 Sep 2022 13:05:29 -0400
Date: Sat, 17 Sep 2022 20:05:29 +0300
Message-Id: <83bkre0w4m.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <87a66yaqwc.fsf@HIDDEN> (message from Augusto Stoffel on Sat, 
 17 Sep 2022 18:48:19 +0200)
Subject: Re: bug#57884: [PATCH] Flymake backend using the shellcheck program
References: <87a66yaqwc.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57884
Cc: 57884 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Augusto Stoffel <arstoffel@HIDDEN>
> Date: Sat, 17 Sep 2022 18:48:19 +0200
> 
> See https://www.shellcheck.net/ for details on the ShellCheck program.
> It seems to be the most usual linter for shell scripts.

Thanks.

> * lisp/progmodes/sh-script.el (sh-shellcheck-program,
> sh--shellcheck-process, sh-shellcheck-flymake): Variables and function
> defining a Flymake backend.
> (sh-mode): Add it to 'flymake-diagnostic-functions'.

Please mention the bug number in the log message.

> +(defcustom sh-shellcheck-command '("shellcheck")
> +  "The shellcheck program followed by extra arguments."
> +  :type 'string)

This lacks the :version tag.

Also, wouldn't it be better to have separate user options for the
program and the switches?  That way, there won't be a need to require
users to provide a list as the value of the option.

> +(defun sh-shellcheck-flymake (report-fn &rest _args)
> +  "Flymake backend using the shellcheck program.

The first line of a function's doc string should mention its
arguments.

And I think this warrants a NEWS entry.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Sep 2022 16:48:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 17 12:48:29 2022
Received: from localhost ([127.0.0.1]:47043 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZazV-0006Rl-Dx
	for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 12:48:29 -0400
Received: from lists.gnu.org ([209.51.188.17]:43968)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1oZazS-0006Rb-Ei
 for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 12:48:27 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41670)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
 id 1oZazS-00085h-6W
 for bug-gnu-emacs@HIDDEN; Sat, 17 Sep 2022 12:48:26 -0400
Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:44028)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
 id 1oZazQ-0004uO-3N
 for bug-gnu-emacs@HIDDEN; Sat, 17 Sep 2022 12:48:25 -0400
Received: by mail-ed1-x534.google.com with SMTP id y8so28720334edc.10
 for <bug-gnu-emacs@HIDDEN>; Sat, 17 Sep 2022 09:48:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc
 :subject:date; bh=tmY+NbvoQaNIaeQPrSakXyG22aG6fKCSvqc4ScGePps=;
 b=oaJvP3lWME04+1FCS91siZWns354PM3IR4BVOiOFO/V70DobspdHSs3npMtN8yJsvQ
 /D3l69lRT9sNYvIngG6L3d8lJnLfw2iZGjNAj2dTmmvtVZBqzA2CjzMMTDTJqiHgD3PB
 XnBHF79aZndT4saHh8Q8nle10WksVe50zruTiIEpPBCkEyk6bdDCA0DbcoC6kqKXOhaA
 ZO/J8TwSI94A/LhcTo6O1fEW+ptkuSaAoHsqkIHqB1jaR1hx4KLggpME1NBrY6H4Is4x
 +XKEyWhCNQY9bOl9j409qkVQCPAEV/mjoAaGfXzjC5CFhcgIt4+T4SAkU3eNF5wIx5ou
 N6Sg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:subject:to:from
 :x-gm-message-state:from:to:cc:subject:date;
 bh=tmY+NbvoQaNIaeQPrSakXyG22aG6fKCSvqc4ScGePps=;
 b=OFpPJzrxWvi+waRKNDicSEKljCVnsbiK/UMblNGppqmcGpH32SMN5xPe+gC1Ny1WqB
 ULjRaby03GyzHa77jSzhPgxqxlc9YYK2+wLjTHDWTI/JvW27tJ57XAvqZYYhYyle+GPM
 +6wi57m8wj747bIXdQSaWjsPCrVWQcG5Hf2XMOM073SdyNYU/HsnVcpBAg91Gd731uJX
 sn4NhiB7VHgVIlmAzpxKVDylp/h2dZN7LatFhf7+e3DlfmSmpssXYAloElysJqCGmVUv
 vQHJTzh29tjTYgpi5fDU67cTuANcSL7lf1Ccfm1sDHtkVzNuAa5HzeOBytOzTxrbLGH3
 hgdw==
X-Gm-Message-State: ACrzQf1NCwqZ/GFfFCM1RPpT2JgkczpNb6cI1+4IY56iSxJPClbT8/Nr
 u1Wml2QToe7C/89pJyWnBScmWT00lfRPdw==
X-Google-Smtp-Source: AMsMyM7h/Ql5mKf1fyzYvr0e+vpNPgRe7K9Jjf8TqYRGdO406fsNYaFN2dSPAZzs3JB5TgrCL+FxjQ==
X-Received: by 2002:a05:6402:e86:b0:440:d1be:20c7 with SMTP id
 h6-20020a0564020e8600b00440d1be20c7mr8393813eda.349.1663433301658; 
 Sat, 17 Sep 2022 09:48:21 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::8510])
 by smtp.gmail.com with ESMTPSA id
 s1-20020a05640217c100b0044ec76521a1sm16114084edy.55.2022.09.17.09.48.20
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 17 Sep 2022 09:48:20 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Flymake backend using the shellcheck program
Date: Sat, 17 Sep 2022 18:48:19 +0200
Message-ID: <87a66yaqwc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::534;
 envelope-from=arstoffel@HIDDEN; helo=mail-ed1-x534.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Tags: patch

See https://www.shellcheck.net/ for details on the ShellCheck program.
It seems to be the most usual linter for shell scripts.


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-New-Flymake-backend-using-the-shellcheck-program.patch

From 7571d833179fa49871a23607dc34f17d380eb147 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@HIDDEN>
Date: Sat, 17 Sep 2022 18:30:04 +0200
Subject: [PATCH] New Flymake backend using the shellcheck program

* lisp/progmodes/sh-script.el (sh-shellcheck-program,
sh--shellcheck-process, sh-shellcheck-flymake): Variables and function
defining a Flymake backend.
(sh-mode): Add it to 'flymake-diagnostic-functions'.
---
 lisp/progmodes/sh-script.el | 70 +++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 517fbbd8e7..242afccb3f 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -31,6 +31,9 @@
 ;; available for filenames, variables known from the script, the shell and
 ;; the environment as well as commands.
 
+;; A Flymake backend using the ShellCheck program is provided.  See
+;; https://www.shellcheck.net/ for installation instructions.
+
 ;;; Known Bugs:
 
 ;; - In Bourne the keyword `in' is not anchored to case, for, select ...
@@ -1580,6 +1583,7 @@ sh-mode
 	 ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
          (t sh-shell-file))
    nil nil)
+  (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t)
   (add-hook 'hack-local-variables-hook
     #'sh-after-hack-local-variables nil t))
 
@@ -3103,6 +3107,72 @@ sh-delete-backslash
  	    (delete-region (1+ (point))
  			   (progn (skip-chars-backward " \t") (point)))))))
 
+;;; Flymake backend
+
+(defcustom sh-shellcheck-command '("shellcheck")
+  "The shellcheck program followed by extra arguments."
+  :type 'string)
+
+(defvar-local sh--shellcheck-process nil)
+
+(defun sh-shellcheck-flymake (report-fn &rest _args)
+  "Flymake backend using the shellcheck program.
+Takes a Flymake callback REPORT-FN as argument, as expected of a
+member of `flymake-diagnostic-functions'."
+  (when (process-live-p sh--shellcheck-process)
+    (kill-process sh--shellcheck-process))
+  (let* ((source (current-buffer))
+         (dialect (named-let dialect ((s sh-shell))
+                    (pcase s
+                      ((or 'bash 'dash 'sh) (symbol-name s))
+                      ('ksh88 "ksh")
+                      ((guard s)
+                       (dialect (alist-get s sh-ancestor-alist))))))
+         (pattern "^-:\\([0-9]+\\):\\([0-9]+\\): \\([^:]+\\): \\(.*\\)$")
+         (sentinel
+          (lambda (proc _event)
+            (when (memq (process-status proc) '(exit signal))
+              (unwind-protect
+                  (if (with-current-buffer source
+                        (not (eq proc sh--shellcheck-process)))
+                      (flymake-log :warning "Canceling obsolete check %s" proc)
+                    (with-current-buffer (process-buffer proc)
+                      (goto-char (point-min))
+                      (cl-loop
+                       while (search-forward-regexp pattern nil t)
+                       for msg = (match-string 4)
+                       for (beg . end) = (flymake-diag-region
+                                          source
+                                          (string-to-number (match-string 1))
+                                          (string-to-number (match-string 2)))
+                       for type = (pcase (match-string 3)
+                                    ("error" :error)
+                                    ("warning" :warning)
+                                    (_ :note))
+                       when (and beg end)
+                       collect (flymake-make-diagnostic source beg end type msg)
+                       into diags
+                       finally (funcall report-fn diags))))
+                (kill-buffer (process-buffer proc)))))))
+    (unless dialect
+      (error "`sh-shellcheck-flymake' is not suitable for shell type `%s'"
+             sh-shell))
+    (setq sh--shellcheck-process
+          (make-process
+           :name "luacheck" :noquery t :connection-type 'pipe
+           :buffer (generate-new-buffer " *flymake-luacheck*")
+           :command `(,(car sh-shellcheck-command)
+                      "--format=gcc"
+                      "--color=never"
+                      "-s" ,dialect
+                      ,@(cdr sh-shellcheck-command)
+                      "-")
+           :sentinel sentinel))
+    (save-restriction
+      (widen)
+      (process-send-region sh--shellcheck-process (point-min) (point-max))
+      (process-send-eof sh--shellcheck-process))))
+
 (provide 'sh-script)
 
 ;;; sh-script.el ends here
-- 
2.37.3


--=-=-=--




Acknowledgement sent to Augusto Stoffel <arstoffel@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#57884; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 19 Sep 2022 07:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.