emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/flycheck 9476fe7949 2/2: flycheck.el: fix a bunch of "free


From: ELPA Syncer
Subject: [nongnu] elpa/flycheck 9476fe7949 2/2: flycheck.el: fix a bunch of "free variable" warnings in parse-statix
Date: Tue, 27 Feb 2024 04:00:19 -0500 (EST)

branch: elpa/flycheck
commit 9476fe794993b41a7d107e8e02ac5b0386327aea
Author: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>

    flycheck.el: fix a bunch of "free variable" warnings in parse-statix
    
    There's no problem with nesting `let-alist` because per `let-alist`
    documentation, dot-references of an embedded let-alist will only refer
    to the embedded let-alist and not the outer one.
    
    Fixes:
    
        In flycheck-parse-statix:
        flycheck.el:11192:21: Warning: assignment to free variable ‘message’
        flycheck.el:11193:21: Warning: assignment to free variable ‘start-line’
        flycheck.el:11194:21: Warning: assignment to free variable 
‘start-column’
        flycheck.el:11195:21: Warning: assignment to free variable ‘end-line’
        flycheck.el:11196:21: Warning: assignment to free variable ‘end-column’
        flycheck.el:11200:16: Warning: reference to free variable ‘start-line’
        flycheck.el:11201:16: Warning: reference to free variable ‘start-column’
        flycheck.el:11205:39: Warning: reference to free variable ‘message’
        flycheck.el:11213:26: Warning: reference to free variable ‘end-line’
        flycheck.el:11214:28: Warning: reference to free variable ‘end-column’
---
 flycheck.el | 47 +++++++++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/flycheck.el b/flycheck.el
index 64152fa914..72dfda71b7 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -11187,31 +11187,30 @@ See URL `https://github.com/nerdypepper/statix' for 
more
 information about statix."
   (mapcar (lambda (err)
             ;; Diagnostic information is a (seemingly always) 1 element array.
-            ;; Set the values here to avoid nesting `let-alist'.
             (let-alist (car (alist-get 'diagnostics err))
-              (setf message .message
-                    start-line .at.from.line
-                    start-column .at.from.column
-                    end-line .at.to.line
-                    end-column .at.to.column))
-
-            (let-alist err
-              (flycheck-error-new-at
-               start-line
-               start-column
-               (pcase .severity ("Error" 'error)
-                      ("Warn" 'warning)
-                      (_ 'warning))
-               (format "%s: %s" .note message)
-               :id (format "%s%02d" (pcase .severity
-                                      ("Error" "E")
-                                      ("Warn" "W")
-                                      (_ "")) .code)
-               :checker checker
-               :buffer buffer
-               :filename (buffer-file-name buffer)
-               :end-line end-line
-               :end-column end-column)))
+              (let ((message .message)
+                    (start-line .at.from.line)
+                    (start-column .at.from.column)
+                    (end-line .at.to.line)
+                    (end-column .at.to.column))
+
+                (let-alist err
+                  (flycheck-error-new-at
+                   start-line
+                   start-column
+                   (pcase .severity ("Error" 'error)
+                          ("Warn" 'warning)
+                          (_ 'warning))
+                   (format "%s: %s" .note message)
+                   :id (format "%s%02d" (pcase .severity
+                                          ("Error" "E")
+                                          ("Warn" "W")
+                                          (_ "")) .code)
+                   :checker checker
+                   :buffer buffer
+                   :filename (buffer-file-name buffer)
+                   :end-line end-line
+                   :end-column end-column)))))
           (alist-get 'report (car (flycheck-parse-json output)))))
 
 (flycheck-define-checker statix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]