Closed spaceotter closed 10 years ago
I have been able to clear the error with the following replacement for the call to 'flycheck-declare-checker'.
(flycheck-define-checker css-js-phpcs
"Check CSS and JavaScript using PHP_CodeSniffer.
PHP_CodeSniffer can be used to check non-PHP files, as exemplified by the
Drupal code sniffer.
See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
:command ("phpcs" "--report=emacs"
(option "--standard=" flycheck-phpcs-standard)
source)
;; Though phpcs supports Checkstyle output which we could feed to
;; `flycheck-parse-checkstyle', we are still using error patterns here,
;; because PHP has notoriously unstable output habits. See URL
;; `https://github.com/lunaryorn/flycheck/issues/78' and URL
;; `https://github.com/lunaryorn/flycheck/issues/118'
:error-patterns
((error "\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): error - \\(?4:.*\\)")
(warning "\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): warning - \\(?4:.*\\)"))
:modes (css-mode js-mode)
:predicate (lambda ()
(and drupal/flycheck-phpcs-js-and-css (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes drupal-js-modes)))))
Thank you. I don't use flycheck myself (yet) so please let me know if this causes any problems.
@xendk might want to test it out?
After upgrading flycheck and PHPMD which flycheck now supports (which we'll probably want to configure specially for Drupal mode buffers), it seems to work. Haven't done any serious testing thought.
Drupal-mode was broken on install. Error like the following:
reference to free variable `css-js-phpcs'
I found the reason to be that flycheck has moved to a different macro. Use 'flycheck-define-checker' and not 'flycheck-declare-checker'.