0
votes

I am new to PHP CodeSniffer, I have git pulled PHP CodeSniffer in my Mac Machine and kept in /var/www/PHP_CodeSniffer and I have my source code in /var/www/Project1. I have git in /var/www/Project1 and is now pointing to a branch CodeCorrection

When I run bin/phpcs ../Project1 -v from /var/www/PHP_CodeSniffer folder it lists down many errors and when I run bin/phpcbf ../Project1 It gives a summary of FIXED & REMAINING.

But no new file is showing as modified in git status. When I open the file also the change is not implemented or shown.

Once again if I run, I get report as same no of code FIXED & REMAINING

Can any one tell be what am I missing. My project is a Vtiger project.

1
Try running phpcbf with -v as well and see if there are any errors reported. Also maybe try running phpcbf on a single file directly and see what happens. I haven't seen any reports of phpcbf not overwriting files, so there isn't much more I can suggest. - Greg Sherwood
I have tried phpcbf -v and also tried for single file. It shows fixed & Remaining but the actual file is not changing. When I run again it shows the same error count fixed once again but the actual file is not changing. - Vijayanand Premnath
try just adding in a comment char somewhere - see if git status picks it up - treyBake
Yes If we do changes manually it shows in git status. I am trying to do code correction for a Vtiger project it has many internal folders will this be a problem. - Vijayanand Premnath
@VijayanandPremnath are you sure codesniffer has correct permissions to change the code? may be able to tell you what it could change, but gets permissions error? - treyBake

1 Answers

0
votes

Moving the source folder into the PHP_CodeSniffer directory helped me to solve the issue.

Keeping the source folder outside the PHP_CodeSniffer and giving full permission did not help me.