This document describes how to run checkstyle using the command line tool. The latest version of checkstyle can be found at http://www.puppycrawl.com/checkstyle. This command line tool is included in the checkstyle distribution.
The easiest way is to include checkstyle-all-1.0.jar in the classpath. This contains all the classes required to run checkstyle. Alternatively, you must include the following in the classpath:
The command line usage is:
java -D<property>=<value> com.puppycrawl.tools.checkstyle.Main file...
checkstyle will process the specified files and report errors to standard error. The default behaviour of checkstyle can be changed by setting system properties using the -D<property>=<value>
arguments to java. The following table describes what properties can be set:
Property | Description |
checkstyle.allow.tabs | Indicates whether to allow tabs. Defaults to "no". |
checkstyle.allow.protected | Indicates whether to allow protected data. Defaults to "no". |
checkstyle.allow.noauthor | Indicates whether to allow no @author tag to be defined for class and interface Javadoc comments. Defaults to "no". |
checkstyle.maxlinelen | Specifies the maximum line length. Default value is defined here. |
checkstyle.pattern.member | Specifies the regular expression to match against member variables. Default value is defined here. |
checkstyle.pattern.parameter | Specifies the regular expression to match against parameters. Default value is defined here. |
checkstyle.pattern.const | Specifies the regular expression to match against static/final variables. Default value is defined here. |
checkstyle.pattern.static | Specifies the regular expression to match against static variables. Default value is defined here. |
checkstyle.pattern.type | Specifies the regular expression to match against type names. Default value is defined here. |
checkstyle.header.file | Specifies the file containing the header lines. Default is to not check. |
checkstyle.header.ignoreline | Specifies the line in the header to ignore when comparing. Default it to not ignore any line. |
Run checkstyle on a file
java com.puppycrawl.tools.checkstyle.Main Check.java
Run checkstyle on a file and allow tabs
java -Dcheckstyle.allow.tabs=yes com.puppycrawl.tools.checkstyle.Main Check.java
Run checkstyle on a file and disable pattern matching
java -Dcheckstyle.pattern.parameter=. \ -Dcheckstyle.pattern.static=. \ -Dcheckstyle.pattern.const=. \ -Dcheckstyle.pattern.member=. \ com.puppycrawl.tools.checkstyle.Main Check.java
Copyright © 2001 Oliver Burn. All rights Reserved.
$Id: cmdline.html,v 1.4 2001/02/15 00:23:48 oburn Exp $