@@ -49,21 +49,24 @@ The Drupal standard includes checks for non-PHP files, this
4949checker runs those.
5050
5151See URL `http://pear.php.net/package/PHP_CodeSniffer/' ."
52- :command (" phpcs" " --report=emacs"
53- (option " --standard=" drupal/phpcs-standard concat)
54- source-inplace)
55- ; ; Though phpcs supports Checkstyle output which we could feed to
56- ; ; `flycheck-parse-checkstyle' , we are still using error patterns here,
57- ; ; because PHP has notoriously unstable output habits. See URL
58- ; ; `https://github.com/lunaryorn/flycheck/issues/78' and URL
59- ; ; `https://github.com/lunaryorn/flycheck/issues/118'
60- :error-patterns
61- ((error line-start
62- (file-name) " :" line " :" column " : error - " (message )
63- line-end)
64- (warning line-start
65- (file-name) " :" line " :" column " : warning - " (message )
66- line-end))
52+ :command (" phpcs" " --report=checkstyle"
53+ (option " --standard=" flycheck-phpcs-standard concat)
54+ ; ; Pass original file name to phpcs. We need to concat explicitly
55+ ; ; here, because phpcs really insists to get option and argument as
56+ ; ; a single command line argument :|
57+ (eval (when (buffer-file-name )
58+ (concat " --stdin-path=" (buffer-file-name )))))
59+ :standard-input t
60+ :error-parser flycheck-parse-checkstyle
61+ :error-filter
62+ (lambda (errors )
63+ (flycheck-sanitize-errors
64+ (flycheck-remove-error-file-names " STDIN" errors)))
65+ ; ; Hardcoded for the moment, as this doesn't work:
66+ ; ; :modes (append drupal-css-modes drupal-js-modes drupal-info-modes)
67+ ; ; As they're reworking the checker selection code, we're letting this
68+ ; ; lie for the moment.
69+ :modes (css-mode javascript-mode js-mode js2-mode conf-windows-mode)
6770 :predicate (lambda ()
6871 (and drupal-mode drupal/phpcs-standard)))
6972
@@ -73,7 +76,7 @@ See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
7376(let ((modes (append drupal-css-modes drupal-js-modes drupal-info-modes)))
7477 (dolist (checker (flycheck-defined-checkers))
7578 (dolist (mode (flycheck-checker-get checker 'modes ))
76- ( if ( memq mode modes )
79+ ( if ( and ( memq mode modes) ( not ( eq checker 'drupal-phpcs )) )
7780 (flycheck-add-next-checker checker 'drupal-phpcs )))))
7881
7982
0 commit comments