-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into radial-search
Signed-off-by: alex-keeler <[email protected]>
- Loading branch information
Showing
179 changed files
with
7,472 additions
and
3,081 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
buildSrc/src/main/kotlin/opensearch-java.spotless-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
plugins { | ||
id("com.diffplug.spotless") | ||
} | ||
|
||
interface SpotlessConventionsPluginExtension { | ||
val eclipseFormatterConfigFile: RegularFileProperty | ||
} | ||
|
||
val extension = project.extensions.create<SpotlessConventionsPluginExtension>("spotlessConventions") | ||
|
||
extension.eclipseFormatterConfigFile.convention(rootProject.layout.projectDirectory.file("buildSrc/formatterConfig.xml")) | ||
|
||
spotless { | ||
java { | ||
target("**/*.java") | ||
|
||
licenseHeaderFile(rootProject.file("LICENSE_HEADER.txt")) | ||
.named("PrimaryLicenseHeader") | ||
.onlyIfContentMatches("^((?!Licensed to Elasticsearch)[\\s\\S])*$") | ||
.delimiter("(package |//-----)") | ||
|
||
licenseHeaderFile(rootProject.file("LICENSE_HEADER_FORKED.txt")) | ||
.named("ForkedLicenseHeader") | ||
.onlyIfContentMatches("Licensed to Elasticsearch") | ||
.delimiter("(package |//-----)") | ||
|
||
// Use the default importOrder configuration | ||
importOrder() | ||
removeUnusedImports() | ||
|
||
eclipse().configFile(extension.eclipseFormatterConfigFile) | ||
|
||
trimTrailingWhitespace() | ||
endWithNewline() | ||
|
||
// NOTE: Any time a custom step below is modified, bump this number. | ||
// Allows up-to-date checks to work correctly with custom steps. | ||
bumpThisNumberIfACustomStepChanges(1) | ||
|
||
val wildcardImportRegex = Regex("""^import\s+(?:static\s+)?[^*\s]+\.\*;$""", RegexOption.MULTILINE) | ||
custom("Refuse wildcard imports") { contents -> | ||
// Wildcard imports can't be resolved by spotless itself. | ||
// This will require the developer themselves to adhere to best practices. | ||
val wildcardImports = wildcardImportRegex.findAll(contents) | ||
if (wildcardImports.any()) { | ||
var msg = """ | ||
Please replace the following wildcard imports with explicit imports ('spotlessApply' cannot resolve this issue): | ||
""".trimIndent() | ||
wildcardImports.forEach { | ||
msg += "\n\t- ${it.value}" | ||
} | ||
msg += "\n" | ||
throw AssertionError(msg) | ||
} | ||
contents | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.