Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import com.diffplug.spotless.FormatterFunc
import com.github.spotbugs.snom.Effort
import java.util.regex.Pattern
import org.gradle.api.Project
import org.gradle.kotlin.dsl.the
import java.io.Serializable

plugins {
`java-library`
Expand Down Expand Up @@ -71,15 +73,25 @@ spotless {
// Enforce a common license header on all files
licenseHeaderFile("${project.rootDir}/config/spotless/license-header.txt")
.onlyIfContentMatches("^((?!SKIPLICENSECHECK)[\\s\\S])*\$")
indentWithSpaces()
leadingTabsToSpaces()
endWithNewline()

eclipse().configFile("${project.rootDir}/config/spotless/formatting.xml")

// Fixes for some strange formatting applied by eclipse:
// see: https://github.com/kamkie/demo-spring-jsf/blob/bcacb9dc90273a5f8d2569470c5bf67b171c7d62/build.gradle.kts#L159
custom("Lambda fix") { it.replace("} )", "})").replace("} ,", "},") }
custom("Long literal fix") { Pattern.compile("([0-9_]+) [Ll]").matcher(it).replaceAll("\$1L") }
// These have to be implemented with anonymous classes this way instead of lambdas because of:
// https://github.com/diffplug/spotless/issues/2387
custom("Lambda fix", object : Serializable, FormatterFunc {
override fun apply(input: String) : String {
return input.replace("} )", "})").replace("} ,", "},")
}
})
custom("Long literal fix", object : Serializable, FormatterFunc {
override fun apply(input: String) : String {
return Pattern.compile("([0-9_]+) [Ll]").matcher(input).replaceAll("\$1L")
}
})

// Static first, then everything else alphabetically
removeUnusedImports()
Expand All @@ -92,7 +104,7 @@ spotless {
// Formatting for build.gradle.kts files
kotlinGradle {
ktlint()
indentWithSpaces()
leadingTabsToSpaces()
trimTrailingWhitespace()
endWithNewline()
}
Expand Down
2 changes: 1 addition & 1 deletion codegen/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ junit5 = "5.11.4"
smithy = "1.54.0"
test-logger-plugin = "4.0.0"
spotbugs = "6.0.22"
spotless = "6.25.0"
spotless = "7.0.2"
smithy-gradle-plugins = "1.2.0"
dep-analysis = "2.8.2"

Expand Down
Loading