Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression generating configuration (#4646)
- Loading branch information
1 parent
1a92cfb
commit 5662cb5
Showing
12 changed files
with
61 additions
and
74 deletions.
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
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
13 changes: 9 additions & 4 deletions
13
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/runners/ConfigExporter.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 |
---|---|---|
@@ -1,20 +1,25 @@ | ||
package io.gitlab.arturbosch.detekt.cli.runners | ||
|
||
import io.github.detekt.tooling.api.DefaultConfigurationProvider | ||
import io.github.detekt.tooling.api.spec.ProcessingSpec | ||
import io.gitlab.arturbosch.detekt.cli.CliArgs | ||
import io.gitlab.arturbosch.detekt.cli.createSpec | ||
import io.gitlab.arturbosch.detekt.cli.MultipleExistingPathConverter | ||
import java.nio.file.Paths | ||
|
||
class ConfigExporter( | ||
private val arguments: CliArgs, | ||
private val outputPrinter: Appendable, | ||
private val errorPrinter: Appendable, | ||
) : Executable { | ||
|
||
override fun execute() { | ||
val configPath = Paths.get(arguments.config ?: "detekt.yml") | ||
val spec = arguments.createSpec(outputPrinter, errorPrinter) | ||
DefaultConfigurationProvider.load(spec).copy(configPath) | ||
val spec = ProcessingSpec { | ||
extensions { | ||
disableDefaultRuleSets = arguments.disableDefaultRuleSets | ||
fromPaths { arguments.plugins?.let { MultipleExistingPathConverter().convert(it) }.orEmpty() } | ||
} | ||
} | ||
DefaultConfigurationProvider.load(spec.extensionsSpec).copy(configPath) | ||
outputPrinter.appendLine("Successfully copied default config to ${configPath.toAbsolutePath()}") | ||
} | ||
} |
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
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
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
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