Fix lint errors

This commit is contained in:
Brian Norman
2020-11-29 16:12:18 -06:00
parent 8fedd0d48a
commit 0b043f4f41
4 changed files with 32 additions and 35 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Run ktlint - name: Run ktlint
uses: ScaCap/action-ktlint@1.1 uses: ScaCap/action-ktlint@1.3
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check reporter: github-pr-check
@@ -66,7 +66,8 @@ fun IrBuilderWithScope.buildMessage(
val rowValues = valuesByRow[row]?.let { values -> values.sortedBy { it.indent } } ?: emptyList() val rowValues = valuesByRow[row]?.let { values -> values.sortedBy { it.indent } } ?: emptyList()
val indentations = rowValues.map { it.indent } val indentations = rowValues.map { it.indent }
addArgument(irString { addArgument(
irString {
appendLine() appendLine()
append(rowSource) append(rowSource)
if (indentations.isNotEmpty()) { if (indentations.isNotEmpty()) {
@@ -77,10 +78,12 @@ fun IrBuilderWithScope.buildMessage(
last = i last = i
} }
} }
}) }
)
for (tmp in rowValues.asReversed()) { for (tmp in rowValues.asReversed()) {
addArgument(irString { addArgument(
irString {
appendLine() appendLine()
var last = -1 var last = -1
for (i in indentations) { for (i in indentations) {
@@ -89,7 +92,8 @@ fun IrBuilderWithScope.buildMessage(
last = i last = i
} }
indent(tmp.indent - last - 1) indent(tmp.indent - last - 1)
}) }
)
addArgument(irGet(tmp.value)) addArgument(irGet(tmp.value))
} }
} }
@@ -9,13 +9,13 @@ import java.lang.reflect.InvocationTargetException
import kotlin.test.assertEquals import kotlin.test.assertEquals
import kotlin.test.fail import kotlin.test.fail
val DEFAULT_COMPONENT_REGISTRARS = arrayOf( private val DEFAULT_COMPONENT_REGISTRARS = arrayOf(
PowerAssertComponentRegistrar(setOf(FqName("kotlin.assert"))), PowerAssertComponentRegistrar(setOf(FqName("kotlin.assert")))
) )
fun compile( fun compile(
list: List<SourceFile>, list: List<SourceFile>,
vararg plugins: ComponentRegistrar = DEFAULT_COMPONENT_REGISTRARS, vararg plugins: ComponentRegistrar = DEFAULT_COMPONENT_REGISTRARS
): KotlinCompilation.Result { ): KotlinCompilation.Result {
return KotlinCompilation().apply { return KotlinCompilation().apply {
sources = list sources = list
@@ -16,15 +16,8 @@
package com.bnorm.power package com.bnorm.power
import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import org.intellij.lang.annotations.Language
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.FqName
import org.junit.Test import org.junit.Test
import java.lang.reflect.InvocationTargetException
import kotlin.test.assertEquals
import kotlin.test.fail
class CompilerTest { class CompilerTest {
@Test @Test
@@ -279,12 +272,12 @@ fun main() {
assert(1.shl(1) == 4) assert(1.shl(1) == 4)
}""", }""",
""" """
Assertion failed Assertion failed
assert(1.shl(1) == 4) assert(1.shl(1) == 4)
| | | |
| false | false
2 2
""".trimIndent() """.trimIndent()
) )
assertMessage( assertMessage(