Skip to content

Commit

Permalink
Enable TrimMultilineRawString
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Aug 23, 2022
1 parent cc51808 commit 7b3eb70
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/detekt/detekt.yml
Expand Up @@ -237,6 +237,8 @@ style:
excludeGuardClauses: true
SpacingBetweenPackageAndImports:
active: true
TrimMultilineRawString:
active: true
UnderscoresInNumericLiterals:
active: true
UnnecessaryAnnotationUseSiteTarget:
Expand Down
Expand Up @@ -23,6 +23,7 @@ class ConfigurationCacheSpec {
inner class `Create baseline task` {
@Test
fun `can be loaded from the configuration cache`() {
@Suppress("TrimMultilineRawString")
val detektConfig = """
|detekt {
| baseline = file("build/baseline.xml")
Expand Down
Expand Up @@ -11,6 +11,7 @@ class CreateBaselineTaskDslSpec {
fun `detektBaseline task can be executed when baseline file is specified`() {
val baselineFilename = "baseline.xml"

@Suppress("TrimMultilineRawString")
val detektConfig = """
|detekt {
| baseline = file("$baselineFilename")
Expand All @@ -35,6 +36,7 @@ class CreateBaselineTaskDslSpec {

@Test
fun `detektBaseline task can be executed when baseline file is not specified`() {
@Suppress("TrimMultilineRawString")
val detektConfig = """
|detekt {
|}
Expand All @@ -57,6 +59,7 @@ class CreateBaselineTaskDslSpec {

@Test
fun `detektBaseline task can not be executed when baseline file is specified null`() {
@Suppress("TrimMultilineRawString")
val detektConfig = """
|detekt {
| baseline = null
Expand Down
Expand Up @@ -76,6 +76,7 @@ class DetektTaskDslSpec {

@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| config.setFrom(files("firstConfig.yml", "secondConfig.yml"))
Expand Down Expand Up @@ -103,6 +104,7 @@ class DetektTaskDslSpec {

@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| baseline = file("$baselineFilename")
Expand Down Expand Up @@ -130,6 +132,7 @@ class DetektTaskDslSpec {
@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| baseline = file("$baselineFilename")
Expand All @@ -156,6 +159,7 @@ class DetektTaskDslSpec {

@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| input = files("$customSrc1", "$customSrc2", "folder_that_does_not_exist")
Expand Down Expand Up @@ -191,6 +195,7 @@ class DetektTaskDslSpec {

@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| source = files("$customSrc1", "$customSrc2", "folder_that_does_not_exist")
Expand Down Expand Up @@ -224,6 +229,7 @@ class DetektTaskDslSpec {

@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| reportsDir = file("build/detekt-reports")
Expand Down Expand Up @@ -266,6 +272,7 @@ class DetektTaskDslSpec {

@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| reportsDir = file("build/detekt-reports")
Expand Down Expand Up @@ -308,6 +315,7 @@ class DetektTaskDslSpec {

@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|tasks.detekt {
| reports {
Expand Down Expand Up @@ -346,6 +354,7 @@ class DetektTaskDslSpec {
inner class `configured correctly` {
@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|tasks.detekt {
| reports {
Expand Down Expand Up @@ -382,6 +391,7 @@ class DetektTaskDslSpec {
inner class `report id is missing` {
@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
| reports {
Expand All @@ -408,6 +418,7 @@ class DetektTaskDslSpec {
inner class `report filename is missing` {
@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
| reports {
Expand Down Expand Up @@ -436,6 +447,7 @@ class DetektTaskDslSpec {
fun beforeGroup() {
val aDirectory = "\${rootDir}/src"

@Suppress("TrimMultilineRawString")
val config = """
|tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
| reports {
Expand Down Expand Up @@ -463,6 +475,7 @@ class DetektTaskDslSpec {
@ParameterizedTest
@EnumSource(DetektReportType::class)
fun `fails the build`(wellKnownType: DetektReportType) {
@Suppress("TrimMultilineRawString")
val config = """
|tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
| reports {
Expand All @@ -488,6 +501,7 @@ class DetektTaskDslSpec {

@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| debug = true
Expand Down Expand Up @@ -567,6 +581,7 @@ class DetektTaskDslSpec {
inner class `with an additional plugin` {
@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|dependencies {
| detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$defaultDetektVersion")
Expand Down Expand Up @@ -596,6 +611,7 @@ class DetektTaskDslSpec {

@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| toolVersion = "$customVersion"
Expand Down Expand Up @@ -623,6 +639,7 @@ class DetektTaskDslSpec {
inner class `and creating a custom task` {
@BeforeAll
fun beforeGroup() {
@Suppress("TrimMultilineRawString")
val config = """
|task<io.gitlab.arturbosch.detekt.Detekt>("myDetekt") {
| description = "Runs a custom detekt build."
Expand Down
Expand Up @@ -9,6 +9,7 @@ class DetektTaskGroovyDslSpec {

@Test
fun `detekt extension can be configured without errors`() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| toolVersion = "1.0.0.RC8"
Expand Down Expand Up @@ -36,6 +37,7 @@ class DetektTaskGroovyDslSpec {

@Test
fun `detekt task can be fully configured without errors`() {
@Suppress("TrimMultilineRawString")
val config = """
|tasks.create("customDetektTask", io.gitlab.arturbosch.detekt.Detekt) {
| source = files("${"$"}projectDir")
Expand Down Expand Up @@ -81,6 +83,7 @@ class DetektTaskGroovyDslSpec {

@Test
fun `detekt create baseline task can be configured without errors`() {
@Suppress("TrimMultilineRawString")
val config = """
|tasks.create("customDetektCreateBaselineTask", io.gitlab.arturbosch.detekt.DetektCreateBaselineTask) {
| source = files("${"$"}projectDir")
Expand Down Expand Up @@ -110,6 +113,7 @@ class DetektTaskGroovyDslSpec {

@Test
fun `detekt generate config task can be configured without errors`() {
@Suppress("TrimMultilineRawString")
val config = """
|tasks.create("customDetektGenerateConfigTask", io.gitlab.arturbosch.detekt.DetektGenerateConfigTask) {
| detektClasspath.setFrom(files("config.yml"))
Expand Down
Expand Up @@ -15,6 +15,7 @@ class DetektTaskSpec {

@Test
fun `build succeeds with more issues than threshold if ignoreFailures = true`() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| ignoreFailures = true
Expand All @@ -33,6 +34,7 @@ class DetektTaskSpec {

@Test
fun `build fails with more issues than threshold successfully if ignoreFailures = false`() {
@Suppress("TrimMultilineRawString")
val config = """
|detekt {
| ignoreFailures = false
Expand Down
Expand Up @@ -22,6 +22,7 @@ class GenerateConfigTaskSpec {
fun `chooses the last config file when configured`() {
val builder = DslTestBuilder.kotlin()
val gradleRunner = builder.withDetektConfig(
@Suppress("TrimMultilineRawString")
"""
|detekt {
| config = files("config/detekt/detekt.yml", "config/other/detekt.yml")
Expand Down
Expand Up @@ -16,6 +16,7 @@ class PluginTaskBehaviorSpec {
val configFileName = "config.yml"
val baselineFileName = "baseline.xml"

@Suppress("TrimMultilineRawString")
val detektConfig = """
|detekt {
| config = files("$configFileName")
Expand Down
Expand Up @@ -76,6 +76,8 @@ abstract class DslTestBuilder {

private class GroovyBuilder : DslTestBuilder() {
override val gradleBuildName: String = "build.gradle"

@Suppress("TrimMultilineRawString")
override val gradlePlugins = """
|plugins {
| id 'java-library'
Expand All @@ -94,6 +96,7 @@ private class GroovyBuilder : DslTestBuilder() {
|}
""".trimMargin()

@Suppress("TrimMultilineRawString")
override val gradleSubprojectsApplyPlugins = """
|apply plugin: "io.gitlab.arturbosch.detekt"
|
Expand All @@ -105,6 +108,7 @@ private class GroovyBuilder : DslTestBuilder() {
private class KotlinBuilder : DslTestBuilder() {
override val gradleBuildName: String = "build.gradle.kts"

@Suppress("TrimMultilineRawString")
override val gradlePlugins = """
|plugins {
| `java-library`
Expand All @@ -123,6 +127,7 @@ private class KotlinBuilder : DslTestBuilder() {
|}
""".trimMargin()

@Suppress("TrimMultilineRawString")
override val gradleSubprojectsApplyPlugins = """
|plugins.apply("io.gitlab.arturbosch.detekt")
|
Expand Down

0 comments on commit 7b3eb70

Please sign in to comment.