lint
This commit is contained in:
9
src/.editorconfig
Normal file
9
src/.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
tab_width = 4
|
||||
@@ -1,8 +1,6 @@
|
||||
package fr.postgresjson.definition
|
||||
|
||||
import fr.postgresjson.definition.Parameter.Direction.IN
|
||||
import fr.postgresjson.definition.parse.ScriptPart
|
||||
import fr.postgresjson.definition.parse.trimSpace
|
||||
import java.nio.file.Path
|
||||
|
||||
class Function(
|
||||
|
||||
@@ -2,7 +2,6 @@ package fr.postgresjson.definition.parse
|
||||
|
||||
import fr.postgresjson.definition.Function
|
||||
import fr.postgresjson.definition.Parameter
|
||||
import fr.postgresjson.definition.Returns.Void
|
||||
import fr.postgresjson.definition.Parameter.Direction
|
||||
import fr.postgresjson.definition.Parameter.Direction.IN
|
||||
import fr.postgresjson.definition.Parameter.Direction.INOUT
|
||||
@@ -10,6 +9,7 @@ import fr.postgresjson.definition.Parameter.Direction.OUT
|
||||
import fr.postgresjson.definition.ParameterType
|
||||
import fr.postgresjson.definition.Resource.ParseException
|
||||
import fr.postgresjson.definition.Returns
|
||||
import fr.postgresjson.definition.Returns.Void
|
||||
import java.nio.file.Path
|
||||
import kotlin.text.RegexOption.IGNORE_CASE
|
||||
|
||||
@@ -26,7 +26,6 @@ internal fun parseFunction(script: String, source: Path? = null): Function {
|
||||
return Function(name, parameters, returns, script, source)
|
||||
}
|
||||
|
||||
|
||||
@Throws(FunctionNameMalformed::class)
|
||||
internal fun ScriptPart.getFunctionName(): NextScript<String> {
|
||||
try {
|
||||
@@ -125,7 +124,8 @@ private fun ScriptPart.getParameterType(): NextScript<ParameterType> {
|
||||
name = name.value.trim(),
|
||||
precision = precision.value,
|
||||
scale = scale.value
|
||||
), fullType.nextScriptPart.restOfScript
|
||||
),
|
||||
fullType.nextScriptPart.restOfScript
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,6 @@ internal inline fun ScriptPart.change(block: String.() -> String): ScriptPart {
|
||||
return ScriptPart(restOfScript.run(block))
|
||||
}
|
||||
|
||||
|
||||
internal fun ScriptPart.getNextInteger(): NextScript<Int?> {
|
||||
val trimmed = restOfScript.trimStart { !it.isDigit() }
|
||||
val digits = trimmed.takeWhile { it.isDigit() }
|
||||
@@ -136,8 +135,6 @@ internal fun ScriptPart.getNextInteger(): NextScript<Int?> {
|
||||
return NextScript(digits.toIntOrNull(), restOfScript).trimSpace()
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal data class Status(
|
||||
var doubleQuoted: Boolean = false, // "
|
||||
var simpleQuoted: Boolean = false, // '
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package fr.postgresjson.functionGenerator
|
||||
|
||||
import fr.postgresjson.definition.Function
|
||||
import fr.postgresjson.definition.Returns
|
||||
import fr.postgresjson.definition.Parameter
|
||||
import fr.postgresjson.definition.Parameter.Direction.IN
|
||||
import fr.postgresjson.definition.Parameter.Direction.INOUT
|
||||
import fr.postgresjson.definition.Parameter.Direction.OUT
|
||||
import fr.postgresjson.definition.Returns
|
||||
import fr.postgresjson.utils.searchSqlFiles
|
||||
import fr.postgresjson.utils.toCamelCase
|
||||
import org.slf4j.Logger
|
||||
|
||||
@@ -9,26 +9,30 @@ import fr.postgresjson.serializer.toTypeReference
|
||||
import io.kotest.core.spec.style.StringSpec
|
||||
import io.kotest.matchers.nulls.shouldBeNull
|
||||
import io.kotest.matchers.nulls.shouldNotBeNull
|
||||
import org.amshove.kluent.`should be equal to`
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import java.util.UUID
|
||||
import kotlin.reflect.full.hasAnnotation
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertNotNull
|
||||
import kotlin.test.assertTrue
|
||||
import org.amshove.kluent.`should be equal to`
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
|
||||
class ConnectionTest: StringSpec({
|
||||
val connection = TestConnection()
|
||||
|
||||
@SqlSerializable
|
||||
class ObjTest(val name: String, val id: UUID = UUID.fromString("2c0243ed-ff4d-4b9f-a52b-e38c71b0ed00"))
|
||||
|
||||
@SqlSerializable
|
||||
class ObjTest2(val id: UUID, val title: String, var test: ObjTest?)
|
||||
|
||||
@SqlSerializable
|
||||
class ObjTest3(val id: UUID, val first: String, var second: String, var third: Int)
|
||||
|
||||
@SqlSerializable
|
||||
class ParameterObject(var third: String)
|
||||
|
||||
@SqlSerializable
|
||||
class ObjTestWithParameterObject(val id: UUID, var first: ParameterObject, var second: ParameterObject)
|
||||
class ObjTest4
|
||||
|
||||
Reference in New Issue
Block a user