Php_codesniffer: Code Sniffer does not return report, despite checking files.

Created on 8 Mar 2018  路  7Comments  路  Source: squizlabs/PHP_CodeSniffer

I am running php code sniffer on an entire project directory. It does not return a report.

On smaller directories and files it works as expected.

Using the -v I can see that all the files are indeed being processed, but still no report is being generated.

Awaiting Feedback

Most helpful comment

So is there a way to feed it more memory?

You can add -d memory_limit=xxxM where xxx is how many MBs you want to give PHPCS. Could try increasing a bit.

Also, a polite feature request would be a non silent failure for this.

I don't hide it. Your PHP settings are probably hiding it, but I think they are shown by default on the CLI. They certainly always have been for me:

$ phpcs -d memory_limit=1M
PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 65536 bytes) in /PHP_CodeSniffer/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php on line 15

All 7 comments

The only thing I can think of is that maybe it has run out of memory. Do you see any out of memory errors in your PHP error log?

I do not see any in the mac console.

Can you run PHPCS again over your project and then run echo $? to get the exit code. Maybe try that with a run that produces no error report and one that produces a report.

If PHPCS thinks there are no errors, it will return 0. If it produces an error report, it will return a non-zero code. If there was a memory error, you should get something like 255.

it is a 255.
Yay.

So is there a way to feed it more memory?

Also, a polite feature request would be a non silent failure for this.

So is there a way to feed it more memory?

You can add -d memory_limit=xxxM where xxx is how many MBs you want to give PHPCS. Could try increasing a bit.

Also, a polite feature request would be a non silent failure for this.

I don't hide it. Your PHP settings are probably hiding it, but I think they are shown by default on the CLI. They certainly always have been for me:

$ phpcs -d memory_limit=1M
PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 65536 bytes) in /PHP_CodeSniffer/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php on line 15

I will give that a shot, thanks!

I suspect this is caused by a memory issue. I'm going to close this issue and look at the problem as part of issue #1790

Was this page helpful?
0 / 5 - 0 ratings