diff --git a/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt b/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt index d4db28b013..cea43d2cc2 100644 --- a/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt +++ b/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt @@ -125,7 +125,7 @@ data class CommonConfiguration(private val configuration: Map?) * List of directory names which will be used to detect test sources */ val testAnchors: List by lazy { - val testDirs = (configuration ?: emptyMap()).getOrDefault("testDirs", "test").split(',') + val testDirs = (configuration ?: emptyMap()).getOrDefault("testDirs", "test").split(',').map { it.trim() } if (testDirs.any { !it.lowercase(Locale.getDefault()).endsWith("test") }) { log.error("test directory names should end with `test`") } diff --git a/diktat-common/src/test/kotlin/org/cqfn/diktat/test/ConfigReaderTest.kt b/diktat-common/src/test/kotlin/org/cqfn/diktat/test/ConfigReaderTest.kt index 8d3287aa42..4d0802e289 100644 --- a/diktat-common/src/test/kotlin/org/cqfn/diktat/test/ConfigReaderTest.kt +++ b/diktat-common/src/test/kotlin/org/cqfn/diktat/test/ConfigReaderTest.kt @@ -25,6 +25,7 @@ class ConfigReaderTest { .readResource("src/test/resources/test-rules-config.yml") requireNotNull(rulesConfigList) assert(rulesConfigList.getCommonConfiguration().kotlinVersion == kotlinVersion) + assert(rulesConfigList.getCommonConfiguration().testAnchors.contains("androidUnitTest")) assert(rulesConfigList.find { it.name == DIKTAT_COMMON } ?.configuration ?.get("kotlinVersion") diff --git a/diktat-common/src/test/resources/test-rules-config.yml b/diktat-common/src/test/resources/test-rules-config.yml index 0e20745031..7ae20b78b7 100644 --- a/diktat-common/src/test/resources/test-rules-config.yml +++ b/diktat-common/src/test/resources/test-rules-config.yml @@ -3,6 +3,7 @@ configuration: domainName: org.cqfn.diktat kotlinVersion: 1.4.21 + testDirs: "test, androidUnitTest" - name: CLASS_NAME_INCORRECT enabled: true - name: CONSTANT_UPPERCASE