Skip to content

Commit

Permalink
Don't use hasSourceLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Jul 23, 2022
1 parent 735d9c2 commit 6245074
Show file tree
Hide file tree
Showing 28 changed files with 132 additions and 133 deletions.
Expand Up @@ -34,7 +34,7 @@ class IndentationSpec {
@Test
fun `places finding location to the indentation`() {
subject.lint(code).assert()
.hasSourceLocation(2, 1)
.hasStartSourceLocation(2, 1)
.hasTextLocations(13 to 14)
}
}
Expand Down
Expand Up @@ -31,7 +31,7 @@ class WrappingSpec {

subject.lint(code).assert()
.hasSize(1)
.hasSourceLocation(1, 12)
.hasStartSourceLocation(1, 12)
.hasTextLocations(11 to 12)
}
}
Expand Up @@ -116,7 +116,7 @@ class NestedScopeFunctionsSpec(private val env: KotlinCoreEnvironment) {
}

private fun expectSourceLocation(location: Pair<Int, Int>) {
assertThat(actual).hasSourceLocation(location.first, location.second)
assertThat(actual).hasStartSourceLocation(location.first, location.second)
}

private fun expectFunctionInMsg(scopeFunction: String) {
Expand Down
Expand Up @@ -21,7 +21,7 @@ class EmptyFunctionBlockSpec {
protected fun stuff() {}
}
"""
assertThat(subject.compileAndLint(code)).hasSourceLocation(2, 27)
assertThat(subject.compileAndLint(code)).hasStartSourceLocation(2, 27)
}

@Test
Expand Down Expand Up @@ -51,7 +51,7 @@ class EmptyFunctionBlockSpec {
fun b() {}
}
"""
assertThat(subject.compileAndLint(code)).hasSourceLocation(2, 13)
assertThat(subject.compileAndLint(code)).hasStartSourceLocation(2, 13)
}

@Nested
Expand Down Expand Up @@ -89,7 +89,7 @@ class EmptyFunctionBlockSpec {
@Test
fun `should not flag overridden functions`() {
val config = TestConfig(mapOf(IGNORE_OVERRIDDEN_FUNCTIONS to "true"))
assertThat(EmptyFunctionBlock(config).compileAndLint(code)).hasSourceLocation(1, 13)
assertThat(EmptyFunctionBlock(config).compileAndLint(code)).hasStartSourceLocation(1, 13)
}
}

Expand All @@ -115,7 +115,7 @@ class EmptyFunctionBlockSpec {

@Test
fun `should not flag overridden functions with commented body`() {
assertThat(subject.compileAndLint(code)).hasSourceLocation(12, 31)
assertThat(subject.compileAndLint(code)).hasStartSourceLocation(12, 31)
}

@Test
Expand Down
Expand Up @@ -16,7 +16,7 @@ class CastToNullableTypeSpec {
"""
val findings = subject.compileAndLint(code)
assertThat(findings).hasSize(1)
assertThat(findings).hasSourceLocation(2, 22)
assertThat(findings).hasStartSourceLocation(2, 22)
assertThat(findings[0]).hasMessage("Use the safe cast ('as? String') instead of 'as String?'.")
}

Expand Down
Expand Up @@ -30,7 +30,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -42,7 +42,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -54,7 +54,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -66,7 +66,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -78,7 +78,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -90,7 +90,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -102,7 +102,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -114,7 +114,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -135,7 +135,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = rule.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(3, 5)
assertThat(result).hasStartSourceLocation(3, 5)
}

@Test
Expand All @@ -157,7 +157,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = rule.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(4, 5)
assertThat(result).hasStartSourceLocation(4, 5)
}

@Test
Expand All @@ -180,7 +180,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = rule.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(5, 5)
assertThat(result).hasStartSourceLocation(5, 5)
}
}

Expand Down Expand Up @@ -357,7 +357,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(1, 1)
assertThat(result).hasStartSourceLocation(1, 1)
}

@Test
Expand All @@ -367,7 +367,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(1, 1)
assertThat(result).hasStartSourceLocation(1, 1)
}

@Test
Expand All @@ -377,7 +377,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(1, 1)
assertThat(result).hasStartSourceLocation(1, 1)
}

@Test
Expand All @@ -387,7 +387,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(1, 1)
assertThat(result).hasStartSourceLocation(1, 1)
}

@Test
Expand All @@ -397,7 +397,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(1, 1)
assertThat(result).hasStartSourceLocation(1, 1)
}

@Test
Expand All @@ -407,7 +407,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(1, 1)
assertThat(result).hasStartSourceLocation(1, 1)
}

@Test
Expand All @@ -417,7 +417,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(1, 1)
assertThat(result).hasStartSourceLocation(1, 1)
}

@Test
Expand All @@ -427,7 +427,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(1, 1)
assertThat(result).hasStartSourceLocation(1, 1)
}

@Test
Expand All @@ -446,7 +446,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = rule.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 1)
assertThat(result).hasStartSourceLocation(2, 1)
}

@Test
Expand All @@ -466,7 +466,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = rule.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(3, 1)
assertThat(result).hasStartSourceLocation(3, 1)
}

@Test
Expand All @@ -487,7 +487,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = rule.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(4, 1)
assertThat(result).hasStartSourceLocation(4, 1)
}
}

Expand Down Expand Up @@ -642,7 +642,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -654,7 +654,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -666,7 +666,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -678,7 +678,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -690,7 +690,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -702,7 +702,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -714,7 +714,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -726,7 +726,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = subject.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(2, 5)
assertThat(result).hasStartSourceLocation(2, 5)
}

@Test
Expand All @@ -747,7 +747,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = rule.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(3, 5)
assertThat(result).hasStartSourceLocation(3, 5)
}

@Test
Expand All @@ -769,7 +769,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = rule.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(4, 5)
assertThat(result).hasStartSourceLocation(4, 5)
}

@Test
Expand All @@ -792,7 +792,7 @@ class DoubleMutabilityForCollectionSpec(private val env: KotlinCoreEnvironment)
"""
val result = rule.compileAndLintWithContext(env, code)
assertThat(result).hasSize(1)
assertThat(result).hasSourceLocation(5, 5)
assertThat(result).hasStartSourceLocation(5, 5)
}
}

Expand Down

0 comments on commit 6245074

Please sign in to comment.