Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't exclude tests in WildcardImport Rule #5121

Merged
merged 3 commits into from Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/detekt/detekt.yml
Expand Up @@ -274,3 +274,6 @@ style:
VarCouldBeVal:
active: true
ignoreAnnotated: ['Parameter']
WildcardImport:
active: true
excludeImports: []
1 change: 0 additions & 1 deletion detekt-core/src/main/resources/default-detekt-config.yml
Expand Up @@ -716,6 +716,5 @@ style:
ignoreLateinitVar: false
WildcardImport:
active: true
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
excludeImports:
- 'java.util.*'
Expand Up @@ -60,7 +60,7 @@ import org.jetbrains.kotlin.com.intellij.lang.ASTNode
import org.jetbrains.kotlin.com.intellij.psi.impl.source.JavaDummyElement
import org.jetbrains.kotlin.com.intellij.psi.impl.source.JavaDummyHolder
import org.jetbrains.kotlin.psi.KtFile
import java.util.*
import java.util.LinkedList

/**
* Runs all KtLint rules.
Expand Down
Expand Up @@ -27,7 +27,6 @@ private object TestExclusions : Exclusions() {
override val ruleSets = emptySet<String>()
override val rules = setOf(
"FunctionNaming",
"WildcardImport",
"LateinitUsage",
"StringLiteralDuplication",
"SpreadOperator",
Expand Down
Expand Up @@ -10,8 +10,8 @@ class DeprecatedPrinterSpec {
fun `prints the correct properties`() {
val markdownString = DeprecatedPrinter.print(listOf(createRuleSetPage()))
val expectedMarkdownString = """
style>WildcardImport>conf2=use conf1 instead
style>WildcardImport>conf4=use conf3 instead
style>MagicNumber>conf2=use conf1 instead
style>MagicNumber>conf4=use conf3 instead

""".trimIndent()
assertThat(markdownString).isEqualTo(expectedMarkdownString)
Expand Down
Expand Up @@ -59,7 +59,7 @@ internal fun createRuleSetPage(): RuleSetPage {

internal fun createRules(): List<Rule> {
val rule1 = Rule(
name = "WildcardImport",
name = "MagicNumber",
description = "a wildcard import",
nonCompliantCodeExample = "import foo.*",
compliantCodeExample = "import foo.bar",
Expand Down
2 changes: 1 addition & 1 deletion detekt-generator/src/test/resources/RuleSet.md
@@ -1,6 +1,6 @@
style rule set

### WildcardImport
### MagicNumber

a wildcard import

Expand Down
4 changes: 2 additions & 2 deletions detekt-generator/src/test/resources/RuleSetConfig.yml
Expand Up @@ -7,9 +7,9 @@ style:
rulesetconfig3:
- 'first'
- 'se*cond'
WildcardImport:
MagicNumber:
active: true
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts']
conf1: 'foo'
conf3:
- 'a'
Expand Down