From 1ac92923a3584206f8e19f4199aee92d0a6fdb54 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 24 Dec 2025 15:17:18 +0100 Subject: [PATCH] update flycheck --- bba.org | 2 +- .../flycheck-autoloads.el | 8 +- .../flycheck-buttercup.el | 0 .../flycheck-ert.el | 0 .../flycheck-pkg.el | 9 +- .../flycheck.el | 98 ++++++++++++++----- 6 files changed, 83 insertions(+), 34 deletions(-) rename elpa/{flycheck-20250423.1305 => flycheck-20251128.1706}/flycheck-autoloads.el (98%) rename elpa/{flycheck-20250423.1305 => flycheck-20251128.1706}/flycheck-buttercup.el (100%) rename elpa/{flycheck-20250423.1305 => flycheck-20251128.1706}/flycheck-ert.el (100%) rename elpa/{flycheck-20250423.1305 => flycheck-20251128.1706}/flycheck-pkg.el (72%) rename elpa/{flycheck-20250423.1305 => flycheck-20251128.1706}/flycheck.el (99%) diff --git a/bba.org b/bba.org index c5e588ad..a2209f9b 100644 --- a/bba.org +++ b/bba.org @@ -737,7 +737,7 @@ log-format. #+BEGIN_SRC emacs-lisp (if (>= emacs-major-version 24) (progn - (add-to-list 'load-path "~/.emacs.d/elpa/flycheck-20250423.1305") + (add-to-list 'load-path "~/.emacs.d/elpa/flycheck-20251128.1706") (require 'flycheck) (add-hook 'after-init-hook #'global-flycheck-mode))) #+END_SRC diff --git a/elpa/flycheck-20250423.1305/flycheck-autoloads.el b/elpa/flycheck-20251128.1706/flycheck-autoloads.el similarity index 98% rename from elpa/flycheck-20250423.1305/flycheck-autoloads.el rename to elpa/flycheck-20251128.1706/flycheck-autoloads.el index c29ab306..475d40f7 100644 --- a/elpa/flycheck-20250423.1305/flycheck-autoloads.el +++ b/elpa/flycheck-20251128.1706/flycheck-autoloads.el @@ -69,7 +69,10 @@ either customize it (see the info node `Easy Customization') or call the function `global-flycheck-mode'.") (custom-autoload 'global-flycheck-mode "flycheck" nil) (autoload 'global-flycheck-mode "flycheck" "\ -Toggle Flycheck mode in all buffers. +Toggle Flycheck mode in many buffers. +Specifically, Flycheck mode is enabled in all buffers where +`flycheck-mode-on-safe' would do it. + With prefix ARG, enable Global Flycheck mode if ARG is positive; otherwise, disable it. @@ -77,9 +80,6 @@ If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. -Flycheck mode is enabled in all buffers where `flycheck-mode-on-safe' -would do it. - See `flycheck-mode' for more information on Flycheck mode. (fn &optional ARG)" t) diff --git a/elpa/flycheck-20250423.1305/flycheck-buttercup.el b/elpa/flycheck-20251128.1706/flycheck-buttercup.el similarity index 100% rename from elpa/flycheck-20250423.1305/flycheck-buttercup.el rename to elpa/flycheck-20251128.1706/flycheck-buttercup.el diff --git a/elpa/flycheck-20250423.1305/flycheck-ert.el b/elpa/flycheck-20251128.1706/flycheck-ert.el similarity index 100% rename from elpa/flycheck-20250423.1305/flycheck-ert.el rename to elpa/flycheck-20251128.1706/flycheck-ert.el diff --git a/elpa/flycheck-20250423.1305/flycheck-pkg.el b/elpa/flycheck-20251128.1706/flycheck-pkg.el similarity index 72% rename from elpa/flycheck-20250423.1305/flycheck-pkg.el rename to elpa/flycheck-20251128.1706/flycheck-pkg.el index d89ca263..f7d9a27b 100644 --- a/elpa/flycheck-20250423.1305/flycheck-pkg.el +++ b/elpa/flycheck-20251128.1706/flycheck-pkg.el @@ -1,10 +1,11 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "flycheck" "20250423.1305" +(define-package "flycheck" "20251128.1706" "On-the-fly syntax checking." - '((emacs "27.1")) + '((emacs "27.1") + (seq "2.24")) :url "https://www.flycheck.org" - :commit "2842e237f6abe6602ac3b3bb1ce45bc130e0a1ec" - :revdesc "2842e237f6ab" + :commit "62570fafbedb8fa3f7d75a50a9364feca3b294ef" + :revdesc "62570fafbedb" :keywords '("convenience" "languages" "tools") :authors '(("Sebastian Wiesner" . "swiesner@lunaryorn.com")) :maintainers '(("Clément Pit-Claudel" . "clement.pitclaudel@live.com") diff --git a/elpa/flycheck-20250423.1305/flycheck.el b/elpa/flycheck-20251128.1706/flycheck.el similarity index 99% rename from elpa/flycheck-20250423.1305/flycheck.el rename to elpa/flycheck-20251128.1706/flycheck.el index 1c20efa7..939bdec4 100644 --- a/elpa/flycheck-20250423.1305/flycheck.el +++ b/elpa/flycheck-20251128.1706/flycheck.el @@ -10,9 +10,9 @@ ;; Bozhidar Batsov ;; URL: https://www.flycheck.org ;; Keywords: convenience, languages, tools -;; Package-Version: 20250423.1305 -;; Package-Revision: 2842e237f6ab -;; Package-Requires: ((emacs "27.1")) +;; Package-Version: 20251128.1706 +;; Package-Revision: 62570fafbedb +;; Package-Requires: ((emacs "27.1") (seq "2.24")) ;; This file is not part of GNU Emacs. @@ -10502,30 +10502,54 @@ CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and the BUFFER that was checked respectively. See URL `https://proselint.com/' for more information about proselint." - (mapcar (lambda (err) - (let-alist err - (flycheck-error-new-at-pos - .start - (pcase .severity - (`"suggestion" 'info) - (`"warning" 'warning) - (`"error" 'error) - ;; Default to error - (_ 'error)) - .message - :id .check - :buffer buffer - :checker checker - ;; See https://github.com/amperser/proselint/issues/1048 - :end-pos .end))) - (let-alist (car (flycheck-parse-json output)) - .data.errors))) + (let ((response (flycheck-parse-json output))) + (if (eq (caaar response) 'data) + ;; Proselint versions <= 0.14.0: + (mapcar (lambda (err) + (let-alist err + (flycheck-error-new-at-pos + .start + (pcase .severity + (`"suggestion" 'info) + (`"warning" 'warning) + (`"error" 'error) + ;; Default to error + (_ 'error)) + .message + :id .check + :buffer buffer + :checker checker + ;; See https://github.com/amperser/proselint/issues/1048 + :end-pos .end))) + (let-alist (car response) + .data.errors)) + ;; Proselint versions >= 0.16.0 + (mapcar (lambda (err) + (let-alist err + (flycheck-error-new-at-pos + (nth 0 .span) + 'warning + .message + :id .check_path + :buffer buffer + :checker checker + :end-pos (nth 1 .span)))) + (let-alist (car response) + .result..diagnostics))))) (flycheck-define-checker proselint "Flycheck checker using Proselint. See URL `https://proselint.com/'." - :command ("proselint" "--json" "-") + :command ("proselint" + (eval + (if (= (call-process (or flycheck-proselint-executable "proselint") + nil nil nil "--version") + 0) + ;; Proselint versions <= 0.14.0: + (list "--json" "-") + ;; Proselint versions >= 0.16.0 + (list "check" "--output-format=json")))) :standard-input t :error-parser flycheck-proselint-parse-errors :modes (text-mode markdown-mode gfm-mode message-mode org-mode)) @@ -10886,6 +10910,15 @@ Requires Flake8 3.0 or newer. See URL (flycheck-def-config-file-var flycheck-python-ruff-config python-ruff '("pyproject.toml" "ruff.toml" ".ruff.toml")) +(defun flycheck-python-ruff-explainer (err) + "Return documentation for the ruff `flycheck-error' ERR." + (when-let (error-code (flycheck-error-id err)) + (lambda () + (flycheck-call-checker-process + 'python-ruff nil standard-output t "rule" error-code) + (with-current-buffer standard-output + (flycheck--fontify-as-markdown))))) + (flycheck-define-checker python-ruff "A Python syntax and style checker using Ruff. @@ -10893,6 +10926,7 @@ See URL `https://docs.astral.sh/ruff/'." :command ("ruff" "check" (config-file "--config" flycheck-python-ruff-config) + ;; older versions of ruff (before 0.2) used "text" instead of "concise" "--output-format=concise" (option "--stdin-filename" buffer-file-name) "-") @@ -10906,14 +10940,16 @@ See URL `https://docs.astral.sh/ruff/'." :error-patterns ((error line-start (or "-" (file-name)) ":" line ":" (optional column ":") " " - "SyntaxError: " + ;; first variant is produced by ruff < 0.8 and kept for backward compat + (or "SyntaxError: " "invalid-syntax: ") (message (one-or-more not-newline)) line-end) (warning line-start (or "-" (file-name)) ":" line ":" (optional column ":") " " - (id (one-or-more (any alpha)) (one-or-more digit) " ") + (id (one-or-more (any alpha)) (one-or-more digit)) " " (message (one-or-more not-newline)) line-end)) + :error-explainer flycheck-python-ruff-explainer :working-directory flycheck-python-find-project-root :modes (python-mode python-ts-mode) :next-checkers ((warning . python-mypy))) @@ -12501,13 +12537,25 @@ or added as a shellcheck directive before the source command: :safe #'booleanp :package-version '(flycheck . "31")) +(flycheck-def-option-var flycheck-shellcheck-infer-shell nil sh-shellcheck + "Whether to let ShellCheck infer the shell from the script. + +When non-nil, the --shell flag is not passed to ShellCheck, +allowing it to infer the shell from the shebang line or +shellcheck directives in the script." + :type 'boolean + :safe #'booleanp + :package-version '(flycheck . "36")) + (flycheck-define-checker sh-shellcheck "A shell script syntax and style checker using Shellcheck. See URL `https://github.com/koalaman/shellcheck/'." :command ("shellcheck" "--format" "checkstyle" - "--shell" (eval (symbol-name sh-shell)) + (eval + (unless flycheck-shellcheck-infer-shell + (list "--shell" (symbol-name sh-shell)))) (option-flag "--external-sources" flycheck-shellcheck-follow-sources) (option "--exclude" flycheck-shellcheck-excluded-warnings list -- 2.47.3