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

Enable trim multiline raw string #5243

Merged
merged 7 commits into from Sep 4, 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
2 changes: 2 additions & 0 deletions config/detekt/detekt.yml
Expand Up @@ -229,6 +229,8 @@ style:
excludeGuardClauses: true
SpacingBetweenPackageAndImports:
active: true
TrimMultilineRawString:
active: true
UnderscoresInNumericLiterals:
active: true
UnnecessaryAnnotationUseSiteTarget:
Expand Down
Expand Up @@ -51,10 +51,7 @@ constructor(

@Suppress("DEPRECATION")
@Deprecated(
"""
locationString was removed and won't get passed to the main constructor.
Use queries on 'ktElement' instead.
""",
"locationString was removed and won't get passed to the main constructor. Use queries on 'ktElement' instead.",
ReplaceWith(
"Location(source, text, file)",
"io.gitlab.arturbosch.detekt.api.Location"
Expand Down
Expand Up @@ -169,7 +169,7 @@ class SuppressionSpec {
println("FAILED TEST")
}
}
"""
""".trimIndent()
)
val rule = TestRule()
rule.visitFile(ktFile)
Expand All @@ -187,7 +187,7 @@ class SuppressionSpec {
println("FAILED TEST")
}
}
"""
""".trimIndent()
)
val rule = TestRule()
rule.visitFile(ktFile)
Expand All @@ -205,7 +205,7 @@ class SuppressionSpec {
println("FAILED TEST")
}
}
"""
""".trimIndent()
)
val rule = TestRule()
rule.visitFile(ktFile)
Expand All @@ -227,7 +227,7 @@ class SuppressionSpec {
println("FAILED TEST")
}
}
"""
""".trimIndent()
)
val rule = TestRule(TestConfig(mutableMapOf("aliases" to "[MyTest]")))
rule.visitFile(ktFile)
Expand Down Expand Up @@ -314,7 +314,7 @@ private fun isSuppressedBy(annotation: String, argument: String): Boolean {
val annotated = """
@$annotation("$argument")
class Test
"""
""".trimIndent()
val file = compileContentForTest(annotated)
val annotatedClass = file.children.first { it is KtClass } as KtAnnotated
return annotatedClass.isSuppressedBy("Test", setOf("alias"))
Expand Down
Expand Up @@ -26,7 +26,7 @@ class CheckConfigurationSpec {
"""
unknown_property:
unknown_var: ""
"""
""".trimIndent()
)
createProcessingSettings(
testDir,
Expand Down Expand Up @@ -55,7 +55,7 @@ class CheckConfigurationSpec {
my_additional_properties:
magic_number: 7
magic_string: 'Hello World'
"""
""".trimIndent()
)
createProcessingSettings(testDir, config).use {
assertThatCode { checkConfiguration(it, spec.getDefaultConfiguration()) }
Expand All @@ -74,7 +74,7 @@ class CheckConfigurationSpec {
TooManyFunctions:
# This property is tested via the SampleConfigValidator
active: 1 # should be true
"""
""".trimIndent()
)
createProcessingSettings(testDir, config).use {
assertThatCode { checkConfiguration(it, spec.getDefaultConfiguration()) }
Expand Down Expand Up @@ -104,7 +104,7 @@ class CheckConfigurationSpec {
my_additional_properties:
magic_number: 7
magic_string: 'Hello World'
"""
""".trimIndent()
)
createProcessingSettings(testDir, config).use {
assertThatCode { checkConfiguration(it, spec.getDefaultConfiguration()) }
Expand Down
Expand Up @@ -22,7 +22,7 @@ class FinalNewlineSpec {
"""
fun main() = Unit

"""
""".trimIndent()
)

assertThat(findings).isEmpty()
Expand All @@ -35,7 +35,7 @@ class FinalNewlineSpec {
"""
fun main() = Unit

"""
""".trimIndent()
)

assertThat(findings).hasSize(1)
Expand Down
Expand Up @@ -85,7 +85,7 @@ class FormattingRuleSpec {
"""
fun main()
= Unit
""",
""".trimIndent(),
expectedPath
)

Expand Down
Expand Up @@ -50,7 +50,7 @@ class MultiRuleCollectorSpec {
p2
)
}
"""
""".trimIndent()
val items = subject.run(code)
assertThat(items[0].rules).hasSize(4)
assertThat(items[0].rules).contains("Rule1", "Rule2", "Rule3", "Rule4")
Expand Down