Merge pull request #85 from kemitix/release/4.1.0

Release 4.1.0
This commit is contained in:
Paul Campbell 2018-05-14 20:59:47 +01:00 committed by GitHub
commit c0751fd7ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 326 additions and 678 deletions

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule ".travis-support"]
path = .travis-support
url = https://github.com/kemitix/kemitix-travis-support.git

View file

@ -1 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip

@ -1 +0,0 @@
Subproject commit b97def251b784ecc8de6d3cc30d2793ac0bd375e

View file

@ -5,14 +5,4 @@ cache:
directories:
- "$HOME/.m2"
install: true
script: "./mvnw clean install"
after_success:
- sh .travis-support/coveralls.sh
- bash <(curl -s https://codecov.io/bash)
deploy:
provider: script
script: sh .travis-support/deploy.sh
on:
branch: master
env:
global:
script: "./mvnw --batch-mode --errors --update-snapshots clean install"

View file

@ -1,6 +1,16 @@
CHANGELOG
=========
4.1.0
-----
* EmptyLineSeparator: disabled
* Upgrade `tiles-maven-plugin` to 2.11
* Upgrade `checkstyle` to 8.10
* Upgrade `sevntu-checkstyle` to 1.29.0
* Upgrade `secntu-checkstyle` to 1.27.0
* Upgrade `checkstyle` to 8.7 (properly now that it is supported by sevntu)
4.0.1
-----

86
Jenkinsfile.groovy Normal file
View file

@ -0,0 +1,86 @@
final String mvn = "mvn --batch-mode --update-snapshots --errors"
final dependenciesSupportJDK=9
pipeline {
agent any
stages {
stage('master != SNAPSHOT') {
// checks that the pom version is not a snapshot when the current or target branch is master
when {
expression {
(env.GIT_BRANCH == 'master' || env.CHANGE_TARGET == 'master') &&
(readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT")
}
}
steps {
error("Build failed because SNAPSHOT version")
}
}
stage('Build & Test') {
steps {
withMaven(maven: 'maven', jdk: 'JDK LTS') {
sh "${mvn} clean compile checkstyle:checkstyle pmd:pmd test"
//junit '**/target/surefire-reports/*.xml'
sh "${mvn} -pl builder jacoco:report com.gavinmogan:codacy-maven-plugin:coverage " +
"-DcoverageReportFile=target/site/jacoco/jacoco.xml " +
"-DprojectToken=`$JENKINS_HOME/codacy/token` " +
"-DapiToken=`$JENKINS_HOME/codacy/apitoken` " +
"-Dcommit=`git rev-parse HEAD`"
jacoco exclusionPattern: '**/*{Test|IT|Main|Application|Immutable}.class'
pmd canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '', unHealthy: ''
step([$class: 'hudson.plugins.checkstyle.CheckStylePublisher',
pattern: '**/target/checkstyle-result.xml',
healthy:'20',
unHealthy:'100'])
}
}
}
stage('Verify & Install') {
steps {
withMaven(maven: 'maven', jdk: 'JDK LTS') {
sh "${mvn} -DskipTests install"
}
}
}
stage('SonarQube (github only)') {
when { expression { env.GIT_URL.startsWith('https://github.com') } }
steps {
withSonarQubeEnv('sonarqube') {
withMaven(maven: 'maven', jdk: 'JDK LTS') {
sh "${mvn} org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar"
}
}
}
}
stage('Archiving') {
when { expression { findFiles(glob: '**/target/*.jar').length > 0 } }
steps {
archiveArtifacts '**/target/*.jar'
}
}
stage('Deploy (master on github)') {
when { expression { (env.GIT_BRANCH == 'master' && env.GIT_URL.startsWith('https://github.com')) } }
steps {
withMaven(maven: 'maven', jdk: 'JDK LTS') {
sh "${mvn} deploy --activate-profiles release -DskipTests=true"
}
}
}
stage('Build Java 9') {
when { expression { dependenciesSupportJDK >= 9 } }
steps {
withMaven(maven: 'maven', jdk: 'JDK 9') {
sh "${mvn} clean verify -Djava.version=9"
}
}
}
stage('Build Java 10') {
when { expression { dependenciesSupportJDK >= 10 } }
steps {
withMaven(maven: 'maven', jdk: 'JDK 10') {
sh "${mvn} clean verify -Djava.version=10"
}
}
}
}
}

View file

@ -20,7 +20,7 @@ The simplest way to use the ruleset is with the maven-tile:
```xml
<project>
<properties>
<tiles-maven-plugin.version>2.10</tiles-maven-plugin.version>
<tiles-maven-plugin.version>2.11</tiles-maven-plugin.version>
</properties>
<build>
<plugins>
@ -101,7 +101,7 @@ Rule|Level|Source|Enabled|Suppressible
[EmptyCatchBlock](#emptycatchblock)|tweaks|checkstyle|Yes|
[EmptyForInitializerPad](#emptyforinitializerpad)|layout|checkstyle|Yes|
[EmptyForIteratorPad](#emptyforiteratorpad)|layout|checkstyle|Yes|
[EmptyLineSeparator](#emptylineseparator)|layout|checkstyle|Yes|
[EmptyLineSeparator](#emptylineseparator)|layout|checkstyle||
[EmptyPublicCtorInClass](#emptypublicctorinclass)|tweaks|sevntu|Yes|
[EmptyStatement](#emptystatement)|layout|checkstyle|Yes|
[EnumValueName](#enumvaluename)|naming|sevntu|Yes|
@ -768,59 +768,6 @@ Invalid:
````
for (Iterator i = list.getIterator(); i.hasNext() ; ) {}
````
#### [EmptyLineSeparator](http://checkstyle.sourceforge.net/config_whitespace.html#EmptyLineSeparator)
Checks that there are blank lines between header, package, import blocks, field, constructors, methods, nested classes, static initialisers and instance initialisers.
Valid:
````
/**
* Licence header.
*/
package net.kemitix.foo;
import ...;
import ...;
class Foo {
private int a;
private int b;
Foo() {}
Foo(int a, int b) {}
int getA() {}
int getB() {}
class Bar {
}
}
````
Invalid:
````
/**
* Licence header.
*/
package net.kemitix.foo;
import ...;
import ...;
class Foo {
private int a;
private int b;
Foo() {}
Foo(int a, int b) {}
int getA() {}
int getB() {}
class Bar {
}
}
````
#### [EmptyStatement](http://checkstyle.sourceforge.net/config_coding.html#EmptyStatement)
Checks for empty statements. An empty statement is a standalone semicolon (;).
@ -2385,8 +2332,6 @@ if (condition) {
}
return "";
````
Example: [MoveVariableInsideIf.java](https://github.com/kemitix/kemitix-checkstyle-ruleset/blob/master/regressions/src/main/java/net/kemitix/checkstyle/regressions/MoveVariableInsideIf.java)
#### [NameConventionForJunit4TestClasses](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.html)
Checks the names of JUnit test classes. Classes checked are those that have at least one method annotated with `Test` or `org.junit.Test`.
@ -2643,6 +2588,9 @@ Ref: Clean Code, Robert C. Martin, J1: Avoid Long Import Lists by Using Wildcard
Ref: Clean Code, Robert C. Martin, J2: Don't Inherit Constants
Recommends using a static import to access constants from another class over inheriting them.
#### [EmptyLineSeparator](http://checkstyle.sourceforge.net/config_whitespace.html#EmptyLineSeparator)
#### [FinalLocalVariable](http://checkstyle.sourceforge.net/config_coding.html#FinalLocalVariable)
Doesn't recognise Lombok's `val` as being `final`.

View file

@ -7,23 +7,23 @@
<parent>
<groupId>net.kemitix</groupId>
<artifactId>kemitix-parent</artifactId>
<version>5.0.3</version>
<version>5.1.0</version>
<relativePath/>
</parent>
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>builder</artifactId>
<packaging>jar</packaging>
<version>4.0.1</version>
<version>4.1.0</version>
<properties>
<maven.install.skip>true</maven.install.skip>
<java.version>1.8</java.version>
<tiles-maven-plugin.version>2.10</tiles-maven-plugin.version>
<kemitix-tiles.version>0.3.0</kemitix-tiles.version>
<tiles-maven-plugin.version>2.11</tiles-maven-plugin.version>
<kemitix-tiles.version>0.8.1</kemitix-tiles.version>
<checkstyle.version>8.6</checkstyle.version>
<sevntu.version>1.26.0</sevntu.version>
<checkstyle.version>8.10</checkstyle.version>
<sevntu.version>1.29.0</sevntu.version>
<lombok.version>1.16.20</lombok.version>
<spring-platform.version>Brussels-SR6</spring-platform.version>
<spring-boot.version>1.5.9.RELEASE</spring-boot.version>
@ -31,6 +31,8 @@
<map-builder.version>1.0.0</map-builder.version>
<mockito.version>2.13.0</mockito.version>
<assertj.version>3.9.0</assertj.version>
<conditional.version>0.3.0</conditional.version>
<fast-classpath-scanner.version>2.18.1</fast-classpath-scanner.version>
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
<kemitix.checkstyle.ruleset.version>${project.version}</kemitix.checkstyle.ruleset.version>
@ -58,6 +60,16 @@
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kemitix</groupId>
<artifactId>conditional</artifactId>
<version>${conditional.version}</version>
</dependency>
<dependency>
<groupId>io.github.lukehutch</groupId>
<artifactId>fast-classpath-scanner</artifactId>
<version>${fast-classpath-scanner.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
@ -130,14 +142,14 @@
<extensions>true</extensions>
<configuration>
<tiles>
<tile>net.kemitix.tiles:maven-plugins-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:enforcer-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:compiler-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:huntbugs-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:pmd-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:testing-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:coverage-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:pitest-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:enforcer:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:compiler:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:huntbugs:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:pmd:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:testing:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:coverage:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:pitest:${kemitix-tiles.version}</tile>
</tiles>
</configuration>
</plugin>

View file

@ -21,15 +21,12 @@
package net.kemitix.checkstyle.ruleset.builder;
import com.google.common.reflect.ClassPath;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -41,18 +38,6 @@ import java.util.stream.Stream;
@Configuration
public class BuilderConfiguration {
/**
* Create the ClassPath used to scan packages.
*
* @return the ClassPath
*
* @throws IOException if there is an error
*/
@Bean
public ClassPath classPath() throws IOException {
return ClassPath.from(getClass().getClassLoader());
}
/**
* A Map of rules for each RuleSource.
*
@ -63,24 +48,11 @@ public class BuilderConfiguration {
@Bean
public Map<RuleSource, List<String>> checkClasses(final PackageScanner packageScanner) {
return Stream.of(RuleSource.values())
.map(toRuleSourceEntry(packageScanner))
.map(source -> entry(source, packageScanner.apply(source)))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
private static Function<RuleSource, AbstractMap.SimpleEntry<RuleSource, List<String>>> toRuleSourceEntry(
final PackageScanner packageScanner
) {
return source -> new AbstractMap.SimpleEntry<>(
source,
classesInSource(source, packageScanner)
);
}
private static List<String> classesInSource(
final RuleSource source,
final PackageScanner packageScanner
) {
return packageScanner.apply(source)
.collect(Collectors.toList());
private static <K, V> AbstractMap.SimpleEntry<K, V> entry(final K key, final V value) {
return new AbstractMap.SimpleEntry<>(key, value);
}
}

View file

@ -21,21 +21,22 @@
package net.kemitix.checkstyle.ruleset.builder;
import com.speedment.common.mapstream.MapStream;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Map;
import java.nio.file.Path;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.util.Arrays.asList;
/**
* Writes the Checkstyle XML files.
*
@ -46,8 +47,6 @@ import java.util.stream.Stream;
@RequiredArgsConstructor
class CheckstyleWriter implements CommandLineRunner {
private static final String NEWLINE = System.getProperty("line.separator");
private final OutputProperties outputProperties;
private final TemplateProperties templateProperties;
@ -56,62 +55,79 @@ class CheckstyleWriter implements CommandLineRunner {
private final RuleClassLocator ruleClassLocator;
private static Predicate<RuleLevel> excludeUnspecifiedRuleLevel() {
return level -> !level.equals(RuleLevel.UNSPECIFIED);
}
private static void writeRuleset(
final Path filePath,
final String content
) throws IOException {
Files.write(filePath, asList(content.split(System.lineSeparator())), StandardCharsets.UTF_8);
}
private static String ruleset(
final String checkerRules,
final String treeWalkerRules,
final String template
) {
return String.format(template, checkerRules, treeWalkerRules);
}
private static boolean fileExists(final File file) {
return file.exists();
}
private static void writeCheckstyleFileWithException(
final Path outputPath,
final String checkerRules,
final String treeWalkerRules,
final Path template
) throws IOException {
if (fileExists(template.toFile())) {
log.info("Writing ruleset: {}", outputPath);
final String xmlTemplate = new String(Files.readAllBytes(template), StandardCharsets.UTF_8);
writeRuleset(outputPath, ruleset(checkerRules, treeWalkerRules, xmlTemplate));
} else {
throw new TemplateNotFoundException(template);
}
}
@Override
public void run(final String... args) {
Stream.of(RuleLevel.values())
.filter(level -> !level.equals(RuleLevel.UNSPECIFIED))
.forEach(this::writeCheckstyleFile);
.filter(excludeUnspecifiedRuleLevel())
.forEach(this::writeCheckstyleFile);
}
private void writeCheckstyleFile(final RuleLevel ruleLevel) {
val xmlFile = outputProperties.getDirectory()
.resolve(outputProperties.getRulesetFiles()
.get(ruleLevel));
val checkerRules = rulesProperties.getRules()
.stream()
.filter(Rule::isEnabled)
.filter(rule -> RuleParent.CHECKER.equals(rule.getParent()))
.filter(rule -> ruleLevel.compareTo(rule.getLevel()) >= 0)
.map(this::formatRuleAsModule)
.collect(Collectors.joining(NEWLINE));
val treeWalkerRules = rulesProperties.getRules()
.stream()
.filter(Rule::isEnabled)
.filter(rule -> RuleParent.TREEWALKER.equals(rule.getParent()))
.filter(rule -> ruleLevel.compareTo(rule.getLevel()) >= 0)
.map(this::formatRuleAsModule)
.collect(Collectors.joining(NEWLINE));
final Path outputPath = outputPath(ruleLevel);
final String checkerRules = enabledRules(ruleLevel, RuleParent.CHECKER);
final String treeWalkerRules = enabledRules(ruleLevel, RuleParent.TREEWALKER);
final Path template = templateProperties.getCheckstyleXml();
try {
val checkstyleXmlTemplate = templateProperties.getCheckstyleXml();
if (checkstyleXmlTemplate.toFile()
.exists()) {
val bytes = Files.readAllBytes(checkstyleXmlTemplate);
val template = new String(bytes, StandardCharsets.UTF_8);
val output = Arrays.asList(String.format(template, checkerRules, treeWalkerRules)
.split(NEWLINE));
log.info("Writing xmlFile: {}", xmlFile);
Files.write(xmlFile, output, StandardCharsets.UTF_8);
} else {
throw new TemplateNotFoundException(checkstyleXmlTemplate);
}
writeCheckstyleFileWithException(outputPath, checkerRules, treeWalkerRules, template);
} catch (IOException e) {
throw new CheckstyleWriterException(e);
}
}
private String formatRuleAsModule(final Rule rule) {
if (rule.getProperties()
.isEmpty()) {
return String.format("<module name=\"%s\"/>", ruleClassLocator.apply(rule));
}
return String.format("<module name=\"%s\">%n %s%n</module>", ruleClassLocator.apply(rule),
formatProperties(rule.getProperties())
);
private Path outputPath(final RuleLevel ruleLevel) {
return outputProperties.getDirectory()
.resolve(outputProperties.getRulesetFiles()
.get(ruleLevel));
}
private String formatProperties(final Map<String, String> properties) {
return MapStream.of(properties)
.map((k, v) -> String.format("<property name=\"%s\" value=\"%s\"/>", k, v))
.collect(Collectors.joining(NEWLINE));
private String enabledRules(
final RuleLevel ruleLevel,
final RuleParent ruleParent
) {
return rulesProperties.getRules()
.stream()
.filter(Rule::isEnabled)
.filter(Rule.hasParent(ruleParent))
.filter(Rule.isIncludedInLevel(ruleLevel))
.map(rule -> Rule.asModule(ruleClassLocator.apply(rule), rule))
.collect(Collectors.joining(System.lineSeparator()));
}
}

View file

@ -21,11 +21,11 @@
package net.kemitix.checkstyle.ruleset.builder;
import com.google.common.reflect.ClassPath;
import lombok.RequiredArgsConstructor;
import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
import org.springframework.stereotype.Service;
import java.util.stream.Stream;
import java.util.List;
import java.util.stream.Collectors;
/**
* Default implementation of {@link PackageScanner}.
@ -33,15 +33,16 @@ import java.util.stream.Stream;
* @author Paul Campbell (pcampbell@kemitix.net).
*/
@Service
@RequiredArgsConstructor
public class DefaultPackageScanner implements PackageScanner {
private final ClassPath classPath;
@Override
public final Stream<String> apply(final RuleSource ruleSource) {
return classPath.getTopLevelClassesRecursive(ruleSource.getBasePackage())
.stream()
.map(ClassPath.ClassInfo::getName);
public final List<String> apply(final RuleSource ruleSource) {
final String basePackage = ruleSource.getBasePackage();
return new FastClasspathScanner(basePackage)
.scan()
.getNamesOfAllStandardClasses()
.stream()
.filter(packageName -> packageName.startsWith(basePackage))
.collect(Collectors.toList());
}
}

View file

@ -21,14 +21,14 @@
package net.kemitix.checkstyle.ruleset.builder;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Stream;
/**
* Scans a package for all classes.
*
* @author Paul Campbell (pcampbell@kemitix.net).
*/
interface PackageScanner extends Function<RuleSource, Stream<String>> {
interface PackageScanner extends Function<RuleSource, List<String>> {
}

View file

@ -21,13 +21,17 @@
package net.kemitix.checkstyle.ruleset.builder;
import com.speedment.common.mapstream.MapStream;
import lombok.Getter;
import lombok.Setter;
import net.kemitix.conditional.Value;
import java.net.URI;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
* A single Checkstyle Check.
@ -40,6 +44,10 @@ public class Rule {
private static final Locale LOCALE = Locale.ENGLISH;
private static final String MODULE_NO_PROPERTIES = "<module name=\"%s\"/>";
private static final String MODULE_WITH_PROPERTIES = "<module name=\"%s\">%n %s%n</module>";
/**
* Configuration properties.
*/
@ -100,6 +108,69 @@ public class Rule {
.compareTo(right.getLowerCaseRuleName());
}
/**
* Predicate to check that the Rule has the given RuleParent.
*
* @param ruleParent the RuleParent to match
*
* @return a Predicate to check a Rule
*/
static Predicate<Rule> hasParent(final RuleParent ruleParent) {
return rule -> ruleParent.equals(rule.getParent());
}
/**
* Predicate to check that the Rule is included in the given RuleLevel.
*
* @param ruleLevel the RuleLevel to match
*
* @return a Predicate to check a Rule
*/
static Predicate<Rule> isIncludedInLevel(final RuleLevel ruleLevel) {
return rule -> ruleLevel.compareTo(rule.getLevel()) >= 0;
}
private static String formatProperties(final Map<String, String> properties) {
return MapStream.of(properties)
.map((k, v) -> String.format("<property name=\"%s\" value=\"%s\"/>", k, v))
.collect(Collectors.joining(System.lineSeparator()));
}
private static boolean hasProperties(final Rule rule) {
return !rule.getProperties().isEmpty();
}
/**
* Formats the Rule as an XML module fragment.
*
* @param rule the Rule to format
* @param ruleClassname the classname for the Rule
*
* @return an XML {@code <module/>} fragment
*/
static String asModule(
final String ruleClassname,
final Rule rule
) {
return Value.<String>where(hasProperties(rule))
.then(() -> moduleWithParameters(rule, ruleClassname))
.otherwise(() -> moduleNoParameters(ruleClassname));
}
private static String moduleNoParameters(
final String ruleClassname
) {
return String.format(MODULE_NO_PROPERTIES, ruleClassname);
}
private static String moduleWithParameters(
final Rule rule,
final String ruleClassname
) {
return String.format(MODULE_WITH_PROPERTIES, ruleClassname, formatProperties(rule.getProperties()));
}
private String getLowerCaseRuleName() {
return getName().toLowerCase(LOCALE);
}

View file

@ -20,7 +20,7 @@ The simplest way to use the ruleset is with the maven-tile:
```xml
<project>
<properties>
<tiles-maven-plugin.version>2.10</tiles-maven-plugin.version>
<tiles-maven-plugin.version>2.11</tiles-maven-plugin.version>
</properties>
<build>
<plugins>

View file

@ -241,9 +241,10 @@ rules:
name: EmptyLineSeparator
parent: TREEWALKER
level: LAYOUT
enabled: true
enabled: false
source: CHECKSTYLE
uri: http://checkstyle.sourceforge.net/config_whitespace.html#EmptyLineSeparator
reason:
-
name: EmptyStatement
parent: TREEWALKER
@ -296,6 +297,8 @@ rules:
enabled: true
source: CHECKSTYLE
uri: http://checkstyle.sourceforge.net/config_sizes.html#FileLength
properties:
max: 500
-
name: FileTabCharacter
parent: CHECKER
@ -463,9 +466,9 @@ rules:
source: CHECKSTYLE
uri: http://checkstyle.sourceforge.net/config_metrics.html#JavaNCSS
properties:
classMaximum: 1200
fileMaximum: 1600
methodMaximum: 40
classMaximum: 250
fileMaximum: 250
methodMaximum: 12
-
name: LeftCurly
parent: TREEWALKER
@ -518,7 +521,7 @@ rules:
source: CHECKSTYLE
uri: http://checkstyle.sourceforge.net/config_sizes.html#MethodCount
properties:
maxTotal: 30
maxTotal: 10
-
name: MethodLength
parent: TREEWALKER
@ -527,7 +530,7 @@ rules:
source: CHECKSTYLE
uri: http://checkstyle.sourceforge.net/config_sizes.html#MethodLength
properties:
max: 40
max: 30
-
name: MethodName
parent: TREEWALKER

View file

@ -18,5 +18,3 @@ if (condition) {
}
return "";
````
Example: [MoveVariableInsideIf.java](https://github.com/kemitix/kemitix-checkstyle-ruleset/blob/master/regressions/src/main/java/net/kemitix/checkstyle/regressions/MoveVariableInsideIf.java)

View file

@ -9,6 +9,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import static java.util.Collections.singletonList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
@ -20,28 +21,20 @@ import static org.mockito.Mockito.mock;
*/
public class BuilderConfigurationTest {
@Test
public void canGetClassPath() throws IOException {
//when
final ClassPath classPath = new BuilderConfiguration().classPath();
//then
assertThat(classPath).isNotNull();
}
@Test
public void canGetCheckClasses() {
//given
final PackageScanner packageScanner = mock(PackageScanner.class);
final String checkstyleClass = "checkstyle class";
given(packageScanner.apply(RuleSource.CHECKSTYLE)).willReturn(Stream.of(checkstyleClass));
given(packageScanner.apply(RuleSource.CHECKSTYLE)).willReturn(singletonList(checkstyleClass));
final String sevntuClass = "sevntu class";
given(packageScanner.apply(RuleSource.SEVNTU)).willReturn(Stream.of(sevntuClass));
given(packageScanner.apply(RuleSource.SEVNTU)).willReturn(singletonList(sevntuClass));
//when
final Map<RuleSource, List<String>> checkClasses = new BuilderConfiguration().checkClasses(packageScanner);
//then
assertThat(checkClasses).containsOnlyKeys(RuleSource.values());
assertThat(checkClasses)
.containsEntry(RuleSource.CHECKSTYLE, Collections.singletonList(checkstyleClass))
.containsEntry(RuleSource.SEVNTU, Collections.singletonList(sevntuClass));
.containsEntry(RuleSource.CHECKSTYLE, singletonList(checkstyleClass))
.containsEntry(RuleSource.SEVNTU, singletonList(sevntuClass));
}
}

View file

@ -1,10 +1,8 @@
package net.kemitix.checkstyle.ruleset.builder;
import com.google.common.reflect.ClassPath;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
import java.util.stream.Stream;
import static org.assertj.core.api.Assertions.assertThat;
@ -16,27 +14,21 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class DefaultPackageScannerTest {
private PackageScanner scanner;
@Before
public void setUp() throws Exception {
final ClassPath classPath = ClassPath.from(getClass().getClassLoader());
scanner = new DefaultPackageScanner(classPath);
}
private PackageScanner scanner = new DefaultPackageScanner();
@Test
public void canScanCheckstylePackage() throws IOException {
public void canScanCheckstylePackage() {
//when
final Stream<String> result = scanner.apply(RuleSource.CHECKSTYLE);
final List<String> result = scanner.apply(RuleSource.CHECKSTYLE);
//then
assertThat(result).allMatch(cn -> cn.startsWith(RuleSource.CHECKSTYLE.getBasePackage()))
.contains("com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck");
}
@Test
public void canScanSevntuPackage() throws IOException {
public void canScanSevntuPackage() {
//when
final Stream<String> result = scanner.apply(RuleSource.SEVNTU);
final List<String> result = scanner.apply(RuleSource.SEVNTU);
//then
assertThat(result).allMatch(cn -> cn.startsWith(RuleSource.SEVNTU.getBasePackage()))
.contains("com.github.sevntu.checkstyle.checks.design.NestedSwitchCheck");

View file

@ -1,3 +0,0 @@
test:
override:
- ./mvnw clean install

View file

@ -5,8 +5,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>root</artifactId>
<version>4.0.1</version>
<artifactId>kemitix-checkstyle-ruleset</artifactId>
<version>4.1.0</version>
<packaging>pom</packaging>
<properties>
@ -16,7 +16,6 @@
<modules>
<module>builder</module>
<module>ruleset</module>
<module>regressions</module>
<module>tile</module>
</modules>

View file

@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.kemitix</groupId>
<artifactId>kemitix-parent</artifactId>
<version>5.0.3</version>
<relativePath/>
</parent>
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>regressions</artifactId>
<version>4.0.1</version>
<properties>
<maven.install.skip>true</maven.install.skip>
<tiles-maven-plugin.version>2.10</tiles-maven-plugin.version>
<kemitix-tiles.version>0.2.0</kemitix-tiles.version>
<checkstyle.version>8.6</checkstyle.version>
<sevntu.version>1.26.0</sevntu.version>
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
<kemitix.checkstyle.ruleset.version>${project.version}</kemitix.checkstyle.ruleset.version>
<!--<kemitix.checkstyle.ruleset.level>5-complexity</kemitix.checkstyle.ruleset.level>-->
<!-- use the disabled ruleset for normal builds. comment out the following line to check that conditions are caught -->
<kemitix.checkstyle.ruleset.level>0-disabled</kemitix.checkstyle.ruleset.level>
<kemitix.checkstyle.ruleset.location>net/kemitix/checkstyle-${kemitix.checkstyle.ruleset.level}.xml</kemitix.checkstyle.ruleset.location>
<digraph-dependency.basePackage>net.kemitix.checkstyle.regressions</digraph-dependency.basePackage>
<pitest.skip>true</pitest.skip>
<immutables-value.version>2.5.6</immutables-value.version>
</properties>
<dependencies>
<dependency>
<groupId>org.immutables</groupId>
<artifactId>value</artifactId>
<version>${immutables-value.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>${tiles-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<tiles>
<tile>net.kemitix.tiles:maven-plugins-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:compiler-tile:${kemitix-tiles.version}</tile>
</tiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
<dependency>
<groupId>com.github.sevntu-checkstyle</groupId>
<artifactId>sevntu-checkstyle-maven-plugin</artifactId>
<version>${sevntu.version}</version>
</dependency>
<dependency>
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>ruleset</artifactId>
<version>${kemitix.checkstyle.ruleset.version}</version>
</dependency>
</dependencies>
<configuration>
<configLocation>${kemitix.checkstyle.ruleset.location}</configLocation>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,40 +0,0 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
import java.io.Serializable;
/**
* Regression test for {@code AvoidDefaultSerializableInInnerClasses}.
*
* @author Paul Campbell (pcampbell@kemitix.net)
*/
public class AvoidDefaultSerializableInInnerClasses {
/**
* Inner class should not use default implementations of {@code readObject()} and {@code writeObject()}.
*/
public class InnerClass implements Serializable {
}
}

View file

@ -1,31 +0,0 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
/**
* Sample class with no checkstyle issues.
*
* @author Paul Campbell (pcampbell@kemitix.net)
*/
class Basic {
}

View file

@ -1,37 +0,0 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
/**
* Regression demo for {@code EmptyPublicCtorInClassCheck}.
*
* @author Paul Campbell (pcampbell@kemitix.net)
*/
public class EmptyPublicCtorInClass {
/**
* Useless empty public constructors.
*/
EmptyPublicCtorInClass() {
}
}

View file

@ -1,48 +0,0 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
/**
* Regression demo for {@code ExplicitInitializationCheck}.
*
* @author Paul Campbell (pcampbell@kemitix.net).
*/
@SuppressWarnings({"hideutilityclassconstructor", "PMD.UnusedPrivateField"})
class ExplicitInitialization {
private boolean validBoolean = false;
private int validInt = 0;
private String validString = "";
private Object validObject = new Object();
private Boolean invalidBoolean = null;
private Integer invalidInteger = null;
private String invalidString = null;
private Object invalidObject = null;
}

View file

@ -1,39 +0,0 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
/**
* Regression test for {@code FinalizeImplementationCheck}.
*
* @author Paul Campbell pcampbell@kemitix.net
*/
class FinalizeImplementation {
/**
* Negates effect of superclass finalize.
*/
@SuppressWarnings("PMD.EmptyFinalizer")
protected void finalize() {
// doesn't call super.finalize()
}
}

View file

@ -1,64 +0,0 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
/**
* Regression demo for {@code MoveVariableInsideIfCheck}.
*
* @author Paul Campbell (pcampbell@kemitix.net)
*/
class MoveVariableInsideIf {
private String input = "1";
private boolean condition;
private String method(final String variable) {
return "value: " + variable;
}
/**
* Fails if not suppressed.
*
* @return value
*/
protected String invalid() {
String variable = input.substring(1);
if (condition) {
return method(variable);
}
return "";
}
/**
* Rewrite {@link #invalid()} as this to pass.
*
* @return value
*/
protected String valid() {
if (condition) {
String variable = input.substring(1);
return method(variable);
}
return "";
}
}

View file

@ -1,42 +0,0 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;
import org.immutables.value.Value;
/**
* Regression subject for org.immutables.
*
* @author Paul Campbell (pcampbell@kemitix.net)
*/
@Value.Immutable
public interface Values {
/**
* Gets the ID.
*
* @return the id
*/
@Value.Parameter
long getId();
}

View file

@ -1,22 +0,0 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Paul Campbell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.kemitix.checkstyle.regressions;

View file

@ -7,13 +7,13 @@
<parent>
<groupId>net.kemitix</groupId>
<artifactId>kemitix-parent</artifactId>
<version>5.0.3</version>
<version>5.1.0</version>
<relativePath/>
</parent>
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>ruleset</artifactId>
<version>4.0.1</version>
<version>4.1.0</version>
<packaging>jar</packaging>
<name>Kemitix Checkstyle Ruleset</name>
@ -21,8 +21,8 @@
<url>https://github.com/kemitix/kemitix-checkstyle-ruleset</url>
<properties>
<tiles-maven-plugin.version>2.10</tiles-maven-plugin.version>
<kemitix-tiles.version>0.2.0</kemitix-tiles.version>
<tiles-maven-plugin.version>2.11</tiles-maven-plugin.version>
<kemitix-tiles.version>0.8.1</kemitix-tiles.version>
<maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>
</properties>
@ -57,9 +57,8 @@
<extensions>true</extensions>
<configuration>
<tiles>
<tile>net.kemitix.tiles:maven-plugins-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:enforcer-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:release-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:enforcer:${kemitix-tiles.version}</tile>
</tiles>
</configuration>
</plugin>

View file

@ -26,7 +26,6 @@
<module name="com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.GenericWhitespaceCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck"/>

View file

@ -32,7 +32,6 @@
<module name="com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.GenericWhitespaceCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.naming.InterfaceTypeParameterNameCheck"/>

View file

@ -38,7 +38,6 @@
<module name="com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.FallThroughCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.GenericWhitespaceCheck"/>

View file

@ -46,7 +46,6 @@
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.ExplicitInitializationCheck">

View file

@ -8,7 +8,9 @@
<property name="fileNamePattern" value="(.sync-conflict-| conflicted copy )"/>
<property name="match" value="true"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck">
<property name="max" value="500"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck">
<property name="fileExtensions" value="java"/>
@ -60,7 +62,6 @@
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheck"/>
@ -97,9 +98,9 @@
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.metrics.JavaNCSSCheck">
<property name="classMaximum" value="1200"/>
<property name="fileMaximum" value="1600"/>
<property name="methodMaximum" value="40"/>
<property name="classMaximum" value="250"/>
<property name="fileMaximum" value="250"/>
<property name="methodMaximum" value="12"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck">
@ -110,10 +111,10 @@
<module name="com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck">
<property name="maxTotal" value="30"/>
<property name="maxTotal" value="10"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.sizes.MethodLengthCheck">
<property name="max" value="40"/>
<property name="max" value="30"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.naming.MethodNameCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck"/>

2
set-version.sh Normal file → Executable file
View file

@ -12,4 +12,4 @@ NEXT=$2
echo Updating version from $CURRENT to $NEXT
./mvnw versions:set -DnewVersion=$NEXT
perl -p -i -e "s,$CURRENT</,$NEXT</," builder/pom.xml builder/src/main/resources/README-template.md regressions/pom.xml ruleset/pom.xml tile/pom.xml tile/tile.xml
perl -p -i -e "s,$CURRENT</,$NEXT</," builder/pom.xml builder/src/main/resources/README-template.md ruleset/pom.xml tile/pom.xml tile/tile.xml

View file

@ -1,8 +0,0 @@
language: java
jdk:
- oraclejdk8
cache:
directories:
- "$HOME/.m2"
install: true
script: "./mvnw clean install"

View file

@ -5,20 +5,20 @@
<parent>
<groupId>net.kemitix</groupId>
<artifactId>kemitix-parent</artifactId>
<version>5.0.3</version>
<version>5.1.0</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>tile</artifactId>
<version>4.0.1</version>
<version>4.1.0</version>
<packaging>tile</packaging>
<properties>
<tiles-maven-plugin.version>2.10</tiles-maven-plugin.version>
<kemitix-tiles.version>0.2.0</kemitix-tiles.version>
<tiles-maven-plugin.version>2.11</tiles-maven-plugin.version>
<kemitix-tiles.version>0.8.1</kemitix-tiles.version>
</properties>
<build>
@ -30,8 +30,7 @@
<extensions>true</extensions>
<configuration>
<tiles>
<tile>net.kemitix.tiles:maven-plugins-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:release-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile>
</tiles>
</configuration>
</plugin>

View file

@ -1,8 +1,8 @@
<project>
<properties>
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
<checkstyle.version>8.6</checkstyle.version>
<sevntu.version>1.26.0</sevntu.version>
<checkstyle.version>8.10</checkstyle.version>
<sevntu.version>1.29.0</sevntu.version>
<kemitix.checkstyle.ruleset.version>4.0.1</kemitix.checkstyle.ruleset.version>
<kemitix.checkstyle.ruleset.level>5-complexity</kemitix.checkstyle.ruleset.level>
<kemitix.checkstyle.ruleset.location>net/kemitix/checkstyle-${kemitix.checkstyle.ruleset.level}.xml</kemitix.checkstyle.ruleset.location>

View file

@ -1,6 +0,0 @@
box: maven:3.5.0-jdk-8
build:
steps:
- xenoterracide/maven:
goals: clean install