Skip to content

Commit

Permalink
Update plugin ktlint to v11.2.0 (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored Feb 20, 2023
1 parent bb538c9 commit 8e19942
Show file tree
Hide file tree
Showing 22 changed files with 243 additions and 221 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ignition = "8.1.1"
[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "11.1.0" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "11.2.0" }
shadow = { id = "com.github.johnrengelman.shadow", version = "7.1.2" }
runtime = { id = "org.beryx.runtime", version = "1.13.0" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ object Kindling {

val frameIcon: Image = Toolkit.getDefaultToolkit().getImage(this::class.java.getResource("/icons/kindling.png"))

@Suppress("ktlint:trailing-comma-on-declaration-site")
enum class Theme(val lookAndFeel: FlatLaf, private val rSyntaxThemeName: String) {
Light(
lookAndFeel = if (SystemInfo.isMacOS) FlatMacLightLaf() else FlatLightLaf(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ abstract class ToolPanel(
}
}

@Suppress("ktlint:trailing-comma-on-declaration-site")
private enum class ExportFormat(
description: String,
val extension: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import java.sql.Connection
import java.time.Instant
import javax.swing.JPanel

@Suppress("ktlint:trailing-comma-on-declaration-site")
enum class IdbTool {
Log {
override fun openPanel(connection: Connection): JPanel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data class Column(
val defaultValue: String?,
val primaryKey: Boolean,
val hidden: Boolean,
val _parent: () -> TreeNode
val _parent: () -> TreeNode,
) : TreeNode {
override fun getChildAt(childIndex: Int): TreeNode? = null
override fun getChildCount(): Int = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class DBMetaDataTree(treeModel: TreeModel) : FlatTree() {
icon = if (selected && focused) TABLE_ICON_SELECTED else TABLE_ICON
this
}

is Column -> {
StyledLabelBuilder()
.add(value.name)
Expand All @@ -41,9 +42,10 @@ class DBMetaDataTree(treeModel: TreeModel) : FlatTree() {
}
}
}

else -> this
}
}
},
)

object : TreeSearchable(this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class GenericView(connection: Connection) : IdbPanel() {
defaultValue = resultSet.getString("dflt_value"),
primaryKey = resultSet.getInt("pk") == 1,
hidden = resultSet.getInt("hidden") == 1,
_parent = { root.getChildAt(i) }
_parent = { root.getChildAt(i) },
)
}
},
)
}

Expand Down Expand Up @@ -120,8 +120,8 @@ class GenericView(connection: Connection) : IdbPanel() {
JMenuItem(
Action("SELECT * FROM ${node.name}") {
query.text = "SELECT * FROM ${node.name};"
}
)
},
),
)
}

Expand All @@ -131,8 +131,8 @@ class GenericView(connection: Connection) : IdbPanel() {
JMenuItem(
Action("SELECT ${node.name} FROM ${table.name}") {
query.text = "SELECT ${node.name} FROM ${table.name}"
}
)
},
),
)
}

Expand All @@ -149,14 +149,14 @@ class GenericView(connection: Connection) : IdbPanel() {
JSplitPane(
JSplitPane.VERTICAL_SPLIT,
FlatScrollPane(queryPanel),
results
results,
).apply {
resizeWeight = 0.2
}
},
).apply {
resizeWeight = 0.1
},
"push, grow"
"push, grow",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sealed interface QueryResult {
class Success(
val columnNames: List<String>,
private val columnTypes: List<Class<*>>,
val data: List<List<*>>
val data: List<List<*>>,
) : QueryResult, AbstractTableModel() {
constructor() : this(emptyList(), emptyList(), emptyList())

Expand All @@ -22,6 +22,6 @@ sealed interface QueryResult {
}

class Error(
val details: String
val details: String,
) : QueryResult
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ResultsPanel : JPanel(MigLayout("ins 0, fill, hidemode 3")) {
""
}
},
getTooltip = { "Export to CSV to view full data (b64 encoded)" }
getTooltip = { "Export to CSV to view full data (b64 encoded)" },
)
}

Expand Down Expand Up @@ -64,7 +64,7 @@ class ResultsPanel : JPanel(MigLayout("ins 0, fill, hidemode 3")) {

private val copy = Action(
description = "Copy to Clipboard",
icon = FlatSVGIcon("icons/bx-clipboard.svg")
icon = FlatSVGIcon("icons/bx-clipboard.svg"),
) {
val tsv = buildString {
table.model.columnNames.joinTo(buffer = this, separator = "\t")
Expand All @@ -88,7 +88,7 @@ class ResultsPanel : JPanel(MigLayout("ins 0, fill, hidemode 3")) {

private val save = Action(
description = "Save to File",
icon = FlatSVGIcon("icons/bx-save.svg")
icon = FlatSVGIcon("icons/bx-save.svg"),
) {
JFileChooser().apply {
fileSelectionMode = JFileChooser.FILES_ONLY
Expand All @@ -107,7 +107,7 @@ class ResultsPanel : JPanel(MigLayout("ins 0, fill, hidemode 3")) {
is ByteArray -> BASE64.encodeToString(cell)
else -> cell?.toString()
}
}
},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import javax.swing.tree.TreeNode
data class Table(
val name: String,
val columns: List<Column>,
val _parent: () -> TreeNode
val _parent: () -> TreeNode,
) : TreeNode {
override fun getChildAt(childIndex: Int): TreeNode = columns[childIndex]
override fun getChildCount(): Int = columns.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class MetricCard(val metric: Metric, data: List<MetricData>) : JPanel(MigLayout(
override fun parse(source: String, parsePosition: ParsePosition): Number = mbFormatter.parse(source, parsePosition)
}

@Suppress("ktlint:trailing-comma-on-declaration-site")
enum class MetricPresentation(val formatter: NumberFormat, val isShowTrend: Boolean) {
Heap(heapFormatter, true),
Queue(NumberFormat.getIntegerInstance(), false),
Expand All @@ -101,7 +102,7 @@ class MetricCard(val metric: Metric, data: List<MetricData>) : JPanel(MigLayout(
},
true,
),
Default(NumberFormat.getInstance(), false)
Default(NumberFormat.getInstance(), false);
}

private val Metric.presentation: MetricPresentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,26 @@ class DetailsIcon(details: Map<String, String>) : JLabel(detailsIcon) {
init {
alignmentY = 0.7F

addMouseListener(object : MouseAdapter() {
var popup: Popup? = null
addMouseListener(
object : MouseAdapter() {
var popup: Popup? = null

override fun mouseEntered(e: MouseEvent) {
popup = PopupFactory.getSharedInstance().getPopup(
this@DetailsIcon,
table,
locationOnScreen.x + detailsIcon.iconWidth,
locationOnScreen.y
).also {
it.show()
override fun mouseEntered(e: MouseEvent) {
popup = PopupFactory.getSharedInstance().getPopup(
this@DetailsIcon,
table,
locationOnScreen.x + detailsIcon.iconWidth,
locationOnScreen.y,
).also {
it.show()
}
}
}

override fun mouseExited(e: MouseEvent) {
popup?.hide()
}
})
override fun mouseExited(e: MouseEvent) {
popup?.hide()
}
},
)
}

companion object {
Expand Down
18 changes: 10 additions & 8 deletions src/main/kotlin/io/github/paulgriffith/kindling/log/Header.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Header(private val totalRows: Int) : JPanel(MigLayout("ins 0, fill")) {
addActionListener {
isShowFullLoggerName = !isShowFullLoggerName
}
}
},
)

val tzGroup = ButtonGroup()
Expand All @@ -53,7 +53,7 @@ class Header(private val totalRows: Int) : JPanel(MigLayout("ins 0, fill")) {
}
}
}
}
},
)

val levelGroup = ButtonGroup()
Expand All @@ -67,16 +67,18 @@ class Header(private val totalRows: Int) : JPanel(MigLayout("ins 0, fill")) {
}
}
}
}
},
)
}

private val settings = JideButton(FlatSVGIcon("icons/bx-cog.svg")).apply {
addMouseListener(object : MouseAdapter() {
override fun mousePressed(e: MouseEvent) {
settingsMenu.show(this@apply, e.x, e.y)
}
})
addMouseListener(
object : MouseAdapter() {
override fun mousePressed(e: MouseEvent) {
settingsMenu.show(this@apply, e.x, e.y)
}
},
)
}

init {
Expand Down
24 changes: 12 additions & 12 deletions src/main/kotlin/io/github/paulgriffith/kindling/log/LogPanel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import kotlin.math.absoluteValue
import io.github.paulgriffith.kindling.core.Detail as DetailEvent

class LogPanel(
private val rawData: List<LogEvent>
private val rawData: List<LogEvent>,
) : JPanel(MigLayout("ins 0, fill, hidemode 3")) {
private val totalRows: Int = rawData.size

Expand Down Expand Up @@ -139,14 +139,14 @@ class LogPanel(
JSplitPane(
JSplitPane.VERTICAL_SPLIT,
tableScrollPane,
details
details,
).apply {
resizeWeight = 0.6
}
},
).apply {
resizeWeight = 0.1
},
"push, grow"
"push, grow",
)

table.selectionModel.apply {
Expand All @@ -162,13 +162,13 @@ class LogPanel(
title = "${dateFormatter.format(event.timestamp)} ${event.thread}",
message = event.message,
body = event.stacktrace,
details = event.mdc
details = event.mdc,
)

is WrapperLogEvent -> DetailEvent(
title = dateFormatter.format(event.timestamp),
message = event.message,
body = event.stacktrace
body = event.stacktrace,
)
}
}
Expand Down Expand Up @@ -240,15 +240,15 @@ class LogPanel(
g.transform(
AffineTransform.getScaleInstance(
trackBounds.width / rangex.toDouble(),
trackBounds.height / density.size.toDouble()
)
trackBounds.height / density.size.toDouble(),
),
)
density.values.forEachIndexed { index, count ->
g.drawLine(
trackBounds.x,
trackBounds.y + index,
trackBounds.x + count,
trackBounds.y + index
trackBounds.y + index,
)
}
g.transform = old
Expand Down Expand Up @@ -286,7 +286,7 @@ class LogPanel(
Duration.ofHours(2),
Duration.ofHours(6),
Duration.ofHours(12),
Duration.ofDays(1)
Duration.ofDays(1),
)

private val DEFAULT_WRAPPER_LOG_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")
Expand Down Expand Up @@ -332,7 +332,7 @@ class LogPanel(
timestamp = time,
message = message.value.trim(),
logger = logger.value.trim(),
level = Level.valueOf(level.value.single())
level = Level.valueOf(level.value.single()),
)
} else {
val stack by match.groups
Expand All @@ -346,7 +346,7 @@ class LogPanel(
events += WrapperLogEvent(
timestamp = time,
message = stack.value,
level = Level.INFO
level = Level.INFO,
)
}
}
Expand Down
Loading

0 comments on commit 8e19942

Please sign in to comment.