Open nylen opened 4 years ago
Tabs vs spaces might be a good one to start with using PHPCBF.
I used the following command to run phpcs on all PHP files:
git ls-files -z | grep -z '\.php$' | xargs -0 ./vendor/bin/phpcs --encoding=utf-8 -s -n -p | pv > cc-phpcs.txt
Results: https://nylen.io/cc-phpcs.txt
Total number of violations:
grep -P '^\s*\|\s*\|\s*\([^) ]+\)$' cc-phpcs.txt | sed 's/^.*(//; s/)$//' | wc -l
3985
Rules broken with number of violations per rule:
Some of these can probably be ignored in phpcs.xml, some can probably be fixed and then enabled for future PRs. I think this should wait until after v1 since there is plenty more urgent work to do.
As of https://github.com/ClassicPress-research/classic-commerce/pull/190 the coding standards checks on every PR are disabled. This is because the coding standards checks run whenever a file is changed in a PR against that whole file, but there are many pre-existing standards violations, for example: https://travis-ci.com/ClassicPress-research/classic-commerce/jobs/278382606
The Woo team fixes these as they go along, but this isn't something we want to do (lots of extra work, makes PRs messier). Future approaches to fix this could include: