From d67da541a4dd8bd4fd7222bf991038a6fe54c1dd Mon Sep 17 00:00:00 2001
From: fscarponi <fscarponi@gmail.com>
Date: Mon, 11 Dec 2023 13:17:01 +0100
Subject: [PATCH] lint happy!

---
 .../jewel/bridge/theme/IntUiBridge.kt         |  2 +-
 .../standalone/styling/IntUiMenuStyling.kt    |  2 +-
 .../samples/standalone/view/TitleBarView.kt   |  3 +-
 .../standalone/view/component/Dropdowns.kt    | 39 ++++++++++++-------
 .../standalone/view/component/Links.kt        |  3 +-
 .../org/jetbrains/jewel/ui/component/Menu.kt  | 13 +++----
 6 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt
index b870fcbac8..5e86266014 100644
--- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt
+++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt
@@ -584,7 +584,7 @@ private fun readMenuStyle(): MenuStyle {
                 ),
                 separatorThickness = retrieveIntAsDpOrUnspecified("PopupMenuSeparator.stripeWidth")
                     .takeOrElse { 0.dp },
-                iconSize = 16.dp
+                iconSize = 16.dp,
             ),
             submenuMetrics = SubmenuMetrics(offset = DpOffset(0.dp, (-8).dp)),
         ),
diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiMenuStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiMenuStyling.kt
index bae013f4c0..baeba77238 100644
--- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiMenuStyling.kt
+++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiMenuStyling.kt
@@ -196,7 +196,7 @@ public fun MenuItemMetrics.Companion.defaults(
         separatorPadding,
         keybindingsPadding,
         separatorThickness,
-        iconSize
+        iconSize,
     )
 
 public fun SubmenuMetrics.Companion.defaults(
diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/TitleBarView.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/TitleBarView.kt
index d2a1fa36d7..81890857e9 100644
--- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/TitleBarView.kt
+++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/TitleBarView.kt
@@ -36,7 +36,8 @@ fun DecoratedWindowScope.TitleBarView() {
                         selected = MainViewModel.currentView == it,
                         onClick = {
                             MainViewModel.currentView = it
-                        }) {
+                        },
+                    ) {
                         Row(
                             horizontalArrangement = Arrangement.spacedBy(4.dp),
                             verticalAlignment = Alignment.CenterVertically,
diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Dropdowns.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Dropdowns.kt
index be80ffa5db..6d07f071bd 100644
--- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Dropdowns.kt
+++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Dropdowns.kt
@@ -48,8 +48,9 @@ fun Dropdowns() {
                     if (it == "---") {
                         separator()
                     } else {
-                        selectableItem(selected == it,
-                            onClick = { selected = it }
+                        selectableItem(
+                            selected = selected == it,
+                            onClick = { selected = it },
                         ) {
                             Text(it)
                         }
@@ -63,7 +64,7 @@ fun Dropdowns() {
                         } else {
                             selectableItem(
                                 selected = selected == it,
-                                onClick = { selected = it }
+                                onClick = { selected = it },
                             ) {
                                 Text(it)
                             }
@@ -77,7 +78,7 @@ fun Dropdowns() {
                             } else {
                                 selectableItem(
                                     selected = selected == it,
-                                    onClick = { selected = it }
+                                    onClick = { selected = it },
                                 ) {
                                     Text(it)
                                 }
@@ -102,7 +103,7 @@ fun Dropdowns() {
                     } else {
                         selectableItem(
                             selected = selected == it,
-                            onClick = { selected = it }
+                            onClick = { selected = it },
                         ) {
                             Text(it)
                         }
@@ -121,11 +122,15 @@ fun Dropdowns() {
                         selectableItem(
                             iconResource = dropdownIconsSample.random(),
                             iconClass = DropdownStyle::class.java,
-                            keybinding = if (Random.nextBoolean()) null else dropdownKeybindingsSample.shuffled()
-                                .take(2)
-                                .toSet(),
+                            keybinding = if (Random.nextBoolean()) {
+                                null
+                            } else {
+                                dropdownKeybindingsSample.shuffled()
+                                    .take(2)
+                                    .toSet()
+                            },
                             selected = false,
-                            onClick = { }
+                            onClick = { },
                         ) {
                             Text(it)
                         }
@@ -139,11 +144,15 @@ fun Dropdowns() {
                             selectableItem(
                                 iconResource = dropdownIconsSample.random(),
                                 iconClass = DropdownStyle::class.java,
-                                keybinding = if (Random.nextBoolean()) null else dropdownKeybindingsSample.shuffled()
-                                    .take(2)
-                                    .toSet(),
+                                keybinding = if (Random.nextBoolean()) {
+                                    null
+                                } else {
+                                    dropdownKeybindingsSample.shuffled()
+                                        .take(2)
+                                        .toSet()
+                                },
                                 selected = false,
-                                onClick = { }
+                                onClick = { },
                             ) {
                                 Text(it)
                             }
@@ -159,7 +168,7 @@ fun Dropdowns() {
                                     iconResource = dropdownIconsSample.random(),
                                     iconClass = DropdownStyle::class.java,
                                     selected = false,
-                                    onClick = { }
+                                    onClick = { },
                                 ) {
                                     Text(it)
                                 }
@@ -179,4 +188,4 @@ fun Dropdowns() {
 }
 
 private val dropdownIconsSample = listOf("icons/search.svg", "icons/close.svg", null)
-private val dropdownKeybindingsSample = setOf('A', 'B', '↑', '→', '␡')
\ No newline at end of file
+private val dropdownKeybindingsSample = setOf('A', 'B', '↑', '→', '␡')
diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Links.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Links.kt
index 6a4dead2ed..c8133508cb 100644
--- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Links.kt
+++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Links.kt
@@ -47,7 +47,8 @@ fun Links() {
                         selected = selected == it,
                         onClick = {
                             selected = it
-                        }) {
+                        },
+                    ) {
                         Text(it)
                     }
                 }
diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt
index c64e0a1bd7..2207a4ce70 100644
--- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt
+++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt
@@ -274,8 +274,8 @@ private fun (MenuScope.() -> Unit).asList() = buildList {
                         iconClass = iconClass,
                         keybinding = keybinding,
                         onClick = onClick,
-                        content = content
-                    )
+                        content = content,
+                    ),
                 )
             }
 
@@ -417,7 +417,7 @@ internal fun MenuItem(
                 modifier = Modifier.fillMaxWidth()
                     .drawItemBackground(itemMetrics, backgroundColor)
                     .padding(itemMetrics.contentPadding),
-                horizontalArrangement = Arrangement.spacedBy(4.dp)
+                horizontalArrangement = Arrangement.spacedBy(4.dp),
             ) {
                 if (iconGap) {
                     if (iconResource != null) {
@@ -430,11 +430,11 @@ internal fun MenuItem(
                     content()
                 }
                 if (keybindingGap) {
-                    val keybindingText = remember { keybinding?.joinToString("") { it.toString() } ?: "" }
+                    val keybindingText = remember { keybinding?.joinToString("") { it.toString() }.orEmpty() }
                     Text(
                         modifier = Modifier.padding(style.metrics.itemMetrics.keybindingsPadding),
                         text = keybindingText,
-                        color = itemColors.keybindingTintFor(itemState).value
+                        color = itemColors.keybindingTintFor(itemState).value,
                     )
                 }
             }
@@ -454,8 +454,7 @@ public fun MenuSubmenuItem(
     submenu: MenuScope.() -> Unit,
     content: @Composable () -> Unit,
 ) {
-    var itemState by
-    remember(interactionSource) {
+    var itemState by remember(interactionSource) {
         mutableStateOf(MenuItemState.of(selected = false, enabled = enabled))
     }