CheckStyle

Checkstyle in the CSL labs

  1. Login to the lab machine using the account of the partner who is the designated driver for this lab.
  2. The BlueJ IDE is installed on the instructor's grader account.  Open a terminal and use the command:
    ~graderjd/bin/bluej/bluej
  3. From the Tools - > Preferences menu click the "Extensions" tab, then in the Checkstyle panel, enter into the Configuration file field:  /home/graderjd/bin/bluej/lib/extensions/308style.xml
  4. Create a new project.  Create a new class, and then copy-paste the source from this example poorly formatted code.
  5. Invoke Checkstyle from the Tools menu and observe which lines are marked as violations.


For Home Use:
Here is a Checkstyle extension for BlueJ that contains the custom checks for our class coding standard. Here is the associated configuration file.

Also, on Unix, Checkstyle is installed in the grader account.
~graderjd/bin/stylechecker myprogram.java

You can also download Checkstyle to run as a stand-alone utility on your workstation:  CheckStyle download
You'll want to install the 308checks.jar and  use the class configuration file.



Limitations

Checkstyle isn't perfect.  It doesn't find every rule in our class coding standard.

The check for a comment before a logic statement only recognizes single line comments.

The line counter used to check method size doesn't use the same rule as the instructor's LOC.  For now we have to live with Checkstyle's rule.