Skip to content

Commit

Permalink
Add formatting changes in feature/extensions
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Jun 9, 2023
1 parent 56e77fe commit c83ad28
Show file tree
Hide file tree
Showing 3 changed files with 511 additions and 0 deletions.
54 changes: 54 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,60 @@ apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.pluginzip'
apply plugin: 'opensearch.rest-test'
apply plugin: 'opensearch.testclusters'
// apply from: 'gradle/formatting.gradle'

spotless {
java {
// Normally this isn't necessary, but we have Java sources in
// non-standard places
target '**/com/amazon/dlic/**/*.java'
target '**/com/amazon/security/**/*.java'
target '**/test/java/org/opensearch/security/**/*.java'

removeUnusedImports()
eclipse().configFile rootProject.file('formatter/formatterConfig.xml')
trimTrailingWhitespace()
endWithNewline();

// note: you can use an empty string for all the imports you didn't specify explicitly, and '\\#` prefix for static imports
importOrder('java', 'javax', '', 'com.amazon', 'org.opensearch', '\\#')

custom 'Refuse wildcard imports', {
// Wildcard imports can't be resolved; fail the build
if (it =~ /\s+import .*\*;/) {
throw new AssertionError("Do not use wildcard imports. 'spotlessApply' cannot resolve this issue.")
}
}

// See DEVELOPER_GUIDE.md for details of when to enable this.
if (System.getProperty('spotless.paddedcell') != null) {
paddedCell()
}
}
format 'misc', {
target '*.md', '*.gradle', '**/*.json', '**/*.yaml', '**/*.yml', '**/*.svg'

trimTrailingWhitespace()
endWithNewline()
}
format('javaFoo', JavaExtension) {

importOrder('java', 'javax', '', 'com.amazon', 'org.opensearch', '\\#')
target '**/*.java'
targetExclude '**/com/amazon/dlic/**/*.java'
targetExclude '**/com/amazon/security/**/*.java'
targetExclude '**/test/java/org/opensearch/security/**/*.java'
targetExclude 'src/integrationTest/**'

trimTrailingWhitespace()
endWithNewline();
}
format("integrationTest", JavaExtension) {
target('src/integrationTest/java/**/*.java')
importOrder('java', 'javax', '', 'com.amazon', 'org.opensearch', '\\#')
indentWithTabs(4)
}
}

licenseFile = rootProject.file('LICENSE.txt')
noticeFile = rootProject.file('NOTICE.txt')
Expand Down
Loading

0 comments on commit c83ad28

Please sign in to comment.