Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Word of advice: Don't make this a pre-commit script.</p> <ul> <li>Any pre-commit script will hold up the commit until it completes. If I check in a dozen files, how long does it take for this script to run? When I first got into computing, a second second response time was considered acceptable. Now, if you don't get a response in a few seconds, people will complain.</li> <li>What happens in those cases where the <code>checkstyle</code> catches something where it is not an issue, or the way the developer wrote it is actually clearer and easier to understand than what <code>checkstyle</code> insists it should be? When you use something like <code>checkstyle</code> or <code>findbugs</code>, you have to understand you'll get a few false positives.</li> </ul> <p>A better method is to use a continuous build engine like <a href="http://jenkins-ci.org" rel="noreferrer">Jenkins</a>. Jenkins can be setup to automatically kick off a build with each and every commit. Jenkins can:</p> <ul> <li>Automatically store the results of the build. Then, you can actually release the code directly from Jenkins for testing and for your clients. After all, you know the same jar/ear/war files you've tested are the same ones your customers will get.</li> <li>Automatically run various tests including: <ul> <li>Checkstyle</li> <li>Findbugs</li> <li>Corbertura</li> <li>PMD</li> <li>DRY</li> <li>JUnit</li> <li>Check for built warnings</li> <li>And dozens of others</li> </ul></li> <li>Jenkins saves the entire build output, all saved artifacts, and all tests in a nice and easy to see webpage that is available to any user.</li> <li>Jenkins can integrate into a wide variety of issue tracking tools, so you can see what Jenkins build a particular issue was involved in.</li> </ul> <p>You don't have to use Jenkins. Hudson is still there. So is CruiseControl, and you can use TeamCity, Bamboo, and dozens of other continuous build systems out there. I like Jenkins because development is very active, and it's dead simple to setup. It took me about 30 minutes to download it and run my first job the very first time I heard of it.</p> <p>I know you asked about your pre-commit hook, and I don't want to sound like a salesman (Jenkins is free and open source, and I have no connection to the project), but making something as complex as a <code>checkstyle</code> check a pre-commit hook is asking for trouble. Using a continuous build server is simply a better way of handling this issue.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload