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

Bugfix. False-positive LOCAL_VARIABLE_EARLY_DECLARATION #535

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -549,4 +549,24 @@ class LocalVariablesWarnTest : LintTestBase(::LocalVariablesRule) {
""".trimMargin()
)
}

@Test
@Tag(WarningNames.LOCAL_VARIABLE_EARLY_DECLARATION)
fun `should not trigger on triple quoted strings`() {
lintMethod(
"""
|class Example {
| fun some() {
| val code = ${"\"\"\""}
| class Some {
| fun for() : String {
| }
| }
| ${"\"\"\""}.trimIndent()
| bar(code)
| }
|}
""".trimMargin()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ class SpecialTagsInKdoc {
fun test() = Unit
}

fun `method name incorrect, part 4`() {
val code = """
class TestPackageName {
fun methODTREE(): String {
}
}
""".trimIndent()
lintMethod(code, LintError(2, 7, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true))
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ class SpecialTagsInKdoc {
fun test() = Unit
}

fun `method name incorrect, part 4`() {
val code = """
class TestPackageName {
fun methODTREE(): String {
}
}
""".trimIndent()
lintMethod(code, LintError(2, 7, ruleId, "${FUNCTION_NAME_INCORRECT_CASE.warnText()} methODTREE", true))
}