Skip to content

Commit 8103c82

Browse files
authored
chore: use custom ktlint-rules from repo tools (#1018)
1 parent 9caf319 commit 8103c82

File tree

28 files changed

+101
-43
lines changed

28 files changed

+101
-43
lines changed

build.gradle.kts

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
5-
import aws.sdk.kotlin.gradle.kmp.typedProp
5+
import aws.sdk.kotlin.gradle.dsl.configureLinting
6+
import aws.sdk.kotlin.gradle.util.typedProp
67
import java.net.URL
78
import java.time.Duration
89

@@ -13,7 +14,7 @@ buildscript {
1314
// only need to include it here, imports in subprojects will work automagically
1415
classpath("aws.sdk.kotlin:build-plugins") {
1516
version {
16-
require("0.1.1")
17+
require("0.2.0")
1718
}
1819
}
1920
}
@@ -144,43 +145,10 @@ if (
144145
}
145146
}
146147

147-
val ktlint: Configuration by configurations.creating {
148-
attributes {
149-
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
150-
}
151-
}
152-
val ktlintVersion: String by project
153-
dependencies {
154-
ktlint("com.pinterest:ktlint:$ktlintVersion")
155-
}
156-
157148
val lintPaths = listOf(
158149
"**/*.{kt,kts}",
159150
"!**/generated-src/**",
160151
"!**/smithyprojections/**",
161152
)
162153

163-
tasks.register<JavaExec>("ktlint") {
164-
description = "Check Kotlin code style."
165-
group = "Verification"
166-
classpath = configurations.getByName("ktlint")
167-
main = "com.pinterest.ktlint.Main"
168-
args = lintPaths
169-
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
170-
}
171-
172-
tasks.register<JavaExec>("ktlintFormat") {
173-
description = "Auto fix Kotlin code style violations"
174-
group = "formatting"
175-
classpath = configurations.getByName("ktlint")
176-
main = "com.pinterest.ktlint.Main"
177-
args = listOf("-F") + lintPaths
178-
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
179-
}
180-
181-
tasks.register("showRepos") {
182-
doLast {
183-
println("All repos:")
184-
println(repositories.map { it.name })
185-
}
186-
}
154+
configureLinting(lintPaths)

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/ServiceClientCompanionObjectWriter.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
package aws.sdk.kotlin.codegen
26

37
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3SigningConfig.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ class S3SigningConfig : KotlinIntegration {
2929
override fun enabledForService(model: Model, settings: KotlinSettings) =
3030
model.expectShape<ServiceShape>(settings.service).isS3
3131

32-
override fun authSchemes(ctx: ProtocolGenerator.GenerationContext): List<AuthSchemeHandler> {
33-
return listOf(S3AuthSchemeHandler())
34-
}
32+
override fun authSchemes(ctx: ProtocolGenerator.GenerationContext): List<AuthSchemeHandler> =
33+
listOf(S3AuthSchemeHandler())
3534
}
3635

3736
private class S3AuthSchemeHandler : SigV4AuthSchemeHandler() {

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/TruncatablePaginationIntegration.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
package aws.sdk.kotlin.codegen.customization.s3
26

37
import software.amazon.smithy.kotlin.codegen.KotlinSettings

codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/testutil/ModelUtil.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
package aws.sdk.kotlin.codegen.testutil
26

37
import software.amazon.smithy.kotlin.codegen.test.prependNamespaceAndService

examples/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
plugins {
26
kotlin("jvm") version "1.8.22"
37
}

examples/client-generator/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
plugins {
26
kotlin("jvm")
37
id("software.amazon.smithy").version("0.5.3")

examples/dynamodb-movies/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
plugins {
26
kotlin("jvm")
37
application

examples/s3-media-ingestion/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
plugins {
26
kotlin("jvm")
37
application

examples/settings.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
15
rootProject.name = "aws-sdk-kotlin-examples"
26

37
include(":client-generator")

0 commit comments

Comments
 (0)