Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a priority field for DetektProvider so tools can easier choos…
…e their provider implemention in tests for example (#4923)
- Loading branch information
1 parent
cdf487a
commit 7c485f5
Showing
4 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
detekt-tooling/src/test/kotlin/io/github/detekt/tooling/api/DetektProviderSpec.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.github.detekt.tooling.api | ||
|
||
import io.github.detekt.tooling.api.spec.ProcessingSpec | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
|
||
class DetektProviderSpec { | ||
|
||
@Test | ||
fun `load provider with highest priority`() { | ||
val provider = DetektProvider.load() | ||
|
||
assertThat(provider.priority).isEqualTo(100) | ||
} | ||
} | ||
|
||
class PrioritizedProvider : DetektProvider { | ||
override val priority: Int = 100 | ||
override fun get(processingSpec: ProcessingSpec): Detekt = error("No instances.") | ||
} |
1 change: 1 addition & 0 deletions
1
...-tooling/src/test/resources/META-INF/services/io.github.detekt.tooling.api.DetektProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.github.detekt.tooling.api.PrioritizedProvider |