From a5f69a8cadcca23ede0788b4960a4caf8b946516 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 30 Apr 2019 10:55:27 +0200 Subject: [PATCH] adding spotless to gradle config --- build-spotless.gradle | 15 ++ build.gradle | 5 +- cfg/spotless/eclipse_formatter.xml | 315 +++++++++++++++++++++++++ cfg/spotless/hsadminng.importorder | 8 + cfg/spotless/javascript_formatters.xml | 267 +++++++++++++++++++++ 5 files changed, 608 insertions(+), 2 deletions(-) create mode 100644 build-spotless.gradle create mode 100755 cfg/spotless/eclipse_formatter.xml create mode 100755 cfg/spotless/hsadminng.importorder create mode 100755 cfg/spotless/javascript_formatters.xml diff --git a/build-spotless.gradle b/build-spotless.gradle new file mode 100644 index 00000000..7f2fe589 --- /dev/null +++ b/build-spotless.gradle @@ -0,0 +1,15 @@ +// apply and check standard formatting of files + +apply plugin: "com.diffplug.gradle.spotless" + +spotless { + // automatically format source files, see https://github.com/diffplug/spotless + java { + licenseHeader '// Licensed under Apache-2.0' + importOrderFile 'cfg/spotless/hsadminng.importorder' + eclipse().configFile 'cfg/spotless/eclipse_formatter.xml' + target 'src/main/**/*.java', 'src/test/**/*.java' + removeUnusedImports() + endWithNewline() + } +} diff --git a/build.gradle b/build.gradle index 903163d2..dd7813d2 100644 --- a/build.gradle +++ b/build.gradle @@ -13,8 +13,8 @@ buildscript { classpath "org.openapitools:openapi-generator-gradle-plugin:3.3.0" classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.5.2" //jhipster-needle-gradle-buildscript-dependency - JHipster will add additional gradle build script plugins here - } - dependencies { + + classpath "com.diffplug.spotless:spotless-plugin-gradle:3.22.0" classpath 'org.owasp:dependency-check-gradle:4.0.2' } } @@ -49,6 +49,7 @@ apply plugin: 'idea' apply from: 'build-jacoco.gradle' apply from: 'build-pitest.gradle' apply from: 'build-cucumber.gradle' +apply from: 'build-spotless.gradle' idea { module { diff --git a/cfg/spotless/eclipse_formatter.xml b/cfg/spotless/eclipse_formatter.xml new file mode 100755 index 00000000..4a564e15 --- /dev/null +++ b/cfg/spotless/eclipse_formatter.xml @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cfg/spotless/hsadminng.importorder b/cfg/spotless/hsadminng.importorder new file mode 100755 index 00000000..da8e19e5 --- /dev/null +++ b/cfg/spotless/hsadminng.importorder @@ -0,0 +1,8 @@ +#Organize Import Order +6=javax +5=java +4=org +3=com +2= +1=org.hostsharing +0=\# diff --git a/cfg/spotless/javascript_formatters.xml b/cfg/spotless/javascript_formatters.xml new file mode 100755 index 00000000..08bdd71d --- /dev/null +++ b/cfg/spotless/javascript_formatters.xml @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +