From baee910ec44a664885ce9f854339698a8f5660b6 Mon Sep 17 00:00:00 2001 From: quebim Date: Tue, 15 Oct 2024 11:14:04 -0300 Subject: [PATCH] ADd precommit hook definition to perform basic formatting using spotless on indexer plugins --- plugins/command-manager/gradle/formatting.gradle | 14 ++++++++++++++ plugins/setup/gradle/formatting.gradle | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 plugins/command-manager/gradle/formatting.gradle create mode 100644 plugins/setup/gradle/formatting.gradle diff --git a/plugins/command-manager/gradle/formatting.gradle b/plugins/command-manager/gradle/formatting.gradle new file mode 100644 index 0000000..036ac4a --- /dev/null +++ b/plugins/command-manager/gradle/formatting.gradle @@ -0,0 +1,14 @@ +import org.opensearch.gradle.BuildPlugin + +allprojects { + plugins.withType(BuildPlugin).whenPluginAdded { + project.apply plugin: "com.diffplug.spotless" + + spotless { + target 'src/**/*.java' + removeUnusedImports() + trimTrailingWhitespace() + } + precommit.dependsOn 'spotlessJavaCheck' + } +} diff --git a/plugins/setup/gradle/formatting.gradle b/plugins/setup/gradle/formatting.gradle new file mode 100644 index 0000000..036ac4a --- /dev/null +++ b/plugins/setup/gradle/formatting.gradle @@ -0,0 +1,14 @@ +import org.opensearch.gradle.BuildPlugin + +allprojects { + plugins.withType(BuildPlugin).whenPluginAdded { + project.apply plugin: "com.diffplug.spotless" + + spotless { + target 'src/**/*.java' + removeUnusedImports() + trimTrailingWhitespace() + } + precommit.dependsOn 'spotlessJavaCheck' + } +}