Code style checker for Dojo
Posted by Shane O'Sullivan on May 23, 2009
I’ve added a code style tool to the Dojo Util project that developers can use to ensure that their code is following the syle guidelines published here –http://www.dojotoolkit.org/developer/StyleGuide .
You can see the current report, as of May 23rd 2009 at http://skynet.ie/~sos/misc/dojoCheckstyle/util/checkstyle/checkstyleReport.html
It can be very difficult to police your own code for tabs and spaces, and developers have much better things to be doing with their time than visually scanning over their code making sure that it is formatted correctly.
This tool identifies style guide violations, and gives developers a HTML file that displays them, and automatically fixes many of the common mistakes for you. (This works best in Firefox right now, so you that if you have it)
The style checker is primarily aimed at Dojo contributors, but can also be used by normal users of the toolkit. To override the standard folders that are examined, you can simply set the ‘dir‘ parameter relative to the Dojo base folder, and a checkstyle report will be generated for you custom code.
To see how to use the tool, get the latest vode from svn, the go to util/checkstyle and type
To run the checkstyle tool on the entire Dojo tree, simply type
then open the checkstyleReport.html file, which you can see below.
If you want to be able to save files from the web interface, you’ll have to renamve the file checkstyle.php.rename.html to checkstyle.php, then click the Save or Save All buttons in the UI.
There is a ticket to track all checkstyle fixes at http://bugs.dojotoolkit.org/ticket/7390 , so can developers please reference this when checking in style fixes?