Add baseline file for testing

This commit is contained in:
Erik C. Thauvin 2025-03-24 16:13:07 -07:00
parent 5a2824507f
commit 69a9eac414
Signed by: erik
GPG key ID: 776702A6A2DA330E
4 changed files with 24 additions and 3 deletions

View file

@ -28,9 +28,9 @@ jobs:
working-directory: examples
run: ./bld download
- name: Run tests [examples]
- name: Run Detekt [examples]
working-directory: examples
run: ./bld compile test
run: ./bld compile test-ci
- name: Download dependencies
run: ./bld download

View file

@ -101,4 +101,13 @@ public class ExampleBuild extends Project {
.input("src/test/kotlin")
.execute();
}
@BuildCommand(value = "test-ci", summary = "Run detek with a test baseline")
public void testCi() throws ExitStatusException, IOException, InterruptedException {
// Run detek with the test basline (for CI testing)
new DetektOperation()
.fromProject(this)
.baseline("src/test/resources/detekt-baseline.xml")
.execute();
}
}

View file

@ -0,0 +1,12 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>EmptyIfBlock:Example.kt$Example.Companion${ }</ID>
<ID>MagicNumber:Example.kt$Example$5</ID>
<ID>NewLineAtEndOfFile:ExampleTest.kt$com.example.ExampleTest.kt</ID>
<ID>ThrowingExceptionsWithoutMessageOrCause:Example.kt$Example.Companion$IllegalStateException()</ID>
<ID>UseCheckOrError:Example.kt$Example.Companion$throw IllegalStateException()</ID>
<ID>VariableNaming:Example.kt$Example$// https://detekt.dev/docs/rules/naming#variablenaming val Message: String get() = "Hello World!"</ID>
</CurrentIssues>
</SmellBaseline>

View file

@ -244,7 +244,7 @@ class DetektOperationTest {
void testExampleBaseline() throws IOException, ExitStatusException, InterruptedException {
var tmpDir = Files.createTempDirectory("bld-detekt-").toFile();
var baseline = new File(tmpDir, "detekt-baseline.xml");
var baseline = new File(tmpDir, "examples/src/test/resources/detekt-baseline.xml");
var op = new DetektOperation()
.fromProject(new BaseProjectBlueprint(new File("examples"), "com.example",