code sniffer not working
I have installed code sniffer alongside drupal/coder globally as per this guide: https://www.jetbrains.com/help/phpstorm/using-php-code-sniffer.html
I have pointed the local php/quality tools configuration to point at .composer/vendor/bin/phpcs, when I click the validate button it says ok and that version 3.4.0 of code sniffer is installed.
When I look at preferences > Inspections I have checked PHP Code Sniffer validation under quality tools and the settings in there have all been left at default apart from the coding standard which I have set to Drupal.
The problem is nothing happens in the editor, I have deliberately written some poorly formatted code to test and none of it is highlighted:
$jimmy =0;
if ($jimmy ) {
print 'do shizzle';}
$jimmy = 1;
$jimmy = 1;
}
When I look in the event log I see no phpcs errors (or any other errors for that matter). What steps can I take to get this working?
请先登录再写评论。
What if you try to run Inspect Code manually, is there anything from "phpcs" in an output?
I've never used code sniffer before this week so am not sure how to run it manually, how do I do that?
Just realized it is kicking in for .php files but not .module files so perhaps this is a file association issue?
You can specify custom file extensions in the EAP, please check: https://youtrack.jetbrains.com/issue/WI-44491
https://www.jetbrains.com/phpstorm/eap/
I can see the same issue, previously PHP CS has worked good. Now, nothing happened in my editor. When I run a code inspection by name, this message appears "No suspicious code found. 1 files processed in 'File "FileFormatter.php''."
But when I run PHP CS from the command line, a lot of warnings printing in my console.
Bump. This is still the case in recent 2019.2.4 - despite having errors, IntelijJ say "No suspicious code found. ...". Running by hand in console shows report as expected.
I created bug for this: https://youtrack.jetbrains.com/issue/PY-38870
Thanks.
Typically those issues are caused by an incorrect config. We'll continue investigation in a bug report linked above.