Skip to content

Commit

Permalink
Bugfix. False-positive LOCAL_VARIABLE_EARLY_DECLARATION (#535)
Browse files Browse the repository at this point in the history
* bugfix/false-positive-local-variable-early-declaration(#488)

### What's done:
  * Fixed bugs
  • Loading branch information
aktsay6 authored Nov 23, 2020
1 parent d8651d2 commit cd83754
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
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))
}

0 comments on commit cd83754

Please sign in to comment.