Bump spring-boot.version from 2.3.5.RELEASE to 2.4.3 (#378)
* Bump spring-boot.version from 2.3.5.RELEASE to 2.4.3 Bumps `spring-boot.version` from 2.3.5.RELEASE to 2.4.3. Updates `spring-boot-dependencies` from 2.3.5.RELEASE to 2.4.3 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v2.3.5.RELEASE...v2.4.3) Updates `spring-boot-maven-plugin` from 2.3.5.RELEASE to 2.4.3 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v2.3.5.RELEASE...v2.4.3) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Version set to 5.5.0 * Bump kemitix-maven-tiles from 2.7.0 to 3.0.1 * Various PMD, checkstyle and FindBugs fixes * buildeR: disable coverage checks * readme: updated * Remove disable rule * Add reason for disabled rule Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Paul Campbell <pcampbell@kemitix.net>
This commit is contained in:
parent
fbf54dc13a
commit
426e3b25fe
26 changed files with 83 additions and 72 deletions
10
README.md
10
README.md
|
@ -161,7 +161,7 @@ Rule|Level|Source|Enabled|Suppressible
|
||||||
[InnerAssignment](#innerassignment)|tweaks|checkstyle|Yes|
|
[InnerAssignment](#innerassignment)|tweaks|checkstyle|Yes|
|
||||||
[InnerTypeLast](#innertypelast)|tweaks|checkstyle|Yes|
|
[InnerTypeLast](#innertypelast)|tweaks|checkstyle|Yes|
|
||||||
[InterfaceIsType](#interfaceistype)|complexity|checkstyle|Yes|
|
[InterfaceIsType](#interfaceistype)|complexity|checkstyle|Yes|
|
||||||
[InterfaceMemberImpliedModifier](#interfacememberimpliedmodifier)|tweaks|checkstyle|Yes|
|
[InterfaceMemberImpliedModifier](#interfacememberimpliedmodifier)|tweaks|checkstyle||
|
||||||
[InterfaceTypeParameterName](#interfacetypeparametername)|naming|checkstyle|Yes|
|
[InterfaceTypeParameterName](#interfacetypeparametername)|naming|checkstyle|Yes|
|
||||||
[JavadocMethod](#javadocmethod)|javadoc|checkstyle||
|
[JavadocMethod](#javadocmethod)|javadoc|checkstyle||
|
||||||
[JavadocPackage](#javadocpackage)|javadoc|checkstyle|Yes|
|
[JavadocPackage](#javadocpackage)|javadoc|checkstyle|Yes|
|
||||||
|
@ -1115,11 +1115,6 @@ interface Foo {
|
||||||
static final String "Foo!!";
|
static final String "Foo!!";
|
||||||
}
|
}
|
||||||
````
|
````
|
||||||
#### [InterfaceMemberImpliedModifier](http://checkstyle.sourceforge.net/config_modifier.html#InterfaceMemberImpliedModifier)
|
|
||||||
|
|
||||||
Checks that members of an interface explicitly state their modifiers. From Java 9 the implied modifiers for members
|
|
||||||
are different depending on whether they are on a class or an interface. Explicitly stating the modifiers removes the
|
|
||||||
need for the developer to remember the differences.
|
|
||||||
#### [InterfaceTypeParameterName](http://checkstyle.sourceforge.net/config_naming.html#InterfaceTypeParameterName)
|
#### [InterfaceTypeParameterName](http://checkstyle.sourceforge.net/config_naming.html#InterfaceTypeParameterName)
|
||||||
|
|
||||||
Checks that the type parameters for an interface are a single uppercase letter.
|
Checks that the type parameters for an interface are a single uppercase letter.
|
||||||
|
@ -2121,6 +2116,9 @@ Generic rule; doesn't embody a 'quality' check.
|
||||||
#### [Indentation](http://checkstyle.sourceforge.net/config_misc.html#Indentation)
|
#### [Indentation](http://checkstyle.sourceforge.net/config_misc.html#Indentation)
|
||||||
|
|
||||||
Couldn't get my IDE's (IntelliJ) code style to match.
|
Couldn't get my IDE's (IntelliJ) code style to match.
|
||||||
|
#### [InterfaceMemberImpliedModifier](http://checkstyle.sourceforge.net/config_modifier.html#InterfaceMemberImpliedModifier)
|
||||||
|
|
||||||
|
Makes interfaces overly verbose.
|
||||||
#### [JavadocMethod](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocMethod)
|
#### [JavadocMethod](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocMethod)
|
||||||
|
|
||||||
Only exceptional cases should need to be documented.
|
Only exceptional cases should need to be documented.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<groupId>net.kemitix.checkstyle</groupId>
|
<groupId>net.kemitix.checkstyle</groupId>
|
||||||
<artifactId>builder</artifactId>
|
<artifactId>builder</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>5.4.1</version>
|
<version>5.5.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.install.skip>true</maven.install.skip>
|
<maven.install.skip>true</maven.install.skip>
|
||||||
|
@ -22,14 +22,14 @@
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<tiles-maven-plugin.version>2.19</tiles-maven-plugin.version>
|
<tiles-maven-plugin.version>2.19</tiles-maven-plugin.version>
|
||||||
<kemitix-tiles.version>2.7.0</kemitix-tiles.version>
|
<kemitix-maven-tiles.version>3.0.1</kemitix-maven-tiles.version>
|
||||||
|
|
||||||
<checkstyle.version>8.41</checkstyle.version>
|
<checkstyle.version>8.41</checkstyle.version>
|
||||||
<sevntu.version>1.38.0</sevntu.version>
|
<sevntu.version>1.38.0</sevntu.version>
|
||||||
<sevntu-plugin.version>1.35.0</sevntu-plugin.version>
|
<sevntu-plugin.version>1.35.0</sevntu-plugin.version>
|
||||||
<lombok.version>1.18.18</lombok.version>
|
<lombok.version>1.18.18</lombok.version>
|
||||||
<spring-platform.version>Brussels-SR6</spring-platform.version>
|
<spring-platform.version>Brussels-SR6</spring-platform.version>
|
||||||
<spring-boot.version>2.3.5.RELEASE</spring-boot.version>
|
<spring-boot.version>2.4.3</spring-boot.version>
|
||||||
<mapstream.version>3.2.10</mapstream.version>
|
<mapstream.version>3.2.10</mapstream.version>
|
||||||
<map-builder.version>1.0.0</map-builder.version>
|
<map-builder.version>1.0.0</map-builder.version>
|
||||||
<mockito.version>3.8.0</mockito.version>
|
<mockito.version>3.8.0</mockito.version>
|
||||||
|
@ -145,14 +145,14 @@
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<tiles>
|
<tiles>
|
||||||
<tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile>
|
<tile>net.kemitix.tiles:maven-plugins:${kemitix-maven-tiles.version}</tile>
|
||||||
<tile>net.kemitix.tiles:enforcer:${kemitix-tiles.version}</tile>
|
<tile>net.kemitix.tiles:compiler-jdk-lts:${kemitix-maven-tiles.version}</tile>
|
||||||
<tile>net.kemitix.tiles:compiler-jdk-11:${kemitix-tiles.version}</tile>
|
<tile>net.kemitix.tiles:pmd:${kemitix-maven-tiles.version}</tile>
|
||||||
<tile>net.kemitix.tiles:huntbugs:${kemitix-tiles.version}</tile>
|
<tile>net.kemitix.tiles:testing:${kemitix-maven-tiles.version}</tile>
|
||||||
<tile>net.kemitix.tiles:pmd:${kemitix-tiles.version}</tile>
|
<tile>net.kemitix.tiles:spotbugs:${kemitix-maven-tiles.version}</tile>
|
||||||
<tile>net.kemitix.tiles:testing:${kemitix-tiles.version}</tile>
|
<!-- <tile>net.kemitix.tiles:coverage:${kemitix-maven-tiles.version}</tile>-->
|
||||||
<tile>net.kemitix.tiles:coverage:${kemitix-tiles.version}</tile>
|
<tile>net.kemitix.tiles:pitest:${kemitix-maven-tiles.version}</tile>
|
||||||
<tile>net.kemitix.tiles:pitest:${kemitix-tiles.version}</tile>
|
<tile>net.kemitix.tiles:pmd-strict:${kemitix-maven-tiles.version}</tile>
|
||||||
</tiles>
|
</tiles>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -7,6 +7,8 @@ package net.kemitix.checkstyle.ruleset.builder;
|
||||||
*/
|
*/
|
||||||
public class CheckstyleClassNotFoundException extends RuntimeException {
|
public class CheckstyleClassNotFoundException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -4752607844086418212L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|
|
@ -14,8 +14,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||||
*/
|
*/
|
||||||
@EnableConfigurationProperties({RulesProperties.class, OutputProperties.class})
|
@EnableConfigurationProperties({RulesProperties.class, OutputProperties.class})
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@SuppressWarnings("hideutilityclassconstructor")
|
@SuppressWarnings({"hideutilityclassconstructor", "PMD.AbstractClassWithoutAbstractMethod"})
|
||||||
public class CheckstyleRulesetBuilderApplication {
|
public abstract class CheckstyleRulesetBuilderApplication {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main methods.
|
* Main methods.
|
||||||
|
|
|
@ -9,6 +9,8 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public class CheckstyleSourceLoadException extends RuntimeException {
|
public class CheckstyleSourceLoadException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4770223195735989937L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.kemitix.checkstyle.ruleset.builder;
|
package net.kemitix.checkstyle.ruleset.builder;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
@ -31,18 +32,22 @@ class CheckstyleWriter implements CommandLineRunner {
|
||||||
|
|
||||||
private final OutputProperties outputProperties;
|
private final OutputProperties outputProperties;
|
||||||
|
|
||||||
private final TemplateProperties templateProperties;
|
private final TemplateProperties templateProps;
|
||||||
|
|
||||||
private final RulesProperties rulesProperties;
|
private final RulesProperties rulesProperties;
|
||||||
|
|
||||||
private final RuleClassLocator ruleClassLocator;
|
private final RuleClassLocator ruleClassLocator;
|
||||||
|
|
||||||
private final SourcesProperties sourcesProperties;
|
private final SourcesProperties sourcesProperties;
|
||||||
private final Set<String> enabledSourceNames = new HashSet<>();
|
|
||||||
|
|
||||||
|
private final Set<String> enabledNames = new HashSet<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds list of enabled sources.
|
||||||
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
enabledSourceNames.addAll(
|
enabledNames.addAll(
|
||||||
sourcesProperties.getSources()
|
sourcesProperties.getSources()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(RuleSource::isEnabled)
|
.filter(RuleSource::isEnabled)
|
||||||
|
@ -51,7 +56,7 @@ class CheckstyleWriter implements CommandLineRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Predicate<RuleLevel> excludeUnspecifiedRuleLevel() {
|
private static Predicate<RuleLevel> excludeUnspecifiedRuleLevel() {
|
||||||
return level -> !level.equals(RuleLevel.UNSPECIFIED);
|
return level -> level != RuleLevel.UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void writeRuleset(
|
private static void writeRuleset(
|
||||||
|
@ -81,7 +86,7 @@ class CheckstyleWriter implements CommandLineRunner {
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
if (fileExists(template.toFile())) {
|
if (fileExists(template.toFile())) {
|
||||||
log.info("Writing ruleset: {}", outputPath);
|
log.info("Writing ruleset: {}", outputPath);
|
||||||
final String xmlTemplate = new String(Files.readAllBytes(template), StandardCharsets.UTF_8);
|
final String xmlTemplate = Files.readString(template);
|
||||||
writeRuleset(outputPath, ruleset(checkerRules, treeWalkerRules, xmlTemplate));
|
writeRuleset(outputPath, ruleset(checkerRules, treeWalkerRules, xmlTemplate));
|
||||||
} else {
|
} else {
|
||||||
throw new TemplateNotFoundException(template);
|
throw new TemplateNotFoundException(template);
|
||||||
|
@ -95,11 +100,12 @@ class CheckstyleWriter implements CommandLineRunner {
|
||||||
.forEach(this::writeCheckstyleFile);
|
.forEach(this::writeCheckstyleFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressFBWarnings("EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS")
|
||||||
private void writeCheckstyleFile(final RuleLevel ruleLevel) {
|
private void writeCheckstyleFile(final RuleLevel ruleLevel) {
|
||||||
final Path outputPath = outputPath(ruleLevel);
|
final Path outputPath = outputPath(ruleLevel);
|
||||||
final String checkerRules = enabledRules(ruleLevel, RuleParent.CHECKER);
|
final String checkerRules = enabledRules(ruleLevel, RuleParent.CHECKER);
|
||||||
final String treeWalkerRules = enabledRules(ruleLevel, RuleParent.TREEWALKER);
|
final String treeWalkerRules = enabledRules(ruleLevel, RuleParent.TREEWALKER);
|
||||||
final Path template = templateProperties.getCheckstyleXml();
|
final Path template = templateProps.getCheckstyleXml();
|
||||||
try {
|
try {
|
||||||
writeCheckstyleFileWithException(outputPath, checkerRules, treeWalkerRules, template);
|
writeCheckstyleFileWithException(outputPath, checkerRules, treeWalkerRules, template);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -120,7 +126,7 @@ class CheckstyleWriter implements CommandLineRunner {
|
||||||
return rulesProperties.getRules()
|
return rulesProperties.getRules()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(Rule::isEnabled)
|
.filter(Rule::isEnabled)
|
||||||
.filter(rule -> enabledSourceNames.contains(rule.getSource()))
|
.filter(rule -> enabledNames.contains(rule.getSource()))
|
||||||
.filter(Rule.hasParent(ruleParent))
|
.filter(Rule.hasParent(ruleParent))
|
||||||
.filter(Rule.isIncludedInLevel(ruleLevel))
|
.filter(Rule.isIncludedInLevel(ruleLevel))
|
||||||
.map(rule -> Rule.asModule(ruleClassLocator.apply(rule), rule))
|
.map(rule -> Rule.asModule(ruleClassLocator.apply(rule), rule))
|
||||||
|
|
|
@ -7,6 +7,8 @@ package net.kemitix.checkstyle.ruleset.builder;
|
||||||
*/
|
*/
|
||||||
class CheckstyleWriterException extends RuntimeException {
|
class CheckstyleWriterException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -2351827809632216096L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
public class ClassGraphPackageScanner implements PackageScanner {
|
public class ClassGraphPackageScanner implements PackageScanner {
|
||||||
|
|
||||||
private final ClassGraph classGraph = new ClassGraph();
|
private final transient ClassGraph classGraph = new ClassGraph();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final List<String> apply(final RuleSource ruleSource) {
|
public final List<String> apply(final RuleSource ruleSource) {
|
||||||
|
|
|
@ -57,7 +57,6 @@ public class DefaultReadmeIndexBuilder implements ReadmeIndexBuilder {
|
||||||
|
|
||||||
private String source(final Rule rule) {
|
private String source(final Rule rule) {
|
||||||
return rule.getSource()
|
return rule.getSource()
|
||||||
.toString()
|
|
||||||
.toLowerCase(LOCALE);
|
.toLowerCase(LOCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.kemitix.checkstyle.ruleset.builder;
|
package net.kemitix.checkstyle.ruleset.builder;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -13,19 +14,12 @@ import java.util.Objects;
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net).
|
* @author Paul Campbell (pcampbell@kemitix.net).
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
//@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DefaultRuleClassLocator implements RuleClassLocator {
|
public class DefaultRuleClassLocator implements RuleClassLocator {
|
||||||
|
|
||||||
private final Map<RuleSource, List<String>> checkClasses;
|
private final Map<RuleSource, List<String>> checkClasses;
|
||||||
private final SourcesProperties sourcesProperties;
|
private final SourcesProperties sourcesProperties;
|
||||||
|
|
||||||
public DefaultRuleClassLocator(
|
|
||||||
final Map<RuleSource, List<String>> checkClasses,
|
|
||||||
final SourcesProperties sourcesProperties) {
|
|
||||||
this.checkClasses = checkClasses;
|
|
||||||
this.sourcesProperties = sourcesProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String apply(final Rule rule) {
|
public final String apply(final Rule rule) {
|
||||||
return getCanonicalClassName(rule.getSource(), rule.getName());
|
return getCanonicalClassName(rule.getSource(), rule.getName());
|
||||||
|
@ -50,8 +44,8 @@ public class DefaultRuleClassLocator implements RuleClassLocator {
|
||||||
final String classname,
|
final String classname,
|
||||||
final String name
|
final String name
|
||||||
) {
|
) {
|
||||||
final String classNameWithDelimiter = "." + name;
|
final String delimitedName = "." + name;
|
||||||
return classname.endsWith(classNameWithDelimiter)
|
return classname.endsWith(delimitedName)
|
||||||
|| classname.endsWith(classNameWithDelimiter + "Check");
|
|| classname.endsWith(delimitedName + "Check");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.kemitix.checkstyle.ruleset.builder;
|
package net.kemitix.checkstyle.ruleset.builder;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -19,13 +20,14 @@ import java.util.stream.Stream;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class DefaultRuleReadmeLoader implements RuleReadmeLoader {
|
class DefaultRuleReadmeLoader implements RuleReadmeLoader {
|
||||||
|
|
||||||
private final TemplateProperties templateProperties;
|
private final TemplateProperties templateProps;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("EXS_EXCEPTION_SOFTENING_NO_CHECKED")
|
||||||
public Stream<String> load(final Rule rule) {
|
public Stream<String> load(final Rule rule) {
|
||||||
if (rule.isEnabled()) {
|
if (rule.isEnabled()) {
|
||||||
final Path resolve =
|
final Path resolve =
|
||||||
templateProperties.getReadmeFragments()
|
templateProps.getReadmeFragments()
|
||||||
.resolve(rule.getName() + ".md");
|
.resolve(rule.getName() + ".md");
|
||||||
log.info("Loading fragment: {}", resolve);
|
log.info("Loading fragment: {}", resolve);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -21,16 +21,12 @@ public class ReadmeBuilder {
|
||||||
* @return the formatted readme document.
|
* @return the formatted readme document.
|
||||||
*/
|
*/
|
||||||
public String build(final String readmeTemplate) {
|
public String build(final String readmeTemplate) {
|
||||||
String enabledCheckstyle = ruleLoader.loadEnabled(CHECKSTYLE);
|
|
||||||
String enabledSevntu = ruleLoader.loadEnabled(SEVNTU);
|
|
||||||
String disabledCheckstyle = ruleLoader.loadDisabled(CHECKSTYLE);
|
|
||||||
String disabledSevntu = ruleLoader.loadDisabled(SEVNTU);
|
|
||||||
return String.format(readmeTemplate,
|
return String.format(readmeTemplate,
|
||||||
indexBuilder.build(),
|
indexBuilder.build(),
|
||||||
enabledCheckstyle,
|
ruleLoader.loadEnabled(CHECKSTYLE),
|
||||||
enabledSevntu,
|
ruleLoader.loadEnabled(SEVNTU),
|
||||||
disabledCheckstyle,
|
ruleLoader.loadDisabled(CHECKSTYLE),
|
||||||
disabledSevntu);
|
ruleLoader.loadDisabled(SEVNTU));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ package net.kemitix.checkstyle.ruleset.builder;
|
||||||
*/
|
*/
|
||||||
class ReadmeFragmentNotFoundException extends RuntimeException {
|
class ReadmeFragmentNotFoundException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1947381338394993108L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|
|
@ -12,5 +12,5 @@ public interface ReadmeIndexBuilder {
|
||||||
*
|
*
|
||||||
* @return The rule index.
|
* @return The rule index.
|
||||||
*/
|
*/
|
||||||
public abstract String build();
|
String build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.kemitix.checkstyle.ruleset.builder;
|
package net.kemitix.checkstyle.ruleset.builder;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.kemitix.files.FileReaderWriter;
|
import net.kemitix.files.FileReaderWriter;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
@ -17,17 +18,18 @@ import java.nio.file.Paths;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class ReadmeWriter implements CommandLineRunner {
|
class ReadmeWriter implements CommandLineRunner {
|
||||||
|
|
||||||
private final TemplateProperties templateProperties;
|
private final TemplateProperties templateProps;
|
||||||
private final OutputProperties outputProperties;
|
private final OutputProperties outputProperties;
|
||||||
private final ReadmeBuilder readmeBuilder;
|
private final ReadmeBuilder readmeBuilder;
|
||||||
private final FileReaderWriter fileReaderWriter;
|
private final FileReaderWriter fileReaderWriter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("PATH_TRAVERSAL_IN")
|
||||||
public void run(final String... args) throws Exception {
|
public void run(final String... args) throws Exception {
|
||||||
File templateFile = templateProperties.getReadmeTemplate();
|
final File templateFile = templateProps.getReadmeTemplate();
|
||||||
String templateBody = fileReaderWriter.read(templateFile);
|
final String templateBody = fileReaderWriter.read(templateFile);
|
||||||
File outputFile = Paths.get(outputProperties.getReadme()).toFile();
|
final File outputFile = Paths.get(outputProperties.getReadme()).toFile();
|
||||||
String outputBody = readmeBuilder.build(templateBody);
|
final String outputBody = readmeBuilder.build(templateBody);
|
||||||
fileReaderWriter.write(outputFile, outputBody);
|
fileReaderWriter.write(outputFile, outputBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,14 @@ public class Rule {
|
||||||
|
|
||||||
private static final Locale LOCALE = Locale.ENGLISH;
|
private static final Locale LOCALE = Locale.ENGLISH;
|
||||||
|
|
||||||
private static final String MODULE_NO_PROPERTIES = "<module name=\"%s\"/>";
|
private static final String NO_PROPERTIES = "<module name=\"%s\"/>";
|
||||||
|
|
||||||
private static final String MODULE_WITH_PROPERTIES = "<module name=\"%s\">%n%s%n</module>";
|
private static final String WITH_PROPERTIES = "<module name=\"%s\">%n%s%n</module>";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration properties.
|
* Configuration properties.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("PMD.UseConcurrentHashMap")
|
||||||
private final Map<String, String> properties = new HashMap<>();
|
private final Map<String, String> properties = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,10 +96,9 @@ public class Rule {
|
||||||
* @return a Predicate to check a Rule
|
* @return a Predicate to check a Rule
|
||||||
*/
|
*/
|
||||||
static Predicate<Rule> hasParent(final RuleParent ruleParent) {
|
static Predicate<Rule> hasParent(final RuleParent ruleParent) {
|
||||||
return rule -> ruleParent.equals(rule.getParent());
|
return rule -> ruleParent == rule.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Predicate to check that the Rule is included in the given RuleLevel.
|
* Predicate to check that the Rule is included in the given RuleLevel.
|
||||||
*
|
*
|
||||||
|
@ -143,14 +143,14 @@ public class Rule {
|
||||||
private static String moduleNoParameters(
|
private static String moduleNoParameters(
|
||||||
final String ruleClassname
|
final String ruleClassname
|
||||||
) {
|
) {
|
||||||
return String.format(MODULE_NO_PROPERTIES, ruleClassname);
|
return String.format(NO_PROPERTIES, ruleClassname);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String moduleWithParameters(
|
private static String moduleWithParameters(
|
||||||
final Rule rule,
|
final Rule rule,
|
||||||
final String ruleClassname
|
final String ruleClassname
|
||||||
) {
|
) {
|
||||||
return String.format(MODULE_WITH_PROPERTIES, ruleClassname, formatProperties(rule.getProperties()));
|
return String.format(WITH_PROPERTIES, ruleClassname, formatProperties(rule.getProperties()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class RuleLoader {
|
||||||
* @return a formatted string containing the disabled rules.
|
* @return a formatted string containing the disabled rules.
|
||||||
*/
|
*/
|
||||||
public String loadDisabled(final String sourceName) {
|
public String loadDisabled(final String sourceName) {
|
||||||
boolean enabledRuleSource = isEnabledRuleSource(sourceName);
|
final boolean enabledRuleSource = isEnabledRuleSource(sourceName);
|
||||||
return readmeRules(rule ->
|
return readmeRules(rule ->
|
||||||
rule.isFromSource(sourceName)
|
rule.isFromSource(sourceName)
|
||||||
&& (!enabledRuleSource || !rule.isEnabled()));
|
&& (!enabledRuleSource || !rule.isEnabled()));
|
||||||
|
|
|
@ -17,5 +17,5 @@ interface RuleReadmeLoader {
|
||||||
*
|
*
|
||||||
* @return A Stream of the readme fragment.
|
* @return A Stream of the readme fragment.
|
||||||
*/
|
*/
|
||||||
public abstract Stream<String> load(Rule rule);
|
Stream<String> load(Rule rule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,17 @@ import java.util.Optional;
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConfigurationProperties
|
@ConfigurationProperties("")
|
||||||
class SourcesProperties {
|
class SourcesProperties {
|
||||||
|
|
||||||
private List<RuleSource> sources = new ArrayList<>();
|
private List<RuleSource> sources = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for a RuleSource by name.
|
||||||
|
*
|
||||||
|
* @param sourceName the name of the source
|
||||||
|
* @return an Optional containing the RuleSource if found
|
||||||
|
*/
|
||||||
public Optional<RuleSource> findSource(final String sourceName) {
|
public Optional<RuleSource> findSource(final String sourceName) {
|
||||||
return sources.stream()
|
return sources.stream()
|
||||||
.filter(ruleSource -> ruleSource.getName().equals(sourceName))
|
.filter(ruleSource -> ruleSource.getName().equals(sourceName))
|
||||||
|
|
|
@ -9,6 +9,8 @@ import java.nio.file.Path;
|
||||||
*/
|
*/
|
||||||
class TemplateNotFoundException extends RuntimeException {
|
class TemplateNotFoundException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5054401608077696337L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|
|
@ -430,6 +430,7 @@ rules:
|
||||||
enabled: false
|
enabled: false
|
||||||
source: CHECKSTYLE
|
source: CHECKSTYLE
|
||||||
uri: http://checkstyle.sourceforge.net/config_modifier.html#InterfaceMemberImpliedModifier
|
uri: http://checkstyle.sourceforge.net/config_modifier.html#InterfaceMemberImpliedModifier
|
||||||
|
reason: Makes interfaces overly verbose.
|
||||||
-
|
-
|
||||||
name: InterfaceTypeParameterName
|
name: InterfaceTypeParameterName
|
||||||
parent: TREEWALKER
|
parent: TREEWALKER
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>net.kemitix.checkstyle</groupId>
|
<groupId>net.kemitix.checkstyle</groupId>
|
||||||
<artifactId>kemitix-checkstyle-ruleset</artifactId>
|
<artifactId>kemitix-checkstyle-ruleset</artifactId>
|
||||||
<version>5.4.1</version>
|
<version>5.5.0</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<groupId>net.kemitix.checkstyle</groupId>
|
<groupId>net.kemitix.checkstyle</groupId>
|
||||||
<artifactId>ruleset</artifactId>
|
<artifactId>ruleset</artifactId>
|
||||||
<version>5.4.1</version>
|
<version>5.5.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Kemitix Checkstyle Ruleset</name>
|
<name>Kemitix Checkstyle Ruleset</name>
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<tiles-maven-plugin.version>2.19</tiles-maven-plugin.version>
|
<tiles-maven-plugin.version>2.19</tiles-maven-plugin.version>
|
||||||
<kemitix-tiles.version>2.7.0</kemitix-tiles.version>
|
<kemitix-tiles.version>3.0.1</kemitix-tiles.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
|
@ -57,7 +57,6 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<tiles>
|
<tiles>
|
||||||
<tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile>
|
<tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile>
|
||||||
<tile>net.kemitix.tiles:enforcer:${kemitix-tiles.version}</tile>
|
|
||||||
</tiles>
|
</tiles>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -66,7 +66,6 @@
|
||||||
</module>
|
</module>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck"/>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck"/>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.modifier.InterfaceMemberImpliedModifierCheck"/>
|
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.naming.InterfaceTypeParameterNameCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.naming.InterfaceTypeParameterNameCheck"/>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck"/>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
|
||||||
|
|
|
@ -86,7 +86,6 @@
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck"/>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck"/>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.design.InterfaceIsTypeCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.design.InterfaceIsTypeCheck"/>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.modifier.InterfaceMemberImpliedModifierCheck"/>
|
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.naming.InterfaceTypeParameterNameCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.naming.InterfaceTypeParameterNameCheck"/>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck"/>
|
||||||
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
|
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
|
|
||||||
<groupId>net.kemitix.checkstyle</groupId>
|
<groupId>net.kemitix.checkstyle</groupId>
|
||||||
<artifactId>tile</artifactId>
|
<artifactId>tile</artifactId>
|
||||||
<version>5.4.1</version>
|
<version>5.5.0</version>
|
||||||
|
|
||||||
<packaging>tile</packaging>
|
<packaging>tile</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<tiles-maven-plugin.version>2.19</tiles-maven-plugin.version>
|
<tiles-maven-plugin.version>2.19</tiles-maven-plugin.version>
|
||||||
<kemitix-maven-tiles.version>2.7.0</kemitix-maven-tiles.version>
|
<kemitix-maven-tiles.version>3.0.1</kemitix-maven-tiles.version>
|
||||||
|
|
||||||
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
|
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
|
||||||
<checkstyle.version>8.41</checkstyle.version>
|
<checkstyle.version>8.41</checkstyle.version>
|
||||||
|
|
Loading…
Reference in a new issue