From 1d266e6960e4b2f9ebbf175249ecf4932bc65cae Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 22 Dec 2024 12:58:58 +0100 Subject: [PATCH] update flycheck Signed-off-by: Andreas Gerler --- elpa/flycheck-20230813.620/flycheck-pkg.el | 18 - .../flycheck-autoloads.el | 22 +- .../flycheck-buttercup.el | 0 .../flycheck-ert.el | 73 +- elpa/flycheck-20241130.1502/flycheck-pkg.el | 12 + .../flycheck.el | 1213 +++++++++++------ elpa/flycheck-readme.txt | 30 - 7 files changed, 834 insertions(+), 534 deletions(-) delete mode 100644 elpa/flycheck-20230813.620/flycheck-pkg.el rename elpa/{flycheck-20230813.620 => flycheck-20241130.1502}/flycheck-autoloads.el (91%) rename elpa/{flycheck-20230813.620 => flycheck-20241130.1502}/flycheck-buttercup.el (100%) rename elpa/{flycheck-20230813.620 => flycheck-20241130.1502}/flycheck-ert.el (86%) create mode 100644 elpa/flycheck-20241130.1502/flycheck-pkg.el rename elpa/{flycheck-20230813.620 => flycheck-20241130.1502}/flycheck.el (93%) delete mode 100644 elpa/flycheck-readme.txt diff --git a/elpa/flycheck-20230813.620/flycheck-pkg.el b/elpa/flycheck-20230813.620/flycheck-pkg.el deleted file mode 100644 index df233a64..00000000 --- a/elpa/flycheck-20230813.620/flycheck-pkg.el +++ /dev/null @@ -1,18 +0,0 @@ -(define-package "flycheck" "20230813.620" "On-the-fly syntax checking" - '((emacs "25.1") - (dash "2.12.1") - (pkg-info "0.4") - (let-alist "1.0.4") - (seq "1.11")) - :commit "773c3eb31ebeb6bb2f9f57d28177882ca7073df0" :authors - '(("Sebastian Wiesner" . "swiesner@lunaryorn.com")) - :maintainers - '(("Clément Pit-Claudel" . "clement.pitclaudel@live.com")) - :maintainer - '("Clément Pit-Claudel" . "clement.pitclaudel@live.com") - :keywords - '("convenience" "languages" "tools") - :url "http://www.flycheck.org") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/flycheck-20230813.620/flycheck-autoloads.el b/elpa/flycheck-20241130.1502/flycheck-autoloads.el similarity index 91% rename from elpa/flycheck-20230813.620/flycheck-autoloads.el rename to elpa/flycheck-20241130.1502/flycheck-autoloads.el index 95975238..c29ab306 100644 --- a/elpa/flycheck-20230813.620/flycheck-autoloads.el +++ b/elpa/flycheck-20241130.1502/flycheck-autoloads.el @@ -13,6 +13,8 @@ (autoload 'flycheck-manual "flycheck" "\ Open the Flycheck manual." t) +(autoload 'flycheck-quick-help "flycheck" "\ +Display brief Flycheck help." t) (autoload 'flycheck-mode "flycheck" "\ Flycheck is a minor mode for on-the-fly syntax checking. @@ -33,10 +35,11 @@ Flycheck displays its status in the mode line. In the default configuration, it looks like this: `FlyC' This buffer has not been checked yet. -`FlyC-' Flycheck doesn't have a checker for this buffer. `FlyC*' Flycheck is running. Expect results soon! -`FlyC:3|2' This buffer contains three warnings and two errors. +`FlyC:0' Last check resulted in no errors and no warnings. +`FlyC:3|5' This buffer contains three errors and five warnings. Use `\\[flycheck-list-errors]' to see the list. +`FlyC-' Flycheck doesn't have a checker for this buffer. You may also see the following icons: `FlyC!' The checker crashed. @@ -209,6 +212,21 @@ of command checkers is `flycheck-sanitize-errors'. If this property is given and has a non-nil value, send the contents of the buffer on standard input. + Some checkers that support reading from standard input have + a separate flag to indicate the name of the file whose + contents are being passed on standard input (typically + `stdin-filename'). In that case, use the `(option)' form in + `:command' to pass the value of variable `buffer-file-name' + when the current buffer has a file name (that is, + use `option \"--stdin-file-name\" buffer-file-name'). + + For buffers not backed by files, checkers that support input + on stdin typically report a file name like `-' or `'. + Make sure your error parser or patterns expect these file + names (for example, use `(or \"\" (file-name))') or + call `flycheck-remove-error-file-names' in a custom + `:error-filter'. + Defaults to nil. Note that you may not give `:start', `:interrupt', and diff --git a/elpa/flycheck-20230813.620/flycheck-buttercup.el b/elpa/flycheck-20241130.1502/flycheck-buttercup.el similarity index 100% rename from elpa/flycheck-20230813.620/flycheck-buttercup.el rename to elpa/flycheck-20241130.1502/flycheck-buttercup.el diff --git a/elpa/flycheck-20230813.620/flycheck-ert.el b/elpa/flycheck-20241130.1502/flycheck-ert.el similarity index 86% rename from elpa/flycheck-20230813.620/flycheck-ert.el rename to elpa/flycheck-20241130.1502/flycheck-ert.el index 1cd94f44..f8219e91 100644 --- a/elpa/flycheck-20230813.620/flycheck-ert.el +++ b/elpa/flycheck-20241130.1502/flycheck-ert.el @@ -37,54 +37,6 @@ (require 'ert) (require 'macroexp) ; For macro utilities - -;;; Compatibility - -(eval-and-compile - ;; Provide `ert-skip' and friends for Emacs 24.3 - (defconst flycheck-ert-ert-can-skip (fboundp 'ert-skip) - "Whether ERT supports test skipping.") - - (unless (fboundp 'define-error) - ;; from Emacs `subr.el' - (defun define-error (name message &optional parent) - "Define NAME as a new error signal. -MESSAGE is a string that will be output to the echo area if such an error -is signaled without being caught by a `condition-case'. -PARENT is either a signal or a list of signals from which it inherits. -Defaults to `error'." - (unless parent (setq parent 'error)) - (let ((conditions - (if (consp parent) - (apply #'append - (mapcar - (lambda (parent) - (cons parent - (or (get parent 'error-conditions) - (error "Unknown signal `%s'" parent)))) - parent)) - (cons parent (get parent 'error-conditions))))) - (put name 'error-conditions - (delete-dups (copy-sequence (cons name conditions)))) - (when message (put name 'error-message message))))) - - (unless flycheck-ert-ert-can-skip - ;; Fake skipping - - (define-error 'flycheck-ert-skipped "Test skipped") - - (defun ert-skip (data) - (signal 'flycheck-ert-skipped data)) - - (defmacro skip-unless (form) - `(unless (ignore-errors ,form) - (signal 'flycheck-ert-skipped ',form))) - - (defun ert-test-skipped-p (result) - (and (ert-test-failed-p result) - (eq (car (ert-test-failed-condition result)) - 'flycheck-ert-skipped))))) - ;;; Internal variables @@ -200,16 +152,7 @@ should use to lookup resource files." (error "No tests defined. \ Call `flycheck-ert-initialize' after defining all tests!")) - (setq flycheck-ert--resource-directory resource-dir) - - ;; Emacs 24.3 don't support skipped tests, so we add poor man's test - ;; skipping: We mark skipped tests as expected failures by adjusting the - ;; expected result of all test cases. Not particularly pretty, but works :) - (unless flycheck-ert-ert-can-skip - (dolist (test tests) - (let ((result (ert-test-expected-result-type test))) - (setf (ert-test-expected-result-type test) - `(or ,result (satisfies ert-test-skipped-p)))))))) + (setq flycheck-ert--resource-directory resource-dir))) ;;; Test case definitions @@ -327,8 +270,8 @@ failed, and the test aborted with failure.") Raise an assertion error if the buffer is not clear afterwards." (flycheck-clear) (should (not flycheck-current-errors)) - (should (not (-any? (lambda (ov) (overlay-get ov 'flycheck-overlay)) - (overlays-in (point-min) (point-max)))))) + (should (not (seq-find (lambda (ov) (overlay-get ov 'flycheck-overlay)) + (overlays-in (point-min) (point-max)))))) ;;; Test assertions @@ -343,11 +286,11 @@ Raise an assertion error if the buffer is not clear afterwards." "Test that ERROR has a proper overlay in the current buffer. ERROR is a Flycheck error object." - (let* ((overlay (-first (lambda (ov) - (equal (flycheck-error-without-group - (overlay-get ov 'flycheck-error)) - (flycheck-error-without-group error))) - (flycheck-overlays-in 0 (+ 1 (buffer-size))))) + (let* ((overlay (seq-find (lambda (ov) + (equal (flycheck-error-without-group + (overlay-get ov 'flycheck-error)) + (flycheck-error-without-group error))) + (flycheck-overlays-in 0 (+ 1 (buffer-size))))) (region ;; Overlays of errors from other files are on the first line (if (flycheck-relevant-error-other-file-p error) diff --git a/elpa/flycheck-20241130.1502/flycheck-pkg.el b/elpa/flycheck-20241130.1502/flycheck-pkg.el new file mode 100644 index 00000000..3fd2f435 --- /dev/null +++ b/elpa/flycheck-20241130.1502/flycheck-pkg.el @@ -0,0 +1,12 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "flycheck" "20241130.1502" + "On-the-fly syntax checking." + '((emacs "26.1")) + :url "https://github.com/flycheck/flycheck" + :commit "ebaf48359b3e21879c8f6f3c1b5d0221b345035e" + :revdesc "ebaf48359b3e" + :keywords '("convenience" "languages" "tools") + :authors '(("Sebastian Wiesner" . "swiesner@lunaryorn.com")) + :maintainers '(("Clément Pit-Claudel" . "clement.pitclaudel@live.com") + ("fmdkdd" . "fmdkdd@gmail.com") + ("Bozhidar Batsov" . "bozhidar@batsov.dev"))) diff --git a/elpa/flycheck-20230813.620/flycheck.el b/elpa/flycheck-20241130.1502/flycheck.el similarity index 93% rename from elpa/flycheck-20230813.620/flycheck.el rename to elpa/flycheck-20241130.1502/flycheck.el index 91b5e16d..0aee4ede 100644 --- a/elpa/flycheck-20230813.620/flycheck.el +++ b/elpa/flycheck-20241130.1502/flycheck.el @@ -1,16 +1,18 @@ ;;; flycheck.el --- On-the-fly syntax checking -*- lexical-binding: t; -*- -;; Copyright (C) 2017-2022 Flycheck contributors +;; Copyright (C) 2017-2024 Flycheck contributors ;; Copyright (C) 2012-2016 Sebastian Wiesner and Flycheck contributors ;; Copyright (C) 2013, 2014 Free Software Foundation, Inc. ;; ;; Author: Sebastian Wiesner ;; Maintainer: Clément Pit-Claudel ;; fmdkdd -;; URL: http://www.flycheck.org +;; Bozhidar Batsov +;; URL: https://www.flycheck.org ;; Keywords: convenience, languages, tools -;; Version: 33-cvs -;; Package-Requires: ((emacs "25.1") (dash "2.12.1") (pkg-info "0.4") (let-alist "1.0.4") (seq "1.11")) +;; Package-Version: 20241130.1502 +;; Package-Revision: ebaf48359b3e +;; Package-Requires: ((emacs "26.1")) ;; This file is not part of GNU Emacs. @@ -25,11 +27,11 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with this program. If not, see . ;;; Commentary: -;; On-the-fly syntax checking for GNU Emacs 24. +;; On-the-fly syntax checking for GNU Emacs. ;; ;; Flycheck is a modern on-the-fly syntax checking extension for GNU Emacs, ;; intended as replacement for the older Flymake extension which is part of GNU @@ -42,7 +44,7 @@ ;; It comes with a rich interface for custom syntax checkers and other ;; extensions, and has already many 3rd party extensions adding new features. ;; -;; Please read the online manual at http://www.flycheck.org for more +;; Please read the online manual at https://www.flycheck.org for more ;; information. You can open the manual directly from Emacs with `M-x ;; flycheck-manual'. ;; @@ -69,17 +71,15 @@ (require 'pcase) ; `pcase-dolist' (`pcase' itself is autoloaded) ) -(require 'dash) - (require 'seq) ; Sequence functions -(require 'subr-x nil 'no-error) ; Additional utilities, Emacs 24.4 and upwards +(require 'subr-x) ; Additional utilities (require 'cl-lib) ; `cl-defstruct' and CL utilities (require 'tabulated-list) ; To list errors (require 'easymenu) ; Flycheck Mode menu definition (require 'rx) ; Regexp fanciness in `flycheck-define-checker' (require 'help-mode) ; `define-button-type' (require 'find-func) ; `find-function-regexp-alist' -(require 'json) ; `flycheck-parse-tslint' +(require 'json) ; `flycheck-parse-json' (require 'ansi-color) ; `flycheck-parse-with-patterns-without-color' @@ -93,57 +93,13 @@ ;; Tell the byte compiler about autoloaded functions from packages (declare-function pkg-info-version-info "pkg-info" (package)) - -;;; Compatibility -(eval-and-compile - (unless (fboundp 'string-suffix-p) - ;; TODO: Remove when dropping support for Emacs 24.3 and earlier - (defun string-suffix-p (suffix string &optional ignore-case) - "Return non-nil if SUFFIX is a suffix of STRING. -If IGNORE-CASE is non-nil, the comparison is done without paying -attention to case differences." - (let ((start-pos (- (length string) (length suffix)))) - (and (>= start-pos 0) - (eq t (compare-strings suffix nil nil - string start-pos nil ignore-case)))))) - - (defalias 'flycheck--format-message - (if (fboundp 'format-message) #'format-message #'format)) - - ;; TODO: Remove when dropping support for Emacs 24.3 and earlier - (unless (featurep 'subr-x) - ;; `subr-x' function for Emacs 24.3 and below - (defsubst string-join (strings &optional separator) - "Join all STRINGS using SEPARATOR." - (mapconcat 'identity strings separator)) - - (defsubst string-trim-left (string) - "Remove leading whitespace from STRING." - (if (string-match "\\`[ \t\n\r]+" string) - (replace-match "" t t string) - string)) - - (defsubst string-trim-right (string) - "Remove trailing whitespace from STRING." - (if (string-match "[ \t\n\r]+\\'" string) - (replace-match "" t t string) - string)) - - (defsubst string-trim (string) - "Remove leading and trailing whitespace from STRING." - (string-trim-left (string-trim-right string))) - - (defsubst string-empty-p (string) - "Check whether STRING is empty." - (string= string "")))) - ;;; Customization (defgroup flycheck nil "Modern on-the-fly syntax checking for GNU Emacs." :prefix "flycheck-" :group 'tools - :link '(url-link :tag "Website" "http://www.flycheck.org") + :link '(url-link :tag "Website" "https://www.flycheck.org") :link '(url-link :tag "Github" "https://github.com/flycheck/flycheck")) (defgroup flycheck-config-files nil @@ -179,10 +135,8 @@ attention to case differences." c/c++-gcc c/c++-cppcheck cfengine - chef-foodcritic coffee coffee-coffeelint - coq css-csslint css-stylelint cuda-nvcc @@ -199,7 +153,6 @@ attention to case differences." eruby-ruumba fortran-gfortran go-gofmt - go-golint go-vet go-build go-test @@ -208,6 +161,7 @@ attention to case differences." go-staticcheck groovy haml + haml-lint handlebars haskell-stack-ghc haskell-ghc @@ -227,14 +181,17 @@ attention to case differences." lua markdown-markdownlint-cli markdown-mdl + markdown-pymarkdown nix nix-linter opam perl perl-perlcritic + perl-perlimports php php-phpmd php-phpcs + php-phpcs-changed processing proselint protobuf-protoc @@ -243,28 +200,32 @@ attention to case differences." puppet-parser puppet-lint python-flake8 + python-ruff python-pylint python-pycompile python-pyright python-mypy r-lintr + r racket rpm-rpmlint rst-sphinx rst ruby-rubocop + ruby-chef-cookstyle ruby-standard ruby-reek - ruby-rubylint ruby ruby-jruby rust-cargo rust rust-clippy + salt-lint scala scala-scalastyle scheme-chicken scss-lint + sass-stylelint scss-stylelint sass/scss-sass-lint sass @@ -277,6 +238,7 @@ attention to case differences." slim slim-lint sql-sqlint + statix systemd-analyze tcl-nagelfar terraform @@ -290,6 +252,7 @@ attention to case differences." vhdl-ghdl xml-xmlstarlet xml-xmllint + yaml-actionlint yaml-jsyaml yaml-ruby yaml-yamllint) @@ -428,6 +391,18 @@ node `(elisp)Hooks'." :package-version '(flycheck . "0.13") :risky t) +(defcustom flycheck-auto-display-errors-after-checking t + "Whether to automatically display errors at the current point after checking. + +When being set to `nil', it will prevent Flycheck from automatically displaying +error messages. This setting is useful when Flycheck is used together with +`flycheck-posframe', to prevent `flycheck-posframe' from repeatedly displaying +errors at point." + :group 'flycheck + :type 'boolean + :package-version '(flycheck . "35") + :safe #'booleanp) + (defcustom flycheck-display-errors-delay 0.9 "Delay in seconds before displaying errors at point. @@ -454,6 +429,18 @@ If set to nil, do not display errors at all." :package-version '(flycheck . "0.13") :risky t) +(defcustom flycheck-clear-displayed-errors-function #'flycheck-clear-displayed-error-messages + "Function to hide error message displayed by `flycheck-display-errors-function'. + +If set to a function, it will be called with no arguments to +clear all displayed errors at point." + :group 'flycheck + :type '(choice (const :tag "Clear displayed error messages" + flycheck-clear-displayed-error-messages) + (function :tag "Clear displayed errors function")) + :package-version '(flycheck . "34.2") + :risky t) + (defcustom flycheck-help-echo-function #'flycheck-help-echo-all-error-messages "Function to compute the contents of the error tooltips. @@ -1164,6 +1151,12 @@ Set this variable to nil to disable the mode line completely." :risky t :package-version '(flycheck . "0.20")) +(defcustom flycheck-mode-line-color t + "Use colors for Flycheck mode line status." + :group 'flycheck + :type 'boolean + :package-version '(flycheck . "35")) + (defcustom flycheck-mode-line-prefix "FlyC" "Base mode line lighter for Flycheck. @@ -1176,6 +1169,12 @@ function must be updated to use this variable." :type 'string :package-version '(flycheck . "26")) +(defcustom flycheck-mode-success-indicator ":0" + "Success indicator appended to `flycheck-mode-line-prefix'." + :group 'flycheck + :type 'string + :package-version '(flycheck . "35")) + (defcustom flycheck-error-list-mode-line `(,(propertized-buffer-identification "%12b") " for buffer " @@ -1225,7 +1224,7 @@ Only has effect when variable `global-flycheck-mode' is non-nil." ;; Add built-in functions to our hooks, via `add-hook', to make sure that our ;; functions are really present, even if the variable was implicitly defined by ;; another call to `add-hook' that occurred before Flycheck was loaded. See -;; http://lists.gnu.org/archive/html/emacs-devel/2015-02/msg01271.html for why +;; https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg01271.html for why ;; we don't initialize the hook variables right away. We append our own ;; functions, because a user likely expects that their functions come first, ;; even if they added them before Flycheck was loaded. @@ -1250,6 +1249,7 @@ Only has effect when variable `global-flycheck-mode' is non-nil." flycheck-checkers))] ["Check current buffer" flycheck-buffer flycheck-mode] ["Clear errors in buffer" flycheck-clear t] + ["Run checker as compile command" flycheck-compile flycheck-mode] "---" ["Go to next error" flycheck-next-error flycheck-mode] ["Go to previous error" flycheck-previous-error flycheck-mode] @@ -1267,12 +1267,32 @@ Only has effect when variable `global-flycheck-mode' is non-nil." ["Describe syntax checker" flycheck-describe-checker t] ["Verify setup" flycheck-verify-setup t] ["Show Flycheck version" flycheck-version t] - ["Read the Flycheck manual" flycheck-info t])) + ["Flycheck quick help" flycheck-quick-help t] + ["Read the Flycheck manual" flycheck-manual t])) "Menu of command `flycheck-mode'.") (easy-menu-add-item nil '("Tools") flycheck-mode-menu-map "Spell Checking") + +(defconst flycheck-version "35.0-snapshot" + "The current version of Flycheck. + +Should be kept in sync with the package version metadata. +Used only when `package-get-function' is not available +or fails.") + +(defun flycheck--pkg-version () + "Extract FLYCHECK's package version from its package metadata." + ;; Use `cond' below to avoid a compiler unused return value warning + ;; when `package-get-version' returns nil. See #3181. + (cond ((fboundp 'package-get-version) + (package-get-version)) + ((fboundp 'pkg-info-version-info) + (pkg-info-version-info 'flycheck)) + (t + flycheck-version))) + ;;; Version information, manual and loading of Flycheck (defun flycheck-version (&optional show-version) "Get the Flycheck version as string. @@ -1287,7 +1307,7 @@ If the version number could not be determined, signal an error, if called interactively, or if SHOW-VERSION is non-nil, otherwise just return nil." (interactive (list t)) - (let ((version (pkg-info-version-info 'flycheck))) + (let ((version (flycheck--pkg-version))) (when show-version (message "Flycheck version: %s" version)) version)) @@ -1304,7 +1324,43 @@ just return nil." (defun flycheck-manual () "Open the Flycheck manual." (interactive) - (browse-url "http://www.flycheck.org")) + (browse-url "https://www.flycheck.org")) + +;;;###autoload +(defun flycheck-quick-help () + "Display brief Flycheck help." + (interactive) + (with-current-buffer (get-buffer-create "*flycheck-quick-help*") + (with-help-window (current-buffer) + (flycheck-mode) ;; so that we can exapnd \\[flycheck-] + (let ((help + (substitute-command-keys + "Flycheck automatically runs checks on writable files when changed. +Mode line status for the current buffer: + FlyC Not been checked yet + FlyC* Flycheck is running + FlyC:0 Last check resulted in no errors and no warnings + FlyC:3|5 Checker reported three errors and five warnings + FlyC- No checker available + FlyC! The checker crashed + FlyC. The last syntax check was manually interrupted + FlyC? The checker did something unexpected + +Key bindings: + \\[flycheck-buffer] Check current buffer + \\[flycheck-clear] Clear errors in current buffer + \\[flycheck-compile] Run checker as compile command + + \\[flycheck-next-error] Next error + \\[flycheck-previous-error] Previous error + \\[flycheck-list-errors] List all errors + + \\[flycheck-copy-errors-as-kill] Copy error messages at point + \\[flycheck-display-error-at-point] Explain error at point +"))) + (help-mode) + (read-only-mode 0) + (insert help))))) (define-obsolete-function-alias 'flycheck-info 'flycheck-manual "Flycheck 26" "Open the Flycheck manual.") @@ -1621,14 +1677,14 @@ Always return the name of the corresponding source file, never any byte-compiled file. Return nil, if the currently loaded file cannot be determined." - (-when-let* ((this-file (cond - (load-in-progress load-file-name) - ((bound-and-true-p byte-compile-current-file)) - (t (buffer-file-name)))) - ;; A best guess for the source file of a compiled library. Works - ;; well in most cases, and especially for ELPA packages - (source-file (concat (file-name-sans-extension this-file) - ".el"))) + (when-let* ((this-file (cond + (load-in-progress load-file-name) + ((bound-and-true-p byte-compile-current-file)) + (t (buffer-file-name)))) + ;; A best guess for the source file of a compiled library. Works + ;; well in most cases, and especially for ELPA packages + (source-file (concat (file-name-sans-extension this-file) + ".el"))) (when (file-exists-p source-file) source-file))) @@ -2593,7 +2649,7 @@ return value is a list of checkers, not including CHECKER." (defun flycheck--verify-next-checkers (checker) "Return a verification result for the next checkers of CHECKER." - (-when-let (next (flycheck-get-next-checkers checker)) + (when-let (next (flycheck-get-next-checkers checker)) (list (flycheck-verification-result-new :label "next checkers" @@ -2645,7 +2701,7 @@ to enable disabled checkers."))) (fill-region-as-paragraph (point) end))) (princ "\n\n--------------------\n\n") - (princ (format "Flycheck version: %s\n" (flycheck-version))) + (princ (format "Flycheck version: %s\n" (flycheck--pkg-version))) (princ (format "Emacs version: %s\n" emacs-version)) (princ (format "System: %s\n" system-configuration)) (princ (format "Window system: %S\n" window-system))) @@ -2925,7 +2981,7 @@ Slots: ;; the focus hooks only work on Emacs 24.4 and upwards, but since undefined ;; hooks are perfectly ok we don't need a version guard here. They'll just ;; not work silently. - (post-command-hook . flycheck-maybe-display-error-at-point-soon) + (post-command-hook . flycheck-display-error-at-point-soon) (focus-in-hook . flycheck-display-error-at-point-soon) (focus-out-hook . flycheck-cancel-error-display-error-at-point-timer) (post-command-hook . flycheck-hide-error-buffer) @@ -2958,10 +3014,11 @@ Flycheck displays its status in the mode line. In the default configuration, it looks like this: `FlyC' This buffer has not been checked yet. -`FlyC-' Flycheck doesn't have a checker for this buffer. `FlyC*' Flycheck is running. Expect results soon! -`FlyC:3|2' This buffer contains three warnings and two errors. +`FlyC:0' Last check resulted in no errors and no warnings. +`FlyC:3|5' This buffer contains three errors and five warnings. Use `\\[flycheck-list-errors]' to see the list. +`FlyC-' Flycheck doesn't have a checker for this buffer. You may also see the following icons: `FlyC!' The checker crashed. @@ -3290,7 +3347,8 @@ WORKING-DIR." (flycheck-delete-marked-overlays) (flycheck-error-list-refresh) (run-hooks 'flycheck-after-syntax-check-hook) - (when (eq (current-buffer) (window-buffer)) + (when (and flycheck-auto-display-errors-after-checking + (eq (current-buffer) (window-buffer))) (flycheck-display-error-at-point)) ;; Immediately try to run any pending deferred syntax check, which ;; were triggered by intermediate automatic check event, to make sure @@ -3329,6 +3387,7 @@ current syntax check." (flycheck-stop)) (flycheck-delete-all-overlays) (flycheck-clear-errors) + (flycheck-clear-displayed-error-messages) (flycheck-error-list-refresh) (flycheck-hide-error-buffer)) @@ -3743,10 +3802,10 @@ Return a cons cell `(BEG . END)'. If the input range is empty, it is expanded to cover at least one character so that END is always greater than BEG. If ERR doesn't specify an end-column return nil." - (-if-let* ((line (flycheck-error-line err)) - (column (flycheck-error-column err)) - (end-line (or (flycheck-error-end-line err) line)) - (end-column (flycheck-error-end-column err))) + (if-let* ((line (flycheck-error-line err)) + (column (flycheck-error-column err)) + (end-line (or (flycheck-error-end-line err) line)) + (end-column (flycheck-error-end-column err))) ;; Ignoring fields speeds up calls to `line-end-position'. (let* ((inhibit-field-text-motion t) (beg (flycheck-line-column-to-position line column)) @@ -3873,8 +3932,8 @@ beginning position)." (other-file-p (and fname (not (equal fname (buffer-file-name)))))) (concat (and other-file-p (format "In %S:\n" (file-relative-name fname))) (and include-snippet - (-when-let* ((snippet (flycheck-error-format-snippet err))) - (flycheck--format-message "`%s': " snippet))) + (when-let* ((snippet (flycheck-error-format-snippet err))) + (format-message "`%s': " snippet))) (or (flycheck-error-message err) (format "Unknown %S" (flycheck-error-level err))) (and id (format " [%s]" id))))) @@ -3995,7 +4054,7 @@ name of an error is nil fill in the result of function Return ERRORS, modified in-place." (seq-do (lambda (err) (setf (flycheck-error-filename err) - (-if-let (filename (flycheck-error-filename err)) + (if-let (filename (flycheck-error-filename err)) (expand-file-name filename directory) (buffer-file-name)))) errors) @@ -4117,19 +4176,29 @@ refresh the mode line." STATUS defaults to `flycheck-last-status-change' if omitted or nil." - (let ((text (pcase (or status flycheck-last-status-change) - (`not-checked "") - (`no-checker "-") - (`running "*") - (`errored "!") - (`finished - (let-alist (flycheck-count-errors flycheck-current-errors) - (if (or .error .warning) - (format ":%s|%s" (or .error 0) (or .warning 0)) - ""))) - (`interrupted ".") - (`suspicious "?")))) - (concat " " flycheck-mode-line-prefix text))) + (let* ((current-status (or status flycheck-last-status-change)) + (indicator (pcase current-status + (`not-checked "") + (`no-checker "-") + (`running "*") + (`errored "!") + (`finished + (let-alist (flycheck-count-errors flycheck-current-errors) + (if (or .error .warning) + (format ":%s|%s" (or .error 0) (or .warning 0)) + flycheck-mode-success-indicator))) + (`interrupted ".") + (`suspicious "?"))) + (face (when flycheck-mode-line-color + (pcase current-status + (`errored 'error) + (`finished + (let-alist (flycheck-count-errors flycheck-current-errors) + (if (or .error .warning) 'error 'success)))))) + (text (format " %s%s" flycheck-mode-line-prefix indicator))) + (when face + (setq text (propertize text 'face face))) + text)) ;;; Error levels @@ -4516,7 +4585,7 @@ Return ERRORS." Return ERRORS." (dolist (err errors) - (-when-let (message (flycheck-error-message err)) + (when-let (message (flycheck-error-message err)) (setf (flycheck-error-message err) (replace-regexp-in-string (rx (one-or-more (any space "\n" "\r"))) " " message 'fixed-case 'literal)))) @@ -4531,7 +4600,7 @@ lines accordingly. Return ERRORS, with in-place modifications." (dolist (err errors) - (-when-let (message (flycheck-error-message err)) + (when-let (message (flycheck-error-message err)) (with-temp-buffer (insert message) ;; Determine the indentation offset @@ -4793,11 +4862,11 @@ errors. Arguments WINDOW, OBJECT and POS are as described in info node `(elisp)Special properties', as this function is intended to be used as the \\='help-echo property of flycheck error overlays." - (-when-let (buf (cond ((bufferp object) object) - ((overlayp object) (overlay-buffer object)))) + (when-let (buf (cond ((bufferp object) object) + ((overlayp object) (overlay-buffer object)))) (with-current-buffer buf - (-when-let* ((fn flycheck-help-echo-function) - (errs (flycheck-overlay-errors-at pos))) + (when-let* ((fn flycheck-help-echo-function) + (errs (flycheck-overlay-errors-at pos))) (propertize (funcall fn errs) 'help-echo-inhibit-substitution t))))) (defun flycheck-help-echo-all-error-messages (errs) @@ -4877,7 +4946,7 @@ overlays." ERR is also interesting (the function returns true) if there are no errors as or more severe than `flycheck-navigation-minimum-level'." (when (flycheck-error-p err) - (-if-let (min-level flycheck-navigation-minimum-level) + (if-let (min-level flycheck-navigation-minimum-level) (or (<= (flycheck-error-level-severity min-level) (flycheck-error-level-severity (flycheck-error-level err))) (not (flycheck-has-current-errors-p min-level))) @@ -4939,8 +5008,8 @@ beginning of the buffer, otherwise advance from the current position. Intended for use with `next-error-function'." - (-if-let* ((pos (flycheck-next-error-pos n reset)) - (err (get-char-property pos 'flycheck-error))) + (if-let* ((pos (flycheck-next-error-pos n reset)) + (err (get-char-property pos 'flycheck-error))) (flycheck-jump-to-error err) (user-error "No more Flycheck errors"))) @@ -5044,11 +5113,8 @@ message to stretch arbitrarily far." ;; `revert-buffer' updates the mode line for us, so all we need to do is ;; set the corresponding mode line construct. mode-line-buffer-identification flycheck-error-list-mode-line) - ;; Guard `truncate-string-ellipsis' for Emacs 24. - ;; TODO: Remove when dropping Emacs 24 compatibility - (when (boundp 'truncate-string-ellipsis) - ;; See https://github.com/flycheck/flycheck/issues/1101 - (setq-local truncate-string-ellipsis "…")) + ;; See https://github.com/flycheck/flycheck/issues/1101 + (setq-local truncate-string-ellipsis "…") (tabulated-list-init-header)) (defvar-local flycheck-error-list-source-buffer nil @@ -5177,8 +5243,8 @@ ensure that they line up properly once the message is displayed." (defun flycheck-error-list-entries () "Create the entries for the error list." - (-when-let* ((errors (flycheck-error-list-current-errors)) - (filtered (flycheck-error-list-apply-filter errors))) + (when-let* ((errors (flycheck-error-list-current-errors)) + (filtered (flycheck-error-list-apply-filter errors))) (seq-map #'flycheck-error-list-make-entry filtered))) (defun flycheck-error-list-entry-< (entry1 entry2) @@ -5228,7 +5294,7 @@ mode line indication of `flycheck-error-list-mode'." ALL-FRAMES specifies the frames to consider, as in `get-buffer-window-list'." - (-when-let (buf (get-buffer flycheck-error-list-buffer)) + (when-let (buf (get-buffer flycheck-error-list-buffer)) (get-buffer-window-list buf nil all-frames))) (defun flycheck-get-error-list-window (&optional all-frames) @@ -5236,7 +5302,7 @@ ALL-FRAMES specifies the frames to consider, as in ALL-FRAMES specifies the frames to consider, as in `get-buffer-window'." - (-when-let (buf (get-buffer flycheck-error-list-buffer)) + (when-let (buf (get-buffer flycheck-error-list-buffer)) (get-buffer-window buf all-frames))) (defun flycheck-error-list-recenter-at (pos) @@ -5257,7 +5323,7 @@ list." ;; select this window while reverting, because Tabulated List mode attempts to ;; recenter the error at the old location, so it must have the proper window ;; selected. - (-when-let (window (flycheck-get-error-list-window t)) + (when-let (window (flycheck-get-error-list-window t)) (with-selected-window window (revert-buffer)) (run-hooks 'flycheck-error-list-after-refresh-hook) @@ -5302,8 +5368,8 @@ Interactively, or with non-nil REFRESH, refresh the error list." (defun flycheck-error-list-apply-filter (errors) "Filter ERRORS according to `flycheck-error-list-minimum-level'." - (-if-let* ((min-level flycheck-error-list-minimum-level) - (min-severity (flycheck-error-level-severity min-level))) + (if-let* ((min-level flycheck-error-list-minimum-level) + (min-severity (flycheck-error-level-severity min-level))) (seq-filter (lambda (err) (>= (flycheck-error-level-severity (flycheck-error-level err)) min-severity)) @@ -5315,7 +5381,7 @@ Interactively, or with non-nil REFRESH, refresh the error list." POS defaults to `point'." (interactive) - (-when-let* ((error (tabulated-list-get-id pos))) + (when-let* ((error (tabulated-list-get-id pos))) (flycheck-jump-to-error error))) (defun flycheck-jump-to-error (error) @@ -5365,11 +5431,11 @@ POS defaults to `point'." POS defaults to `point'." (interactive) - (-when-let* ((error (tabulated-list-get-id pos)) - (explainer (flycheck-checker-get (flycheck-error-checker error) - 'error-explainer))) + (when-let* ((error (tabulated-list-get-id pos)) + (explainer (flycheck-checker-get (flycheck-error-checker error) + 'error-explainer))) (flycheck-error-with-buffer error - (-when-let (explanation (funcall explainer error)) + (when-let (explanation (funcall explainer error)) (flycheck-display-error-explanation explanation))))) (defun flycheck-error-list-next-error-pos (pos &optional n) @@ -5493,6 +5559,11 @@ non-nil." (when flycheck-display-errors-function (funcall flycheck-display-errors-function errors))) +(defun flycheck-clear-displayed-errors () + "Clear errors using `flycheck-clear-displayed-errors-function'." + (when flycheck-clear-displayed-errors-function + (funcall flycheck-clear-displayed-errors-function))) + (defvar-local flycheck-display-error-at-point-timer nil "Timer to automatically show errors.") @@ -5502,40 +5573,27 @@ non-nil." (cancel-timer flycheck-display-error-at-point-timer) (setq flycheck-display-error-at-point-timer nil))) -(defun flycheck--error-display-tick () - "Return point and tick counter of current buffer." - (cons (point) (buffer-modified-tick))) - -(defvar-local flycheck--last-error-display-tick nil - "Value of `flycheck--error-display-tick' when errors were last displayed.") - (defun flycheck-display-error-at-point () - "Display all the error messages at point." + "Display all the error messages at point. + +If there are no errors, clears the error messages at point." (interactive) ;; This function runs from a timer, so we must take care to not ignore any ;; errors (with-demoted-errors "Flycheck error display error: %s" (flycheck-cancel-error-display-error-at-point-timer) - (setq flycheck--last-error-display-tick (flycheck--error-display-tick)) (when flycheck-mode - (-when-let (errors (flycheck-overlay-errors-at (point))) - (flycheck-display-errors errors))))) + (let ((errors (flycheck-overlay-errors-at (point)))) + (if errors + (flycheck-display-errors errors) + (flycheck-clear-displayed-errors)))))) (defun flycheck-display-error-at-point-soon () "Display error messages at point, with a delay." - (setq flycheck--last-error-display-tick nil) - (flycheck-maybe-display-error-at-point-soon)) - -(defun flycheck-maybe-display-error-at-point-soon () - "Display error message at point with a delay, unless already displayed." (flycheck-cancel-error-display-error-at-point-timer) - (when (and (not (equal flycheck--last-error-display-tick - (setq flycheck--last-error-display-tick - (flycheck--error-display-tick)))) - (flycheck-overlays-at (point))) - (setq flycheck-display-error-at-point-timer - (run-at-time flycheck-display-errors-delay nil - 'flycheck-display-error-at-point)))) + (setq flycheck-display-error-at-point-timer + (run-at-time flycheck-display-errors-delay nil + 'flycheck-display-error-at-point))) ;;; Functions to display errors @@ -5560,6 +5618,14 @@ and if the echo area is not occupied by minibuffer input." "Flycheck error messages" "Major mode for extended error messages.") +(defvar flycheck--last-displayed-message nil + "Reference to the last displayed message so it can be cleared. + +This value is the return value from `display-message-or-buffer', +thus it can be a string or a window. + +See `flycheck-clear-displayed-error-messages'.") + (defun flycheck-display-error-messages (errors) "Display the messages of ERRORS. @@ -5573,15 +5639,17 @@ information. In the latter case, show messages in the buffer denoted by variable `flycheck-error-message-buffer'." (when (and errors (flycheck-may-use-echo-area-p)) - (let ((message (flycheck-help-echo-all-error-messages errors))) - (display-message-or-buffer - message flycheck-error-message-buffer 'not-this-window) + (let* ((message (flycheck-help-echo-all-error-messages errors)) + (retval (display-message-or-buffer + message flycheck-error-message-buffer 'not-this-window))) ;; We cannot rely on `display-message-or-buffer' returning the right ;; window. See URL `https://github.com/flycheck/flycheck/issues/1643'. - (-when-let (buf (get-buffer flycheck-error-message-buffer)) + (when-let (buf (get-buffer flycheck-error-message-buffer)) (with-current-buffer buf (unless (derived-mode-p 'flycheck-error-message-mode) - (flycheck-error-message-mode))))))) + (flycheck-error-message-mode)))) + (setq flycheck--last-displayed-message retval) + retval))) (defun flycheck-display-error-messages-unless-error-list (errors) "Show messages of ERRORS unless the error list is visible. @@ -5596,14 +5664,22 @@ the current frame." "Hide the Flycheck error buffer if necessary. Hide the error buffer if there is no error under point." - (-when-let* ((buffer (flycheck-error-message-buffer)) - (window (get-buffer-window buffer))) + (when-let* ((buffer (flycheck-error-message-buffer)) + (window (get-buffer-window buffer))) (unless (flycheck-overlays-at (point)) ;; save-selected-window prevents `quit-window' from changing the current ;; buffer (see https://github.com/flycheck/flycheck/issues/648). (save-selected-window (quit-window nil window))))) +(defun flycheck-clear-displayed-error-messages () + "Clear error messages displayed by `flycheck-display-error-messages'." + (when flycheck--last-displayed-message + (if (and (stringp flycheck--last-displayed-message) + (equal (current-message) flycheck--last-displayed-message)) + (message nil) + (flycheck-hide-error-buffer)))) + ;;; Working with errors (defun flycheck-copy-errors-as-kill (pos &optional formatter) @@ -5635,16 +5711,16 @@ with a non-nil `:error-explainer' function defined in its checker. The `:error-explainer' function is then called with this error to produce the explanation to display." (interactive) - (-when-let* ((first-error - ;; Get the first error at point that has an `error-explainer'. - (seq-find (lambda (error) - (flycheck-checker-get - (flycheck-error-checker error) 'error-explainer)) - (flycheck-overlay-errors-at (point)))) - (explainer - (flycheck-checker-get (flycheck-error-checker first-error) - 'error-explainer)) - (explanation (funcall explainer first-error))) + (when-let* ((first-error + ;; Get the first error at point that has an `error-explainer'. + (seq-find (lambda (error) + (flycheck-checker-get + (flycheck-error-checker error) 'error-explainer)) + (flycheck-overlay-errors-at (point)))) + (explainer + (flycheck-checker-get (flycheck-error-checker first-error) + 'error-explainer)) + (explanation (funcall explainer first-error))) (flycheck-display-error-explanation explanation))) (defconst flycheck-explain-error-buffer "*Flycheck error explanation*" @@ -5800,6 +5876,21 @@ of command checkers is `flycheck-sanitize-errors'. If this property is given and has a non-nil value, send the contents of the buffer on standard input. + Some checkers that support reading from standard input have + a separate flag to indicate the name of the file whose + contents are being passed on standard input (typically + `stdin-filename'). In that case, use the `(option)' form in + `:command' to pass the value of variable `buffer-file-name' + when the current buffer has a file name (that is, + use `option \"--stdin-file-name\" buffer-file-name'). + + For buffers not backed by files, checkers that support input + on stdin typically report a file name like `-' or `'. + Make sure your error parser or patterns expect these file + names (for example, use `(or \"\" (file-name))') or + call `flycheck-remove-error-file-names' in a custom + `:error-filter'. + Defaults to nil. Note that you may not give `:start', `:interrupt', and @@ -5911,7 +6002,7 @@ executable cannot be found, and return a numeric exit status or a signal description string otherwise. CHECKER's input is taken from INFILE, and its output is sent to DESTINATION, as in `call-process'." - (-if-let (executable (flycheck-find-checker-executable checker)) + (if-let (executable (flycheck-find-checker-executable checker)) (condition-case err (apply #'call-process executable infile destination nil args) (error (when error (signal (car err) (cdr err))))) @@ -6089,27 +6180,27 @@ are substituted within the body of cells!" (list (make-temp-name (expand-file-name "flycheck" directory))))) (`null-device (list null-device)) (`(config-file ,option-name ,file-name-var) - (-when-let* ((value (symbol-value file-name-var)) - (file-name (flycheck-locate-config-file value checker))) + (when-let* ((value (symbol-value file-name-var)) + (file-name (flycheck-locate-config-file value checker))) (flycheck-prepend-with-option option-name (list file-name)))) (`(config-file ,option-name ,file-name-var ,prepend-fn) - (-when-let* ((value (symbol-value file-name-var)) - (file-name (flycheck-locate-config-file value checker))) + (when-let* ((value (symbol-value file-name-var)) + (file-name (flycheck-locate-config-file value checker))) (flycheck-prepend-with-option option-name (list file-name) prepend-fn))) (`(option ,option-name ,variable) - (-when-let (value (symbol-value variable)) + (when-let (value (symbol-value variable)) (unless (stringp value) (error "Value %S of %S for option %s is not a string" value variable option-name)) (flycheck-prepend-with-option option-name (list value)))) (`(option ,option-name ,variable ,prepend-fn) - (-when-let (value (symbol-value variable)) + (when-let (value (symbol-value variable)) (unless (stringp value) (error "Value %S of %S for option %s is not a string" value variable option-name)) (flycheck-prepend-with-option option-name (list value) prepend-fn))) (`(option ,option-name ,variable ,prepend-fn ,filter) - (-when-let (value (funcall filter (symbol-value variable))) + (when-let (value (funcall filter (symbol-value variable))) (unless (stringp value) (error "Value %S of %S (filter: %S) for option %s is not a string" value variable filter option-name)) @@ -6567,8 +6658,8 @@ directory of the current buffer and all ancestors thereof (see absolute path. Otherwise return nil. _CHECKER is ignored." - (-when-let* ((basefile (buffer-file-name)) - (directory (locate-dominating-file basefile filename))) + (when-let* ((basefile (buffer-file-name)) + (directory (locate-dominating-file basefile filename))) (expand-file-name filename directory))) (defun flycheck-locate-config-file-home (filename _checker) @@ -6657,7 +6748,7 @@ SEPARATOR is ignored in this case." (let ((filter (or filter #'identity)) (separator (or separator ","))) (if (listp value) - (-when-let (value (delq nil (seq-map filter value))) + (when-let (value (delq nil (seq-map filter value))) (string-join value separator)) (funcall filter value)))) @@ -6768,8 +6859,12 @@ Instead of highlighting errors in the buffer, this command pops up a separate buffer with the entire output of the syntax checker tool, just like `compile' (\\[compile])." (interactive - (let ((default (flycheck-get-checker-for-buffer))) - (list (flycheck-read-checker "Run syntax checker as compile command: " + (let* ((default (flycheck-get-checker-for-buffer)) + (prompt (concat + "Run syntax checker as compile command" + (when default (concat " [" (format "%S" default) "]")) + ": "))) + (list (flycheck-read-checker prompt (when (flycheck-checker-get default 'command) default) 'command)))) @@ -6809,7 +6904,7 @@ Make the file name of ERR absolute. If the absolute file name of ERR is in BUFFER-FILES, replace it with the value of variable `buffer-file-name'." (flycheck-error-with-buffer err - (-when-let (filename (flycheck-error-filename err)) + (when-let (filename (flycheck-error-filename err)) (when (seq-some (apply-partially #'flycheck-same-files-p (expand-file-name filename cwd)) buffer-files) @@ -6872,7 +6967,7 @@ checkers that have an option to output errors in this format. CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and the BUFFER that was checked respectively. -See URL `http://checkstyle.sourceforge.net/' for information +See URL `https://checkstyle.sourceforge.net/' for information about Checkstyle." (pcase (flycheck-parse-xml-string output) (`(checkstyle ,_ . ,file-nodes) @@ -6908,7 +7003,7 @@ Parse Cppcheck XML v2 output. CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and the BUFFER that was checked respectively. -See URL `http://cppcheck.sourceforge.net/' for more information +See URL `https://cppcheck.sourceforge.net/' for more information about Cppcheck." (pcase (flycheck-parse-xml-string output) (`(results ,_ . ,body) @@ -6950,7 +7045,7 @@ about Cppcheck." CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and the BUFFER that was checked respectively. -See URL `http://phpmd.org/' for more information about phpmd." +See URL `https://phpmd.org/' for more information about phpmd." (pcase (flycheck-parse-xml-string output) (`(pmd ,_ . ,body) (let (errors) @@ -7507,7 +7602,7 @@ Uses the GNAT compiler from GCC. See URL (flycheck-define-checker asciidoc "A AsciiDoc syntax checker using the AsciiDoc compiler. -See URL `http://www.methods.co.nz/asciidoc'." +See URL `https://www.methods.co.nz/asciidoc'." :command ("asciidoc" "-o" null-device "-") :standard-input t :error-patterns @@ -7525,7 +7620,7 @@ See URL `http://www.methods.co.nz/asciidoc'." (flycheck-define-checker asciidoctor "An AsciiDoc syntax checker using the Asciidoctor compiler. -See URL `http://asciidoctor.org'." +See URL `https://asciidoctor.org'." :command ("asciidoctor" "-o" null-device "-") :standard-input t :error-patterns @@ -7646,7 +7741,7 @@ See URL `https://github.com/bazelbuild/buildtools/blob/master/buildifier'." "Enable blocks in Clang. When non-nil, enable blocks in Clang with `-fblocks'. See URL -`http://clang.llvm.org/docs/BlockLanguageSpec.html' for more +`https://clang.llvm.org/docs/BlockLanguageSpec.html' for more information about blocks." :type 'boolean :safe #'booleanp @@ -7747,7 +7842,7 @@ The value of this variable is the name of a standard library as string, or nil to use the default standard library. Refer to the Clang manual at URL -`http://clang.llvm.org/docs/UsersManual.html' for more +`https://clang.llvm.org/docs/UsersManual.html' for more information about the standard library." :type '(choice (const :tag "Default standard library" nil) (const "libc++") @@ -7765,7 +7860,7 @@ recommended warnings and some extra warnings are enabled (as by `-Wall' and `-Wextra' respectively). Refer to the Clang manual at URL -`http://clang.llvm.org/docs/UsersManual.html' for more +`https://clang.llvm.org/docs/UsersManual.html' for more information about warnings." :type '(choice (const :tag "No additional warnings" nil) (repeat :tag "Additional warnings" @@ -7783,7 +7878,7 @@ explicitly determine the directory for quoted includes. This function determines the directory by looking at function `buffer-file-name', or if that is nil, at `default-directory'." - (-if-let (fn (buffer-file-name)) + (if-let (fn (buffer-file-name)) (file-name-directory fn) ;; If the buffer has no file name, fall back to its default directory default-directory)) @@ -7791,7 +7886,7 @@ This function determines the directory by looking at function (flycheck-define-checker c/c++-clang "A C/C++ syntax checker using Clang. -See URL `http://clang.llvm.org/'." +See URL `https://clang.llvm.org/'." :command ("clang" "-fsyntax-only" "-fno-color-diagnostics" ; Do not include color codes in output @@ -7999,7 +8094,7 @@ string is the name of an additional check to enable. By default, all coding style checks are enabled. See section \"Enable message\" in the Cppcheck manual at URL -`http://cppcheck.sourceforge.net/manual.pdf', and the +`https://cppcheck.sourceforge.net/manual.pdf', and the documentation of the `--enable' option for more information, including a list of supported checks." :type '(repeat :tag "Additional checks" @@ -8069,7 +8164,7 @@ Relative paths are relative to the file being checked." (flycheck-define-checker c/c++-cppcheck "A C/C++ checker using cppcheck. -See URL `http://cppcheck.sourceforge.net/'." +See URL `https://cppcheck.sourceforge.net/'." :command ("cppcheck" "--quiet" "--xml-version=2" "--inline-suppr" (option "--enable=" flycheck-cppcheck-checks concat flycheck-option-comma-separated-list) @@ -8101,45 +8196,6 @@ See URL `https://cfengine.com/'." ": error: " (message) line-end)) :modes (cfengine-mode cfengine3-mode)) -(flycheck-def-option-var flycheck-foodcritic-tags nil chef-foodcritic - "A list of tags to select for Foodcritic. - -The value of this variable is a list of strings where each string -is a tag expression describing Foodcritic rules to enable or -disable, via the `--tags' option. To disable a tag, prefix it -with `~'." - :type '(repeat :tag "Tags" (string :tag "Tag expression")) - :safe #'flycheck-string-list-p - :package-version '(flycheck . "0.23")) - -(flycheck-define-checker chef-foodcritic - "A Chef cookbooks syntax checker using Foodcritic. - -See URL `http://www.foodcritic.io'." - ;; Use `source-inplace' to allow resource discovery with relative paths. - ;; foodcritic interprets these as relative to the source file, so we need to - ;; stay within the source tree. See - ;; https://github.com/flycheck/flycheck/pull/556 - :command ("foodcritic" - (option-list "--tags" flycheck-foodcritic-tags) - source-inplace) - :error-patterns - ((error line-start (id (one-or-more alnum)) ": " - (message) ": " (file-name) ":" line line-end)) - :modes (enh-ruby-mode ruby-mode ruby-ts-mode) - :predicate - (lambda () - (let ((parent-dir (file-name-directory - (directory-file-name - (expand-file-name default-directory))))) - (or - ;; Chef CookBook - ;; http://docs.opscode.com/chef/knife.html#id38 - (locate-dominating-file parent-dir "recipes") - ;; Knife Solo - ;; http://matschaffer.github.io/knife-solo/#label-Init+command - (locate-dominating-file parent-dir "cookbooks"))))) - (flycheck-define-checker coffee "A CoffeeScript syntax checker using coffee. @@ -8159,7 +8215,7 @@ See URL `https://coffeescript.org/'." (flycheck-define-checker coffee-coffeelint "A CoffeeScript style checker using coffeelint. -See URL `http://www.coffeelint.org/'." +See URL `https://www.coffeelint.org/'." :command ("coffeelint" (config-file "--file" flycheck-coffeelintrc) @@ -8172,43 +8228,6 @@ See URL `http://www.coffeelint.org/'." (flycheck-sanitize-errors errors)))) :modes coffee-mode) -(defun flycheck-coq-error-filter (errors) - "Sanitize Coq ERRORS and compute end-lines and end-columns." - (flycheck-increment-error-columns errors) - (dolist (err errors) - (setf (flycheck-error-message err) - (replace-regexp-in-string (rx (1+ (syntax whitespace)) line-end) - "" (flycheck-error-message err) - 'fixedcase 'literal)) - (-when-let* ((end-col (flycheck-error-end-column err))) - ;; Coq reports an offset (potentially past eol), not an end column - (let* ((line (flycheck-error-line err)) - (end-lc (save-excursion - (flycheck-goto-line line) - (goto-char (+ (point) (1- end-col))) - (flycheck-line-column-at-point)))) - (setf (flycheck-error-end-line err) (car end-lc)) - (setf (flycheck-error-end-column err) (cdr end-lc))))) - (flycheck-sanitize-errors errors)) - -(flycheck-define-checker coq - "A Coq syntax checker using the Coq compiler. - -See URL `https://coq.inria.fr/'." - ;; We use coqtop in batch mode, because coqc is picky about file names. - :command ("coqtop" "-batch" "-load-vernac-source" source) - :error-patterns - ((error line-start "File \"" (file-name) "\", line " line - ", characters " column "-" end-column ":\n" - (or "Syntax error:" "Error:") - ;; Most Coq error messages span multiple lines, and end with a dot. - ;; There are simple one-line messages, too, though. - (message (or (and (one-or-more (or not-newline "\n")) ".") - (one-or-more not-newline))) - line-end)) - :error-filter flycheck-coq-error-filter - :modes coq-mode) - (flycheck-define-checker css-csslint "A CSS syntax and style checker using csslint. @@ -8221,11 +8240,15 @@ See URL `https://github.com/CSSLint/csslint'." (defconst flycheck-stylelint-args '("--formatter" "json") "Common arguments to stylelint invocations.") -(flycheck-def-config-file-var flycheck-stylelintrc - (css-stylelint scss-stylelint less-stylelint) nil) +;; Limit the length of the generated docstring by including only the first three +;; checker symbols, otherwise emacs will complain about the docstring length +;; and may refuse to compile the package. +(let ((print-length 3)) + (flycheck-def-config-file-var flycheck-stylelintrc + (css-stylelint scss-stylelint sass-stylelint less-stylelint) nil)) (flycheck-def-option-var flycheck-stylelint-quiet - nil (css-stylelint scss-stylelint less-stylelint) + nil (css-stylelint scss-stylelint sass-stylelint less-stylelint) "Whether to run stylelint in quiet mode. When non-nil, enable quiet mode, via `--quiet'." @@ -8269,7 +8292,7 @@ If the CHECKER throws an Error it returns an Error message with a stacktrace." CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and the BUFFER that was checked respectively. -See URL `http://stylelint.io/developer-guide/formatters/' for information +See URL `https://stylelint.io/developer-guide/formatters/' for information about the JSON format of stylelint." (let ((json-object-type 'plist)) @@ -8322,19 +8345,54 @@ about the JSON format of stylelint." ;; Return the combined errors (deprecations, invalid options, warnings) (append deprecations invalid-options warnings)))) +(defun flycheck--stylelint-config-exists-p (checker) + "Whether there is a valid stylelint CHECKER config for the current buffer." + (eql 0 (flycheck-call-checker-process + checker nil nil nil + "--print-config" (or buffer-file-name "index.js")))) + +(defun flycheck--stylelint-get-major-version (checker) + "Return major version of stylelint CHECKER." + (let ((cb (current-buffer))) + (with-temp-buffer + (let ((temp-buffer (current-buffer))) + (with-current-buffer cb + (flycheck-call-checker-process + checker nil temp-buffer nil "--version")) + (string-to-number (car (split-string (buffer-string) "\\."))))))) + +(defun flycheck--stylelint-verify (checker) + "Verify stylelint setup for CHECKER." + (let ((have-config (flycheck--stylelint-config-exists-p checker))) + (list + (flycheck-verification-result-new + :label "configuration available" + :message (if have-config "yes" "no config file found") + :face (if have-config 'success '(bold error))) + (flycheck-verification-result-new + :label "stylecheck version" + :message (number-to-string (flycheck--stylelint-get-major-version checker)) + :face 'success)))) + (flycheck-define-checker css-stylelint "A CSS syntax and style checker using stylelint. -See URL `http://stylelint.io/'." +See URL `https://stylelint.io/'." :command ("stylelint" (eval flycheck-stylelint-args) (option-flag "--quiet" flycheck-stylelint-quiet) (config-file "--config" flycheck-stylelintrc) "--stdin-filename" (eval (or (buffer-file-name) "style.css"))) :standard-input t + :verify (lambda (_) (flycheck--stylelint-verify 'css-stylelint)) :error-parser flycheck-parse-stylelint :predicate flycheck-buffer-nonempty-p - :modes (css-mode css-ts-mode)) + :modes (css-mode css-ts-mode) + :error-explainer + (lambda (err) + (let ((error-code (flycheck-error-id err)) + (url "https://stylelint.io/user-guide/rules/%s")) + (and error-code `(url . ,(format url error-code)))))) (flycheck-def-option-var flycheck-cuda-language-standard nil cuda-nvcc "Our CUDA Language Standard." @@ -8369,6 +8427,24 @@ A list of strings to pass to cuda, a la flycheck-clang" :safe #'flycheck-string-list-p :package-version '(flycheck . "32")) +(flycheck-def-option-var flycheck-cuda-relaxed-constexpr nil cuda-nvcc + "Enable calling host constexpr from device function for nvcc. + +When non-nil, enable experimental calling of a constexpr __host__ +function from a __device__ function." + :type 'boolean + :safe #'booleanp + :package-version '(flycheck . "35")) + +(flycheck-def-option-var flycheck-cuda-extended-lambda nil cuda-nvcc + "Enable annotating lambda functions with __host__ or __device__. + +When non-nil, enable experimental compilation of __host__ and +__device__ lambda functions." + :type 'boolean + :safe #'booleanp + :package-version '(flycheck . "35")) + (flycheck-define-checker cuda-nvcc "A CUDA C/C++ syntax checker using nvcc. @@ -8379,6 +8455,8 @@ See URL `https://developer.nvidia.com/cuda-llvm-compiler'." "--x=cu" ;; explicitly specify it's a CUDA language file "-rdc=true" ;; Allow linking with external cuda funcions (option "-std=" flycheck-cuda-language-standard concat) + (option-flag "--expt-relaxed-constexpr" flycheck-cuda-relaxed-constexpr) + (option-flag "--expt-extended-lambda" flycheck-cuda-extended-lambda) (option-list "-include" flycheck-cuda-includes) (option-list "-gencode" flycheck-cuda-gencodes) (option-list "-D" flycheck-cuda-definitions concat) @@ -8483,7 +8561,7 @@ Requires DMD 2.066 or newer. See URL `https://dlang.org/'." (flycheck-define-checker dockerfile-hadolint "A Dockerfile syntax checker using the hadolint. -See URL `http://github.com/hadolint/hadolint/'." +See URL `https://github.com/hadolint/hadolint/'." :command ("hadolint" "--no-color" "-") :standard-input t :error-patterns @@ -8521,7 +8599,7 @@ When non-nil, pass the `--strict' flag to credo." (flycheck-define-checker elixir-credo "An Elixir checker for static code analysis using Credo. -See `http://credo-ci.org/'." +See `https://credo-ci.org/'." :command ("mix" "credo" (option-flag "--strict" flycheck-elixir-credo-strict) "--format" "flycheck" @@ -8908,7 +8986,7 @@ Relative paths are relative to the file being checked." (flycheck-define-checker erlang "An Erlang syntax checker using the Erlang interpreter. -See URL `http://www.erlang.org/'." +See URL `https://www.erlang.org/'." :command ("erlc" "-o" temporary-directory (option-list "-I" flycheck-erlang-include-path) @@ -9001,7 +9079,7 @@ directory name is \"test\" or \"eqc\", or else \"default\"." (flycheck-define-checker eruby-erubis "An eRuby syntax checker using the `erubis' command. -See URL `http://www.kuwata-lab.com/erubis/'." +See URL `https://www.kuwata-lab.com/erubis/'." :command ("erubis" "-z" source) :error-patterns ((error line-start (file-name) ":" line ": " (message) line-end)) @@ -9151,6 +9229,18 @@ Uses GCC's Fortran compiler gfortran. See URL "Warning: " (message) line-end)) :modes (fortran-mode f90-mode)) +(flycheck-define-checker yaml-actionlint + "A YAML syntax checker using actionlint. + +See URL https://github.com/rhysd/actionlint/." + :command ("actionlint" "-oneline" source) + :error-patterns ((error line-start (file-name) ":" line ":" column ": " (message) line-end)) + :modes (yaml-mode yaml-ts-mode) + :predicate (lambda () + (string-match-p + (rx (or ".github/workflows" ".github\\workflows")) + (buffer-file-name)))) + (flycheck-define-checker go-gofmt "A Go syntax and style checker using the gofmt utility. @@ -9161,27 +9251,13 @@ See URL `https://golang.org/cmd/gofmt/'." ((error line-start ":" line ":" column ": " (message) line-end)) :modes (go-mode go-ts-mode) - :next-checkers ((warning . go-golint) - ;; Fall back, if go-golint doesn't exist - (warning . go-vet) + :next-checkers ((warning . go-vet) ;; Fall back, if go-vet doesn't exist (warning . go-build) (warning . go-test) (warning . go-errcheck) (warning . go-unconvert) (warning . go-staticcheck))) -(flycheck-define-checker go-golint - "A Go style checker using Golint. - -See URL `https://github.com/golang/lint'." - :command ("golint" source) - :error-patterns - ((warning line-start (file-name) ":" line ":" column ": " (message) line-end)) - :modes (go-mode go-ts-mode) - :next-checkers (go-vet - ;; Fall back, if go-vet doesn't exist - go-build go-test go-errcheck go-unconvert)) - (flycheck-def-option-var flycheck-go-vet-print-functions nil go-vet "A list of print-like functions for `go vet'. @@ -9338,7 +9414,7 @@ See URL `https://github.com/kisielk/errcheck'." (lambda (errors) (let ((errors (flycheck-sanitize-errors errors))) (dolist (err errors) - (-when-let (message (flycheck-error-message err)) + (when-let (message (flycheck-error-message err)) ;; Improve the messages reported by errcheck to make them more clear. (setf (flycheck-error-message err) (format "Ignored `error` returned from `%s`" message))))) @@ -9376,7 +9452,7 @@ limited features) if `flycheck-go-version' is set. See URL (flycheck-define-checker groovy "A groovy syntax checker using groovy compiler API. -See URL `http://www.groovy-lang.org'." +See URL `https://www.groovy-lang.org'." :command ("groovy" "-e" "import org.codehaus.groovy.control.* @@ -9397,7 +9473,7 @@ try { (flycheck-define-checker haml "A Haml syntax checker using the Haml compiler. -See URL `http://haml.info'." +See URL `https://haml.info'." :command ("haml" "-c" "--stdin") :standard-input t :error-patterns @@ -9405,10 +9481,20 @@ See URL `http://haml.info'." (error line-start ":" line ": syntax error, " (message) line-end)) :modes haml-mode) +(flycheck-define-checker haml-lint + "HAML-Lint style checker. + +See URL `https://github.com/sds/haml-lint'." + :command ("haml-lint" "--no-color" "--no-summary" source) + :error-patterns + ((error line-start (file-name) ":" line " [E]" (message) line-end) + (warning line-start (file-name) ":" line " [W]" (message) line-end)) + :modes haml-mode) + (flycheck-define-checker handlebars "A Handlebars syntax checker using the Handlebars compiler. -See URL `http://handlebarsjs.com/'." +See URL `https://handlebarsjs.com/'." :command ("handlebars" "-i-") :standard-input t :error-patterns @@ -9530,12 +9616,12 @@ directory returned by \"stack path --project-root\"." (flycheck--locate-dominating-file-matching (file-name-directory (buffer-file-name)) (rx "stack" (* any) "." (or "yml" "yaml") eos))) - (-when-let* ((stack (funcall flycheck-executable-find "stack")) - (output (ignore-errors - (process-lines stack - "--no-install-ghc" - "path" "--project-root"))) - (stack-dir (car output))) + (when-let* ((stack (funcall flycheck-executable-find "stack")) + (output (ignore-errors + (process-lines stack + "--no-install-ghc" + "path" "--project-root"))) + (stack-dir (car output))) (and (file-directory-p stack-dir) stack-dir)))) (defun flycheck-haskell--ghc-find-default-directory (_checker) @@ -9579,6 +9665,7 @@ See URL `https://github.com/commercialhaskell/stack'." (one-or-more (not (any ?\n ?|))))) line-end) (error line-start (file-name) ":" line ":" column ":" (optional " error:") + (optional " " "[" (id (one-or-more not-newline)) "]") (or (message (one-or-more not-newline)) (and "\n" (message @@ -9638,6 +9725,7 @@ See URL `https://www.haskell.org/ghc/'." (one-or-more (not (any ?\n ?|))))) line-end) (error line-start (file-name) ":" line ":" column ":" (optional " error:") + (optional " " "[" (id (one-or-more not-newline)) "]") (or (message (one-or-more not-newline)) (and "\n" (message @@ -9653,7 +9741,7 @@ See URL `https://www.haskell.org/ghc/'." :next-checkers ((warning . haskell-hlint)) :working-directory flycheck-haskell--ghc-find-default-directory) -(flycheck-def-config-file-var flycheck-hlintrc haskell-hlint "HLint.hs") +(flycheck-def-config-file-var flycheck-hlintrc haskell-hlint ".hlint.yaml") (flycheck-def-args-var flycheck-hlint-args haskell-hlint :package-version '(flycheck . "0.25")) @@ -9695,6 +9783,7 @@ string is a default hint package (e.g. (\"Generalise\" See URL `https://github.com/ndmitchell/hlint'." :command ("hlint" + "--no-exit-code" (option-list "-X" flycheck-hlint-language-extensions concat) (option-list "-i=" flycheck-hlint-ignore-rules concat) (option-list "-h" flycheck-hlint-hint-packages concat) @@ -9757,7 +9846,7 @@ extract Javascript if a HTML file is detected. If `always' or `never' extract Javascript always or never respectively. Refer to the jshint manual at the URL -`http://jshint.com/docs/cli/#flags' for more information." +`https://jshint.com/docs/cli/#flags' for more information." :type '(choice (const :tag "No extraction rule" nil) (const :tag "Try to extract Javascript when detecting HTML files" @@ -9770,7 +9859,7 @@ Refer to the jshint manual at the URL (flycheck-define-checker javascript-jshint "A Javascript syntax and style checker using jshint. -See URL `http://www.jshint.com'." +See URL `https://www.jshint.com'." :command ("jshint" "--reporter=checkstyle" "--filename" source-original (config-file "--config" flycheck-jshintrc) @@ -9795,7 +9884,7 @@ The value of this variable is a list of strings, where each string is a directory with custom rules for ESLint. Refer to the ESLint manual at URL -`http://eslint.org/docs/user-guide/command-line-interface#--rulesdir' +`https://eslint.org/docs/user-guide/command-line-interface#--rulesdir' for more information about the custom directories." :type '(repeat (directory :tag "Custom rules directory")) :safe #'flycheck-string-list-p @@ -9983,7 +10072,7 @@ See URL `https://jsonnet.org'." Requires lessc 1.4 or newer. -See URL `http://lesscss.org'." +See URL `https://lesscss.org'." :command ("lessc" "--lint" "--no-color" "-") :standard-input t @@ -9998,13 +10087,13 @@ See URL `http://lesscss.org'." (flycheck-define-checker less-stylelint "A LESS syntax and style checker using stylelint. -See URL `http://stylelint.io/'." +See URL `https://stylelint.io/'." :command ("stylelint" (eval flycheck-stylelint-args) - "--syntax" "less" (option-flag "--quiet" flycheck-stylelint-quiet) (config-file "--config" flycheck-stylelintrc)) :standard-input t + :verify (lambda (_) (flycheck--stylelint-verify 'less-stylelint)) :error-parser flycheck-parse-stylelint :predicate flycheck-buffer-nonempty-p :modes (less-css-mode)) @@ -10012,7 +10101,7 @@ See URL `http://stylelint.io/'." (flycheck-define-checker llvm-llc "Flycheck LLVM IR checker using llc. -See URL `http://llvm.org/docs/CommandGuide/llc.html'." +See URL `https://llvm.org/docs/CommandGuide/llc.html'." :command ("llc" "-o" null-device source) :error-patterns ((error line-start @@ -10068,12 +10157,12 @@ See URL `https://github.com/mpeterv/luacheck'." ;; the ID is optional here (optional " (" (id "E" (one-or-more digit)) ") ") (message) line-end)) - :modes lua-mode) + :modes (lua-mode lua-ts-mode)) (flycheck-define-checker lua "A Lua syntax checker using the Lua compiler. -See URL `http://www.lua.org/'." +See URL `https://www.lua.org/'." :command ("luac" "-p" "-") :standard-input t :error-patterns @@ -10081,7 +10170,7 @@ See URL `http://www.lua.org/'." ;; Skip the name of the luac executable. (minimal-match (zero-or-more not-newline)) ": stdin:" line ": " (message) line-end)) - :modes lua-mode) + :modes (lua-mode lua-ts-mode)) (flycheck-define-checker opam "A Opam syntax and style checker using opam lint. @@ -10196,18 +10285,67 @@ See URL `https://metacpan.org/pod/Perl::Critic'." "STDIN/" line "/" column "/" (any "5") "/" (id (one-or-more (not (any "/")))) "/" (message) line-end)) + :modes (cperl-mode perl-mode) + :next-checkers (perl-perlimports) + + :error-explainer + (lambda (err) + (let ((error-code (flycheck-error-id err)) + (url "https://metacpan.org/pod/Perl::Critic::Policy::%s")) + (and error-code `(url . ,(format url error-code)))))) + +(defun flycheck-perl-perlimports-parse-errors (output checker buffer) + "Parse perlimports json output errors from OUTPUT. + +CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and +the BUFFER that was checked respectively. + +See URL `https://metacpan.org/dist/App-perlimports/view/script/perlimports' +for more information about perlimports." + (mapcar (lambda (err) + (let-alist err + (flycheck-error-new-at + .location.start.line + .location.start.column + 'info + (concat .module " " .reason ":" + (with-temp-buffer + (insert (substring .diff (string-match-p "\n" .diff))) + (diff-mode) + (font-lock-ensure) + (buffer-string))) + :end-line .location.end.line + :end-column .location.end.column + :checker checker + :buffer buffer))) + (flycheck-parse-json output))) + +(flycheck-define-checker perl-perlimports + "A checker for cleaning up Perl import statements. + +See URL `https://metacpan.org/dist/App-perlimports/view/script/perlimports'." + :command ("perlimports" + "--filename" source + "--json" + "--lint" + "--no-preserve-duplicates" + "--no-preserve-unused" + "--no-tidy-whitespace" + "--read-stdin") + :standard-input t + :error-parser flycheck-perl-perlimports-parse-errors :modes (cperl-mode perl-mode)) (flycheck-define-checker php "A PHP syntax checker using the PHP command line interpreter. -See URL `http://php.net/manual/en/features.commandline.php'." +See URL `https://php.net/manual/en/features.commandline.php'." :command ("php" "-l" "-d" "error_reporting=E_ALL" "-d" "display_errors=1" "-d" "log_errors=0" source) :error-patterns ((error line-start (or "Parse" "Fatal" "syntax") " error" (any ":" ",") " " (message) " in " (file-name) " on line " line line-end)) - :modes (php-mode php+-mode) + :modes (php-mode php-ts-mode php+-mode) :next-checkers ((warning . php-phpmd) (warning . php-phpcs))) @@ -10232,7 +10370,7 @@ See URL `https://phpmd.org/'." (eval (flycheck-option-comma-separated-list flycheck-phpmd-rulesets))) :error-parser flycheck-parse-phpmd - :modes (php-mode php+-mode) + :modes (php-mode php-ts-mode php+-mode) :next-checkers (php-phpcs)) (flycheck-def-option-var flycheck-phpcs-standard nil php-phpcs @@ -10251,7 +10389,7 @@ or as path to a standard specification." Needs PHP Code Sniffer 2.6 or newer. -See URL `http://pear.php.net/package/PHP_CodeSniffer/'." +See URL `https://pear.php.net/package/PHP_CodeSniffer/'." :command ("phpcs" "--report=checkstyle" ;; Use -q flag to force quiet mode ;; Quiet mode prevents errors from extra output when phpcs has @@ -10261,8 +10399,8 @@ See URL `http://pear.php.net/package/PHP_CodeSniffer/'." ;; Some files are not detected correctly ;; so it is necessary to pass the extension. (eval - (-when-let* ((fname buffer-file-name) - (ext (file-name-extension fname))) + (when-let* ((fname buffer-file-name) + (ext (file-name-extension fname))) (concat "--extensions=" ext))) ;; Pass original file name to phpcs. We need to concat explicitly @@ -10275,6 +10413,28 @@ See URL `http://pear.php.net/package/PHP_CodeSniffer/'." :standard-input t :error-parser flycheck-parse-checkstyle :error-filter + (lambda (errors) + (flycheck-sanitize-errors + (flycheck-remove-error-file-names "STDIN" errors))) + :modes (php-mode php-ts-mode php+-mode) + ;; phpcs seems to choke on empty standard input, hence skip phpcs if the + ;; buffer is empty, see https://github.com/flycheck/flycheck/issues/907 + :predicate flycheck-buffer-nonempty-p) + +(flycheck-define-checker php-phpcs-changed + "A PHP style checker using PHPCS-Changed. + Needs PHP Code Sniffer 2.6 or newer. + See `https://github.com/sirbrillig/phpcs-changed'." + :command ("phpcs-changed" + "--git" + "--git-base trunk" + "--git-unstaged" + (option "--standard=" flycheck-phpcs-standard concat) + (eval (buffer-file-name)) + ) + :standard-input t + :error-parser flycheck-parse-checkstyle + :error-filter (lambda (errors) (flycheck-sanitize-errors (flycheck-remove-error-file-names "STDIN" errors))) @@ -10306,7 +10466,7 @@ See https://github.com/processing/processing/wiki/Command-Line" CHECKER and BUFFER denoted the CHECKER that returned OUTPUT and the BUFFER that was checked respectively. -See URL `http://proselint.com/' for more information about proselint." +See URL `https://proselint.com/' for more information about proselint." (mapcar (lambda (err) (let-alist err (flycheck-error-new-at-pos @@ -10329,7 +10489,7 @@ See URL `http://proselint.com/' for more information about proselint." (flycheck-define-checker proselint "Flycheck checker using Proselint. -See URL `http://proselint.com/'." +See URL `https://proselint.com/'." :command ("proselint" "--json" "-") :standard-input t :error-parser flycheck-proselint-parse-errors @@ -10443,7 +10603,7 @@ See URL `https://puppet.com/'." ": Could not parse for environment " (one-or-more word) ": " (message (minimal-match (zero-or-more anything))) " at " (file-name "/" (zero-or-more not-newline)) ":" line line-end)) - :modes puppet-mode + :modes (puppet-mode puppet-ts-mode) :next-checkers ((warning . puppet-lint))) (flycheck-def-config-file-var flycheck-puppet-lint-rc puppet-lint @@ -10457,7 +10617,7 @@ The value of this variable is a list of strings, where each string is the name of a check to disable (e.g. \"80chars\" or \"double_quoted_strings\"). -See URL `http://puppet-lint.com/checks/' for a list of all checks +See URL `https://puppet-lint.com/checks/' for a list of all checks and their names." :type '(repeat (string :tag "Check Name")) :package-version '(flycheck . "26")) @@ -10469,7 +10629,7 @@ and their names." (flycheck-define-checker puppet-lint "A Puppet DSL style checker using puppet-lint. -See URL `http://puppet-lint.com/'." +See URL `https://puppet-lint.com/'." ;; We must check the original file, because Puppetlint is quite picky on the ;; names of files and there place in the directory structure, to comply with ;; Puppet's autoload directory layout. For instance, a class foo::bar is @@ -10485,7 +10645,7 @@ See URL `http://puppet-lint.com/'." :error-patterns ((warning line-start (file-name) ":" line ":warning: " (message) line-end) (error line-start (file-name) ":" line ":error: " (message) line-end)) - :modes puppet-mode + :modes (puppet-mode puppet-ts-mode) ;; Since we check the original file, we can only use this syntax checker if ;; the buffer is actually linked to a file, and if it is not modified. :predicate flycheck-buffer-saved-p) @@ -10494,8 +10654,8 @@ See URL `http://puppet-lint.com/'." "Run a python SNIPPET and return the output. CHECKER's executable is assumed to be a Python REPL." - (-when-let (output (flycheck-call-checker-process-for-output - checker nil nil "-c" snippet)) + (when-let (output (flycheck-call-checker-process-for-output + checker nil nil "-c" snippet)) (string-trim output))) (defun flycheck-python-get-path (checker) @@ -10554,7 +10714,7 @@ current project; `.pylintrc' is not part of the list because it is commonly found in ~/." :group 'flycheck :type '(repeat (string :tag "File name")) - :package-version '(flycheck . "0.33") + :package-version '(flycheck . "33") :safe #'flycheck-string-list-p) (defun flycheck-python-find-project-root (_checker) @@ -10688,6 +10848,41 @@ Requires Flake8 3.0 or newer. See URL :next-checkers ((warning . python-pylint) (warning . python-mypy))) +(flycheck-def-config-file-var flycheck-python-ruff-config python-ruff + '("pyproject.toml" "ruff.toml" ".ruff.toml")) + +(flycheck-define-checker python-ruff + "A Python syntax and style checker using Ruff. + +See URL `https://docs.astral.sh/ruff/'." + :command ("ruff" + "check" + (config-file "--config" flycheck-python-ruff-config) + "--output-format=concise" + (option "--stdin-filename" buffer-file-name) + "-") + :standard-input t + :error-filter (lambda (errors) + (let* ((errors (flycheck-sanitize-errors errors)) + (errors-with-ids (seq-filter #'flycheck-error-id errors))) + (seq-union + (seq-difference errors errors-with-ids) + (seq-map #'flycheck-flake8-fix-error-level errors-with-ids)))) + :error-patterns + ((error line-start + (or "-" (file-name)) ":" line ":" (optional column ":") " " + "SyntaxError: " + (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) " ") + (message (one-or-more not-newline)) + line-end)) + :working-directory flycheck-python-find-project-root + :modes (python-mode python-ts-mode) + :next-checkers ((warning . python-mypy))) + (flycheck-def-config-file-var flycheck-pylintrc python-pylint '("pylintrc" ".pylintrc" "pyproject.toml" "setup.cfg")) @@ -10749,7 +10944,7 @@ See URL `https://www.pylint.org/'." (flycheck-python-find-module 'python-pylint "pylint"))) :verify (lambda (_) (flycheck-python-verify-module 'python-pylint "pylint")) :error-explainer (lambda (err) - (-when-let (id (flycheck-error-id err)) + (when-let (id (flycheck-error-id err)) (apply #'flycheck-call-checker-process-for-output 'python-pylint nil t @@ -10838,7 +11033,7 @@ See URL https://github.com/microsoft/pyright." (flycheck-define-checker python-mypy "Mypy syntax and type checker. Requires mypy>=0.730. -See URL `http://mypy-lang.org/'." +See URL `https://mypy-lang.org/'." :command ("mypy" "--show-column-numbers" "--no-pretty" @@ -10919,6 +11114,21 @@ See URL `https://github.com/jimhester/lintr'." :message (if has-lintr "present" "missing") :face (if has-lintr 'success '(bold error))))))) +(flycheck-define-checker r + "An R syntax checker using the builtin `parse' function. + +See URL: `https://www.r-project.org/'." + :command ("R" "--slave" "--no-restore" "--no-save" "-e" + "parse(file=file('stdin'), srcfile='')") + :standard-input t + :error-patterns + ((error line-start (zero-or-more space) ":" line ":" column ": " + (message) line-end)) + :modes (ess-mode ess-r-mode) + :predicate + ;; Don't check ESS files which do not contain R + (lambda () (equal ess-language "S"))) + (defun flycheck-racket-has-expand-p (checker) "Whether the executable of CHECKER provides the `expand' command." (eql 0 (flycheck-call-checker-process checker nil nil nil "expand"))) @@ -10999,10 +11209,10 @@ See URL `https://github.com/rpm-software-management/rpmlint'." errors) :error-explainer (lambda (error) - (-when-let* ((error-message (flycheck-error-message error)) - (message-id (save-match-data - (string-match "\\([^ ]+\\)" error-message) - (match-string 1 error-message)))) + (when-let* ((error-message (flycheck-error-message error)) + (message-id (save-match-data + (string-match "\\([^ ]+\\)" error-message) + (match-string 1 error-message)))) (flycheck-call-checker-process-for-output 'rpm-rpmlint nil t "-I" message-id))) :modes (sh-mode rpm-spec-mode) @@ -11034,7 +11244,7 @@ See URL `https://github.com/rpm-software-management/rpmlint'." (flycheck-define-checker markdown-markdownlint-cli "Markdown checker using markdownlint-cli. -See URL `https://github.com/DavidAnson/markdownlint-cli'." +See URL `https://github.com/igorshubovych/markdownlint-cli'." :command ("markdownlint" (config-file "--config" flycheck-markdown-markdownlint-cli-config) (option-list "--disable" flycheck-markdown-markdownlint-cli-disable-rules) @@ -11050,7 +11260,12 @@ See URL `https://github.com/DavidAnson/markdownlint-cli'." (lambda (errors) (flycheck-sanitize-errors (flycheck-remove-error-file-names "(string)" errors))) - :modes (markdown-mode gfm-mode)) + :modes (markdown-mode gfm-mode) + :error-explainer + (lambda (err) + (let ((error-code (substring (flycheck-error-id err) 0 5)) + (url "https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#%s")) + (and error-code `(url . ,(format url error-code)))))) (flycheck-def-option-var flycheck-markdown-mdl-rules nil markdown-mdl "Rules to enable for mdl. @@ -11104,6 +11319,29 @@ See URL `https://github.com/markdownlint/markdownlint'." (flycheck-remove-error-file-names "(stdin)" errors))) :modes (markdown-mode gfm-mode)) +(flycheck-def-config-file-var flycheck-markdown-pymarkdown-config + markdown-pymarkdown nil + :package-version '(flycheck . "34")) + +(flycheck-define-checker markdown-pymarkdown + "Markdown checker using PyMarkdown. + +See URL `https://pypi.org/project/pymarkdownlnt/'." + :command ("pymarkdown" + (config-file "--config" flycheck-markdown-markdownlint-cli-config) + "scan" + source) + :error-patterns + ((error line-start + (file-name) ":" line + (? ":" column) ": " (id (one-or-more alnum)) + ": " (message) line-end)) + :error-filter + (lambda (errors) + (flycheck-sanitize-errors + (flycheck-remove-error-file-names "(string)" errors))) + :modes (markdown-mode gfm-mode)) + (flycheck-define-checker nix "Nix checker using nix-instantiate. @@ -11127,7 +11365,7 @@ See URL `https://nixos.org/nix/manual/#sec-nix-instantiate'." (flycheck-sanitize-errors (flycheck-remove-error-file-names "(string)" errors))) :next-checkers ((warning . nix-linter)) - :modes nix-mode) + :modes (nix-mode nix-ts-mode)) (defun flycheck-parse-nix-linter (output checker buffer) "Parse nix-linter warnings from JSON OUTPUT. @@ -11161,9 +11399,53 @@ See URL `https://github.com/Synthetica9/nix-linter'." :error-parser flycheck-parse-nix-linter :error-explainer (lambda (error) - (-when-let (error-code (flycheck-error-id error)) + (when-let (error-code (flycheck-error-id error)) (flycheck-call-checker-process-for-output 'nix-linter nil t "--help-for" error-code))) + :modes (nix-mode nix-ts-mode)) + +(defun flycheck-parse-statix (output checker buffer) + "Parse statix warnings from JSON OUTPUT. + +CHECKER and BUFFER denote the CHECKER that returned OUTPUT and +the BUFFER that was checked respectively. + +See URL `https://github.com/nerdypepper/statix' for more +information about statix." + (mapcar (lambda (err) + ;; Diagnostic information is a (seemingly always) 1 element array. + (let-alist (car (alist-get 'diagnostics err)) + (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 + "Nix checker using statix. + +See URL `https://github.com/nerdypepper/statix'." + :command ("statix" "check" "-o=json" source) + :error-parser flycheck-parse-statix :modes nix-mode) (defun flycheck-locate-sphinx-source-directory () @@ -11171,14 +11453,14 @@ See URL `https://github.com/Synthetica9/nix-linter'." Return the source directory, or nil, if the current buffer is not part of a Sphinx project." - (-when-let* ((filename (buffer-file-name)) - (dir (locate-dominating-file filename "conf.py"))) + (when-let* ((filename (buffer-file-name)) + (dir (locate-dominating-file filename "conf.py"))) (expand-file-name dir))) (flycheck-define-checker rst "A ReStructuredText (RST) syntax checker using Docutils. -See URL `http://docutils.sourceforge.net/'." +See URL `https://docutils.sourceforge.net/'." ;; include:: directives :command ("rst2pseudoxml.py" "--report=2" "--halt=5" ;; Read from standard input and throw output away @@ -11203,7 +11485,7 @@ Sphinx via `-n'." (flycheck-define-checker rst-sphinx "A ReStructuredText (RST) syntax checker using Sphinx. -Requires Sphinx 1.2 or newer. See URL `http://sphinx-doc.org'." +Requires Sphinx 1.2 or newer. See URL `https://sphinx-doc.org'." :command ("sphinx-build" "-b" "pseudoxml" "-q" "-N" ; Reduced output and no colors (option-flag "-n" flycheck-sphinx-warn-on-missing-references) @@ -11229,11 +11511,17 @@ This is either a parent directory containing a Gemfile, or nil." buffer-file-name (locate-dominating-file buffer-file-name "Gemfile"))) +(defun flycheck-ruby--filter-rubocop-errors (errors) + "Filter RuboCop ERRORS attributed to dummy stdin filename." + (flycheck-remove-error-file-names + (flycheck--file-truename (expand-file-name "stdin")) + errors)) + (flycheck-def-config-file-var flycheck-rubocoprc ruby-rubocop ".rubocop.yml") (flycheck-def-option-var flycheck-rubocop-lint-only nil - (ruby-rubocop ruby-standard) - "Whether to only report code issues in Rubocop and Standard. + (ruby-rubocop ruby-standard ruby-chef-cookstyle) + "Whether to only report code issues in Rubocop, Cookstyle and Standard. When non-nil, only report code issues, via `--lint'. Otherwise report style issues as well." @@ -11263,23 +11551,57 @@ See URL `https://rubocop.org/'." "--display-cop-names" "--force-exclusion" "--format" "emacs" - ;; Explicitly disable caching to prevent Rubocop 0.35.1 and earlier - ;; from caching standard input. Later versions of Rubocop - ;; automatically disable caching with --stdin, see - ;; https://github.com/flycheck/flycheck/issues/844 and - ;; https://github.com/bbatsov/rubocop/issues/2576 - "--cache" "false" (config-file "--config" flycheck-rubocoprc) (option-flag "--lint" flycheck-rubocop-lint-only) - ;; Rubocop takes the original file name as argument when reading - ;; from standard input - "--stdin" source-original) + ;; RuboCop takes the original file name as argument when reading + ;; from standard input, but it chokes when that name is the empty + ;; string, so fall back to "stdin" in order to handle buffers with + ;; no backing file (e.g. org-mode snippet buffers) + "--stdin" (eval (or (buffer-file-name) "stdin"))) :standard-input t :working-directory #'flycheck-ruby--find-project-root :error-patterns flycheck-ruby-rubocop-error-patterns + :error-filter #'flycheck-ruby--filter-rubocop-errors :modes '(enh-ruby-mode ruby-mode ruby-ts-mode) :next-checkers '((warning . ruby-reek) - (warning . ruby-rubylint))) + (warning . ruby-chef-cookstyle))) + +(flycheck-def-executable-var ruby-chef-cookstyle "cookstyle") +(flycheck-define-command-checker 'ruby-chef-cookstyle + "A Chef (Ruby) syntax and style checker using the Cookstyle tool. +Basically Cookstyle is a thin wrapper around RuboCop, so this +checker is essentially the same. + +See URL `https://github.com/chef/cookstyle'." + :command '("cookstyle" + "--display-cop-names" + "--force-exclusion" + "--format" "emacs" + (config-file "--config" flycheck-rubocoprc) + (option-flag "--lint" flycheck-rubocop-lint-only) + ;; RuboCop takes the original file name as argument when reading + ;; from standard input, but it chokes when that name is the empty + ;; string, so fall back to "stdin" in order to handle buffers with + ;; no backing file (e.g. org-mode snippet buffers) + "--stdin" (eval (or (buffer-file-name) "stdin"))) + :standard-input t + :working-directory #'flycheck-ruby--find-project-root + :error-patterns flycheck-ruby-rubocop-error-patterns + :error-filter #'flycheck-ruby--filter-rubocop-errors + :modes '(enh-ruby-mode ruby-mode ruby-ts-mode) + :predicate + (lambda () + (let ((parent-dir (file-name-directory + (directory-file-name + (expand-file-name default-directory))))) + (or + ;; Chef CookBook + ;; https://docs.opscode.com/chef/knife.html#id38 + (locate-dominating-file parent-dir "recipes") + ;; Knife Solo + ;; https://matschaffer.github.io/knife-solo/#label-Init+command + (locate-dominating-file parent-dir "cookbooks")))) + :next-checkers '((warning . ruby-reek))) (flycheck-def-config-file-var flycheck-ruby-standardrc ruby-standard ".standard.yml") @@ -11301,9 +11623,10 @@ See URL `https://github.com/testdouble/standard' for more information." :standard-input t :working-directory #'flycheck-ruby--find-project-root :error-patterns flycheck-ruby-rubocop-error-patterns + :error-filter #'flycheck-ruby--filter-rubocop-errors :modes '(enh-ruby-mode ruby-mode ruby-ts-mode) :next-checkers '((warning . ruby-reek) - (warning . ruby-rubylint))) + (warning . ruby-chef-cookstyle))) (flycheck-def-config-file-var flycheck-reekrc ruby-reek ".reek.yml" :safe #'string-or-null-p @@ -11317,29 +11640,6 @@ See URL `https://github.com/troessner/reek'." (config-file "--config" flycheck-reekrc) source) :error-parser flycheck-parse-reek - :modes (enh-ruby-mode ruby-mode ruby-ts-mode) - :next-checkers ((warning . ruby-rubylint))) - -;; Default to `nil' to let Rubylint find its configuration file by itself, and -;; to maintain backwards compatibility with older Rubylint and Flycheck releases -(flycheck-def-config-file-var flycheck-rubylintrc ruby-rubylint nil) - -(flycheck-define-checker ruby-rubylint - "A Ruby syntax and code analysis checker using ruby-lint. - -Requires ruby-lint 2.0.2 or newer. See URL -`https://github.com/YorickPeterse/ruby-lint'." - :command ("ruby-lint" "--presenter=syntastic" - (config-file "--config" flycheck-rubylintrc) - source) - ;; Ruby Lint can't read from standard input - :error-patterns - ((info line-start - (file-name) ":I:" line ":" column ": " (message) line-end) - (warning line-start - (file-name) ":W:" line ":" column ": " (message) line-end) - (error line-start - (file-name) ":E:" line ":" column ": " (message) line-end)) :modes (enh-ruby-mode ruby-mode ruby-ts-mode)) (flycheck-define-checker ruby @@ -11363,7 +11663,7 @@ See URL `https://www.ruby-lang.org/'." " warning: " (message) line-end) (error line-start "-:" line ": " (message) line-end)) :modes (enh-ruby-mode ruby-mode ruby-ts-mode) - :next-checkers ((warning . ruby-rubylint))) + :next-checkers ((warning . ruby-chef-cookstyle))) (flycheck-define-checker ruby-jruby "A Ruby syntax checker using the JRuby interpreter. @@ -11371,17 +11671,16 @@ See URL `https://www.ruby-lang.org/'." This syntax checker is very primitive, and may break on future versions of JRuby. -Please consider using `ruby-rubocop' or `ruby-rubylint' instead. +Please consider using `ruby-rubocop' instead. -See URL `http://jruby.org/'." +See URL `https://jruby.org/'." :command ("jruby" "-w" "-c") :standard-input t :error-patterns ((error line-start "SyntaxError in -:" line ": " (message) line-end) (warning line-start "-:" line ": warning: " (message) line-end) (error line-start "-:" line ": " (message) line-end)) - :modes (enh-ruby-mode ruby-mode ruby-ts-mode) - :next-checkers ((warning . ruby-rubylint))) + :modes (enh-ruby-mode ruby-mode ruby-ts-mode)) (flycheck-def-args-var flycheck-cargo-check-args (rust-cargo) :package-version '(flycheck . "32")) @@ -11497,7 +11796,7 @@ Relative paths are relative to the file being checked." (defun flycheck-rust-error-explainer (error) "Return an explanation for the given `flycheck-error' ERROR." - (-when-let (error-code (flycheck-error-id error)) + (when-let (error-code (flycheck-error-id error)) (lambda () (flycheck-call-checker-process 'rust nil standard-output t "--explain" error-code) @@ -11511,10 +11810,10 @@ Relative paths are relative to the file being checked." (or ;; Macro errors emit a diagnostic in a phony file, ;; e.g. "". - (-when-let (filename (flycheck-error-filename err)) + (when-let (filename (flycheck-error-filename err)) (string-match-p (rx "macros>" line-end) filename)) ;; Redundant message giving the number of failed errors - (-when-let (msg (flycheck-error-message err)) + (when-let (msg (flycheck-error-message err)) (string-match-p (rx (or (: "aborting due to " (optional (one-or-more num) " ") @@ -11555,9 +11854,9 @@ versions inferior to 1.25)." Execute `cargo --list' to find out whether COMMAND is present." (let ((cargo (funcall flycheck-executable-find "cargo"))) (member command - (mapcar (lambda (line) - (replace-regexp-in-string "\\s-*\\(\\S-+\\).*\\'" "\\1" line)) - (ignore-errors (process-lines cargo "--list")))))) + (mapcar (lambda (line) + (replace-regexp-in-string "\\s-*\\(\\S-+\\).*\\'" "\\1" line)) + (ignore-errors (process-lines cargo "--list")))))) (defun flycheck-rust-valid-crate-type-p (crate-type) "Whether CRATE-TYPE is a valid target type for Cargo. @@ -11688,6 +11987,42 @@ See URL `https://github.com/rust-lang-nursery/rust-clippy'." :message (if has-toml "Found" "Missing") :face (if has-toml 'success '(bold warning)))))))) +(flycheck-define-checker salt-lint + "A salt linter which apply common best practices for SaltStack. + +See URL `https://salt-lint.readthedocs.io/en/latest/'." + :command ("python" "-m" "saltlint" "--json") + :standard-input t + :error-parser flycheck-salt-lint-parser + :error-filter (lambda (errors) (flycheck-sanitize-errors errors)) + :modes salt-mode) + +(defun flycheck-salt-lint-parser (output checker buffer) + "Parse salt lint JSON errors from OUTPUT. + +The arguments CHECKER and BUFFER are only passed through." + (condition-case nil + (let* ((json-array-type 'list) + (json-object-type 'plist) + (filename (buffer-file-name buffer)) + (errors (json-read-from-string output))) + (mapcar (lambda (e) + (flycheck-error-new + :checker checker + :buffer buffer + :filename filename + :level (pcase (plist-get e :severity) + ("HIGH" 'error) + ("MEDIUM" 'warning) + ("LOW" 'warning) + ("INFO" 'info) + (_ 'info)) + :line (plist-get e :linenumber) + :column 0 + :message (concat (plist-get e :message) (plist-get e :line)) + :id (plist-get e :id))) errors)) + (json-error nil))) + (defvar flycheck-sass-scss-cache-directory nil "The cache directory for `sass' and `scss'.") @@ -11711,7 +12046,7 @@ When non-nil, enable the Compass CSS framework, via `--compass'." (flycheck-define-checker sass "A Sass syntax checker using the Sass compiler. -See URL `http://sass-lang.com'." +See URL `https://sass-lang.com'." :command ("sass" "--cache-location" (eval (flycheck-sass-scss-cache-location)) (option-flag "--compass" flycheck-sass-compass) @@ -11774,7 +12109,7 @@ See URL `https://www.scala-lang.org/'." Note that this syntax checker is not used if `flycheck-scalastylerc' is nil or refers to a non-existing file. -See URL `http://www.scalastyle.org'." +See URL `https://www.scalastyle.org'." :command ("scalastyle" (config-file "-c" flycheck-scalastylerc) source) @@ -11817,7 +12152,7 @@ See URL `http://www.scalastyle.org'." (flycheck-define-checker scheme-chicken "A CHICKEN Scheme syntax checker using the CHICKEN compiler `csc'. -See URL `http://call-cc.org/'." +See URL `https://call-cc.org/'." :command ("csc" "-analyze-only" "-local" (eval flycheck-scheme-chicken-args) source) @@ -11929,7 +12264,7 @@ See URL `https://github.com/brigade/scss-lint'." :modes scss-mode :verify (lambda (checker) - (-when-let + (when-let (output (flycheck-call-checker-process-for-output checker nil nil "--require=scss_lint_reporter_checkstyle")) (let ((reporter-missing @@ -11947,17 +12282,31 @@ See URL `https://github.com/brigade/scss-lint'." (flycheck-define-checker scss-stylelint "A SCSS syntax and style checker using stylelint. -See URL `http://stylelint.io/'." +See URL `https://stylelint.io/'." :command ("stylelint" (eval flycheck-stylelint-args) - "--syntax" "scss" (option-flag "--quiet" flycheck-stylelint-quiet) (config-file "--config" flycheck-stylelintrc)) :standard-input t + :verify (lambda (_) (flycheck--stylelint-verify 'scss-stylelint)) :error-parser flycheck-parse-stylelint :predicate flycheck-buffer-nonempty-p :modes (scss-mode)) +(flycheck-define-checker sass-stylelint + "A Sass syntax and style checker using stylelint. + +See URL `https://stylelint.io/'." + :command ("stylelint" + (eval flycheck-stylelint-args) + (option-flag "--quiet" flycheck-stylelint-quiet) + (config-file "--config" flycheck-stylelintrc)) + :standard-input t + :verify (lambda (_) (flycheck--stylelint-verify 'sass-stylelint)) + :error-parser flycheck-parse-stylelint + :predicate flycheck-buffer-nonempty-p + :modes (sass-mode)) + (flycheck-def-option-var flycheck-scss-compass nil scss "Whether to enable the Compass CSS framework. @@ -11969,7 +12318,7 @@ When non-nil, enable the Compass CSS framework, via `--compass'." (flycheck-define-checker scss "A SCSS syntax checker using the SCSS compiler. -See URL `http://sass-lang.com'." +See URL `https://sass-lang.com'." :command ("scss" "--cache-location" (eval (flycheck-sass-scss-cache-location)) (option-flag "--compass" flycheck-scss-compass) @@ -12002,7 +12351,7 @@ See URL `http://sass-lang.com'." (flycheck-define-checker sh-bash "A Bash syntax checker using the Bash shell. -See URL `http://www.gnu.org/software/bash/'." +See URL `https://www.gnu.org/software/bash/'." :command ("bash" "--norc" "-n" (eval flycheck-sh-bash-args) "--") @@ -12022,7 +12371,7 @@ See URL `http://www.gnu.org/software/bash/'." (flycheck-define-checker sh-posix-dash "A POSIX Shell syntax checker using the Dash shell. -See URL `http://gondor.apana.org.au/~herbert/dash/'." +See URL `https://gondor.apana.org.au/~herbert/dash/'." :command ("dash" "-n") :standard-input t :error-patterns @@ -12034,7 +12383,7 @@ See URL `http://gondor.apana.org.au/~herbert/dash/'." (flycheck-define-checker sh-posix-bash "A POSIX Shell syntax checker using the Bash shell. -See URL `http://www.gnu.org/software/bash/'." +See URL `https://www.gnu.org/software/bash/'." :command ("bash" "--posix" "--norc" "-n" "--") :standard-input t :error-patterns @@ -12052,7 +12401,7 @@ See URL `http://www.gnu.org/software/bash/'." (flycheck-define-checker sh-zsh "A Zsh syntax checker using the Zsh shell. -See URL `http://www.zsh.org/'." +See URL `https://www.zsh.org/'." :command ("zsh" "--no-exec" "--no-globalrcs" "--no-rcs" source) :error-patterns ((error line-start (file-name) ":" line ": " (message) line-end)) @@ -12124,7 +12473,7 @@ See URL `https://github.com/koalaman/shellcheck/'." (flycheck-define-checker slim "A Slim syntax checker using the Slim compiler. -See URL `http://slim-lang.com'." +See URL `https://slim-lang.com'." :command ("slimrb" "--compile") :standard-input t :error-patterns @@ -12184,7 +12533,7 @@ See URL (flycheck-define-checker tcl-nagelfar "An extensible tcl syntax checker -See URL `http://nagelfar.sourceforge.net/'." +See URL `https://nagelfar.sourceforge.net/'." :command ("nagelfar" "-H" source) :error-patterns ;; foo.tcl: 29: E Wrong number of arguments (4) to "set" @@ -12253,19 +12602,31 @@ information about tflint." "A Terraform checker using tflint. See URL `https://github.com/terraform-linters/tflint'." - :command ("tflint" "--format=json" - (option-list "--var-file=" flycheck-tflint-variable-files concat) - source-original) + :command ("tflint" "--format=json" "--force" + (option-list "--var-file=" flycheck-tflint-variable-files concat)) :error-parser flycheck-parse-tflint-linter :predicate flycheck-buffer-saved-p :modes terraform-mode) +(flycheck-def-option-var flycheck-chktex-extra-flags nil tex-chktex + "A list of extra arguments to give to chktex. +This variable works the same way as `tex-chktex-extra-flags': its value +is a list of strings, where each string is an argument added to chktex. + +For example, to ignore warnings 8 and 18, you would set this option to + + \\='(\"-n8\" \"-n18\")." + :type '(repeat string) + :safe #'flycheck-string-list-p + :package-version '(flycheck . "35")) + (flycheck-define-checker tex-chktex "A TeX and LaTeX syntax and style checker using chktex. -See URL `http://www.nongnu.org/chktex/'." +See URL `https://www.nongnu.org/chktex/'." :command ("chktex" (config-file "--localrc" flycheck-chktexrc) + (option-list "" flycheck-chktex-extra-flags concat) ;; Compact error messages, and no version information, and execute ;; \input statements "--verbosity=0" "--quiet" "--inputfiles") @@ -12276,23 +12637,23 @@ See URL `http://www.nongnu.org/chktex/'." :error-filter (lambda (errors) (flycheck-sanitize-errors (flycheck-increment-error-columns errors))) - :modes (latex-mode plain-tex-mode)) + :modes (latex-mode LaTeX-mode plain-tex-mode plain-TeX-mode)) (flycheck-define-checker tex-lacheck "A LaTeX syntax and style checker using lacheck. -See URL `http://www.ctan.org/pkg/lacheck'." +See URL `https://www.ctan.org/pkg/lacheck'." :command ("lacheck" source-inplace) :error-patterns ((warning line-start "\"" (file-name) "\", line " line ": " (message) line-end)) - :modes latex-mode) + :modes (latex-mode LaTeX-mode)) (flycheck-define-checker texinfo "A Texinfo syntax checker using makeinfo. -See URL `http://www.gnu.org/software/texinfo/'." +See URL `https://www.gnu.org/software/texinfo/'." :command ("makeinfo" "-o" null-device "-") :standard-input t :error-patterns @@ -12302,7 +12663,7 @@ See URL `http://www.gnu.org/software/texinfo/'." (error line-start "-:" line (optional ":" column) ": " (message) line-end)) - :modes texinfo-mode) + :modes (texinfo-mode Texinfo-mode)) (flycheck-def-config-file-var flycheck-textlint-config textlint "textlintrc.json") @@ -12329,7 +12690,7 @@ published on NPM." (defun flycheck--textlint-get-plugin () "Return the textlint plugin for the current mode." - (cdr (-first + (cdr (seq-find (lambda (arg) (pcase-let ((`(,mode . _) arg)) (or (and (booleanp mode) mode) ; mode is t @@ -12356,7 +12717,7 @@ See URL `https://textlint.github.io/'." ;; `flycheck-textlint-plugin-alist'. :modes (text-mode markdown-mode gfm-mode message-mode adoc-mode - mhtml-mode latex-mode org-mode rst-mode) + mhtml-mode latex-mode LaTeX-mode org-mode rst-mode) :enabled (lambda () (flycheck--textlint-get-plugin)) :verify @@ -12381,7 +12742,7 @@ to a directory with custom rules, or nil, to not give any custom rules to TSLint. Refer to the TSLint manual at URL -`http://palantir.github.io/tslint/usage/cli/' +`https://palantir.github.io/tslint/usage/cli/' for more information about the custom directory." :type '(choice (const :tag "No custom rules directory" nil) (directory :tag "Custom rules directory")) @@ -12485,7 +12846,8 @@ See URL `https://github.com/ghdl/ghdl'." (option "--ieee=" flycheck-ghdl-ieee-library concat) source) :error-patterns - ((error line-start (file-name) ":" line ":" column ": " (message) line-end)) + ((warning line-start (file-name) ":" line ":" column ":warning: " (message) line-end) + (error line-start (file-name) ":" line ":" column ":error: " (message) line-end)) :modes vhdl-mode) (flycheck-def-option-var flycheck-xml-xmlstarlet-xsd-path nil xml-xmlstarlet @@ -12498,7 +12860,7 @@ See URL `https://github.com/ghdl/ghdl'." (flycheck-define-checker xml-xmlstarlet "A XML syntax checker and validator using the xmlstarlet utility. -See URL `http://xmlstar.sourceforge.net/'." +See URL `https://xmlstar.sourceforge.net/'." ;; Validate standard input with verbose error messages, and do not dump ;; contents to standard output :command ("xmlstarlet" "val" "--err" "--quiet" @@ -12516,13 +12878,21 @@ See URL `http://xmlstar.sourceforge.net/'." :safe #'flycheck-string-or-nil-p :package-version '(flycheck . "31")) +(flycheck-def-option-var flycheck-xml-xmllint-relaxng-path nil xml-xmllint + "An RELAX NG schema to validate against." + :type '(choice (const :tag "None" nil) + (file :tag "RELAX NG schema")) + :safe #'flycheck-string-or-nil-p + :package-version '(flycheck . "34")) + (flycheck-define-checker xml-xmllint "A XML syntax checker and validator using the xmllint utility. The xmllint is part of libxml2, see URL -`http://www.xmlsoft.org/'." +`https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home'." :command ("xmllint" "--noout" (option "--schema" flycheck-xml-xmllint-xsd-path) + (option "--relaxng" flycheck-xml-xmllint-relaxng-path) "-") :standard-input t :error-patterns @@ -12554,7 +12924,7 @@ See URL `https://github.com/nodeca/js-yaml'." This syntax checker uses the YAML parser from Ruby's standard library. -See URL `http://www.ruby-doc.org/stdlib-2.0.0/libdoc/yaml/rdoc/YAML.html'." +See URL `https://www.ruby-doc.org/stdlib-2.0.0/libdoc/yaml/rdoc/YAML.html'." :command ("ruby" "-ryaml" "-e" "begin; YAML.load(STDIN); \ rescue Exception => e; \ @@ -12568,7 +12938,12 @@ See URL `http://www.ruby-doc.org/stdlib-2.0.0/libdoc/yaml/rdoc/YAML.html'." :next-checkers ((warning . yaml-yamllint) (warning . cwl))) -(flycheck-def-config-file-var flycheck-yamllintrc yaml-yamllint ".yamllint") +(flycheck-def-config-file-var flycheck-yamllintrc + yaml-yamllint + '(".yamllint" + ".yamllint.yaml" + ".yamllint.yml" + "~/.config/yamllint/config")) (flycheck-define-checker yaml-yamllint "A YAML syntax checker using YAMLLint. diff --git a/elpa/flycheck-readme.txt b/elpa/flycheck-readme.txt deleted file mode 100644 index 43e7c7fc..00000000 --- a/elpa/flycheck-readme.txt +++ /dev/null @@ -1,30 +0,0 @@ -On-the-fly syntax checking for GNU Emacs 24. - -Flycheck is a modern on-the-fly syntax checking extension for GNU Emacs, -intended as replacement for the older Flymake extension which is part of GNU -Emacs. - -Flycheck automatically checks buffers for errors while you type, and reports -warnings and errors directly in the buffer and in an optional IDE-like error -list. - -It comes with a rich interface for custom syntax checkers and other -extensions, and has already many 3rd party extensions adding new features. - -Please read the online manual at http://www.flycheck.org for more -information. You can open the manual directly from Emacs with `M-x -flycheck-manual'. - -# Setup - -Flycheck works best on Unix systems. It does not officially support Windows, -but tries to maintain Windows compatibility and should generally work fine on -Windows, too. - -To enable Flycheck add the following to your init file: - - (add-hook 'after-init-hook #'global-flycheck-mode) - -Flycheck will then automatically check buffers in supported languages, as -long as all necessary tools are present. Use `flycheck-verify-setup' to -troubleshoot your Flycheck setup. -- 2.47.3