Skip to content

Commit

Permalink
Issue #238: update to CS 8.23
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Muehlbachler authored and romani committed Sep 25, 2019
1 parent 018c720 commit 7549240
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Compatibility matrix from checkstyle team:

Checkstyle Plugin|Sonar min|Sonar max|Checkstyle|Jdk
-----------------|---------|---------|----------|---
4.23|6.7 |7.7+|8.23|1.8
4.22|6.7 |7.7+|8.22|1.8
4.21|6.7 |7.7+|8.21|1.8
4.20|6.7 |7.7+|8.20|1.8
Expand Down
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.22</checkstyle.version>
<checkstyle.version>8.23</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
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class CheckstyleProfileImporter extends ProfileImporter {
"SuppressionCommentFilter",
"SuppressWithNearbyCommentFilter",
"SuppressionXpathSingleFilter",
"SuppressionSingleFilter",
};
private final RuleFinder ruleFinder;

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 @@ -1362,6 +1362,19 @@
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.javadoc.InvalidJavadocPositionCheck</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.imports.CustomImportOrderCheck</rule-key>
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/org/sonar/l10n/checkstyle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageChe
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck.param.allowLegacy=If set then allow the use of a package.html file.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck.param.fileExtensions=file type extension of files to process
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocPackageCheck.name=Missing Javadoc Package
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.javadoc.InvalidJavadocPositionCheck.name=Invalid Javadoc Position
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.name=Declaration Order
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.param.ignoreModifiers=Whether to ignore modifiers
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.param.ignoreConstructors=Whether to ignore constructors
Expand Down Expand Up @@ -141,6 +142,7 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck.p
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck.param.ignoreHashCodeMethod=ignore magic numbers in hashCode methods. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck.param.ignoreAnnotation=ignore magic numbers in annotation declarations. Default is false.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck.param.ignoreFieldDeclaration=ignore magic numbers in field declarations
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck.param.ignoreAnnotationElementDefaults=Ignore magic numbers in annotation elements defaults
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck.name=Header
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck.param.header=the required header specified inline. Individual header lines must be separated by the string "\\n" (even on platforms with a different line separator)
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck.param.headerFile=the file that contains the header to check against.
Expand Down Expand Up @@ -461,6 +463,7 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.pa
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.param.maxProtected=maximum allowable number of protected methods.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.param.maxPublic=maximum allowable number of public methods.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck.name=One Statement Per Line
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck.param.treatTryResourcesAsStatement=Enable resources processing
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ClassTypeParameterNameCheck.name=Class Type(Generic) Parameter Name
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ClassTypeParameterNameCheck.param.format=Regular expression
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.MethodTypeParameterNameCheck.name=Method Type(Generic) Parameter Name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Checks for magic numbers.

<p>
Checks that there are no "magic numbers" where a magic number is a numeric literal that is not defined as a constant. By default, -1, 0, 1, and 2 are not considered to be magic numbers.
</p>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p>
Checks there is only one statement per line. The following line will be flagged as an error: <code>x = 1; y = 2; // Two statments on a single line.</code>
</p>

<p>
Checks that there is only one statement per line.<br>
Rationale: It's very difficult to read multiple statements on one line.<br>
In the Java programming language, statements are the fundamental unit of execution. All statements except blocks are terminated by a semicolon. Blocks are denoted by open and close curly braces.<br>
OneStatementPerLineCheck checks the following types of statements: variable declaration statements, empty statements, import statements, assignment statements, expression statements, increment statements, object creation statements, 'for loop' statements, 'break' statements, 'continue' statements, 'return' statements, resources statements (optional).
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
Checks that Javadocs are located at the correct position. As specified at <a href="https://docs.oracle.com/en/java/javase/11/docs/specs/doc-comment-spec.html">Documentation Comment Specification for the Standard Doclet</a>, Javadocs are recognized only when placed immediately before module, package, class, interface, constructor, method, or field declarations. Any other position, like in the body of a method, will be ignored by the javadoc tool and is considered invalid by this check.
</p>
14 changes: 14 additions & 0 deletions src/main/resources/org/sonar/plugins/checkstyle/rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@
<status>READY</status>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.javadoc.InvalidJavadocPositionCheck">
<priority>MINOR</priority>
<name><![CDATA[Invalid Javadoc Position]]></name>
<tag>comment</tag>
<configKey><![CDATA[Checker/TreeWalker/InvalidJavadocPosition]]></configKey>
<status>READY</status>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck">
<priority>MAJOR</priority>
<name><![CDATA[Regexp Multiline]]></name>
Expand Down Expand Up @@ -1066,6 +1074,9 @@
<param key="ignoreFieldDeclaration" type="BOOLEAN">
<defaultValue>false</defaultValue>
</param>
<param key="ignoreAnnotationElementDefaults" type="BOOLEAN">
<defaultValue>true</defaultValue>
</param>
<status>READY</status>
</rule>

Expand Down Expand Up @@ -1811,6 +1822,9 @@
<priority>MAJOR</priority>
<name><![CDATA[One Statement Per Line]]></name>
<configKey><![CDATA[Checker/TreeWalker/OneStatementPerLine]]></configKey>
<param key="treatTryResourcesAsStatement" type="BOOLEAN">
<defaultValue>false</defaultValue>
</param>
<status>READY</status>
</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(163);
assertThat(rules).hasSize(164);

for (RulesDefinition.Rule rule : rules) {
assertThat(rule.key()).isNotNull();
Expand Down

0 comments on commit 7549240

Please sign in to comment.