Issue #2425: fixed invalid xml examples in xdocs
This commit is contained in:
parent
57408d4463
commit
24f73e69dc
|
|
@ -129,7 +129,7 @@ class PackageObjectFactory implements ModuleFactory {
|
|||
declaredConstructor.setAccessible(true);
|
||||
return declaredConstructor.newInstance();
|
||||
}
|
||||
catch (final ReflectiveOperationException exception) {
|
||||
catch (final ReflectiveOperationException | NoClassDefFoundError exception) {
|
||||
throw new CheckstyleException("Unable to find class for " + className, exception);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,10 +155,10 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
|
|||
* </p>
|
||||
* <pre>
|
||||
* <module name="VariableDeclarationUsageDistance">
|
||||
* <property name="allowedDistance" value="4">
|
||||
* <property name="ignoreVariablePattern" value="^temp.*">
|
||||
* <property name="validateBetweenScopes" value="true">
|
||||
* <property name="ignoreFinal" value="false">
|
||||
* <property name="allowedDistance" value="4"/>
|
||||
* <property name="ignoreVariablePattern" value="^temp.*"/>
|
||||
* <property name="validateBetweenScopes" value="true"/>
|
||||
* <property name="ignoreFinal" value="false"/>
|
||||
* </module>
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
|
|||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* <module name="CommentsIndentation"/module>
|
||||
* <module name="CommentsIndentation"/>
|
||||
* }
|
||||
* {@code
|
||||
* /*
|
||||
|
|
|
|||
|
|
@ -31,16 +31,6 @@ import com.puppycrawl.tools.checkstyle.utils.JavadocUtils;
|
|||
* <pre>
|
||||
* <module name="NonEmptyAtclauseDescription"/>
|
||||
* </pre>
|
||||
* <p>
|
||||
* To check non-empty at-clause description for tags {@code @throws},
|
||||
* {@code @deprecated}, use following configuration:
|
||||
* </p>
|
||||
* <pre>
|
||||
* <module name="NonEmptyAtclauseDescription">
|
||||
* <property name="target" value="JAVADOC_TAG_THROWS_LITERAL,
|
||||
* JAVADOC_TAG_DEPRECATED_LITERAL"/>
|
||||
* </module>
|
||||
* </pre>
|
||||
*
|
||||
* @author maxvetrenko
|
||||
*
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
|||
* </p>
|
||||
* <pre class="body">
|
||||
* <module name="NoLineWrap">
|
||||
* <property name="tokens" value="IMPORT">
|
||||
* <property name="tokens" value="IMPORT"/>
|
||||
* </module>
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,83 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// checkstyle: Checks Java source code for adherence to a set of rules.
|
||||
// Copyright (C) 2001-2015 the original author or authors.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.puppycrawl.tools.checkstyle;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
|
||||
public class AllChecksPresentOnAvailableChecksPageTest {
|
||||
private static final File JAVA_SOURCES_DIRECTORY = new File("src/main/java");
|
||||
private static final String AVAILABLE_CHECKS_PATH = "src/xdocs/checks.xml";
|
||||
private static final File AVAILABLE_CHECKS_FILE = new File(AVAILABLE_CHECKS_PATH);
|
||||
private static final String CHECK_FILE_NAME = ".+Check.java$";
|
||||
private static final String CHECK_SUFFIX = "Check.java";
|
||||
private static final String LINK_TEMPLATE =
|
||||
"(?s).*<a href=\"config_\\w+\\.html#%1$s\">%1$s</a>.*";
|
||||
|
||||
private static final List<String> IGNORE_LIST = Arrays.asList(
|
||||
"AbstractAccessControlNameCheck.java",
|
||||
"AbstractClassCouplingCheck.java",
|
||||
"AbstractComplexityCheck.java",
|
||||
"AbstractFileSetCheck.java",
|
||||
"AbstractFormatCheck.java",
|
||||
"AbstractHeaderCheck.java",
|
||||
"AbstractIllegalCheck.java",
|
||||
"AbstractIllegalMethodCheck.java",
|
||||
"AbstractJavadocCheck.java",
|
||||
"AbstractNameCheck.java",
|
||||
"AbstractNestedDepthCheck.java",
|
||||
"AbstractOptionCheck.java",
|
||||
"AbstractParenPadCheck.java",
|
||||
"AbstractSuperCheck.java",
|
||||
"AbstractTypeAwareCheck.java",
|
||||
"AbstractTypeParameterNameCheck.java",
|
||||
"FileSetCheck.java"
|
||||
);
|
||||
|
||||
@Test
|
||||
public void testAllChecksPresentOnAvailableChecksPage() throws IOException {
|
||||
final String availableChecks = Files.toString(AVAILABLE_CHECKS_FILE, UTF_8);
|
||||
for (File file : Files.fileTreeTraverser().preOrderTraversal(JAVA_SOURCES_DIRECTORY)) {
|
||||
final String fileName = file.getName();
|
||||
if (fileName.matches(CHECK_FILE_NAME) && !IGNORE_LIST.contains(fileName)) {
|
||||
final String checkName = fileName.replace(CHECK_SUFFIX, "");
|
||||
if (!isPresent(availableChecks, checkName)) {
|
||||
Assert.fail(checkName + " is not correctly listed on Available Checks page"
|
||||
+ " - add it to " + AVAILABLE_CHECKS_PATH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPresent(String availableChecks, String checkName) {
|
||||
final String linkPattern = String.format(Locale.ROOT, LINK_TEMPLATE, checkName);
|
||||
return availableChecks.matches(linkPattern);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,248 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// checkstyle: Checks Java source code for adherence to a set of rules.
|
||||
// Copyright (C) 2001-2015 the original author or authors.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.puppycrawl.tools.checkstyle;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
|
||||
import com.puppycrawl.tools.checkstyle.api.Configuration;
|
||||
|
||||
public class XDocsPagesTest {
|
||||
private static final File JAVA_SOURCES_DIRECTORY = new File("src/main/java");
|
||||
private static final File XDOCS_DIRECTORY = new File("src/xdocs");
|
||||
private static final String AVAILABLE_CHECKS_PATH = "src/xdocs/checks.xml";
|
||||
private static final File AVAILABLE_CHECKS_FILE = new File(AVAILABLE_CHECKS_PATH);
|
||||
private static final String CHECK_FILE_NAME = ".+Check.java$";
|
||||
private static final String CHECK_SUFFIX = "Check.java";
|
||||
private static final String LINK_TEMPLATE =
|
||||
"(?s).*<a href=\"config_\\w+\\.html#%1$s\">%1$s</a>.*";
|
||||
|
||||
private static final List<String> CHECKS_ON_PAGE_IGNORE_LIST = Arrays.asList(
|
||||
"AbstractAccessControlNameCheck.java",
|
||||
"AbstractClassCouplingCheck.java",
|
||||
"AbstractComplexityCheck.java",
|
||||
"AbstractFileSetCheck.java",
|
||||
"AbstractFormatCheck.java",
|
||||
"AbstractHeaderCheck.java",
|
||||
"AbstractIllegalCheck.java",
|
||||
"AbstractIllegalMethodCheck.java",
|
||||
"AbstractJavadocCheck.java",
|
||||
"AbstractNameCheck.java",
|
||||
"AbstractNestedDepthCheck.java",
|
||||
"AbstractOptionCheck.java",
|
||||
"AbstractParenPadCheck.java",
|
||||
"AbstractSuperCheck.java",
|
||||
"AbstractTypeAwareCheck.java",
|
||||
"AbstractTypeParameterNameCheck.java",
|
||||
"FileSetCheck.java"
|
||||
);
|
||||
|
||||
private static final List<String> XML_FILESET_LIST = Arrays.asList(
|
||||
"TreeWalker",
|
||||
"name=\"Checker\"",
|
||||
"name=\"Header\"",
|
||||
"name=\"Translation\"",
|
||||
"name=\"SeverityMatchFilter\"",
|
||||
"name=\"SuppressionFilter\"",
|
||||
"name=\"SuppressionCommentFilter\"",
|
||||
"name=\"SuppressWithNearbyCommentFilter\"",
|
||||
"name=\"SuppressWarningsFilter\"",
|
||||
"name=\"RegexpHeader\"",
|
||||
"name=\"RegexpMultiline\"",
|
||||
"name=\"JavadocPackage\"",
|
||||
"name=\"NewlineAtEndOfFile\"",
|
||||
"name=\"UniqueProperties\"",
|
||||
"name=\"FileLength\"",
|
||||
"name=\"FileTabCharacter\""
|
||||
);
|
||||
|
||||
@Test
|
||||
public void testAllChecksPresentOnAvailableChecksPage() throws IOException {
|
||||
final String availableChecks = Files.toString(AVAILABLE_CHECKS_FILE, UTF_8);
|
||||
for (File file : Files.fileTreeTraverser().preOrderTraversal(JAVA_SOURCES_DIRECTORY)) {
|
||||
final String fileName = file.getName();
|
||||
if (fileName.matches(CHECK_FILE_NAME) && !CHECKS_ON_PAGE_IGNORE_LIST.contains(fileName)) {
|
||||
final String checkName = fileName.replace(CHECK_SUFFIX, "");
|
||||
if (!isPresent(availableChecks, checkName)) {
|
||||
Assert.fail(checkName + " is not correctly listed on Available Checks page"
|
||||
+ " - add it to " + AVAILABLE_CHECKS_PATH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPresent(String availableChecks, String checkName) {
|
||||
final String linkPattern = String.format(Locale.ROOT, LINK_TEMPLATE, checkName);
|
||||
return availableChecks.matches(linkPattern);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllXmlExamples() throws Exception {
|
||||
for (File file : Files.fileTreeTraverser().preOrderTraversal(XDOCS_DIRECTORY)) {
|
||||
if (file.isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final String source = Files.toString(file, UTF_8);
|
||||
int position = -1;
|
||||
|
||||
while (true) {
|
||||
position = source.indexOf("<source>", position + 1);
|
||||
|
||||
if (position == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
final int nextPosition = source.indexOf("</source>", position);
|
||||
final String unserializedSource = source.substring(position + 8, nextPosition)
|
||||
.trim().replace("<", "<").replace(">", ">").replace(""", "\"")
|
||||
.replace("&", "&").replace("...", "");
|
||||
|
||||
position = nextPosition;
|
||||
|
||||
if (unserializedSource.charAt(0) != '<'
|
||||
|| unserializedSource.charAt(unserializedSource.length() - 1) != '>') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// no dtd testing yet
|
||||
if (unserializedSource.contains("<!")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
buildAndTestXml(file.getName(), unserializedSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildAndTestXml(String fileName, String unserializedSource)
|
||||
throws IOException, ParserConfigurationException {
|
||||
// not all examples come with the full xml structure
|
||||
String code = unserializedSource;
|
||||
|
||||
if (!hasFileSetClass(code)) {
|
||||
code = "<module name=\"TreeWalker\">\n" + code + "\n</module>";
|
||||
}
|
||||
if (!code.contains("name=\"Checker\"")) {
|
||||
code = "<module name=\"Checker\">\n" + code + "\n</module>";
|
||||
}
|
||||
if (!code.startsWith("<?xml")) {
|
||||
final String dtdPath = new File(
|
||||
"src/main/resources/com/puppycrawl/tools/checkstyle/configuration_1_3.dtd")
|
||||
.getCanonicalPath();
|
||||
|
||||
code = "<?xml version=\"1.0\"?>\n<!DOCTYPE module PUBLIC "
|
||||
+ "\"-//Puppy Crawl//DTD Check Configuration 1.3//EN\" \"" + dtdPath + "\">\n"
|
||||
+ code;
|
||||
}
|
||||
|
||||
testRawXml(fileName, code, unserializedSource);
|
||||
|
||||
// can't test ant structure, or old and outdated checks
|
||||
if (!fileName.startsWith("anttask") && !fileName.startsWith("releasenotes")) {
|
||||
testCheckstyleXml(fileName, code, unserializedSource);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasFileSetClass(String xml) {
|
||||
boolean found = false;
|
||||
|
||||
for (String find : XML_FILESET_LIST) {
|
||||
if (xml.contains(find)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
private static void testRawXml(String fileName, String code, String unserializedSource)
|
||||
throws ParserConfigurationException {
|
||||
try {
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setValidating(false);
|
||||
factory.setNamespaceAware(true);
|
||||
|
||||
final DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
|
||||
builder.parse(new InputSource(new StringReader(code)));
|
||||
}
|
||||
catch (IOException | SAXException e) {
|
||||
Assert.fail(fileName + " has invalid xml (" + e.getMessage() + "): "
|
||||
+ unserializedSource);
|
||||
}
|
||||
}
|
||||
|
||||
private static void testCheckstyleXml(String fileName, String code, String unserializedSource)
|
||||
throws IOException {
|
||||
// can't process non-existent examples, or out of context snippets
|
||||
if (code.contains("com.mycompany") || code.contains("checkstyle-packages")
|
||||
|| code.contains("MethodLimit") || code.contains("<suppress ")
|
||||
|| code.contains("<import-control ") || unserializedSource.startsWith("<property ")
|
||||
|| unserializedSource.startsWith("<taskdef ")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// validate checkstyle structure and contents
|
||||
try {
|
||||
final Properties properties = new Properties();
|
||||
|
||||
properties.setProperty("checkstyle.header.file",
|
||||
new File("config/java.header").getCanonicalPath());
|
||||
|
||||
final PropertiesExpander expander = new PropertiesExpander(properties);
|
||||
final Configuration config = ConfigurationLoader.loadConfiguration(new InputSource(
|
||||
new StringReader(code)), expander, false);
|
||||
final Checker checker = new Checker();
|
||||
|
||||
try {
|
||||
final ClassLoader moduleClassLoader = Checker.class.getClassLoader();
|
||||
checker.setModuleClassLoader(moduleClassLoader);
|
||||
checker.configure(config);
|
||||
}
|
||||
finally {
|
||||
checker.destroy();
|
||||
}
|
||||
}
|
||||
catch (CheckstyleException e) {
|
||||
Assert.fail(fileName + " has invalid Checkstyle xml (" + e.getMessage() + "): "
|
||||
+ unserializedSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
for element:
|
||||
|
||||
<source>
|
||||
<module name="com.puppycrawl.tools.checkstyle.TreeWalker">
|
||||
<module name="com.puppycrawl.tools.checkstyle.TreeWalker"/>
|
||||
</source>
|
||||
|
||||
This is useful for plugging third-party modules into a configuration.
|
||||
|
|
@ -218,7 +218,9 @@
|
|||
</p>
|
||||
|
||||
<source>
|
||||
<property name="headerFile" value="${checkstyle.header.file}"/>
|
||||
<module name="Header">
|
||||
<property name="headerFile" value="${checkstyle.header.file}"/>
|
||||
</module>
|
||||
</source>
|
||||
|
||||
<p>
|
||||
|
|
@ -236,7 +238,7 @@
|
|||
</p>
|
||||
|
||||
<source>
|
||||
<module name="JavaDocMethod">
|
||||
<module name="JavadocMethod">
|
||||
<property name="severity"
|
||||
value="${checkstyle.javadoc.severity}"
|
||||
default="error"/>
|
||||
|
|
@ -375,9 +377,9 @@
|
|||
<property name="fileExtensions" value="null"/>
|
||||
...
|
||||
</module>
|
||||
|
||||
OR
|
||||
|
||||
</source>
|
||||
<p>OR</p>
|
||||
<source>
|
||||
<module name="Checker">
|
||||
<property name="fileExtensions" value=""/>
|
||||
...
|
||||
|
|
@ -479,9 +481,9 @@ OR
|
|||
<property name="fileExtensions" value="null"/>
|
||||
...
|
||||
</module>
|
||||
|
||||
OR
|
||||
|
||||
</source>
|
||||
<p>OR</p>
|
||||
<source>
|
||||
<module name="TreeWalker">
|
||||
<property name="fileExtensions" value=""/>
|
||||
...
|
||||
|
|
@ -550,7 +552,7 @@ OR
|
|||
<module name="MethodLength">
|
||||
<property name="tokens" value="METHOD_DEF"/>
|
||||
</module>
|
||||
<module name="MethodLength">
|
||||
<module name="MethodLength">
|
||||
<property name="tokens" value="CTOR_DEF"/>
|
||||
<property name="max" value="60"/>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ String nullString = null;
|
|||
</p>
|
||||
<source>
|
||||
<module name="FinalLocalVariable">
|
||||
<property name="token" value="VARIABLE_DEF"/>
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="validateEnhancedForLoopVariable" value="true"/>
|
||||
</module>
|
||||
</source>
|
||||
|
|
@ -2774,7 +2774,7 @@ case 5:
|
|||
<source>
|
||||
<module name="FallThrough">
|
||||
<property name="reliefPattern" value="continue in next case"/>
|
||||
<module name="FallThrough"/>
|
||||
</module>
|
||||
</source>
|
||||
</subsection>
|
||||
|
||||
|
|
@ -3344,10 +3344,10 @@ cal.set(Calendar.MINUTE, minutes);
|
|||
</p>
|
||||
<source>
|
||||
<module name="VariableDeclarationUsageDistance">
|
||||
<property name="allowedDistance" value="4">
|
||||
<property name="ignoreVariablePattern" value="^temp.*">
|
||||
<property name="validateBetweenScopes" value="true">
|
||||
<property name="mIgnoreFinal" value="false">
|
||||
<property name="allowedDistance" value="4"/>
|
||||
<property name="ignoreVariablePattern" value="^temp.*"/>
|
||||
<property name="validateBetweenScopes" value="true"/>
|
||||
<property name="ignoreFinal" value="false"/>
|
||||
</module>
|
||||
</source>
|
||||
</subsection>
|
||||
|
|
|
|||
|
|
@ -123,11 +123,11 @@
|
|||
For example, the following configuration fragment directs the
|
||||
Checker to use a <code>SuppressionFilter</code>
|
||||
with suppressions
|
||||
file <code>docs/suppressions.xml</code>:
|
||||
file <code>config/suppressions.xml</code>:
|
||||
</p>
|
||||
<source>
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="docs/suppressions.xml"/>
|
||||
<property name="file" value="config/suppressions.xml"/>
|
||||
</module>
|
||||
</source>
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -108,12 +108,12 @@ line 5: ////////////////////////////////////////////////////////////////////
|
|||
</source>
|
||||
|
||||
<p>
|
||||
To configure the check to use header file <code>"java.header"</code> and ignore lines <code>2</code>, <code>3</code>, and <code> 4</code> and only process Java files:
|
||||
To configure the check to use header file <code>"config/java.header"</code> and ignore lines <code>2</code>, <code>3</code>, and <code> 4</code> and only process Java files:
|
||||
</p>
|
||||
|
||||
<source>
|
||||
<module name="Header">
|
||||
<property name="headerFile" value="java.header"/>
|
||||
<property name="headerFile" value="config/java.header"/>
|
||||
<property name="ignoreLines" value="2, 3, 4"/>
|
||||
<property name="fileExtensions" value="java"/>
|
||||
</module>
|
||||
|
|
@ -289,11 +289,11 @@ line 6: ^\W*$
|
|||
</source>
|
||||
|
||||
<p>
|
||||
To configure the check to use header file <code>"java.header"</code> and <code>10</code> and <code>13</code> muli-lines:
|
||||
To configure the check to use header file <code>"config/java.header"</code> and <code>10</code> and <code>13</code> muli-lines:
|
||||
</p>
|
||||
<source>
|
||||
<module name="RegexpHeader">
|
||||
<property name="headerFile" value="java.header"/>
|
||||
<property name="headerFile" value="config/java.header"/>
|
||||
<property name="multiLines" value="10, 13"/>
|
||||
</module>
|
||||
</source>
|
||||
|
|
|
|||
|
|
@ -710,12 +710,12 @@ public class SomeClass { ... }
|
|||
<subsection name="Example">
|
||||
<p>
|
||||
To configure the check using a import control file called
|
||||
"import-control.xml", then have the following:
|
||||
"config/import-control.xml", then have the following:
|
||||
</p>
|
||||
|
||||
<source>
|
||||
<module name="ImportControl">
|
||||
<property name="file" value="import-control.xml"/>
|
||||
<property name="file" value="config/import-control.xml"/>
|
||||
</module>
|
||||
</source>
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@
|
|||
<source>
|
||||
<module name="JavadocType">
|
||||
<property name="scope" value="private"/>
|
||||
<property name="excludescope" value="package"/>
|
||||
<property name="excludeScope" value="package"/>
|
||||
</module>
|
||||
</source>
|
||||
</subsection>
|
||||
|
|
@ -970,14 +970,6 @@ public boolean isSomething()
|
|||
<source>
|
||||
<module name="NonEmptyAtclauseDescription"/>
|
||||
</source>
|
||||
<p>
|
||||
To check non-empty at-clause description for tags <code>@throws</code>, <code>@deprecated</code>, use following config:
|
||||
</p>
|
||||
<source>
|
||||
<module name="NonEmptyAtclauseDescription">
|
||||
<property name="target" value="JAVADOC_TAG_THROWS_LITERAL, JAVADOC_TAG_DEPRECATED_LITERAL"/>
|
||||
</module>
|
||||
</source>
|
||||
</subsection>
|
||||
|
||||
<subsection name="Example of Usage">
|
||||
|
|
@ -1036,7 +1028,7 @@ public boolean isSomething()
|
|||
</p>
|
||||
<source>
|
||||
<module name="JavadocTagContinuationIndentation">
|
||||
<property name="tagContinuationIndentation" value="4"/>
|
||||
<property name="offset" value="4"/>
|
||||
</module>
|
||||
</source>
|
||||
</subsection>
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@
|
|||
To configure the Check:
|
||||
</p>
|
||||
<source>
|
||||
<module name="CommentsIndentation"/module>
|
||||
<module name="CommentsIndentation"/>
|
||||
</source>
|
||||
<source>
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@
|
|||
<property name="tokens" value="VARIABLE_DEF,CLASS_DEF"/>
|
||||
<property name="ignoreStatic" value="false"/>
|
||||
<property name="allowedAbbreviationLength" value="1"/>
|
||||
<property name="allowedAbbreviation" value="XML,URL"/>
|
||||
<property name="allowedAbbreviations" value="XML,URL"/>
|
||||
</module>
|
||||
</source>
|
||||
</subsection>
|
||||
|
|
|
|||
|
|
@ -385,26 +385,26 @@
|
|||
value="\A/\*\n \* (\w*)\.java\n \*\n \* Copyright \(c\)
|
||||
\d\d\d\d ACME\n \* 123 Some St\.\n \* Somewhere\.\n \*\n
|
||||
\* This software is the confidential and proprietary information
|
||||
of ACME\.\n \* \("Confidential Information"\)\. You
|
||||
of ACME\.\n \* \(&quot;Confidential Information&quot;\)\. You
|
||||
shall not disclose such\n \* Confidential Information and shall
|
||||
use it only in accordance with\n \* the terms of the license
|
||||
agreement you entered into with ACME\.\n \*\n
|
||||
\* \$Log: config_misc.xml,v $
|
||||
\* \Revision 1.7 2007/01/16 12:16:35 oburn
|
||||
\* \Removing all reference to mailing lists
|
||||
\* \$Log: config_misc\.xml,v $
|
||||
\* Revision 1\.7 2007/01/16 12:16:35 oburn
|
||||
\* Removing all reference to mailing lists
|
||||
\* \
|
||||
\* \Revision 1.6 2005/12/25 16:13:10 o_sukhodolsky
|
||||
\* \Fix for rfe 1248106 (TYPECAST is now accepted by NoWhitespaceAfter)
|
||||
\* Revision 1.6 2005/12/25 16:13:10 o_sukhodolsky
|
||||
\* Fix for rfe 1248106 \(TYPECAST is now accepted by NoWhitespaceAfter\)
|
||||
\* \
|
||||
\* \Fix for rfe 953266 (thanks to Paul Guyot (pguyot) for submitting patch)
|
||||
\* \IllegalType can be configured to accept some abstract classes which
|
||||
\* \matches to regexp of illegal type names (property legalAbstractClassNames)
|
||||
\* \
|
||||
\* \TrailingComment now can be configured to accept some trailing comments
|
||||
\* \(such as NOI18N) (property legalComment, rfe 1385344).
|
||||
\* \
|
||||
\* \Revision 1.5 2005/11/06 11:54:12 oburn
|
||||
\* \Incorporate excellent patch [ 1344344 ] Consolidation of regexp checks.
|
||||
\* Fix for rfe 953266 \(thanks to Paul Guyot \(pguyot\) for submitting patch\)
|
||||
\* IllegalType can be configured to accept some abstract classes which
|
||||
\* matches to regexp of illegal type names \(property legalAbstractClassNames\)
|
||||
\*
|
||||
\* TrailingComment now can be configured to accept some trailing comments
|
||||
\* \(such as NOI18N\) \(property legalComment, rfe 1385344\).
|
||||
\*
|
||||
\* Revision 1.5 2005/11/06 11:54:12 oburn
|
||||
\* Incorporate excellent patch \[ 1344344 \] Consolidation of regexp checks.
|
||||
\* \\n(.*\n)*([\w|\s]*( class | interface )\1)"/>
|
||||
<property name="message" value="Correct header not found"/>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -1516,7 +1516,7 @@ import com.puppycrawl.tools.
|
|||
</p>
|
||||
<source>
|
||||
<module name="NoLineWrap">
|
||||
<property name="tokens" value="IMPORT">
|
||||
<property name="tokens" value="IMPORT"/>
|
||||
</module>
|
||||
</source>
|
||||
<p>
|
||||
|
|
|
|||
Loading…
Reference in New Issue