Added support for public member patterns.
This commit is contained in:
parent
fa128598e1
commit
d3f39e6b87
|
|
@ -1,3 +1,8 @@
|
|||
2001-08-05 Oliver Burn <oliver-work@puppycrawl.com>
|
||||
|
||||
* src/checkstyle/com/puppycrawl/tools/checkstyle/VerifierImpl.java, src/checkstyle/com/puppycrawl/tools/checkstyle/Defn.java, src/checkstyle/com/puppycrawl/tools/checkstyle/Configuration.java:
|
||||
Added support for public member patterns.
|
||||
|
||||
2001-07-02 Oliver Burn <oliver-work@puppycrawl.com>
|
||||
|
||||
* docs/index.html: Added that can ignore checking braces.
|
||||
|
|
|
|||
467
build.xml
467
build.xml
|
|
@ -1,233 +1,234 @@
|
|||
<project name="test" default="compile.checkstyle" basedir=".">
|
||||
|
||||
<!-- set global properties for this build -->
|
||||
|
||||
<!-- Give user a chance to override without editing this file -->
|
||||
<!-- (and without typing -D each time it compiles it) -->
|
||||
<property file="checkstyle.buildproperties" />
|
||||
<property file="${user.home}/checkstyle.buildproperties" />
|
||||
|
||||
<!-- Note: to compile successfully, the classpath must point to the home -->
|
||||
<!-- of ANTLR. This is because not all ANTLR classes are part of the ANTLR -->
|
||||
<!-- distributed jar file. -->
|
||||
<property name="antlr.home" value="c:/apps/antlr-2.7.1" />
|
||||
<property name="regexp.jar" value="c:/apps/jakarta-regexp-1.2/jakarta-regexp-1.2.jar" />
|
||||
<property name="checkstyle.dir" value="src/checkstyle/com/puppycrawl/tools/checkstyle" />
|
||||
<property name="version" value="1.2" />
|
||||
|
||||
<path id="build.classpath">
|
||||
<pathelement location="${antlr.home}" />
|
||||
<pathelement location="${regexp.jar}" />
|
||||
</path>
|
||||
|
||||
<path id="run.classpath">
|
||||
<pathelement location="classes/checkstyle" />
|
||||
<path refid="build.classpath" />
|
||||
</path>
|
||||
|
||||
<path id="tests.classpath">
|
||||
<pathelement location="classes/tests" />
|
||||
<path refid="run.classpath" />
|
||||
</path>
|
||||
|
||||
<target name="display.classpath">
|
||||
<property name="asd" refid="run.classpath" />
|
||||
<echo message="Classpath is ${asd}" />
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- Cleanup targets -->
|
||||
<!-- -->
|
||||
<target name="clean">
|
||||
<delete dir="classes" />
|
||||
<delete dir="dist" />
|
||||
<delete dir="javadoc" />
|
||||
<delete>
|
||||
<fileset dir="src/checkstyle" includes="**/Generated*.java" />
|
||||
<fileset dir="src/checkstyle" includes="**/Generated*.txt" />
|
||||
<fileset dir="." includes="**/TEST-*" />
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- ANTLR targets -->
|
||||
<!-- -->
|
||||
|
||||
<target name="antlr">
|
||||
<antlr target="${checkstyle.dir}/java.g" />
|
||||
<!-- need to fork to run in the directory where the files generated -->
|
||||
<!-- from the previous task are. -->
|
||||
<antlr target="${checkstyle.dir}/java.tree.g"
|
||||
fork="yes" dir="${checkstyle.dir}" />
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- COMPILE TARGETS -->
|
||||
<!-- -->
|
||||
<target name="compile.checkstyle" depends="antlr">
|
||||
<mkdir dir="classes/checkstyle" />
|
||||
<depend srcdir="src/checkstyle" destdir="classes/checkstyle" closure="yes"/>
|
||||
<javac srcdir="src/checkstyle"
|
||||
destdir="classes/checkstyle"
|
||||
deprecation="on" debug="on"
|
||||
classpathref="build.classpath" />
|
||||
</target>
|
||||
|
||||
<target name="compile.tests" depends="compile.checkstyle">
|
||||
<mkdir dir="classes/tests" />
|
||||
<depend srcdir="src/tests" destdir="classes/tests" closure="yes"/>
|
||||
<javac srcdir="src/tests"
|
||||
destdir="classes/tests"
|
||||
deprecation="on" debug="on"
|
||||
classpathref="run.classpath" />
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- TEST TARGETS -->
|
||||
<!-- -->
|
||||
|
||||
<!-- runs the command line version on a file -->
|
||||
<target name="run.checkstyle" depends="compile.checkstyle">
|
||||
<java classname="com.puppycrawl.tools.checkstyle.Main"
|
||||
fork="yes"
|
||||
dir="${checkstyle.dir}"
|
||||
classpathref="run.classpath">
|
||||
<arg value="VerifierImpl.java" />
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="checkstyle.simple" depends="compile.tests">
|
||||
<taskdef name="checkstyle"
|
||||
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
|
||||
<classpath refid="run.classpath"/>
|
||||
</taskdef>
|
||||
<checkstyle file="src/tests/com/puppycrawl/tools/checkstyle/InputSimple.java" />
|
||||
</target>
|
||||
|
||||
<target name="checkstyle.import" depends="compile.tests">
|
||||
<taskdef name="checkstyle"
|
||||
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
|
||||
<classpath refid="run.classpath"/>
|
||||
</taskdef>
|
||||
<checkstyle file="src/tests/com/puppycrawl/tools/checkstyle/InputImport.java" />
|
||||
</target>
|
||||
|
||||
<target name="checkstyle.checkstyle" depends="compile.checkstyle">
|
||||
<taskdef name="checkstyle"
|
||||
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
|
||||
<classpath refid="run.classpath"/>
|
||||
</taskdef>
|
||||
<checkstyle headerfile="docs/java.header"
|
||||
ignorebraces="false"
|
||||
headerignoreline="3">
|
||||
<fileset dir="src/checkstyle"
|
||||
includes="**/*.java"
|
||||
excludes="**/Generated*.java"/>
|
||||
</checkstyle>
|
||||
</target>
|
||||
|
||||
<target name="checkstyle.noargs" depends="compile.checkstyle">
|
||||
<taskdef name="checkstyle"
|
||||
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
|
||||
<classpath refid="run.classpath"/>
|
||||
</taskdef>
|
||||
<echo message="Calling checkstyle with no arguments" />
|
||||
<checkstyle>
|
||||
</checkstyle>
|
||||
</target>
|
||||
|
||||
<target name="run.tests" depends="compile.tests">
|
||||
<junit printsummary="yes">
|
||||
<formatter type="plain" />
|
||||
<classpath refid="tests.classpath"/>
|
||||
<batchtest>
|
||||
<fileset dir="src/tests">
|
||||
<include name="**/*Test.java" />
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- DIST TARGETS -->
|
||||
<!-- -->
|
||||
<target name="build.bindist" depends="compile.checkstyle">
|
||||
<mkdir dir="dist/checkstyle-${version}" />
|
||||
<jar jarfile="dist/checkstyle-${version}/checkstyle-${version}.jar"
|
||||
basedir="classes/checkstyle" />
|
||||
<!-- copy the JARS and make a mega JAR out of them -->
|
||||
<copy file="${regexp.jar}"
|
||||
todir="dist/checkstyle-${version}" />
|
||||
<copy file="${antlr.home}/antlr.jar"
|
||||
todir="dist/checkstyle-${version}" />
|
||||
<mkdir dir="dist/checkstyle-${version}/tmp" />
|
||||
<unjar src="dist/checkstyle-${version}/antlr.jar"
|
||||
dest="dist/checkstyle-${version}/tmp" />
|
||||
<unjar src="dist/checkstyle-${version}/jakarta-regexp-1.2.jar"
|
||||
dest="dist/checkstyle-${version}/tmp" />
|
||||
<unjar src="dist/checkstyle-${version}/checkstyle-${version}.jar"
|
||||
dest="dist/checkstyle-${version}/tmp" />
|
||||
<delete dir="dist/checkstyle-${version}/tmp/META-INF" />
|
||||
<jar jarfile="dist/checkstyle-${version}/checkstyle-all-${version}.jar"
|
||||
basedir="dist/checkstyle-${version}/tmp" />
|
||||
<delete dir="dist/checkstyle-${version}/tmp" />
|
||||
<!-- copy documentation -->
|
||||
<copy todir="dist/checkstyle-${version}">
|
||||
<fileset dir=".">
|
||||
<exclude name="**/RCS" />
|
||||
<exclude name="*.xml" />
|
||||
<exclude name="classes" />
|
||||
<exclude name="dist" />
|
||||
<exclude name="src" />
|
||||
<exclude name="prj.el" />
|
||||
<exclude name="**/TEST-*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<!-- create the final zip & tar/gzip files -->
|
||||
<zip zipfile="dist/checkstyle-${version}.zip">
|
||||
<fileset dir="dist">
|
||||
<include name="checkstyle-${version}/**"/>
|
||||
</fileset>
|
||||
</zip>
|
||||
<tar tarfile="dist/checkstyle-${version}.tar"
|
||||
basedir="dist" includes="checkstyle-${version}/**" />
|
||||
<gzip zipfile="dist/checkstyle-${version}.tar.gz"
|
||||
src="dist/checkstyle-${version}.tar" />
|
||||
</target>
|
||||
|
||||
<target name="build.srcdist" depends="checkstyle.checkstyle">
|
||||
<mkdir dir="dist/checkstyle-src-${version}" />
|
||||
<copy todir="dist/checkstyle-src-${version}">
|
||||
<fileset dir=".">
|
||||
<exclude name="**/*.jpl" />
|
||||
<exclude name="**/RCS" />
|
||||
<exclude name="**/Generated*.java" />
|
||||
<exclude name="**/Generated*.txt" />
|
||||
<exclude name="classes" />
|
||||
<exclude name="dist" />
|
||||
<exclude name="javadoc" />
|
||||
<exclude name="prj.el" />
|
||||
<exclude name="**/TEST-*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<!-- Produce the final distributions -->
|
||||
<zip zipfile="dist/checkstyle-src-${version}.zip">
|
||||
<fileset dir="dist">
|
||||
<include name="checkstyle-src-${version}/**"/>
|
||||
</fileset>
|
||||
</zip>
|
||||
<tar tarfile="dist/checkstyle-src-${version}.tar"
|
||||
basedir="dist" includes="checkstyle-src-${version}/**" />
|
||||
<gzip zipfile="dist/checkstyle-src-${version}.tar.gz"
|
||||
src="dist/checkstyle-src-${version}.tar" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="javadoc">
|
||||
<mkdir dir="javadoc" />
|
||||
<javadoc sourcepath="src/checkstyle" destdir="javadoc"
|
||||
packagenames="com.puppycrawl.tools.checkstyle"
|
||||
classpathref="run.classpath" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
<project name="test" default="compile.checkstyle" basedir=".">
|
||||
|
||||
<!-- set global properties for this build -->
|
||||
|
||||
<!-- Give user a chance to override without editing this file -->
|
||||
<!-- (and without typing -D each time it compiles it) -->
|
||||
<property file="checkstyle.buildproperties" />
|
||||
<property file="${user.home}/checkstyle.buildproperties" />
|
||||
|
||||
<!-- Note: to compile successfully, the classpath must point to the home -->
|
||||
<!-- of ANTLR. This is because not all ANTLR classes are part of the ANTLR -->
|
||||
<!-- distributed jar file. -->
|
||||
<property name="antlr.home" value="c:/apps/antlr-2.7.1" />
|
||||
<property name="regexp.jar" value="c:/apps/jakarta-regexp-1.2/jakarta-regexp-1.2.jar" />
|
||||
<property name="checkstyle.dir" value="src/checkstyle/com/puppycrawl/tools/checkstyle" />
|
||||
<property name="version" value="1.3" />
|
||||
|
||||
<path id="build.classpath">
|
||||
<pathelement location="${antlr.home}" />
|
||||
<pathelement location="${regexp.jar}" />
|
||||
</path>
|
||||
|
||||
<path id="run.classpath">
|
||||
<pathelement location="classes/checkstyle" />
|
||||
<path refid="build.classpath" />
|
||||
</path>
|
||||
|
||||
<path id="tests.classpath">
|
||||
<pathelement location="classes/tests" />
|
||||
<path refid="run.classpath" />
|
||||
</path>
|
||||
|
||||
<target name="display.classpath">
|
||||
<property name="asd" refid="run.classpath" />
|
||||
<echo message="Classpath is ${asd}" />
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- Cleanup targets -->
|
||||
<!-- -->
|
||||
<target name="clean">
|
||||
<delete dir="classes" />
|
||||
<delete dir="dist" />
|
||||
<delete dir="javadoc" />
|
||||
<delete>
|
||||
<fileset dir="src/checkstyle" includes="**/Generated*.java" />
|
||||
<fileset dir="src/checkstyle" includes="**/Generated*.txt" />
|
||||
<fileset dir="." includes="**/TEST-*" />
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- ANTLR targets -->
|
||||
<!-- -->
|
||||
|
||||
<target name="antlr">
|
||||
<antlr target="${checkstyle.dir}/java.g" />
|
||||
<!-- need to fork to run in the directory where the files generated -->
|
||||
<!-- from the previous task are. -->
|
||||
<antlr target="${checkstyle.dir}/java.tree.g"
|
||||
fork="yes" dir="${checkstyle.dir}" />
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- COMPILE TARGETS -->
|
||||
<!-- -->
|
||||
<target name="compile.checkstyle" depends="antlr">
|
||||
<mkdir dir="classes/checkstyle" />
|
||||
<depend srcdir="src/checkstyle" destdir="classes/checkstyle" closure="yes"/>
|
||||
<javac srcdir="src/checkstyle"
|
||||
destdir="classes/checkstyle"
|
||||
deprecation="on" debug="on"
|
||||
classpathref="build.classpath" />
|
||||
</target>
|
||||
|
||||
<target name="compile.tests" depends="compile.checkstyle">
|
||||
<mkdir dir="classes/tests" />
|
||||
<depend srcdir="src/tests" destdir="classes/tests" closure="yes"/>
|
||||
<javac srcdir="src/tests"
|
||||
destdir="classes/tests"
|
||||
deprecation="on" debug="on"
|
||||
classpathref="run.classpath" />
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- TEST TARGETS -->
|
||||
<!-- -->
|
||||
|
||||
<!-- runs the command line version on a file -->
|
||||
<target name="run.checkstyle" depends="compile.checkstyle">
|
||||
<java classname="com.puppycrawl.tools.checkstyle.Main"
|
||||
fork="yes"
|
||||
dir="${checkstyle.dir}"
|
||||
classpathref="run.classpath">
|
||||
<arg value="VerifierImpl.java" />
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="checkstyle.simple" depends="compile.tests">
|
||||
<taskdef name="checkstyle"
|
||||
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
|
||||
<classpath refid="run.classpath"/>
|
||||
</taskdef>
|
||||
<checkstyle file="src/tests/com/puppycrawl/tools/checkstyle/InputSimple.java" publicMemberPattern="."/>
|
||||
</target>
|
||||
|
||||
<target name="checkstyle.import" depends="compile.tests">
|
||||
<taskdef name="checkstyle"
|
||||
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
|
||||
<classpath refid="run.classpath"/>
|
||||
</taskdef>
|
||||
<checkstyle file="src/tests/com/puppycrawl/tools/checkstyle/InputImport.java" />
|
||||
</target>
|
||||
|
||||
<target name="checkstyle.checkstyle" depends="compile.checkstyle">
|
||||
<taskdef name="checkstyle"
|
||||
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
|
||||
<classpath refid="run.classpath"/>
|
||||
</taskdef>
|
||||
<checkstyle headerfile="docs/java.header"
|
||||
ignorebraces="false"
|
||||
headerignoreline="3">
|
||||
<fileset dir="src/checkstyle"
|
||||
includes="**/*.java"
|
||||
excludes="**/Generated*.java"/>
|
||||
</checkstyle>
|
||||
</target>
|
||||
|
||||
<target name="checkstyle.noargs" depends="compile.checkstyle">
|
||||
<taskdef name="checkstyle"
|
||||
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
|
||||
<classpath refid="run.classpath"/>
|
||||
</taskdef>
|
||||
<echo message="Calling checkstyle with no arguments" />
|
||||
<checkstyle>
|
||||
</checkstyle>
|
||||
</target>
|
||||
|
||||
<target name="run.tests" depends="compile.tests">
|
||||
<junit printsummary="yes">
|
||||
<formatter type="plain" />
|
||||
<classpath refid="tests.classpath"/>
|
||||
<batchtest>
|
||||
<fileset dir="src/tests">
|
||||
<include name="**/*Test.java" />
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<!-- -->
|
||||
<!-- DIST TARGETS -->
|
||||
<!-- -->
|
||||
<target name="build.bindist" depends="compile.checkstyle">
|
||||
<mkdir dir="dist/checkstyle-${version}" />
|
||||
<jar jarfile="dist/checkstyle-${version}/checkstyle-${version}.jar"
|
||||
basedir="classes/checkstyle" />
|
||||
<!-- copy the JARS and make a mega JAR out of them -->
|
||||
<copy file="${regexp.jar}"
|
||||
todir="dist/checkstyle-${version}" />
|
||||
<copy file="${antlr.home}/antlr.jar"
|
||||
todir="dist/checkstyle-${version}" />
|
||||
<mkdir dir="dist/checkstyle-${version}/tmp" />
|
||||
<unjar src="dist/checkstyle-${version}/antlr.jar"
|
||||
dest="dist/checkstyle-${version}/tmp" />
|
||||
<unjar src="dist/checkstyle-${version}/jakarta-regexp-1.2.jar"
|
||||
dest="dist/checkstyle-${version}/tmp" />
|
||||
<unjar src="dist/checkstyle-${version}/checkstyle-${version}.jar"
|
||||
dest="dist/checkstyle-${version}/tmp" />
|
||||
<delete dir="dist/checkstyle-${version}/tmp/META-INF" />
|
||||
<jar jarfile="dist/checkstyle-${version}/checkstyle-all-${version}.jar"
|
||||
basedir="dist/checkstyle-${version}/tmp" />
|
||||
<delete dir="dist/checkstyle-${version}/tmp" />
|
||||
<!-- copy documentation -->
|
||||
<filter token="@@VERSION@@" value="${version}"/>
|
||||
<copy todir="dist/checkstyle-${version}" filtering="true">
|
||||
<fileset dir=".">
|
||||
<exclude name="**/RCS" />
|
||||
<exclude name="*.xml" />
|
||||
<exclude name="classes" />
|
||||
<exclude name="dist" />
|
||||
<exclude name="src" />
|
||||
<exclude name="prj.el" />
|
||||
<exclude name="**/TEST-*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<!-- create the final zip & tar/gzip files -->
|
||||
<zip zipfile="dist/checkstyle-${version}.zip">
|
||||
<fileset dir="dist">
|
||||
<include name="checkstyle-${version}/**"/>
|
||||
</fileset>
|
||||
</zip>
|
||||
<tar tarfile="dist/checkstyle-${version}.tar"
|
||||
basedir="dist" includes="checkstyle-${version}/**" />
|
||||
<gzip zipfile="dist/checkstyle-${version}.tar.gz"
|
||||
src="dist/checkstyle-${version}.tar" />
|
||||
</target>
|
||||
|
||||
<target name="build.srcdist" depends="checkstyle.checkstyle">
|
||||
<mkdir dir="dist/checkstyle-src-${version}" />
|
||||
<copy todir="dist/checkstyle-src-${version}">
|
||||
<fileset dir=".">
|
||||
<exclude name="**/*.jpl" />
|
||||
<exclude name="**/RCS" />
|
||||
<exclude name="**/Generated*.java" />
|
||||
<exclude name="**/Generated*.txt" />
|
||||
<exclude name="classes" />
|
||||
<exclude name="dist" />
|
||||
<exclude name="javadoc" />
|
||||
<exclude name="prj.el" />
|
||||
<exclude name="**/TEST-*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<!-- Produce the final distributions -->
|
||||
<zip zipfile="dist/checkstyle-src-${version}.zip">
|
||||
<fileset dir="dist">
|
||||
<include name="checkstyle-src-${version}/**"/>
|
||||
</fileset>
|
||||
</zip>
|
||||
<tar tarfile="dist/checkstyle-src-${version}.tar"
|
||||
basedir="dist" includes="checkstyle-src-${version}/**" />
|
||||
<gzip zipfile="dist/checkstyle-src-${version}.tar.gz"
|
||||
src="dist/checkstyle-src-${version}.tar" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="javadoc">
|
||||
<mkdir dir="javadoc" />
|
||||
<javadoc sourcepath="src/checkstyle" destdir="javadoc"
|
||||
packagenames="com.puppycrawl.tools.checkstyle"
|
||||
classpathref="run.classpath" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
This task is included in the checkstyle distribution.</p>
|
||||
|
||||
<h3>Installation</h3>
|
||||
<p>The easiest way is to include <span class="default">checkstyle-all-1.1.jar</span> in the classpath. This contains all the classes required to run checkstyle. Alternatively, you must include the following in the classpath:</p>
|
||||
<p>The easiest way is to include <span class="default">checkstyle-all-@@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-1.1.jar</span></li>
|
||||
<li><span class="default">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>
|
||||
|
|
@ -43,77 +43,82 @@ This task is included in the checkstyle distribution.</p>
|
|||
<td align="center" valign="top">One of either <i>file</i> or at least one nested <i>fileset</i> element</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">allowtabs</td>
|
||||
<td valign="top">allowTabs</td>
|
||||
<td valign="top">Indicates whether to allow tabs. Defaults to <span class="default">"false"</span>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">allowprotected</td>
|
||||
<td valign="top">allowProtected</td>
|
||||
<td valign="top">Indicates whether to allow protected data. Defaults to <span class="default">"false"</span>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">allownoauthor</td>
|
||||
<td valign="top">allowNoAuthor</td>
|
||||
<td valign="top">Indicates whether to allow no <span class="default">@author</span> tag to be defined for class and interface Javadoc comments. Defaults to <span class="default">"false"</span>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">maxlinelen</td>
|
||||
<td valign="top">maxLineLen</td>
|
||||
<td valign="top">Specifies the maximum line length. Default value is defined <a href="index.html#length">here</a>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">memberpattern</td>
|
||||
<td valign="top">memberPattern</td>
|
||||
<td valign="top">Specifies the regular expression to match against member variables. Default value is defined <a href="index.html#varformat">here</a>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">parampattern</td>
|
||||
<td valign="top">publicMemberPattern</td>
|
||||
<td valign="top">Specifies the regular expression to match against public member variables. Default value is defined <a href="index.html#varformat">here</a>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">paramPattern</td>
|
||||
<td valign="top">Specifies the regular expression to match against parameters. Default value is defined <a href="index.html#paramformat">here</a>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">constpattern</td>
|
||||
<td valign="top">constPattern</td>
|
||||
<td valign="top">Specifies the regular expression to match against static/final variables. Default value is defined <a href="index.html#varformat">here</a>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">staticpattern</td>
|
||||
<td valign="top">staticPattern</td>
|
||||
<td valign="top">Specifies the regular expression to match against static variables. Default value is defined <a href="index.html#varformat">here</a>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">typepattern</td>
|
||||
<td valign="top">typePattern</td>
|
||||
<td valign="top">Specifies the regular expression to match against type names. Default value is defined <a href="index.html#typeformat">here</a>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">headerfile</td>
|
||||
<td valign="top">headerFile</td>
|
||||
<td valign="top">Specifies the file containing the header lines. Default is to not check.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">headerignoreline</td>
|
||||
<td valign="top">headerIgnoreLine</td>
|
||||
<td valign="top">Specifies the line in the header to ignore when comparing. Default it to not ignore any line.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">relaxjavadoc</td>
|
||||
<td valign="top">relaxJavadoc</td>
|
||||
<td valign="top">Specifies whether to relax checking Javadoc comments. Defaults to <span class="default">"false"</span>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">ignoreimports</td>
|
||||
<td valign="top">ignoreImports</td>
|
||||
<td valign="top">Specifies whether to ignore checking import statements. Defaults to <span class="default">"false"</span>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">ignorewhitespace</td>
|
||||
<td valign="top">ignoreWhitespace</td>
|
||||
<td valign="top">Specifies whether to ignore checking whitespace. Defaults to <span class="default">"false"</span>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">ignorebraces</td>
|
||||
<td valign="top">ignoreBraces</td>
|
||||
<td valign="top">Specifies whether to ignore checking braces. Defaults to <span class="default">"false"</span>.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
|
|
@ -134,18 +139,18 @@ This task is included in the checkstyle distribution.</p>
|
|||
|
||||
<p><b>Run checkstyle on a set of Java files and allow tabs</b></p>
|
||||
<pre>
|
||||
<checkstyle allowtabs="yes">
|
||||
<checkstyle allowTabs="yes">
|
||||
<fileset dir="src/checkstyle" includes="**/*.java"/>
|
||||
</checkstyle>
|
||||
</pre>
|
||||
|
||||
<p><b>Run checkstyle on a set of Java files and disable pattern matching</b></p>
|
||||
<pre>
|
||||
<checkstyle allowtabs="yes">
|
||||
parampattern="."
|
||||
constpattern="."
|
||||
staticpattern="."
|
||||
memberpattern="."
|
||||
<checkstyle allowTabs="yes">
|
||||
paramPattern="."
|
||||
constPattern="."
|
||||
staticPattern="."
|
||||
memberPattern="."
|
||||
<fileset dir="src/checkstyle" includes="**/*.java"/>
|
||||
</checkstyle>
|
||||
</pre>
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ This command line tool is included in the checkstyle distribution.</p>
|
|||
|
||||
|
||||
<h3>Installation</h3>
|
||||
<p>The easiest way is to include <span class="default">checkstyle-all-1.0.jar</span> in the classpath. This contains all the classes required to run checkstyle. Alternatively, you must include the following in the classpath:</p>
|
||||
<p>The easiest way is to include <span class="default">checkstyle-all-@@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-1.0.jar</span></li>
|
||||
<li><span class="default">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>
|
||||
|
|
@ -59,6 +59,10 @@ This command line tool is included in the checkstyle distribution.</p>
|
|||
<td valign="top">checkstyle.pattern.member</td>
|
||||
<td valign="top">Specifies the regular expression to match against member variables. Default value is defined <a href="index.html#varformat">here</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">checkstyle.pattern.publicmember</td>
|
||||
<td valign="top">Specifies the regular expression to match against public member variables. Default value is defined <a href="index.html#varformat">here</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">checkstyle.pattern.parameter</td>
|
||||
<td valign="top">Specifies the regular expression to match against parameters. Default value is defined <a href="index.html#paramformat">here</a>.</td>
|
||||
|
|
|
|||
|
|
@ -169,6 +169,11 @@ div.tip {margin-left : 5%;margin-right : 5%;padding-left: 2%; padding-right: 2%;
|
|||
<td><span class="code">^m[A-Z][a-zA-Z0-9]*$</span></td>
|
||||
<td><span class="code">private int mNumCreated = 0;</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>non <span class="code">static public</span></td>
|
||||
<td><span class="code">^f[A-Z][a-zA-Z0-9]*$</span></td>
|
||||
<td><span class="code">public int fCMPField;</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
@ -185,6 +190,11 @@ div.tip {margin-left : 5%;margin-right : 5%;padding-left: 2%; padding-right: 2%;
|
|||
|
||||
<p>Note: you can turn on allowing <code>protected</code> data members.</p>
|
||||
|
||||
<div class="tip">
|
||||
<h4 class="tip">Tip</h4>
|
||||
<p>Container Managed Persistence EJBs require that managed fields are declared <span class="code">public</span>. This will cause checkstyle to complain that the fields should be declared <span class="code">private</span>. Hence checkstyle supports ignoring <span class="code">public</span> that match a specified regular expression. The default is <span class="code">^f[A-Z][a-zA-Z0-9]*$</span>.</p>
|
||||
</div>
|
||||
|
||||
<h3>White space</h3>
|
||||
<p>Checks for the following use of white space:</p>
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -99,6 +99,18 @@ public class CheckStyleTask
|
|||
}
|
||||
}
|
||||
|
||||
/** @param aPat pattern for public member variables **/
|
||||
public void setPublicMemberPattern(String aPat)
|
||||
{
|
||||
try {
|
||||
mConfig.setPublicMemberPat(aPat);
|
||||
}
|
||||
catch (RESyntaxException ex) {
|
||||
throw new BuildException("Unable to parse publicmemberpattern - " +
|
||||
ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** @param aPat pattern for parameters **/
|
||||
public void setParamPattern(String aPat)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ class Configuration
|
|||
private static final String CONST_PATTERN = "^[A-Z]([A-Z0-9_]*[A-Z0-9])?$";
|
||||
/** the pattern to match against member names **/
|
||||
private static final String MEMBER_PATTERN = "^m[A-Z][a-zA-Z0-9]*$";
|
||||
/** the pattern to match against public member names **/
|
||||
private static final String PUBLIC_MEMBER_PATTERN = "^f[A-Z][a-zA-Z0-9]*$";
|
||||
/** the pattern to match against type names **/
|
||||
private static final String TYPE_PATTERN = "^[A-Z][a-zA-Z0-9]*$";
|
||||
/** The maximum line length **/
|
||||
|
|
@ -76,6 +78,11 @@ class Configuration
|
|||
/** regexp to match member variables **/
|
||||
private RE mMemberRegexp;
|
||||
|
||||
/** pattern to match public member variables **/
|
||||
private String mPublicMemberPat;
|
||||
/** regexp to match public member variables **/
|
||||
private RE mPublicMemberRegexp;
|
||||
|
||||
/** pattern to match type names **/
|
||||
private String mTypePat;
|
||||
/** regexp to match type names **/
|
||||
|
|
@ -127,6 +134,8 @@ class Configuration
|
|||
CONST_PATTERN));
|
||||
setMemberPat(aProps.getProperty(MEMBER_PATTERN_PROP,
|
||||
MEMBER_PATTERN));
|
||||
setPublicMemberPat(aProps.getProperty(PUBLIC_MEMBER_PATTERN_PROP,
|
||||
PUBLIC_MEMBER_PATTERN));
|
||||
setTypePat(aProps.getProperty(TYPE_PATTERN_PROP,
|
||||
TYPE_PATTERN));
|
||||
setMaxLineLength(getIntProperty(
|
||||
|
|
@ -172,6 +181,7 @@ class Configuration
|
|||
setStaticPat(STATIC_PATTERN);
|
||||
setStaticFinalPat(CONST_PATTERN);
|
||||
setMemberPat(MEMBER_PATTERN);
|
||||
setPublicMemberPat(PUBLIC_MEMBER_PATTERN);
|
||||
setTypePat(TYPE_PATTERN);
|
||||
}
|
||||
catch (RESyntaxException ex) {
|
||||
|
|
@ -233,6 +243,18 @@ class Configuration
|
|||
return mMemberRegexp;
|
||||
}
|
||||
|
||||
/** @return pattern to match public member variables **/
|
||||
String getPublicMemberPat()
|
||||
{
|
||||
return mPublicMemberPat;
|
||||
}
|
||||
|
||||
/** @return regexp to match public member variables **/
|
||||
RE getPublicMemberRegexp()
|
||||
{
|
||||
return mPublicMemberRegexp;
|
||||
}
|
||||
|
||||
/** @return pattern to match type names **/
|
||||
String getTypePat()
|
||||
{
|
||||
|
|
@ -353,6 +375,17 @@ class Configuration
|
|||
mMemberPat = aMemberPat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aPublicMemberPat pattern to match public member variables
|
||||
* @throws RESyntaxException if an error occurs
|
||||
*/
|
||||
void setPublicMemberPat(String aPublicMemberPat)
|
||||
throws RESyntaxException
|
||||
{
|
||||
mPublicMemberRegexp = new RE(aPublicMemberPat);
|
||||
mPublicMemberPat = aPublicMemberPat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aTypePat pattern to match type names
|
||||
* @throws RESyntaxException if an error occurs
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ interface Defn
|
|||
String CONST_PATTERN_PROP = "checkstyle.pattern.const";
|
||||
/** property name for the member variable pattern **/
|
||||
String MEMBER_PATTERN_PROP = "checkstyle.pattern.member";
|
||||
/** property name for the public member variable pattern **/
|
||||
String PUBLIC_MEMBER_PATTERN_PROP = "checkstyle.pattern.publicmember";
|
||||
/** property name for the type pattern **/
|
||||
String TYPE_PATTERN_PROP = "checkstyle.pattern.type";
|
||||
/** property name for the maximum line length **/
|
||||
|
|
|
|||
|
|
@ -264,9 +264,10 @@ class VerifierImpl
|
|||
else {
|
||||
final MyModifierSet mods = aVar.getModifierSet();
|
||||
|
||||
if (mods.containsPrivate()) {
|
||||
System.out.println("Need to check for " + aVar.getText());
|
||||
}
|
||||
// Logic to detect unused variables
|
||||
//if (mods.containsPrivate()) {
|
||||
// System.out.println("Need to check for " + aVar.getText());
|
||||
//}
|
||||
|
||||
// Checks for Javadoc
|
||||
if (mods.containsStatic()) {
|
||||
|
|
@ -301,6 +302,11 @@ class VerifierImpl
|
|||
mConfig.getMemberRegexp(),
|
||||
mConfig.getMemberPat());
|
||||
}
|
||||
else if (mods.containsPublic() &&
|
||||
mConfig.getPublicMemberRegexp().match(aVar.getText()))
|
||||
{
|
||||
// silently allow
|
||||
}
|
||||
else {
|
||||
log(aVar.getLineNo(),
|
||||
"variable '" + aVar.getText() +
|
||||
|
|
|
|||
|
|
@ -155,14 +155,32 @@ public class CheckerTest
|
|||
assertNotNull(c);
|
||||
final String[] expected = {
|
||||
"InputInner.java:14: type is missing a Javadoc comment.",
|
||||
"InputInner.java:17: variable 'data' missing Javadoc.",
|
||||
"InputInner.java:17: variable 'data' must be private and have accessor methods.",
|
||||
"InputInner.java:17: variable 'fData' missing Javadoc.",
|
||||
"InputInner.java:21: type is missing a Javadoc comment.",
|
||||
"InputInner.java:24: variable 'data' missing Javadoc.",
|
||||
"InputInner.java:24: variable 'data' must match pattern '^[A-Z]([A-Z0-9_]*[A-Z0-9])?$'.",
|
||||
"InputInner.java:27: type is missing a Javadoc comment.",
|
||||
"InputInner.java:30: variable 'data' missing Javadoc.",
|
||||
"InputInner.java:30: variable 'data' must be private and have accessor methods."
|
||||
"InputInner.java:30: variable 'rData' missing Javadoc.",
|
||||
"InputInner.java:30: variable 'rData' must be private and have accessor methods."
|
||||
};
|
||||
verify(c, "InputInner.java", expected);
|
||||
}
|
||||
|
||||
public void testIgnorePublic()
|
||||
throws Exception
|
||||
{
|
||||
mConfig.setPublicMemberPat("^r[A-Z]");
|
||||
final Checker c = new Checker(mConfig, mStream);
|
||||
assertNotNull(c);
|
||||
final String[] expected = {
|
||||
"InputInner.java:14: type is missing a Javadoc comment.",
|
||||
"InputInner.java:17: variable 'fData' missing Javadoc.",
|
||||
"InputInner.java:17: variable 'fData' must be private and have accessor methods.",
|
||||
"InputInner.java:21: type is missing a Javadoc comment.",
|
||||
"InputInner.java:24: variable 'data' missing Javadoc.",
|
||||
"InputInner.java:24: variable 'data' must match pattern '^[A-Z]([A-Z0-9_]*[A-Z0-9])?$'.",
|
||||
"InputInner.java:27: type is missing a Javadoc comment.",
|
||||
"InputInner.java:30: variable 'rData' missing Javadoc.",
|
||||
};
|
||||
verify(c, "InputInner.java", expected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class InputInner
|
|||
class InnerInner2
|
||||
{
|
||||
// Ignore
|
||||
public int data;
|
||||
public int fData;
|
||||
}
|
||||
|
||||
// Ignore - 2 errors
|
||||
|
|
@ -27,7 +27,7 @@ class InputInner
|
|||
class InnerInterfaceInnerClass
|
||||
{
|
||||
// Ignore - need Javadoc and made private
|
||||
int data;
|
||||
public int rData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ class InputSimple
|
|||
static int sTest2;
|
||||
|
||||
/** should be private **/
|
||||
public int mTest1;
|
||||
int mTest1;
|
||||
/** should be private **/
|
||||
int mTest2;
|
||||
public int mTest2;
|
||||
|
||||
//
|
||||
// Parameter name format tests
|
||||
|
|
|
|||
Loading…
Reference in New Issue