Skip to content

Commit 274015c

Browse files
committed
Merge pull request #37 from xendk/develop
Fixups to flycheck support.
2 parents 8d57a2a + 889fc24 commit 274015c

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

drupal/flycheck.el

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,10 @@ so no need to highlight it twice."
4646
(defun drupal/flycheck-hook ()
4747
"Enable drupal-mode support for flycheck."
4848
(when (and (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes drupal-js-modes))
49-
(executable-find "phpcs")
5049
drupal/phpcs-standard)
5150
;; Set the coding standard to "Drupal" (we checked that it is
5251
;; supported above.
53-
(set (make-local-variable 'flycheck-phpcs-standard) drupal/phpcs-standard)
54-
55-
(when drupal/flycheck-phpcs-js-and-css
56-
(if (and (apply 'derived-mode-p (append drupal-css-modes drupal-js-modes))
57-
(flycheck-may-use-checker 'css-js-phpcs)
58-
)
59-
(set (make-local-variable 'flycheck-checker) 'css-js-phpcs)
60-
)
61-
)
52+
(setq flycheck-phpcs-standard drupal/phpcs-standard)
6253

6354
;; Flycheck will also highlight trailing whitespace as an
6455
;; error so no need to highlight it twice.
@@ -88,11 +79,10 @@ See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
8879
'(("\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): error - \\(?4:.*\\)" error)
8980
("\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): warning - \\(?4:.*\\)" warning))
9081
:modes '(css-mode js-mode)
91-
:predicate #'(lambda ()
92-
(apply 'derived-mode-p (append drupal-php-modes drupal-css-modes drupal-js-modes))))
93-
82+
:predicate (lambda ()
83+
(and drupal/flycheck-phpcs-js-and-css (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes drupal-js-modes)))))
84+
(add-to-list 'flycheck-checkers 'css-js-phpcs)
9485

9586

9687
(provide 'drupal/flycheck)
97-
9888
;;; drupal/flycheck.el ends here

0 commit comments

Comments
 (0)