101 lines
4.1 KiB
HTML
101 lines
4.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>Checkstyle Command Line - Version @CHECKSTYLE_VERSION@</title>
|
|
<link rel="stylesheet" type="text/css" href="mystyle.css">
|
|
</head>
|
|
|
|
<body>
|
|
<h1><a name="checkstyle">Checkstyle Command Line - Version @CHECKSTYLE_VERSION@</a></h1>
|
|
<h2>Description</h2>
|
|
|
|
<p>This document describes how to run checkstyle using the command line tool. The latest version of checkstyle can be found at
|
|
<a href="http://checkstyle.sourceforge.net">http://checkstyle.sourceforge.net</a>.
|
|
This command line tool is included in the checkstyle distribution.</p>
|
|
|
|
|
|
<h2>Installation</h2>
|
|
<p>The easiest way is to include <span class="default">checkstyle-all-@CHECKSTYLE_VERSION@.jar</span> in the classpath. This contains all the classes required to run checkstyle. Alternatively, you must include the following in the classpath:</p>
|
|
<ol>
|
|
<li><span class="default">checkstyle-@CHECKSTYLE_VERSION@.jar</span></li>
|
|
<li>ANTLR 2.7.1 classes. <span class="default">antlr.jar</span> is included in the distribution.</li>
|
|
<li>Jakarta Regexp 1.2 classes. <span class="default">jakarta-regexp-1.2.jar</span> is included in the distribution.</li>
|
|
</ol>
|
|
|
|
|
|
<h2>Usage</h2>
|
|
<p>The command line usage is:</p>
|
|
<pre>
|
|
java -D<property>=<value> \
|
|
com.puppycrawl.tools.checkstyle.Main \
|
|
[-f <format>] [-p <propertiesFile>] [-o <file>] [-r <dir>] file...
|
|
</pre>
|
|
|
|
<p>Checkstyle will process the specified files and by default report errors to standard out in plain format. The options are:</p>
|
|
|
|
<ul>
|
|
<li><span class="default">-f format</span> - specify the output format. Options are <span class="default">"plain"</span> for the <a href="api/com/puppycrawl/tools/checkstyle/DefaultLogger.html">DefaultLogger</a> and <span class="default">"xml"</span> for the <a href="api/com/puppycrawl/tools/checkstyle/XMLLogger.html">XMLLogger</a>. Defaults to <span class="default">"plain"</span>.</li>
|
|
<li><span class="default">-p propertiesFile</span> - specify a properties file to use.
|
|
<li><span class="default">-o file</span> - specify the file to output to.</li>
|
|
<li><span class="default">-r dir</span> - specify the directory to traverse for Java source files.</li>
|
|
</ul>
|
|
|
|
<p>The default behaviour of checkstyle can be changed either by setting system
|
|
properties using the <code>-D<property>=<value></code> arguments
|
|
to java or by specifying a property file using the <code>-p</code> option.
|
|
<a href="config.html">See here</a> for all available configuration options.</li>
|
|
If a property file is specified the system properties are ignored. The
|
|
following table describes what properties can be set:</p>
|
|
|
|
|
|
|
|
<h2>Examples</h2>
|
|
<p><b>Run checkstyle on a file</b></p>
|
|
<pre>
|
|
java com.puppycrawl.tools.checkstyle.Main Check.java
|
|
</pre>
|
|
|
|
<p><b>Run checkstyle on all java files in a directory</b></p>
|
|
<pre>
|
|
java com.puppycrawl.tools.checkstyle.Main -r src/
|
|
</pre>
|
|
|
|
<p><b>Run checkstyle on a file and use specified properties</b></p>
|
|
<pre>
|
|
java com.puppycrawl.tools.checkstyle.Main \
|
|
-p myCheckstyle.properties Check.java
|
|
</pre>
|
|
|
|
<p><b>Run checkstyle on a file and output to a file in XML format with Australian localisation</b></p>
|
|
<pre>
|
|
java -Dcheckstyle.allow.tabs=yes \
|
|
-Dcheckstyle.locale.language=en \
|
|
-Dcheckstyle.locale.language=au \
|
|
com.puppycrawl.tools.checkstyle.Main \
|
|
-f xml -o build/checkstyle_errors.xml Check.java
|
|
</pre>
|
|
|
|
<p><b>Run checkstyle on a file and disable pattern matching</b></p>
|
|
<pre>
|
|
java -Dcheckstyle.pattern.parameter=. \
|
|
-Dcheckstyle.pattern.static=. \
|
|
-Dcheckstyle.pattern.const=. \
|
|
-Dcheckstyle.pattern.member=. \
|
|
com.puppycrawl.tools.checkstyle.Main Check.java
|
|
</pre>
|
|
|
|
<div class="tip">
|
|
<h4 class="tip">Tip</h4>
|
|
<p>It is possible to run Checkstyle directly from the JAR file using the <span class="code">-jar</span> option. Example would be: </p>
|
|
|
|
<pre>
|
|
java -jar checkstyle-all-@CHECKSTYLE_VERSION@.jar Check.java
|
|
</pre>
|
|
</div>
|
|
|
|
<hr>
|
|
<p align="center">Copyright © 2001 Oliver Burn. All rights Reserved.</p>
|
|
</body>
|
|
</html>
|