Skip to content

Commit

Permalink
exclude test sources from Konsist rules
Browse files Browse the repository at this point in the history
  • Loading branch information
belagertem committed Apr 8, 2024
1 parent 53f9e4f commit 6f44391
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@ class KonsistArchitecturalRules {

companion object {

fun checkNameOfRequirementTestClasses(moduleName: String) {
Konsist.scopeFromModule(moduleName).classes()
fun checkNameOfRequirementTestClasses(moduleName: String, sourceSet: String = "main") {
Konsist.scopeFromProject(moduleName = moduleName, sourceSetName = sourceSet).classes()
.filter { it.resideInPackage("..direct..") || it.resideInPackage("..invariant..") }
.assertTrue {
it.name.endsWith("Test")
}
}

fun checkAnnotationsOfRequirementTests(
moduleName: String
moduleName: String,
sourceSet: String = "main"
) {
Konsist.scopeFromModule(moduleName).functions()
Konsist.scopeFromProject(moduleName = moduleName, sourceSetName = sourceSet).functions()
.filter { it.resideInPackage("..direct..") || it.resideInPackage("..invariant..") }
.withAnnotationOf(org.junit.jupiter.api.Test::class)
.assertTrue {
Expand Down

0 comments on commit 6f44391

Please sign in to comment.