Skip to content

Commit 69a9eac

Browse files
committed
Add baseline file for testing
1 parent 5a28245 commit 69a9eac

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

.github/workflows/bld.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
working-directory: examples
2929
run: ./bld download
3030

31-
- name: Run tests [examples]
31+
- name: Run Detekt [examples]
3232
working-directory: examples
33-
run: ./bld compile test
33+
run: ./bld compile test-ci
3434

3535
- name: Download dependencies
3636
run: ./bld download

examples/src/bld/java/com/example/ExampleBuild.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,13 @@ public void detektTest() throws ExitStatusException, IOException, InterruptedExc
101101
.input("src/test/kotlin")
102102
.execute();
103103
}
104+
105+
@BuildCommand(value = "test-ci", summary = "Run detek with a test baseline")
106+
public void testCi() throws ExitStatusException, IOException, InterruptedException {
107+
// Run detek with the test basline (for CI testing)
108+
new DetektOperation()
109+
.fromProject(this)
110+
.baseline("src/test/resources/detekt-baseline.xml")
111+
.execute();
112+
}
104113
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
<SmellBaseline>
3+
<ManuallySuppressedIssues/>
4+
<CurrentIssues>
5+
<ID>EmptyIfBlock:Example.kt$Example.Companion${ }</ID>
6+
<ID>MagicNumber:Example.kt$Example$5</ID>
7+
<ID>NewLineAtEndOfFile:ExampleTest.kt$com.example.ExampleTest.kt</ID>
8+
<ID>ThrowingExceptionsWithoutMessageOrCause:Example.kt$Example.Companion$IllegalStateException()</ID>
9+
<ID>UseCheckOrError:Example.kt$Example.Companion$throw IllegalStateException()</ID>
10+
<ID>VariableNaming:Example.kt$Example$// https://detekt.dev/docs/rules/naming#variablenaming val Message: String get() = "Hello World!"</ID>
11+
</CurrentIssues>
12+
</SmellBaseline>

src/test/java/rife/bld/extension/DetektOperationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void testConfigResource() {
244244
void testExampleBaseline() throws IOException, ExitStatusException, InterruptedException {
245245
var tmpDir = Files.createTempDirectory("bld-detekt-").toFile();
246246

247-
var baseline = new File(tmpDir, "detekt-baseline.xml");
247+
var baseline = new File(tmpDir, "examples/src/test/resources/detekt-baseline.xml");
248248

249249
var op = new DetektOperation()
250250
.fromProject(new BaseProjectBlueprint(new File("examples"), "com.example",

0 commit comments

Comments
 (0)