Compare commits

...

4 commits

6 changed files with 76 additions and 21 deletions

14
.idea/misc.xml generated
View file

@ -3,20 +3,6 @@
<component name="EntryPointsManager">
<pattern value="rife.bld.extension.DetektOperationBuild" method="pmd" />
</component>
<component name="PDMPlugin">
<option name="customRuleSets">
<list>
<option value="K:\java\semver\config\pmd.xml" />
<option value="$PROJECT_DIR$/../bld-generated-version/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-pitest/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-jacoco-report/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-checkstyle/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-exec/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-testng/config/pmd.xml" />
</list>
</option>
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build" />
</component>

View file

@ -1,6 +1,6 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.4
bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.7
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.4
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=

View file

@ -31,7 +31,7 @@ public class ExampleBuild extends Project {
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES);
final var kotlin = version(1, 9, 24);
final var kotlin = version(2, 0, 0);
scope(compile)
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin));
scope(test)

View file

@ -34,7 +34,7 @@ public class DetektOperationBuild extends Project {
public DetektOperationBuild() {
pkg = "rife.bld.extension";
name = "DetektOperation";
version = version(0, 9, 4);
version = version(0, 9, 5, "SNAPSHOT");
javaRelease = 17;
downloadSources = true;
@ -47,7 +47,7 @@ public class DetektOperationBuild extends Project {
scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2)))
.include(dependency("org.assertj", "assertj-core", version(3, 25, 3)));
.include(dependency("org.assertj", "assertj-core", version(3, 26, 0)));
javadocOperation()
.javadocOptions()
.author()

View file

@ -257,10 +257,10 @@ public class DetektOperation extends AbstractProcessOperation<DetektOperation> {
super.execute();
if (successful_ && LOGGER.isLoggable(Level.INFO)) {
if (createBaseline_) {
LOGGER.info("Detekt baseline successfully generated: "
LOGGER.info("Detekt baseline generated successfully: "
+ "file://" + new File(baseline_).toURI().getPath());
} else {
LOGGER.info("Detekt executed successfully.");
LOGGER.info("Detekt operation finished successfully.");
}
}
}
@ -402,7 +402,7 @@ public class DetektOperation extends AbstractProcessOperation<DetektOperation> {
// report
if (!report_.isEmpty()) {
report_.forEach(it -> {
args.add("-r");
args.add("--report");
args.add(it.id().name().toLowerCase() + ":" + it.path());
});
}

View file

@ -18,6 +18,7 @@ package rife.bld.extension;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import rife.bld.BaseProject;
import rife.bld.blueprints.BaseProjectBlueprint;
import rife.bld.operations.exceptions.ExitStatusException;
@ -57,6 +58,74 @@ class DetektOperationTest {
}
}
@Test
void testCheckAllParameters() {
var params = List.of(
"--all-rules",
"--auto-correct",
"--base-path",
"--baseline",
"--build-upon-default-config",
"--classpath",
"--config",
"--config-resource",
"--create-baseline",
"--debug",
"--disable-default-rulesets",
"--excludes",
"--generate-config",
"--includes",
"--input",
"--jdk-home",
"--jvm-target",
"--language-version",
"--max-issues",
"--parallel",
"--plugins",
"--report"
);
var args = new DetektOperation()
.fromProject(new BaseProject())
.allRules(true)
.autoCorrect(true)
.basePath("basePath")
.baseline("baseline")
.buildUponDefaultConfig(true)
.classPath("classpath")
.classPath(List.of("path2", "path3"))
.config("config")
.config(List.of("config2", "config4"))
.configResource("configResource")
.createBaseline(true)
.debug(true)
.disableDefaultRuleSets(true)
.excludes("excludes")
.generateConfig(true)
.includes("patterns")
.input("input")
.jdkHome("jdkHome")
.jvmTarget("jvmTarget")
.languageVersion("languageVersion")
.maxIssues(10)
.parallel(true)
.plugins("jars")
.plugins(List.of("jars2", "jar3"))
.report(new DetektReport(DetektReportId.HTML, "reports"))
.executeConstructProcessCommandList();
for (var p : params) {
var found = false;
for (var a : args) {
if (a.startsWith(p)) {
found = true;
break;
}
}
assertThat(found).as(p + " not found.").isTrue();
}
}
@Test
void testExampleBaseline() throws IOException, ExitStatusException, InterruptedException {
var tmpDir = Files.createTempDirectory("bld-detekt-").toFile();