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
- name: Run ktlint
uses: ScaCap/action-ktlint@1.1
uses: ScaCap/action-ktlint@1.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
@@ -66,30 +66,34 @@ fun IrBuilderWithScope.buildMessage(
val rowValues = valuesByRow[row]?.let { values -> values.sortedBy { it.indent } } ?: emptyList()
val indentations = rowValues.map { it.indent }
addArgument(irString {
appendLine()
append(rowSource)
if (indentations.isNotEmpty()) {
addArgument(
irString {
appendLine()
var last = -1
for (i in indentations) {
if (i > last) indent(i - last - 1).append("|")
last = i
append(rowSource)
if (indentations.isNotEmpty()) {
appendLine()
var last = -1
for (i in indentations) {
if (i > last) indent(i - last - 1).append("|")
last = i
}
}
}
})
)
for (tmp in rowValues.asReversed()) {
addArgument(irString {
appendLine()
var last = -1
for (i in indentations) {
if (i == tmp.indent) break
if (i > last) indent(i - last - 1).append("|")
last = i
addArgument(
irString {
appendLine()
var last = -1
for (i in indentations) {
if (i == tmp.indent) break
if (i > last) indent(i - last - 1).append("|")
last = i
}
indent(tmp.indent - last - 1)
}
indent(tmp.indent - last - 1)
})
)
addArgument(irGet(tmp.value))
}
}
@@ -9,13 +9,13 @@ import java.lang.reflect.InvocationTargetException
import kotlin.test.assertEquals
import kotlin.test.fail
val DEFAULT_COMPONENT_REGISTRARS = arrayOf(
PowerAssertComponentRegistrar(setOf(FqName("kotlin.assert"))),
private val DEFAULT_COMPONENT_REGISTRARS = arrayOf(
PowerAssertComponentRegistrar(setOf(FqName("kotlin.assert")))
)
fun compile(
list: List<SourceFile>,
vararg plugins: ComponentRegistrar = DEFAULT_COMPONENT_REGISTRARS,
vararg plugins: ComponentRegistrar = DEFAULT_COMPONENT_REGISTRARS
): KotlinCompilation.Result {
return KotlinCompilation().apply {
sources = list
@@ -16,15 +16,8 @@
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.junit.Test
import java.lang.reflect.InvocationTargetException
import kotlin.test.assertEquals
import kotlin.test.fail
class CompilerTest {
@Test
@@ -279,12 +272,12 @@ fun main() {
assert(1.shl(1) == 4)
}""",
"""
Assertion failed
assert(1.shl(1) == 4)
| |
| false
2
""".trimIndent()
Assertion failed
assert(1.shl(1) == 4)
| |
| false
2
""".trimIndent()
)
assertMessage(