Pre-commit - Code Standards

72 views
Skip to first unread message

Juan Basso

unread,
Mar 31, 2012, 6:16:45 PM3/31/12
to cakeph...@googlegroups.com
Hi guys,

Mark did an amazing job in put all CakePHP core in the Cake Code Standard. He also changed the continuous integration (http://ci,cakephp.org) to fail the build if the phpcs fail.

To catch these errors before CI, I created a git pre-commit hook to fail the commit if your changes are breaking the standards: https://gist.github.com/2268925
It will check only the modified files, so it does not take long time. To install, just create a file .git/hooks/pre-commit with the gist content and save the file with executable permission (chmod +x .git/hooks/pre-commit).

It can be used for everybody that contribute to the core or if someone wants to keep the app using the same code standard.

If, for some reason (ie, you are commiting to release 1.3), you want to commit ignoring the rules, you can use the -n param in git commit, ie: git commit -n -m "My message"


Juan Basso

mark_story

unread,
Mar 31, 2012, 8:02:48 PM3/31/12
to cakeph...@googlegroups.com
Nice work Juan!  It might be a good idea for us to update the documentation about how to check coding style and use pre-commit hooks.

-Mark

Graham Weldon

unread,
Apr 1, 2012, 12:58:00 AM4/1/12
to cakeph...@googlegroups.com
Nice!

Cheers,
Graham Weldon
Skype: grahamweldon

Reply all
Reply to author
Forward
0 new messages