branch: elpa/flycheck
commit 3bc87825a5c0ab0b7a456c3d9c3c2c02f66be906
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Fix proselint version detection breaking checker validation
    
    The (eval ...) form in flycheck-define-checker accepts exactly one
    expression, but the proselint caching change in cd063dfa placed two
    expressions (when + if) inside eval.  Extract the logic into a
    dedicated flycheck--proselint-args helper function.
---
 flycheck.el | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/flycheck.el b/flycheck.el
index 47049ad71a..c507c1db5d 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -10405,22 +10405,25 @@ See URL `https://proselint.com/' for more information 
about proselint."
 Value is t for old (<= 0.14.0), nil for new (>= 0.16.0),
 or `unknown' if not yet detected.")
 
+(defun flycheck--proselint-args ()
+  "Return command arguments for proselint, detecting the version once."
+  (when (eq flycheck--proselint-use-old-args 'unknown)
+    (setq flycheck--proselint-use-old-args
+          (zerop (call-process
+                  (or flycheck-proselint-executable "proselint")
+                  nil nil nil "--version"))))
+  (if flycheck--proselint-use-old-args
+      ;; Proselint versions <= 0.14.0:
+      (list "--json" "-")
+    ;; Proselint versions >= 0.16.0
+    (list "check" "--output-format=json")))
+
 (flycheck-define-checker proselint
   "Flycheck checker using Proselint.
 
 See URL `https://proselint.com/'."
   :command ("proselint"
-            (eval
-             (when (eq flycheck--proselint-use-old-args 'unknown)
-               (setq flycheck--proselint-use-old-args
-                     (zerop (call-process
-                             (or flycheck-proselint-executable "proselint")
-                             nil nil nil "--version"))))
-             (if flycheck--proselint-use-old-args
-                 ;; Proselint versions <= 0.14.0:
-                 (list "--json" "-")
-               ;; Proselint versions >= 0.16.0
-               (list "check" "--output-format=json"))))
+            (eval (flycheck--proselint-args)))
   :standard-input t
   :error-parser flycheck-proselint-parse-errors
   :modes (text-mode markdown-mode gfm-mode message-mode org-mode rst-mode))

Reply via email to