Skip navigation


Usually before committing a file we need to check modified files against the code convention before committing to the code repository.

Here’s a single line to run modified files in Git against PHPCS.

git ls-files -m | grep '\.php$' | xargs ./vendor/bin/phpcs -s --standard=etc/phpcs/ruleset.xml

Code above assumes you install PHPCS using composer and have your own standard located in the etc/phpcs/ruleset.xml.

UPDATE

To check all uncommited files, run this

git ls-files --others --exclude-standard | grep '\.php$' | xargs ./vendor/bin/phpcs -s --standard=etc/phpcs/ruleset.xml

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: