Fix lint errors
This commit is contained in:
@@ -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,30 +66,34 @@ 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(
|
||||||
appendLine()
|
irString {
|
||||||
append(rowSource)
|
|
||||||
if (indentations.isNotEmpty()) {
|
|
||||||
appendLine()
|
appendLine()
|
||||||
var last = -1
|
append(rowSource)
|
||||||
for (i in indentations) {
|
if (indentations.isNotEmpty()) {
|
||||||
if (i > last) indent(i - last - 1).append("|")
|
appendLine()
|
||||||
last = i
|
var last = -1
|
||||||
|
for (i in indentations) {
|
||||||
|
if (i > last) indent(i - last - 1).append("|")
|
||||||
|
last = i
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
|
|
||||||
for (tmp in rowValues.asReversed()) {
|
for (tmp in rowValues.asReversed()) {
|
||||||
addArgument(irString {
|
addArgument(
|
||||||
appendLine()
|
irString {
|
||||||
var last = -1
|
appendLine()
|
||||||
for (i in indentations) {
|
var last = -1
|
||||||
if (i == tmp.indent) break
|
for (i in indentations) {
|
||||||
if (i > last) indent(i - last - 1).append("|")
|
if (i == tmp.indent) break
|
||||||
last = i
|
if (i > last) indent(i - last - 1).append("|")
|
||||||
|
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(
|
||||||
|
|||||||
Reference in New Issue
Block a user