From 85b48891c61c604c952c8739b50bdae2998c44a7 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Fri, 8 Sep 2017 13:29:16 +0200 Subject: Added code analyzing with Detekt Refactoring --- .../kotlin/pl/treksoft/kvision/ApplicationBase.kt | 2 +- src/main/kotlin/pl/treksoft/kvision/HMR.kt | 2 +- src/main/kotlin/pl/treksoft/kvision/Main.kt | 3 +-- src/main/kotlin/pl/treksoft/kvision/Showcase.kt | 14 +++++----- src/main/kotlin/pl/treksoft/kvision/basic/Label.kt | 2 +- .../kotlin/pl/treksoft/kvision/core/Container.kt | 2 +- .../kotlin/pl/treksoft/kvision/core/KVManager.kt | 18 +++++++++---- src/main/kotlin/pl/treksoft/kvision/core/Root.kt | 2 +- src/main/kotlin/pl/treksoft/kvision/core/Widget.kt | 25 ++++++++++------- .../pl/treksoft/kvision/dropdown/DropDown.kt | 31 +++++++++++++++------- src/main/kotlin/pl/treksoft/kvision/html/Button.kt | 11 ++++---- src/main/kotlin/pl/treksoft/kvision/html/Image.kt | 7 ++--- src/main/kotlin/pl/treksoft/kvision/html/List.kt | 9 ++++--- src/main/kotlin/pl/treksoft/kvision/html/Tag.kt | 15 ++++++----- .../kotlin/pl/treksoft/kvision/snabbdom/Types.kt | 21 +++++++++------ 15 files changed, 103 insertions(+), 61 deletions(-) (limited to 'src/main/kotlin') diff --git a/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt b/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt index a7b3d465..e9e99fc7 100644 --- a/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt +++ b/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt @@ -3,4 +3,4 @@ package pl.treksoft.kvision abstract class ApplicationBase { abstract fun start(state: Map) abstract fun dispose(): Map -} \ No newline at end of file +} diff --git a/src/main/kotlin/pl/treksoft/kvision/HMR.kt b/src/main/kotlin/pl/treksoft/kvision/HMR.kt index 1251c187..e657567a 100644 --- a/src/main/kotlin/pl/treksoft/kvision/HMR.kt +++ b/src/main/kotlin/pl/treksoft/kvision/HMR.kt @@ -16,4 +16,4 @@ external interface Hot { fun dispose(callback: (data: dynamic) -> Unit) } -external fun require(name: String): dynamic \ No newline at end of file +external fun require(name: String): dynamic diff --git a/src/main/kotlin/pl/treksoft/kvision/Main.kt b/src/main/kotlin/pl/treksoft/kvision/Main.kt index 918cd51f..385d23e8 100644 --- a/src/main/kotlin/pl/treksoft/kvision/Main.kt +++ b/src/main/kotlin/pl/treksoft/kvision/Main.kt @@ -1,7 +1,6 @@ package pl.treksoft.kvision -import kotlin.browser.* -import kotlin.dom.* +import kotlin.browser.document fun main(args: Array) { var application: ApplicationBase? = null diff --git a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt index 67d7bbd1..b2e6d764 100644 --- a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt +++ b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt @@ -33,7 +33,8 @@ class Showcase : ApplicationBase() { val dd = DropDown("Dropdown", listOf("abc" to "#!/x", "def" to "#!/y"), "flag") root.add(dd) - val dd2 = DropDown("Dropdown2", listOf("abc" to "#!/abc", "def" to "#!/def", "xyz" to DISABLED.POS, "Header" to HEADER.POS, "Separtatorek" to SEPARATOR.POS + val dd2 = DropDown("Dropdown2", listOf("abc" to "#!/abc", "def" to "#!/def", "xyz" to DISABLED.POS, + "Header" to HEADER.POS, "Separtatorek" to SEPARATOR.POS ), "flag", dropup = true) root.add(dd2) @@ -43,7 +44,8 @@ class Showcase : ApplicationBase() { val del = Tag(TAG.DEL, "To jest deleted") root.add(del) - val list = ListTag(LIST.DL_HORIZ, listOf("abc", "defdasdasdasddasdtdasdas", "Dasdsada", "dasdasdads"), true) + val list = ListTag(LIST.DL_HORIZ, listOf("abc", "defdasdasdasddasdtdasdas", "Dasdsada", + "dasdasdads"), true) root.add(list) val list2 = ListTag(LIST.OL, null) @@ -52,15 +54,15 @@ class Showcase : ApplicationBase() { list2.add(Image(Img("kotlin.png"))) root.add(list2) - val img = Image(Img("kotlin.png"), "Image", true, IMAGE_SHAPE.ROUNDED) + val img = Image(Img("kotlin.png"), "Image", true, IMAGESHAPE.ROUNDED) root.add(img) - val button = Button("To jest przycisk FA", "fa-flag", BUTTON_STYLE.DANGER) + val button = Button("To jest przycisk FA", "fa-flag", BUTTONSTYLE.DANGER) button.setEventListener