Skip to content

Commit cb6cfa2

Browse files
committed
chore: ktlint fixes
1 parent 64ec8d9 commit cb6cfa2

39 files changed

Lines changed: 400 additions & 293 deletions

build.gradle.kts

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,32 @@ intellijPlatform {
5959
version = providers.gradleProperty("pluginVersion")
6060

6161
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
62-
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
63-
val start = "<!-- Plugin description -->"
64-
val end = "<!-- Plugin description end -->"
65-
66-
with(it.lines()) {
67-
if (!containsAll(listOf(start, end))) {
68-
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
62+
description =
63+
providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
64+
val start = "<!-- Plugin description -->"
65+
val end = "<!-- Plugin description end -->"
66+
67+
with(it.lines()) {
68+
if (!containsAll(listOf(start, end))) {
69+
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
70+
}
71+
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
6972
}
70-
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
7173
}
72-
}
7374

7475
val changelog = project.changelog // local variable for configuration cache compatibility
7576
// Get the latest available change notes from the changelog file
76-
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
77-
with(changelog) {
78-
renderItem(
79-
(getOrNull(pluginVersion) ?: getUnreleased())
80-
.withHeader(false)
81-
.withEmptySections(false),
82-
Changelog.OutputType.HTML,
83-
)
77+
changeNotes =
78+
providers.gradleProperty("pluginVersion").map { pluginVersion ->
79+
with(changelog) {
80+
renderItem(
81+
(getOrNull(pluginVersion) ?: getUnreleased())
82+
.withHeader(false)
83+
.withEmptySections(false),
84+
Changelog.OutputType.HTML,
85+
)
86+
}
8487
}
85-
}
8688

8789
ideaVersion {
8890
sinceBuild = providers.gradleProperty("pluginSinceBuild")
@@ -100,7 +102,8 @@ intellijPlatform {
100102
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
101103
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
102104
// https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#specifying-a-release-channel
103-
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
105+
channels =
106+
providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
104107
}
105108

106109
pluginVerification {
@@ -142,14 +145,15 @@ intellijPlatformTesting {
142145
runIde {
143146
register("runIdeForUiTests") {
144147
task {
145-
jvmArgumentProviders += CommandLineArgumentProvider {
146-
listOf(
147-
"-Drobot-server.port=8082",
148-
"-Dide.mac.message.dialogs.as.sheets=false",
149-
"-Djb.privacy.policy.text=<!--999.999-->",
150-
"-Djb.consents.confirmation.enabled=false",
151-
)
152-
}
148+
jvmArgumentProviders +=
149+
CommandLineArgumentProvider {
150+
listOf(
151+
"-Drobot-server.port=8082",
152+
"-Dide.mac.message.dialogs.as.sheets=false",
153+
"-Djb.privacy.policy.text=<!--999.999-->",
154+
"-Djb.consents.confirmation.enabled=false",
155+
)
156+
}
153157
}
154158

155159
plugins {

src/main/kotlin/com/nazarethlabs/notes/AppStartupActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import com.intellij.openapi.project.Project
55
import com.intellij.openapi.startup.ProjectActivity
66

77
class AppStartupActivity : ProjectActivity {
8-
98
override suspend fun execute(project: Project) {
109
thisLogger().info("MyProjectActivity executed for project: ${project.name}")
1110
}

src/main/kotlin/com/nazarethlabs/notes/AppWindowFactory.kt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,30 @@ import com.intellij.ui.content.ContentFactory
88
import com.nazarethlabs.notes.ui.ToolWindowPanel
99

1010
class AppWindowFactory : ToolWindowFactory {
11-
1211
init {
1312
thisLogger().info("MyToolWindowFactory initialized")
1413
}
1514

16-
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
15+
override fun createToolWindowContent(
16+
project: Project,
17+
toolWindow: ToolWindow,
18+
) {
1719
val myToolWindow = MyToolWindow(project)
18-
val content = ContentFactory
19-
.getInstance()
20-
.createContent(myToolWindow.getContent(), null, false)
20+
val content =
21+
ContentFactory
22+
.getInstance()
23+
.createContent(myToolWindow.getContent(), null, false)
2124

2225
toolWindow.contentManager.addContent(content)
2326
}
2427

2528
override fun shouldBeAvailable(project: Project) = true
2629

27-
class MyToolWindow(private val project: Project) {
28-
fun getContent() = ToolWindowPanel()
29-
.create(project)
30+
class MyToolWindow(
31+
private val project: Project,
32+
) {
33+
fun getContent() =
34+
ToolWindowPanel()
35+
.create(project)
3036
}
3137
}

src/main/kotlin/com/nazarethlabs/notes/MyBundle.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ import org.jetbrains.annotations.PropertyKey
88
private const val BUNDLE = "messages.MyBundle"
99

1010
object MyBundle : DynamicBundle(BUNDLE) {
11-
1211
@JvmStatic
13-
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
14-
getMessage(key, *params)
12+
fun message(
13+
@PropertyKey(resourceBundle = BUNDLE) key: String,
14+
vararg params: Any,
15+
) = getMessage(key, *params)
1516

1617
@Suppress("unused")
1718
@JvmStatic
18-
fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
19-
getLazyMessage(key, *params)
19+
fun messagePointer(
20+
@PropertyKey(resourceBundle = BUNDLE) key: String,
21+
vararg params: Any,
22+
) = getLazyMessage(key, *params)
2023
}

src/main/kotlin/com/nazarethlabs/notes/dto/Note.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ data class Note(
66
var filePath: String = "",
77
var createdAt: Long = 0L,
88
var updatedAt: Long = 0L,
9-
var isFavorite: Boolean = false
9+
var isFavorite: Boolean = false,
1010
)

src/main/kotlin/com/nazarethlabs/notes/enum/SortTypeEnum.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ package com.nazarethlabs.notes.enum
33
enum class SortTypeEnum {
44
TITLE,
55
DATE,
6-
FAVORITE
6+
FAVORITE,
77
}

src/main/kotlin/com/nazarethlabs/notes/helper/DialogHelper.kt

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,32 @@ import com.intellij.openapi.project.Project
44
import com.intellij.openapi.ui.Messages
55

66
object DialogHelper {
7+
fun showYesNoDialog(
8+
project: Project,
9+
message: String,
10+
title: String,
11+
): Int = Messages.showYesNoDialog(project, message, title, Messages.getQuestionIcon())
712

8-
fun showYesNoDialog(project: Project, message: String, title: String): Int {
9-
return Messages.showYesNoDialog(project, message, title, Messages.getQuestionIcon())
10-
}
11-
12-
fun showInputDialog(project: Project, message: String, title: String, initialValue: String?): String? {
13-
return Messages.showInputDialog(project, message, title, Messages.getQuestionIcon(), initialValue, null)
14-
}
13+
fun showInputDialog(
14+
project: Project,
15+
message: String,
16+
title: String,
17+
initialValue: String?,
18+
): String? = Messages.showInputDialog(project, message, title, Messages.getQuestionIcon(), initialValue, null)
1519

16-
fun showWarningDialog(project: Project, message: String, title: String) {
20+
fun showWarningDialog(
21+
project: Project,
22+
message: String,
23+
title: String,
24+
) {
1725
Messages.showWarningDialog(project, message, title)
1826
}
1927

20-
fun showErrorDialog(project: Project, message: String, title: String) {
28+
fun showErrorDialog(
29+
project: Project,
30+
message: String,
31+
title: String,
32+
) {
2133
Messages.showErrorDialog(project, message, title)
2234
}
2335
}

src/main/kotlin/com/nazarethlabs/notes/helper/FileExtensionHelper.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package com.nazarethlabs.notes.helper
22

33
object FileExtensionHelper {
4-
54
fun normalizeExtension(extension: String): String {
6-
var normalized = extension.trim()
7-
.replace(Regex("[^a-zA-Z0-9.]"), "")
5+
var normalized =
6+
extension
7+
.trim()
8+
.replace(Regex("[^a-zA-Z0-9.]"), "")
89

910
if (normalized.isEmpty()) {
1011
return ".md"

src/main/kotlin/com/nazarethlabs/notes/helper/FileHelper.kt

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ package com.nazarethlabs.notes.helper
33
import java.io.File
44

55
object FileHelper {
6-
7-
fun createFile(dir: String, fileName: String): File {
6+
fun createFile(
7+
dir: String,
8+
fileName: String,
9+
): File {
810
val file = File(dir, fileName)
911
file.writeText("")
1012
return file
@@ -17,17 +19,24 @@ object FileHelper {
1719
}
1820
}
1921

20-
fun renameFile(oldPath: String, newName: String): Boolean {
22+
fun renameFile(
23+
oldPath: String,
24+
newName: String,
25+
): Boolean {
2126
val oldFile = File(oldPath)
2227
val newFile = File(oldFile.parent, newName)
2328
return oldFile.exists() && oldFile.renameTo(newFile)
2429
}
2530

26-
fun fileExists(parent: String, name: String): Boolean {
27-
return File(parent, name).exists()
28-
}
31+
fun fileExists(
32+
parent: String,
33+
name: String,
34+
): Boolean = File(parent, name).exists()
2935

30-
fun getNewFilePath(oldPath: String, newName: String): String {
36+
fun getNewFilePath(
37+
oldPath: String,
38+
newName: String,
39+
): String {
3140
val oldFile = File(oldPath)
3241
return File(oldFile.parent, newName).absolutePath
3342
}

src/main/kotlin/com/nazarethlabs/notes/helper/MessageHelper.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package com.nazarethlabs.notes.helper
33
import com.nazarethlabs.notes.MyBundle
44

55
object MessageHelper {
6-
7-
fun getMessage(key: String, vararg params: Any): String = MyBundle.message(key, *params)
6+
fun getMessage(
7+
key: String,
8+
vararg params: Any,
9+
): String = MyBundle.message(key, *params)
810
}

0 commit comments

Comments
 (0)