Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #222: update to CS 8.21 #223

Merged
merged 1 commit into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</ciManagement>

<properties>
<checkstyle.version>8.20</checkstyle.version>
<checkstyle.version>8.21</checkstyle.version>
<sonar.version>6.7</sonar.version>
<sonar-java.version>5.12.0.17701</sonar-java.version>
<maven.checkstyle.plugin.version>2.17</maven.checkstyle.plugin.version>
Expand Down
13 changes: 13 additions & 0 deletions src/main/resources/com/sonar/sqale/checkstyle-model.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,19 @@
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck</rule-key>
<prop>
<key>remediationFunction</key>
<txt>CONSTANT_ISSUE</txt>
</prop>
<prop>
<key>offset</key>
<val>30</val>
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.metrics.JavaNCSSCheck</rule-key>
Expand Down
12 changes: 8 additions & 4 deletions src/main/resources/org/sonar/l10n/checkstyle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,22 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodChec
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.allowMissingReturnTag=whether to ignore errors when a method returns non-void type does have a return tag in the javadoc. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.allowMissingThrowsTags=whether to ignore errors when a method declares that it throws exceptions but does have matching throws tags in the javadoc. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.allowThrowsTagsForSubclasses=whether to allow documented exceptions that are subclass of one of declared exception. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.allowMissingJavadoc=whether to ignore errors when a method javadoc is missed. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.allowMissingParamTags=whether to ignore errors when a method has parameters but does not have matching param tags in the javadoc. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.scope=visibility scope where Javadoc comments are checked
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.allowMissingPropertyJavadoc=Whether to allow missing Javadoc on accessor methods for properties (setters and getters). The setter and getter methods must match exactly the structures below. <code> public void setNumber(final int number) '{' mNumber = number; '}' public int getNumber() '{' return mNumber; '}' public boolean isSomething() '{' return false; '}' </code>. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.excludeScope=visibility scope where Javadoc comments are not checked
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.allowUndeclaredRTE=whether to allow documented exceptions that are not declared if they are a subclass of java.lang.RuntimeException. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.suppressLoadErrors=When set to false all problems with loading classes would be reported as violations. Default is true.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.ignoreMethodNamesRegex=Method names that match this pattern do not require javadoc blocks
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.minLineCount=Minimal amount of lines in method to demand documentation presence
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.allowedAnnotations=List of annotations that could allow missed documentation
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.validateThrows=Allows validating throws tags
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.param.logLoadErrors=If set to false a classpath configuration problem is assumed and the TreeWalker stops operating on the class completely. If set to true (the default) , checkstyle assumes a typo or refactoring problem in the javadoc and logs the problem in the normal checkstyle report
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck.name=Javadoc Method
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck.param.tokens=definitions to check
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck.param.scope=visibility scope where Javadoc comments are checked
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck.param.excludeScope=visibility scope where Javadoc comments are not checked
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck.param.minLineCount=Minimal amount of lines in method to demand documentation presence
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck.param.allowedAnnotations=List of annotations that could allow missed documentation
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck.param.ignoreMethodNamesRegex=Method names that match this pattern do not require javadoc blocks
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck.param.allowMissingPropertyJavadoc=Whether to allow missing Javadoc on accessor methods for properties (setters and getters). The setter and getter methods must match exactly the structures below. <code> public void setNumber(final int number) '{' mNumber = number; '}' public int getNumber() '{' return mNumber; '}' public boolean isSomething() '{' return false; '}' </code>. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck.name=Regexp Singleline Java
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck.param.ignoreCase=Controls whether to ignore case when searching. Default value is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck.param.ignoreComments=Controls whether to ignore text in comments when searching. Default value is false.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Checks for missing Javadoc comments for a method or constructor. The scope to verify is
specified using the Scope class and defaults to Scope.PUBLIC. To verify
another scope, set property scope to a different scope.

<br><br>Javadoc is not required on a method that is tagged with the @Override annotation.
However under Java 5 it is not possible to mark a method required for an interface (this
was <i>corrected</i> under Java 6). Hence Checkstyle supports using the convention of using
a single @inheritDoc tag instead of all the other tags.
<p>
</p>
39 changes: 28 additions & 11 deletions src/main/resources/org/sonar/plugins/checkstyle/rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,6 @@
<tag>comment</tag>
<configKey><![CDATA[Checker/TreeWalker/JavadocMethod]]></configKey>
<cardinality>MULTIPLE</cardinality>
<param key="minLineCount" type="INTEGER">
<defaultValue>-1</defaultValue>
</param>
romani marked this conversation as resolved.
Show resolved Hide resolved
<param key="allowedAnnotations" type="s{}">
<defaultValue>Override</defaultValue>
</param>
Expand All @@ -843,12 +840,6 @@
<param key="allowMissingReturnTag" type="BOOLEAN">
<defaultValue>false</defaultValue>
</param>
<param key="allowMissingJavadoc" type="BOOLEAN">
<defaultValue>false</defaultValue>
</param>
<param key="allowMissingPropertyJavadoc" type="BOOLEAN">
<defaultValue>false</defaultValue>
</param>
<param key="logLoadErrors" type="BOOLEAN">
<defaultValue>true</defaultValue>
</param>
Expand All @@ -859,6 +850,32 @@
<!-- Note that default value in Checkstyle 5.5 is false -->
<defaultValue>true</defaultValue>
</param>
<status>READY</status>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck">
<priority>MAJOR</priority>
<name><![CDATA[Missing Javadoc Method]]></name>
<tag>comment</tag>
<configKey><![CDATA[Checker/TreeWalker/MissingJavadocMethod]]></configKey>
<cardinality>MULTIPLE</cardinality>
<param key="minLineCount" type="INTEGER">
<defaultValue>-1</defaultValue>
</param>
<param key="allowMissingPropertyJavadoc" type="BOOLEAN">
<defaultValue>false</defaultValue>
</param>
<param key="allowedAnnotations" type="s{}">
<defaultValue>Override</defaultValue>
</param>
<param key="scope" type="s[nothing,public,protected,package,private,anoninner]">
<defaultValue>public</defaultValue>
</param>
<param key="excludeScope" type="s[nothing,public,protected,package,private,anoninner]">
</param>
<param key="tokens" type="s[METHOD_DEF,CTOR_DEF,ANNOTATION_FIELD_DEF]">
<defaultValue>METHOD_DEF,CTOR_DEF,ANNOTATION_FIELD_DEF</defaultValue>
</param>
<param key="ignoreMethodNamesRegex" type="REGULAR_EXPRESSION">
</param>
<status>READY</status>
Expand Down Expand Up @@ -1240,7 +1257,7 @@
<name><![CDATA[Newline At End Of File]]></name>
<configKey><![CDATA[Checker/NewlineAtEndOfFile]]></configKey>
<param key="lineSeparator" type="s[system,crlf,cr,lf,lf_cr_crlf]">
<defaultValue>system</defaultValue>
<defaultValue>lf_cr_crlf</defaultValue>
romani marked this conversation as resolved.
Show resolved Hide resolved
</param>
<param key="fileExtensions" type="s{}">
</param>
Expand Down Expand Up @@ -1956,7 +1973,7 @@
<param key="allowSamelineParameterizedAnnotation" type="BOOLEAN">
<defaultValue>false</defaultValue>
</param>
<param key="tokens" type="s[CLASS_DEF,INTERFACE_DEF,PACKAGE_DEF,ENUM_CONSTANT_DEF,ENUM_DEF,METHOD_DEF,CTOR_DEF,VARIABLE_DEF,PARAMETER_DEF,ANNOTATION_DEF,ANNOTATION_FIELD_DEF]">
<param key="tokens" type="s[CLASS_DEF,INTERFACE_DEF,PACKAGE_DEF,ENUM_CONSTANT_DEF,ENUM_DEF,METHOD_DEF,CTOR_DEF,VARIABLE_DEF,ANNOTATION_DEF,ANNOTATION_FIELD_DEF]">
romani marked this conversation as resolved.
Show resolved Hide resolved
<defaultValue>CLASS_DEF,INTERFACE_DEF,PACKAGE_DEF,ENUM_CONSTANT_DEF,ENUM_DEF,METHOD_DEF,CTOR_DEF,VARIABLE_DEF</defaultValue>
</param>
</rule>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void test() {
assertThat(repository.language()).isEqualTo("java");

final List<RulesDefinition.Rule> rules = repository.rules();
assertThat(rules).hasSize(158);
assertThat(rules).hasSize(159);

for (RulesDefinition.Rule rule : rules) {
assertThat(rule.key()).isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ private static Set<String> getProperties(Class<?> clss) {
final PropertyDescriptor[] map = PropertyUtils.getPropertyDescriptors(clss);

for (PropertyDescriptor p : map) {
if (p.getWriteMethod() != null) {
if (p.getWriteMethod() != null && !p.getWriteMethod().isAnnotationPresent(Deprecated.class)) {
romani marked this conversation as resolved.
Show resolved Hide resolved
result.add(p.getName());
}
}
Expand Down