Good idea of the day: checkstyle on jenkins

When I started a new project at work, I configured our Jenkins server to automatically deploy to production and testing servers when either git master or develop branches get pushed to - but only if all the tests pass.

In our case, it's only syntax checks for HTML, PHP, SCSS, SQL and XML files as well as coding style checks for those files.

But when things get time-critical, nobody can take an excuse that "it has to be quick now" - because your code will just not get live unless you follow the rules. And not only this, everybody else's code will not go live because of you.

This really helps keeping developers play by the rules :)

Tools

In case you were wondering which tools we use for syntax and style checking:

php -l
PHP syntax checking
xmllint --noout
XML syntax checking (and HTML, since I enforce XHTML well-formedness)
php-sqllint
SQL file syntax checking
scss-lint
SCSS syntax and coding style checking
phpcs PHP_CodeSniffer
PHP coding style checking

Written by Christian Weiske.

Comments? Please send an e-mail.