Skip to content

Commit afa6392

Browse files
authored
jetbrains: Add ktlint to generator project (#896)
## Problem Code style is not consistent ## Solution Add ktlint to project ## License By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent b750b1a commit afa6392

File tree

8 files changed

+240
-159
lines changed

8 files changed

+240
-159
lines changed

telemetry/jetbrains/.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[*]
2+
charset = utf-8
3+
end_of_line = lf
4+
indent_size = 4
5+
indent_style = space
6+
insert_final_newline = true
7+
max_line_length = 160
8+
tab_width = 4
9+
ij_continuation_indent_size = 4
10+
11+
[*.{kt,kts}]
12+
ktlint_code_style = ktlint_official

telemetry/jetbrains/build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ plugins {
1111
`maven-publish`
1212
signing
1313
alias(libs.plugins.nexus.publishing)
14+
alias(libs.plugins.jlleitschuh.ktlint)
1415
}
1516

1617
java {
@@ -146,9 +147,10 @@ publishing {
146147
gradlePlugin { setAutomatedPublishing(false) }
147148

148149
signing {
149-
if (project.hasProperty("signing.keyId")
150-
&& project.hasProperty("signing.password")
151-
&& project.hasProperty("signing.secretKeyRingFile")) {
150+
if (project.hasProperty("signing.keyId") &&
151+
project.hasProperty("signing.password") &&
152+
project.hasProperty("signing.secretKeyRingFile")
153+
) {
152154
sign(publishing.publications["mavenJava"])
153155
}
154156
}

telemetry/jetbrains/gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[versions]
22
assertJ = "3.26.3"
33
jackson = "2.17.2"
4+
jlleitschuh-ktlint = "12.1.1"
45
# deprecated; should move to json-skema
56
jsonSchema = "1.14.4"
67
junit4 = "4.13.2"
@@ -16,5 +17,6 @@ json-schema = { module = "com.github.erosb:everit-json-schema", version.ref = "j
1617
junit4 = { module = "junit:junit", version.ref = "junit4" }
1718

1819
[plugins]
20+
jlleitschuh-ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "jlleitschuh-ktlint" }
1921
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
2022
nexus-publishing = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }

telemetry/jetbrains/src/main/kotlin/software/aws/toolkits/telemetry/generator/ResourceLoader.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
package software.aws.toolkits.telemetry.generator
55

66
object ResourceLoader {
7-
private const val schemaPath = "/telemetrySchema.json"
7+
private const val SCHEMA_PATH = "/telemetrySchema.json"
8+
9+
val SCHEMA_FILE = this.javaClass.getResourceAsStream(SCHEMA_PATH).use { it.bufferedReader().readText() }
810

9-
val SCHEMA_FILE = this.javaClass.getResourceAsStream(schemaPath).use { it.bufferedReader().readText() }
1011
// TODO add a manifest or something
11-
val DEFINITIONS_FILES = listOf("/definitions/commonDefinitions.json").map {
12-
this.javaClass.getResourceAsStream(it).use {
13-
it.bufferedReader().readText()
12+
val DEFINITIONS_FILES =
13+
listOf("/definitions/commonDefinitions.json").map {
14+
this.javaClass.getResourceAsStream(it).use {
15+
it.bufferedReader().readText()
16+
}
1417
}
15-
}
1618
}

0 commit comments

Comments
 (0)