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

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

[nongnu] elpa/drupal-mode 7402b9e9fb 201/308: Merge pull request #43 fro


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode 7402b9e9fb 201/308: Merge pull request #43 from arnested/flycheck-update
Date: Tue, 25 Jan 2022 10:59:47 -0500 (EST)

branch: elpa/drupal-mode
commit 7402b9e9fb43ad5ac473d3080d8d7e8920091301
Merge: 7b2c43bd41 13b2fff6ef
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>

    Merge pull request #43 from arnested/flycheck-update
    
    Use flycheck-add-next-checker.
---
 drupal/flycheck.el | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drupal/flycheck.el b/drupal/flycheck.el
index 84d5da1a46..5f2d948bc5 100644
--- a/drupal/flycheck.el
+++ b/drupal/flycheck.el
@@ -28,19 +28,11 @@
 (require 'flycheck)
 (require 'drupal/phpcs)
 
-(defcustom drupal/flycheck-phpcs-js-and-css t
-  "When Non-nil, override Flycheck to use PHPCS for checking CSS and 
JavaScript files instead of the checkers configured for css-mode and js-mode."
-  :type `(choice
-          (const :tag "Yes" t)
-          (const :tag "No" nil))
-  :group 'drupal)
-
 (defun drupal/flycheck-hook ()
   "Enable drupal-mode support for flycheck."
-  (when (and (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes 
drupal-js-modes))
-             drupal/phpcs-standard)
-    ;; Set the coding standard to "Drupal" (we checked that it is
-    ;; supported above.
+  (when (and drupal-mode drupal/phpcs-standard)
+    ;; Set the coding standard to "Drupal" (phpcs.el has checked that
+    ;; it's supported).
     (setq flycheck-phpcs-standard drupal/phpcs-standard)
 
     ;; Flycheck will also highlight trailing whitespace as an
@@ -50,11 +42,11 @@
 
 (add-hook 'drupal-mode-hook #'drupal/flycheck-hook)
 
-(flycheck-define-checker css-js-phpcs
-  "Check CSS and JavaScript  using PHP_CodeSniffer.
+(flycheck-define-checker drupal-phpcs
+  "Check non-PHP Drupal files using PHP_CodeSniffer.
 
-PHP_CodeSniffer can be used to check non-PHP files, as exemplified by the
-Drupal code sniffer.
+The Drupal standard includes checks for non-PHP files, this
+checker runs those.
 
 See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
   :command ("phpcs" "--report=emacs"
@@ -72,11 +64,19 @@ See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
    (warning line-start
             (file-name) ":" line ":" column ": warning - " (message)
             line-end))
-  :modes (css-mode js-mode)
+  ;; We'd prefer to just check drupal-mode, but flycheck global mode
+  ;; finds the checker before we get a chance to set drupal-mode.
   :predicate (lambda ()
-               (and drupal/flycheck-phpcs-js-and-css (apply 'derived-mode-p 
(append drupal-php-modes drupal-css-modes drupal-js-modes)))))
-
-(add-to-list 'flycheck-checkers 'css-js-phpcs)
+               (apply 'derived-mode-p (append drupal-php-modes 
drupal-css-modes drupal-js-modes drupal-info-modes))))
+
+;; Append our custom checker.
+(add-to-list 'flycheck-checkers 'drupal-phpcs t)
+;; Add our checker as next-checker to checkers of all supported modes.
+(let ((modes (append drupal-css-modes drupal-js-modes drupal-info-modes)))
+  (dolist (checker (flycheck-defined-checkers))
+          (dolist (mode (flycheck-checker-modes checker))
+                  (if (memq mode modes)
+                      (flycheck-add-next-checker checker 'drupal-phpcs)))))
 
 
 (provide 'drupal/flycheck)



reply via email to

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