Skip to content

Commit

Permalink
Issue #151: upgrade to chekcstyle 8.11
Browse files Browse the repository at this point in the history
  • Loading branch information
romani committed Jul 1, 2018
1 parent f10709a commit c0eeb89
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This plugin provides coding rules from [Checkstyle](http://checkstyle.sourceforg

Checkstyle Plugin|Sonar|Checkstyle|Jdk
-----------------|-----|----------|---
4.11|5.6.6|8.10.1|1.8
4.10.1|5.6.6|8.10.1|1.8
4.10|5.6.6|8.10|1.8
4.9|5.6.6|8.9|1.8
Expand Down
16 changes: 6 additions & 10 deletions checkstyle-sonar-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<properties>
<maven.checkstyle.plugin.version>2.17</maven.checkstyle.plugin.version>
<maven.sevntu.checkstyle.plugin.version>1.29.0</maven.sevntu.checkstyle.plugin.version>
<!-- it should be a version of checkstyle that is compatible/compiled with sevntu -->
<maven.sevntu.checkstyle.plugin.checkstyle.version>
8.10
</maven.sevntu.checkstyle.plugin.checkstyle.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -166,7 +170,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
<version>${maven.sevntu.checkstyle.plugin.checkstyle.version}</version>
</dependency>
<dependency>
<groupId>com.github.sevntu-checkstyle</groupId>
Expand All @@ -182,7 +186,7 @@
<goal>check</goal>
</goals>
<configuration>
<configLocation>https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml</configLocation>
<configLocation>https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${maven.sevntu.checkstyle.plugin.checkstyle.version}/config/checkstyle_checks.xml</configLocation>
<failOnViolation>true</failOnViolation>
<headerLocation>I just need to put here smth to let it not use default - LICENSE.txt</headerLocation>
<propertiesLocation>config/checkstyle.properties</propertiesLocation>
Expand Down Expand Up @@ -390,12 +394,4 @@
</plugins>
</build>

<pluginRepositories>
<pluginRepository>
<id>sevntu-maven</id>
<name>sevntu-maven</name>
<url>http://sevntu-checkstyle.github.io/sevntu.checkstyle/maven2</url>
</pluginRepository>
</pluginRepositories>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,19 @@
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck</rule-key>
<prop>
<key>remediationFunction</key>
<txt>CONSTANT_ISSUE</txt>
</prop>
<prop>
<key>offset</key>
<val>10</val>
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.naming.CatchParameterNameCheck</rule-key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.param.format=Regular expression
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.param.ignoreOverridden=Allows to skip methods with Override annotation from validation.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.param.accessModifiers=Access modifiers of methods where parameters are checked.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.name=Lambda Parameter Name
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck.param.format=Regular expression
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck.name=Redundant Modifier
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck.param.tokens=tokens to check
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck.name=Empty For Initializer Pad
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Check to verify lambda parameter names.
For more details please refere to <a href="http://checkstyle.sourceforge.net/config_naming.html#LambdaParameterName">online documentation</a>
<p>
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,16 @@
<status>READY</status>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck">
<priority>MAJOR</priority>
<name><![CDATA[Parameter Name]]></name>
<configKey><![CDATA[Checker/TreeWalker/LambdaParameterName]]></configKey>
<param key="format" type="REGULAR_EXPRESSION">
<defaultValue>^[a-z][a-zA-Z0-9]*$</defaultValue>
</param>
<status>READY</status>
</rule>

<rule key="com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck">
<priority>MAJOR</priority>
<name><![CDATA[Parameter Number]]></name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void test() {
assertThat(repository.language()).isEqualTo("java");

final List<RulesDefinition.Rule> rules = repository.rules();
assertThat(rules).hasSize(154);
assertThat(rules).hasSize(155);

for (RulesDefinition.Rule rule : rules) {
assertThat(rule.key()).isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
import com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck;
import com.puppycrawl.tools.checkstyle.guava.collect.ImmutableSet;
import com.puppycrawl.tools.checkstyle.guava.reflect.ClassPath;
import com.puppycrawl.tools.checkstyle.utils.JavadocUtils;
import com.puppycrawl.tools.checkstyle.utils.TokenUtils;
import com.puppycrawl.tools.checkstyle.utils.JavadocUtil;
import com.puppycrawl.tools.checkstyle.utils.TokenUtil;

public final class CheckUtil {
private CheckUtil() {
Expand Down Expand Up @@ -240,7 +240,7 @@ public static String getTokenText(int[] tokens, int... subtractions) {
result.append(',');
}

result.append(TokenUtils.getTokenName(token));
result.append(TokenUtil.getTokenName(token));
}

return result.toString();
Expand Down Expand Up @@ -271,7 +271,7 @@ public static String getJavadocTokenText(int[] tokens, int... subtractions) {
result.append(',');
}

result.append(JavadocUtils.getTokenName(token));
result.append(JavadocUtil.getTokenName(token));
}

return result.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ else if (AbstractFileSetCheck.class.isAssignableFrom(clss)) {

// remove undocumented properties
new HashSet<>(properties).stream()
.filter(p -> UNDOCUMENTED_PROPERTIES.contains(clss.getSimpleName() + "." + p))
.filter(property -> {
return UNDOCUMENTED_PROPERTIES.contains(clss.getSimpleName() + "." + property);
})
.forEach(properties::remove);

if (AbstractCheck.class.isAssignableFrom(clss)) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</ciManagement>

<properties>
<checkstyle.version>8.10.1</checkstyle.version>
<checkstyle.version>8.11</checkstyle.version>
<sonar.version>5.6.6</sonar.version>
<sonar-java.version>3.7</sonar-java.version>
<java.version>1.8</java.version>
Expand Down

0 comments on commit c0eeb89

Please sign in to comment.