magento / marketplace-eqp

Magento 1.x Coding Standard
http://docs.magento.com/marketplace/user_guide/Resources/pdf/Extension_Quality_Program_Overview.pdf
MIT License
224 stars 68 forks source link

phpcbf have no impact on files #34

Closed kooliahmd closed 7 years ago

kooliahmd commented 7 years ago

After I run phpcs it shows several fixable warnings. Now when i run phpcbf, most of the warnings remain, it's like phpcbf didn't correct any thing.

On the standard output, I get this from phpcbf:

 [0] => Ignoring potentially dangerous file name /home/XXX..
    [1] => can't find file to patch at input line 3
    [2] => Perhaps you used the wrong -p or --strip option?
    [3] => The text leading up to this was:
    [4] => --------------------------
    [5] => |--- /home/XXXX..
    [6] => |+++ PHP_CodeSniffer

Why phpcbf is considering most of files as "potentially dangerous" ? How can I force it to do the correction ?

kooliahmd commented 7 years ago

After some debugging , I have found this : This issue is related to how patch cmd is called, for some patch versions (for instance: GNU patch 2.7.1) only relative paths not containing .. are accepted.

I fixed this by prefixing patch call with cd / &&

cd / && patch -p0 -ui \"$diffFile\" instead of: patch -p0 -ui \"$diffFile\"

(File /vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php , Line : 198)

lenaorobei commented 7 years ago

@Snake-Tn thanks for your investigation. I suppose, we can close this issue?