This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a commit to branch ignite-14591 in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 8c45c63070138fac2853d0930520eeb53e3c5c11 Author: Andrew Mashenkov <[email protected]> AuthorDate: Mon Apr 19 13:14:50 2021 +0300 Add javadoc validation to checkstyle plugin. --- .../checkstyle-javadoc-additional-rules.xml | 57 +++++++++++ check-rules/checkstyle-rules.xml | 112 +++++++++++++++++++++ parent/pom.xml | 5 +- 3 files changed, 172 insertions(+), 2 deletions(-) diff --git a/check-rules/checkstyle-javadoc-additional-rules.xml b/check-rules/checkstyle-javadoc-additional-rules.xml new file mode 100644 index 0000000..fce7d48 --- /dev/null +++ b/check-rules/checkstyle-javadoc-additional-rules.xml @@ -0,0 +1,57 @@ +<?xml version="1.0"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!DOCTYPE module PUBLIC + "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" + "http://checkstyle.org/dtds/configuration_1_3.dtd"> +<module name="Checker"> + <property name="charset" value="UTF-8"/> + + <property name="fileExtensions" value="java, properties, xml"/> + + <module name="BeforeExecutionExclusionFileFilter"> + <property name="fileNamePattern" value=".*/test/.*"/> + </module> + + <!-- SuppressWarning Filter. https://checkstyle.sourceforge.io/config_filters.html#SuppressWarningsFilter --> + <module name="SuppressWarningsFilter"/> + + <!-- + Checks that each Java package has a Javadoc file used for commenting. + By default it only allows a package-info.java file. + See: https://checkstyle.org/config_javadoc.html#JavadocPackage + --> + <module name="JavadocPackage"/> + + <module name="TreeWalker"> + <!-- + Validates Javadoc comments to help ensure they are well formed. + See: https://checkstyle.org/config_javadoc.html#JavadocStyle + --> + <module name="JavadocStyle"> + <property name="scope" value="package"/> + <property name="checkEmptyJavadoc" value="true"/> + </module> + + <module name="JavadocStyle"> + <property name="scope" value="private"/> + <property name="excludeScope" value="package"/> + </module> + </module> +</module> diff --git a/check-rules/checkstyle-rules.xml b/check-rules/checkstyle-rules.xml index bc010f9..9459f97 100644 --- a/check-rules/checkstyle-rules.xml +++ b/check-rules/checkstyle-rules.xml @@ -112,5 +112,117 @@ See: https://checkstyle.sourceforge.io/config_whitespace.html#SingleSpaceSeparator --> <module name="SingleSpaceSeparator"/> + + <!-- + Javdoc style checks. + --> + + <!-- + Checks the order of javadoc block-tags or javadoc tags. + See: https://checkstyle.org/config_javadoc.html#AtclauseOrder + --> + <module name="AtclauseOrder"/> + + <!-- + Checks that Javadocs are located at the correct position. + See: https://checkstyle.org/config_javadoc.html#InvalidJavadocPosition + --> + <module name="InvalidJavadocPosition"/> + + <!-- + Checks that a javadoc block tag (starts with @) appears only at the beginning of a line, + ignoring leading asterisks and white space. + This check ignores block tags in comments and inside inline tags {@code } and {@literal }. + See: https://checkstyle.org/config_javadoc.html#JavadocBlockTagLocation + --> + <module name="JavadocBlockTagLocation"> + <!-- default tags --> + <property name="tags" value="author, deprecated, exception, hidden"/> + <property name="tags" value="param, provides, return, see, serial"/> + <property name="tags" value="serialData, serialField, since, throws"/> + <property name="tags" value="uses, version"/> + <!-- additional tags can be used in the project --> + <property name="tags" value="apiNote, implSpec, implNote"/> + <property name="tags" value="noinspection"/> + </module> + + <!-- + Checks that the Javadoc content begins from the same position for all Javadoc comments in the project. + Any leading asterisks and spaces are not counted as the beginning of the content and are therefore ignored. + https://checkstyle.org/config_javadoc.html#JavadocContentLocation + --> + <module name="JavadocContentLocationCheck"/> + + <!-- + Checks if the javadoc has leading asterisks on each line. + See: https://checkstyle.org/config_javadoc.html#JavadocMissingLeadingAsterisk + --> + <module name="JavadocMissingLeadingAsterisk"/> + + <!-- + Checks that there is at least one whitespace after the leading asterisk. + See: https://checkstyle.org/config_javadoc.html#JavadocMissingWhitespaceAfterAsterisk + --> + <module name="JavadocMissingWhitespaceAfterAsterisk"/> + + <!-- + Checks that one blank line before the block tag if it is present in Javadoc. + See: https://checkstyle.org/config_javadoc.html#RequireEmptyLineBeforeBlockTagGroup + --> + <module name="RequireEmptyLineBeforeBlockTagGroup"/> + + <!-- + Checks that the block tag is followed by description. + See: https://checkstyle.org/config_javadoc.html#NonEmptyAtclauseDescription + --> + <module name="NonEmptyAtclauseDescription"/> + + <!-- + Checks that a Javadoc block can fit in a single line and doesn't contain block tags. + See: https://checkstyle.org/config_javadoc.html#SingleLineJavadoc + --> + <module name="SingleLineJavadoc"> + <property name="ignoredTags" value="@inheritDoc"/> + </module> + + <!-- + Checks the Javadoc of a method or constructor. + See: https://checkstyle.org/config_javadoc.html#JavadocMethod + --> + <module name="JavadocMethod"> + <property name="scope" value="package"/> + <property name="validateThrows" value="true"/> + </module> + + <!-- + Checks the Javadoc comments for type definitions. + See: https://checkstyle.org/config_javadoc.html#JavadocType + --> + <module name="JavadocType"> + <property name="scope" value="package"/> + <property name="allowUnknownTags" value="true"/> + </module> + + <!-- + Checks for missing Javadoc comments for a method or constructor. + See: https://checkstyle.org/config_javadoc.html#MissingJavadocMethod + --> + <module name="MissingJavadocMethod"> + <property name="scope" value="anoninner"/> + </module> + + <!-- + Checks for missing Javadoc comments for class, enum, interface, and annotation interface definitions. + See: https://checkstyle.org/config_javadoc.html#MissingJavadocType + --> + <module name="MissingJavadocType"> + <property name="scope" value="private"/> + </module> + + <!-- + Checks that a variable has a Javadoc comment. Ignores serialVersionUID fields. + See: https://checkstyle.org/config_javadoc.html#JavadocVariable + --> + <module name="JavadocVariable"/> </module> </module> diff --git a/parent/pom.xml b/parent/pom.xml index d0cd6ea..3381091 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -77,12 +77,12 @@ <!-- Plugins versions --> <apache.rat.plugin.version>0.13</apache.rat.plugin.version> - <checkstyle.puppycrawl.version>8.37</checkstyle.puppycrawl.version> + <checkstyle.puppycrawl.version>8.41.1</checkstyle.puppycrawl.version> <launch.maven.plugin.version>1.7.25</launch.maven.plugin.version> <maven.antrun.plugin.version>3.0.0</maven.antrun.plugin.version> <maven.assembly.plugin.version>3.2.0</maven.assembly.plugin.version> <maven.build-helper.plugin.version>3.2.0</maven.build-helper.plugin.version> - <maven.checkstyle.plugin.version>3.1.1</maven.checkstyle.plugin.version> + <maven.checkstyle.plugin.version>3.1.2</maven.checkstyle.plugin.version> <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version> <maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version> <maven.failsafe.plugin.version>3.0.0-M5</maven.failsafe.plugin.version> @@ -314,6 +314,7 @@ <!-- Profile to exclude running surefire (unit) tests but do not prevent running integration ones --> + <!--suppress MavenModelInspection --> <profile> <activation> <property>
