aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-10-25 20:46:42 +0200
committerRobert Jaros <rjaros@finn.pl>2019-10-25 20:46:42 +0200
commitc78775aa2aaf76f9fa1404ff32a10fb8227f380e (patch)
treea6991e1f520e1ce54679b2194a756203a645f99e /kvision-modules
parenta990385dd3f2dbac4807b7a9498271efb3519c0d (diff)
downloadkvision-c78775aa2aaf76f9fa1404ff32a10fb8227f380e.tar.gz
kvision-c78775aa2aaf76f9fa1404ff32a10fb8227f380e.tar.bz2
kvision-c78775aa2aaf76f9fa1404ff32a10fb8227f380e.zip
Style fixes
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt4
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt2
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt10
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt1
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt1
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt1
-rw-r--r--kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt7
-rw-r--r--kvision-modules/kvision-common-annotations/src/main/kotlin/pl/treksoft/kvision/annotations/Annotations.kt3
-rw-r--r--kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Battery.kt2
-rw-r--r--kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/File.kt4
-rw-r--r--kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/MediaCapture.kt2
-rw-r--r--kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt2
-rw-r--r--kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt5
-rw-r--r--kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt2
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt2
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt1
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt15
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt2
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt15
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt1
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt3
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt15
22 files changed, 59 insertions, 41 deletions
diff --git a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
index 178fbeaa..f9f170a9 100644
--- a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
+++ b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
@@ -241,8 +241,7 @@ open class DateTimeInput(
override fun afterDestroy() {
if (initialized) {
- val comp = getElementJQueryD()?.data("DateTimePicker")
- if (comp != null) comp.destroy()
+ getElementJQueryD()?.data("DateTimePicker")?.destroy()
initialized = false
}
}
@@ -314,6 +313,7 @@ open class DateTimeInput(
private fun initEventHandlers() {
this.getElementJQuery()?.on("dp.change") { e, _ ->
val moment = e.asDynamic().date
+ @Suppress("UnsafeCastFromDynamic")
if (moment) {
this.value = moment.toDate()
} else {
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt
index 09f92a0d..c1e7e244 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt
@@ -50,7 +50,7 @@ internal object KVManagerSelect {
require("./js/locales/ajax-bootstrap-select/ajax-bootstrap-select.sr-SP.min.js")
require("./js/locales/ajax-bootstrap-select/ajax-bootstrap-select.tr-TR.min.js")
js("$.fn.selectpicker.Constructor.BootstrapVersion = '4';")
- js("$.fn.selectpicker.Constructor.DEFAULTS.styleBase = 'form-control';");
+ js("$.fn.selectpicker.Constructor.DEFAULTS.styleBase = 'form-control';")
js("$.fn.selectpicker.Constructor.DEFAULTS.style = '';")
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
index 342a8e84..891cd226 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
@@ -377,12 +377,10 @@ internal class DropDownButton(
}
override fun getSnClass(): List<StringBoolPair> {
- return if (forNavbar) {
- listOf("nav-link" to true, "dropdown-toggle" to true)
- } else if (forDropDown) {
- super.getSnClass() + listOf("dropdown-item" to true, "dropdown-toggle" to true)
- } else {
- super.getSnClass() + ("dropdown-toggle" to true)
+ return when {
+ forNavbar -> listOf("nav-link" to true, "dropdown-toggle" to true)
+ forDropDown -> super.getSnClass() + listOf("dropdown-item" to true, "dropdown-toggle" to true)
+ else -> super.getSnClass() + ("dropdown-toggle" to true)
}
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
index 08fc7aa8..b064e30c 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt
@@ -25,7 +25,6 @@ import com.github.snabbdom.VNode
import pl.treksoft.kvision.core.Component
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.StringBoolPair
-import pl.treksoft.kvision.core.StringPair
import pl.treksoft.kvision.core.Widget
import pl.treksoft.kvision.html.Button
import pl.treksoft.kvision.html.TAG
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt
index 92f8832d..68975f8d 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt
@@ -29,7 +29,6 @@ import pl.treksoft.kvision.core.StringBoolPair
import pl.treksoft.kvision.core.StringPair
import pl.treksoft.kvision.html.Link
import pl.treksoft.kvision.html.Span
-import pl.treksoft.kvision.html.div
import pl.treksoft.kvision.html.span
import pl.treksoft.kvision.panel.SimplePanel
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt
index b993b649..861127fa 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt
@@ -24,7 +24,6 @@ package pl.treksoft.kvision.window
import com.github.snabbdom.VNode
import org.w3c.dom.events.Event
import org.w3c.dom.events.MouseEvent
-import pl.treksoft.kvision.KVManager
import pl.treksoft.kvision.KVManagerBootstrap
import pl.treksoft.kvision.core.Component
import pl.treksoft.kvision.core.Container
diff --git a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt
index 29cc80c2..55718918 100644
--- a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt
+++ b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt
@@ -23,6 +23,7 @@ package pl.treksoft.kvision.chart
import com.github.snabbdom.VNode
import pl.treksoft.kvision.chart.js.Chart.ChartConfiguration
+import pl.treksoft.kvision.chart.js.PluginServiceGlobalRegistration
import pl.treksoft.kvision.chart.js.Chart as JsChart
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Widget
@@ -112,11 +113,13 @@ open class Chart(
companion object {
fun registerPlugin(plugin: dynamic) {
- JsChart.plugins.register(plugin)
+ @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE")
+ JsChart.plugins.register(plugin as PluginServiceGlobalRegistration)
}
fun unregisterPlugin(plugin: dynamic) {
- JsChart.plugins.unregister(plugin)
+ @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE")
+ JsChart.plugins.unregister(plugin as PluginServiceGlobalRegistration)
}
}
}
diff --git a/kvision-modules/kvision-common-annotations/src/main/kotlin/pl/treksoft/kvision/annotations/Annotations.kt b/kvision-modules/kvision-common-annotations/src/main/kotlin/pl/treksoft/kvision/annotations/Annotations.kt
index 02026f56..22cf570b 100644
--- a/kvision-modules/kvision-common-annotations/src/main/kotlin/pl/treksoft/kvision/annotations/Annotations.kt
+++ b/kvision-modules/kvision-common-annotations/src/main/kotlin/pl/treksoft/kvision/annotations/Annotations.kt
@@ -22,5 +22,4 @@
package pl.treksoft.kvision.annotations
@Target(AnnotationTarget.CLASS)
-annotation class KVService()
-
+annotation class KVService
diff --git a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Battery.kt b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Battery.kt
index 656a519a..8078353b 100644
--- a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Battery.kt
+++ b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Battery.kt
@@ -65,7 +65,7 @@ object Battery {
*/
suspend fun getStatus(): BatteryStatus {
return suspendCoroutine { continuation ->
- addStatusListener(Battery.BatteryEvent.BATTERY_STATUS) { status ->
+ addStatusListener(BatteryEvent.BATTERY_STATUS) { status ->
continuation.resume(status)
}
}
diff --git a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/File.kt b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/File.kt
index 944042fa..5d24ac9f 100644
--- a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/File.kt
+++ b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/File.kt
@@ -169,8 +169,8 @@ object File {
): Result<FileSystem, FileException> {
return suspendCoroutine { continuation ->
val type = when (fileSystemType) {
- File.FileSystemType.TEMPORARY -> LocalFileSystem.TEMPORARY
- File.FileSystemType.PERSISTENT -> LocalFileSystem.PERSISTENT
+ FileSystemType.TEMPORARY -> LocalFileSystem.TEMPORARY
+ FileSystemType.PERSISTENT -> LocalFileSystem.PERSISTENT
}
addDeviceReadyListener {
window.asDynamic().requestFileSystem(type, size, { fs ->
diff --git a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/MediaCapture.kt b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/MediaCapture.kt
index fda81da7..be291620 100644
--- a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/MediaCapture.kt
+++ b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/MediaCapture.kt
@@ -84,7 +84,7 @@ suspend fun MediaFile.getFormatData(): MediaFileData? {
/**
* Exception class for media capture errors.
*/
-class CaptureException(val code: MediaCapture.CaptureErrorCode) : Exception("Capture exception: $code")
+class CaptureException(code: MediaCapture.CaptureErrorCode) : Exception("Capture exception: $code")
/**
* Main media capture object.
diff --git a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt
index a33b2453..2ad009f9 100644
--- a/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt
+++ b/kvision-modules/kvision-cordova/src/main/kotlin/pl/treksoft/kvision/cordova/Screen.kt
@@ -65,7 +65,7 @@ object Screen {
return Orientation.values().find {
@Suppress("UnsafeCastFromDynamic")
it.type == type
- } ?: Screen.Orientation.ANY
+ } ?: Orientation.ANY
}
/**
diff --git a/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt b/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt
index 8905ce2c..3a732c1e 100644
--- a/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt
+++ b/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt
@@ -148,7 +148,10 @@ class PaceOptions(
class Pace {
companion object {
- fun init(@Suppress("UNUSED_PARAMETER") req: dynamic = require("pace-progressbar/themes/blue/pace-theme-flash.css")) {
+ fun init(
+ @Suppress("UNUSED_PARAMETER") req: dynamic =
+ require("pace-progressbar/themes/blue/pace-theme-flash.css")
+ ) {
}
fun setOptions(options: PaceOptions) {
diff --git a/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt b/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
index c4889567..7625ed7a 100644
--- a/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
+++ b/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt
@@ -67,7 +67,7 @@ class ReduxStore<S : Any, A : RAction>(
initialState: S,
vararg middlewares: Middleware<S>
) : ObservableState<S> {
- @Suppress("UNCHECKED_CAST")
+ @Suppress("UNCHECKED_CAST", "SpreadOperator")
private val store: Store<S> = createStore({ s: S, a: Any ->
if (a == ActionTypes.INIT || a == ActionTypes.REPLACE) {
s
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index 90fdd2df..ca323264 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -57,6 +57,7 @@ internal object JsonDateSerializer : KSerializer<Date> {
}
}
+@Suppress("ComplexMethod", "MagicNumber")
internal fun String.toDateInternal(): Date {
val dt = this.split(':', 'T', '-', '+')
val utcCheck = this[length - 1] == 'Z'
@@ -89,6 +90,7 @@ internal fun String.toDateInternal(): Date {
}
internal fun Date.toStringInternal(): String {
+ @Suppress("MagicNumber")
val tz = this.getTimezoneOffset() / 60
val sign = if (tz > 0) "-" else "+"
return "" + this.getFullYear() + "-" + ("0" + (this.getMonth() + 1)).takeLast(2) + "-" +
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 6bb28059..bb682351 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -423,6 +423,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
routes.add {
call(HttpMethod.POST, "/kv/$routeDef") { req, res ->
val jsonRpcRequest = req.body(JsonRpcRequest::class.java)
+ @Suppress("MagicNumber")
if (jsonRpcRequest.params.size == 3) {
val param1 = getParameter<String?>(jsonRpcRequest.params[0])
val param2 = getParameter<String?>(jsonRpcRequest.params[1])
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index f041465b..58636fcc 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -87,6 +87,7 @@ class LocalDateTimeDeserializer : JsonDeserializer<LocalDateTime>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDateTime? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalDateTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -113,6 +114,7 @@ class LocalDateDeserializer : JsonDeserializer<LocalDate>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDate? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalDate.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -139,6 +141,7 @@ class LocalTimeDeserializer : JsonDeserializer<LocalTime>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalTime? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -164,11 +167,11 @@ class OffsetDateTimeDeserializer : JsonDeserializer<OffsetDateTime>() {
@Throws(IOException::class)
override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetDateTime? {
val str = p.text
- try {
- return OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+ return try {
+ OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
- return null
+ null
}
}
}
@@ -190,11 +193,11 @@ class OffsetTimeDeserializer : JsonDeserializer<OffsetTime>() {
@Throws(IOException::class)
override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetTime? {
val str = p.text
- try {
- return OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+ return try {
+ OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
- return null
+ null
}
}
}
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 4d19e301..e4a48bc3 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -389,6 +389,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
* @param function a function of the receiver
* @param route a route
*/
+ @Suppress("EmptyCatchBlock")
protected actual inline fun <reified PAR1 : Any, reified PAR2 : Any> bind(
noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit,
route: String?
@@ -449,6 +450,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
addRoute(HttpMethod.POST, "/kv/$routeDef") {
val service = call.injector.createChildInjector(DummyWsSessionModule()).getInstance(serviceClass.java)
val jsonRpcRequest = call.receive<JsonRpcRequest>()
+ @Suppress("MagicNumber")
if (jsonRpcRequest.params.size == 3) {
val param1 = getParameter<String?>(jsonRpcRequest.params[0])
val param2 = getParameter<String?>(jsonRpcRequest.params[1])
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index f041465b..58636fcc 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -87,6 +87,7 @@ class LocalDateTimeDeserializer : JsonDeserializer<LocalDateTime>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDateTime? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalDateTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -113,6 +114,7 @@ class LocalDateDeserializer : JsonDeserializer<LocalDate>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDate? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalDate.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -139,6 +141,7 @@ class LocalTimeDeserializer : JsonDeserializer<LocalTime>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalTime? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -164,11 +167,11 @@ class OffsetDateTimeDeserializer : JsonDeserializer<OffsetDateTime>() {
@Throws(IOException::class)
override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetDateTime? {
val str = p.text
- try {
- return OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+ return try {
+ OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
- return null
+ null
}
}
}
@@ -190,11 +193,11 @@ class OffsetTimeDeserializer : JsonDeserializer<OffsetTime>() {
@Throws(IOException::class)
override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetTime? {
val str = p.text
- try {
- return OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+ return try {
+ OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
- return null
+ null
}
}
}
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 295ec8fb..fb6b6210 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -514,6 +514,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
val service = ctx.getBean(serviceClass.java)
initializeService(service, req)
val jsonRpcRequest = req.awaitBody<JsonRpcRequest>()
+ @Suppress("MagicNumber")
if (jsonRpcRequest.params.size == 3) {
val param1 = getParameter<String?>(jsonRpcRequest.params[0])
val param2 = getParameter<String?>(jsonRpcRequest.params[1])
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
index 328e384d..7a9084dc 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/Security.kt
@@ -29,6 +29,7 @@ import org.springframework.security.web.server.util.matcher.ServerWebExchangeMat
/**
* A function to gather paths for spring security matchers.
*/
+@Suppress("SpreadOperator", "MaxLineLength")
fun ServerHttpSecurity.AuthorizeExchangeSpec.serviceMatchers(vararg services: KVServiceManager<*>): ServerHttpSecurity.AuthorizeExchangeSpec.Access {
return this.matchers(*getServerWebExchangeMatcher(*services))
}
@@ -36,6 +37,7 @@ fun ServerHttpSecurity.AuthorizeExchangeSpec.serviceMatchers(vararg services: KV
/**
* A function to gather paths for spring security matchers.
*/
+@Suppress("SpreadOperator")
fun serviceMatchers(vararg services: KVServiceManager<*>): ServerWebExchangeMatcher {
return ServerWebExchangeMatchers.matchers(*getServerWebExchangeMatcher(*services))
}
@@ -43,6 +45,7 @@ fun serviceMatchers(vararg services: KVServiceManager<*>): ServerWebExchangeMatc
/**
* A function to gather paths for spring security matchers.
*/
+@Suppress("SpreadOperator")
fun getServerWebExchangeMatcher(vararg services: KVServiceManager<*>): Array<ServerWebExchangeMatcher> {
val matchers = mutableListOf<ServerWebExchangeMatcher>()
val getPaths = services.flatMap { it.getRequests.keys }.toTypedArray()
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index f041465b..58636fcc 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -87,6 +87,7 @@ class LocalDateTimeDeserializer : JsonDeserializer<LocalDateTime>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDateTime? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalDateTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -113,6 +114,7 @@ class LocalDateDeserializer : JsonDeserializer<LocalDate>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalDate? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalDate.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -139,6 +141,7 @@ class LocalTimeDeserializer : JsonDeserializer<LocalTime>() {
override fun deserialize(p: JsonParser, ctx: DeserializationContext): LocalTime? {
val str = p.text
try {
+ @Suppress("MagicNumber")
return LocalTime.parse(str.dropLast(6), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
@@ -164,11 +167,11 @@ class OffsetDateTimeDeserializer : JsonDeserializer<OffsetDateTime>() {
@Throws(IOException::class)
override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetDateTime? {
val str = p.text
- try {
- return OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+ return try {
+ OffsetDateTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
- return null
+ null
}
}
}
@@ -190,11 +193,11 @@ class OffsetTimeDeserializer : JsonDeserializer<OffsetTime>() {
@Throws(IOException::class)
override fun deserialize(p: JsonParser, ctx: DeserializationContext): OffsetTime? {
val str = p.text
- try {
- return OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+ return try {
+ OffsetTime.parse(str, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
} catch (e: DateTimeParseException) {
System.err.println(e)
- return null
+ null
}
}
}