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:
dependabot-preview[bot] 2021-03-13 17:34:51 +00:00 committed by GitHub
parent fbf54dc13a
commit 426e3b25fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 83 additions and 72 deletions

View file

@ -161,7 +161,7 @@ Rule|Level|Source|Enabled|Suppressible
[InnerAssignment](#innerassignment)|tweaks|checkstyle|Yes|
[InnerTypeLast](#innertypelast)|tweaks|checkstyle|Yes|
[InterfaceIsType](#interfaceistype)|complexity|checkstyle|Yes|
[InterfaceMemberImpliedModifier](#interfacememberimpliedmodifier)|tweaks|checkstyle|Yes|
[InterfaceMemberImpliedModifier](#interfacememberimpliedmodifier)|tweaks|checkstyle||
[InterfaceTypeParameterName](#interfacetypeparametername)|naming|checkstyle|Yes|
[JavadocMethod](#javadocmethod)|javadoc|checkstyle||
[JavadocPackage](#javadocpackage)|javadoc|checkstyle|Yes|
@ -1115,11 +1115,6 @@ interface 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)
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)
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)
Only exceptional cases should need to be documented.

View file

@ -14,7 +14,7 @@
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>builder</artifactId>
<packaging>jar</packaging>
<version>5.4.1</version>
<version>5.5.0</version>
<properties>
<maven.install.skip>true</maven.install.skip>
@ -22,14 +22,14 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<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>
<sevntu.version>1.38.0</sevntu.version>
<sevntu-plugin.version>1.35.0</sevntu-plugin.version>
<lombok.version>1.18.18</lombok.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>
<map-builder.version>1.0.0</map-builder.version>
<mockito.version>3.8.0</mockito.version>
@ -145,14 +145,14 @@
<extensions>true</extensions>
<configuration>
<tiles>
<tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:enforcer:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:compiler-jdk-11:${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>
<tile>net.kemitix.tiles:maven-plugins:${kemitix-maven-tiles.version}</tile>
<tile>net.kemitix.tiles:compiler-jdk-lts:${kemitix-maven-tiles.version}</tile>
<tile>net.kemitix.tiles:pmd:${kemitix-maven-tiles.version}</tile>
<tile>net.kemitix.tiles:testing:${kemitix-maven-tiles.version}</tile>
<tile>net.kemitix.tiles:spotbugs:${kemitix-maven-tiles.version}</tile>
<!-- <tile>net.kemitix.tiles:coverage:${kemitix-maven-tiles.version}</tile>-->
<tile>net.kemitix.tiles:pitest:${kemitix-maven-tiles.version}</tile>
<tile>net.kemitix.tiles:pmd-strict:${kemitix-maven-tiles.version}</tile>
</tiles>
</configuration>
</plugin>

View file

@ -7,6 +7,8 @@ package net.kemitix.checkstyle.ruleset.builder;
*/
public class CheckstyleClassNotFoundException extends RuntimeException {
private static final long serialVersionUID = -4752607844086418212L;
/**
* Constructor.
*

View file

@ -14,8 +14,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
*/
@EnableConfigurationProperties({RulesProperties.class, OutputProperties.class})
@SpringBootApplication
@SuppressWarnings("hideutilityclassconstructor")
public class CheckstyleRulesetBuilderApplication {
@SuppressWarnings({"hideutilityclassconstructor", "PMD.AbstractClassWithoutAbstractMethod"})
public abstract class CheckstyleRulesetBuilderApplication {
/**
* Main methods.

View file

@ -9,6 +9,8 @@ import java.io.IOException;
*/
public class CheckstyleSourceLoadException extends RuntimeException {
private static final long serialVersionUID = 4770223195735989937L;
/**
* Constructor.
*

View file

@ -1,5 +1,6 @@
package net.kemitix.checkstyle.ruleset.builder;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
@ -31,18 +32,22 @@ class CheckstyleWriter implements CommandLineRunner {
private final OutputProperties outputProperties;
private final TemplateProperties templateProperties;
private final TemplateProperties templateProps;
private final RulesProperties rulesProperties;
private final RuleClassLocator ruleClassLocator;
private final SourcesProperties sourcesProperties;
private final Set<String> enabledSourceNames = new HashSet<>();
private final Set<String> enabledNames = new HashSet<>();
/**
* Builds list of enabled sources.
*/
@PostConstruct
public void init() {
enabledSourceNames.addAll(
enabledNames.addAll(
sourcesProperties.getSources()
.stream()
.filter(RuleSource::isEnabled)
@ -51,7 +56,7 @@ class CheckstyleWriter implements CommandLineRunner {
}
private static Predicate<RuleLevel> excludeUnspecifiedRuleLevel() {
return level -> !level.equals(RuleLevel.UNSPECIFIED);
return level -> level != RuleLevel.UNSPECIFIED;
}
private static void writeRuleset(
@ -81,7 +86,7 @@ class CheckstyleWriter implements CommandLineRunner {
) throws IOException {
if (fileExists(template.toFile())) {
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));
} else {
throw new TemplateNotFoundException(template);
@ -95,11 +100,12 @@ class CheckstyleWriter implements CommandLineRunner {
.forEach(this::writeCheckstyleFile);
}
@SuppressFBWarnings("EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS")
private void writeCheckstyleFile(final RuleLevel ruleLevel) {
final Path outputPath = outputPath(ruleLevel);
final String checkerRules = enabledRules(ruleLevel, RuleParent.CHECKER);
final String treeWalkerRules = enabledRules(ruleLevel, RuleParent.TREEWALKER);
final Path template = templateProperties.getCheckstyleXml();
final Path template = templateProps.getCheckstyleXml();
try {
writeCheckstyleFileWithException(outputPath, checkerRules, treeWalkerRules, template);
} catch (IOException e) {
@ -120,7 +126,7 @@ class CheckstyleWriter implements CommandLineRunner {
return rulesProperties.getRules()
.stream()
.filter(Rule::isEnabled)
.filter(rule -> enabledSourceNames.contains(rule.getSource()))
.filter(rule -> enabledNames.contains(rule.getSource()))
.filter(Rule.hasParent(ruleParent))
.filter(Rule.isIncludedInLevel(ruleLevel))
.map(rule -> Rule.asModule(ruleClassLocator.apply(rule), rule))

View file

@ -7,6 +7,8 @@ package net.kemitix.checkstyle.ruleset.builder;
*/
class CheckstyleWriterException extends RuntimeException {
private static final long serialVersionUID = -2351827809632216096L;
/**
* Constructor.
*

View file

@ -17,7 +17,7 @@ import java.util.stream.Collectors;
@Service
public class ClassGraphPackageScanner implements PackageScanner {
private final ClassGraph classGraph = new ClassGraph();
private final transient ClassGraph classGraph = new ClassGraph();
@Override
public final List<String> apply(final RuleSource ruleSource) {

View file

@ -57,7 +57,6 @@ public class DefaultReadmeIndexBuilder implements ReadmeIndexBuilder {
private String source(final Rule rule) {
return rule.getSource()
.toString()
.toLowerCase(LOCALE);
}

View file

@ -1,5 +1,6 @@
package net.kemitix.checkstyle.ruleset.builder;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@ -13,19 +14,12 @@ import java.util.Objects;
* @author Paul Campbell (pcampbell@kemitix.net).
*/
@Service
//@RequiredArgsConstructor
@RequiredArgsConstructor
public class DefaultRuleClassLocator implements RuleClassLocator {
private final Map<RuleSource, List<String>> checkClasses;
private final SourcesProperties sourcesProperties;
public DefaultRuleClassLocator(
final Map<RuleSource, List<String>> checkClasses,
final SourcesProperties sourcesProperties) {
this.checkClasses = checkClasses;
this.sourcesProperties = sourcesProperties;
}
@Override
public final String apply(final Rule rule) {
return getCanonicalClassName(rule.getSource(), rule.getName());
@ -50,8 +44,8 @@ public class DefaultRuleClassLocator implements RuleClassLocator {
final String classname,
final String name
) {
final String classNameWithDelimiter = "." + name;
return classname.endsWith(classNameWithDelimiter)
|| classname.endsWith(classNameWithDelimiter + "Check");
final String delimitedName = "." + name;
return classname.endsWith(delimitedName)
|| classname.endsWith(delimitedName + "Check");
}
}

View file

@ -1,5 +1,6 @@
package net.kemitix.checkstyle.ruleset.builder;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -19,13 +20,14 @@ import java.util.stream.Stream;
@RequiredArgsConstructor
class DefaultRuleReadmeLoader implements RuleReadmeLoader {
private final TemplateProperties templateProperties;
private final TemplateProperties templateProps;
@Override
@SuppressFBWarnings("EXS_EXCEPTION_SOFTENING_NO_CHECKED")
public Stream<String> load(final Rule rule) {
if (rule.isEnabled()) {
final Path resolve =
templateProperties.getReadmeFragments()
templateProps.getReadmeFragments()
.resolve(rule.getName() + ".md");
log.info("Loading fragment: {}", resolve);
try {

View file

@ -21,16 +21,12 @@ public class ReadmeBuilder {
* @return the formatted readme document.
*/
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,
indexBuilder.build(),
enabledCheckstyle,
enabledSevntu,
disabledCheckstyle,
disabledSevntu);
ruleLoader.loadEnabled(CHECKSTYLE),
ruleLoader.loadEnabled(SEVNTU),
ruleLoader.loadDisabled(CHECKSTYLE),
ruleLoader.loadDisabled(SEVNTU));
}
}

View file

@ -7,6 +7,8 @@ package net.kemitix.checkstyle.ruleset.builder;
*/
class ReadmeFragmentNotFoundException extends RuntimeException {
private static final long serialVersionUID = 1947381338394993108L;
/**
* Constructor.
*

View file

@ -12,5 +12,5 @@ public interface ReadmeIndexBuilder {
*
* @return The rule index.
*/
public abstract String build();
String build();
}

View file

@ -1,5 +1,6 @@
package net.kemitix.checkstyle.ruleset.builder;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import lombok.RequiredArgsConstructor;
import net.kemitix.files.FileReaderWriter;
import org.springframework.boot.CommandLineRunner;
@ -17,17 +18,18 @@ import java.nio.file.Paths;
@RequiredArgsConstructor
class ReadmeWriter implements CommandLineRunner {
private final TemplateProperties templateProperties;
private final TemplateProperties templateProps;
private final OutputProperties outputProperties;
private final ReadmeBuilder readmeBuilder;
private final FileReaderWriter fileReaderWriter;
@Override
@SuppressFBWarnings("PATH_TRAVERSAL_IN")
public void run(final String... args) throws Exception {
File templateFile = templateProperties.getReadmeTemplate();
String templateBody = fileReaderWriter.read(templateFile);
File outputFile = Paths.get(outputProperties.getReadme()).toFile();
String outputBody = readmeBuilder.build(templateBody);
final File templateFile = templateProps.getReadmeTemplate();
final String templateBody = fileReaderWriter.read(templateFile);
final File outputFile = Paths.get(outputProperties.getReadme()).toFile();
final String outputBody = readmeBuilder.build(templateBody);
fileReaderWriter.write(outputFile, outputBody);
}

View file

@ -23,13 +23,14 @@ public class Rule {
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.
*/
@SuppressWarnings("PMD.UseConcurrentHashMap")
private final Map<String, String> properties = new HashMap<>();
/**
@ -95,10 +96,9 @@ public class Rule {
* @return a Predicate to check a Rule
*/
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.
*
@ -143,14 +143,14 @@ public class Rule {
private static String moduleNoParameters(
final String ruleClassname
) {
return String.format(MODULE_NO_PROPERTIES, ruleClassname);
return String.format(NO_PROPERTIES, ruleClassname);
}
private static String moduleWithParameters(
final Rule rule,
final String ruleClassname
) {
return String.format(MODULE_WITH_PROPERTIES, ruleClassname, formatProperties(rule.getProperties()));
return String.format(WITH_PROPERTIES, ruleClassname, formatProperties(rule.getProperties()));
}
/**

View file

@ -40,7 +40,7 @@ public class RuleLoader {
* @return a formatted string containing the disabled rules.
*/
public String loadDisabled(final String sourceName) {
boolean enabledRuleSource = isEnabledRuleSource(sourceName);
final boolean enabledRuleSource = isEnabledRuleSource(sourceName);
return readmeRules(rule ->
rule.isFromSource(sourceName)
&& (!enabledRuleSource || !rule.isEnabled()));

View file

@ -17,5 +17,5 @@ interface RuleReadmeLoader {
*
* @return A Stream of the readme fragment.
*/
public abstract Stream<String> load(Rule rule);
Stream<String> load(Rule rule);
}

View file

@ -17,11 +17,17 @@ import java.util.Optional;
@Setter
@Getter
@Configuration
@ConfigurationProperties
@ConfigurationProperties("")
class SourcesProperties {
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) {
return sources.stream()
.filter(ruleSource -> ruleSource.getName().equals(sourceName))

View file

@ -9,6 +9,8 @@ import java.nio.file.Path;
*/
class TemplateNotFoundException extends RuntimeException {
private static final long serialVersionUID = -5054401608077696337L;
/**
* Constructor.
*

View file

@ -430,6 +430,7 @@ rules:
enabled: false
source: CHECKSTYLE
uri: http://checkstyle.sourceforge.net/config_modifier.html#InterfaceMemberImpliedModifier
reason: Makes interfaces overly verbose.
-
name: InterfaceTypeParameterName
parent: TREEWALKER

View file

@ -6,7 +6,7 @@
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>kemitix-checkstyle-ruleset</artifactId>
<version>5.4.1</version>
<version>5.5.0</version>
<packaging>pom</packaging>
<properties>

View file

@ -13,7 +13,7 @@
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>ruleset</artifactId>
<version>5.4.1</version>
<version>5.5.0</version>
<packaging>jar</packaging>
<name>Kemitix Checkstyle Ruleset</name>
@ -22,7 +22,7 @@
<properties>
<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>
<licenses>
@ -57,7 +57,6 @@
<configuration>
<tiles>
<tile>net.kemitix.tiles:maven-plugins:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:enforcer:${kemitix-tiles.version}</tile>
</tiles>
</configuration>
</plugin>

View file

@ -66,7 +66,6 @@
</module>
<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.modifier.InterfaceMemberImpliedModifierCheck"/>
<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.JavadocStyleCheck"/>

View file

@ -86,7 +86,6 @@
<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.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.javadoc.JavadocParagraphCheck"/>
<module name="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>

View file

@ -12,13 +12,13 @@
<groupId>net.kemitix.checkstyle</groupId>
<artifactId>tile</artifactId>
<version>5.4.1</version>
<version>5.5.0</version>
<packaging>tile</packaging>
<properties>
<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>
<checkstyle.version>8.41</checkstyle.version>