magento-ecg / coding-standard

Magento PHP_CodeSniffer Coding Standard
MIT License
308 stars 100 forks source link

Empty diff #60

Closed endersaka closed 2 years ago

endersaka commented 6 years ago

I tryed the standard Ecg on a Magento 1.9 custom Module. The stdout report works as expected and spots many Warning and Errors. Then I tryed to generate a diff file to eventually patch the code in the future, though mostly to browse what kind of modifications the standard would apply. But the resulting diff file is empty.

This is the command I used:

phpcs --report-diff=phpcs.diff --standard=Ecg .

I tryed the same command with different standard:

phpcs --report-diff=phpcs.diff --standard=PSR2 .

And it produce the desired diff file.

zhooravlik commented 2 years ago

Hi @endersaka, This is a limitation of the \PHP_CodeSniffer\Reports\Diff::generateFileReport method - in case there is nothing can be fixed by PHPCBF. If nothing can be auto-fixed - method generateFileReport just exits, w/o putting any data to the result .diff file. image

endersaka commented 2 years ago

Thaks @zhooravlik,

I appreciate your explanation and I found it interesting. Sadly I don't work on Magento anymore since September 2018, about a month after I posted this issue, 4 years ago.

It looks like this project is not very active.