FINERACT-1072: Implementing Spotless for Gradle files

This commit is contained in:
Petri Tuomola
2020-07-04 11:25:23 +01:00
committed by Awasum Yannick
parent 1102d5b58a
commit 3f444e2710
2 changed files with 144 additions and 103 deletions
+63 -22
View File
@@ -184,7 +184,10 @@ eclipse
System.setProperty("openjpa.Log", "commons") System.setProperty("openjpa.Log", "commons")
openjpa { openjpa {
includes = ['**/AbstractPersistableCustom.class', '**/domain/*.class'] includes = [
'**/AbstractPersistableCustom.class',
'**/domain/*.class'
]
enhance { enhance {
enforcePropertyRestrictions true enforcePropertyRestrictions true
} }
@@ -219,13 +222,21 @@ jacocoTestReport{
spotless { spotless {
format 'misc', { format 'misc', {
target '**/*.md', '**/*.properties', '**/*.gradle', '**/.gitignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql' target '**/*.md', '**/*.properties', '**/.gitignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql'
targetExclude '**/build/**', '**/bin/**', '**/.settings/**','**/.idea/**' targetExclude '**/build/**', '**/bin/**', '**/.settings/**','**/.idea/**'
indentWithSpaces(4) indentWithSpaces(4)
endWithNewline() endWithNewline()
trimTrailingWhitespace() trimTrailingWhitespace()
} }
groovyGradle {
target '*.gradle', '**/*.gradle'
greclipse()
indentWithSpaces(4)
endWithNewline()
trimTrailingWhitespace()
}
java { java {
importOrder() //sort imports alphabetically importOrder() //sort imports alphabetically
removeUnusedImports() removeUnusedImports()
@@ -309,7 +320,6 @@ rat {
'**/native/**', '**/native/**',
'**/wrapper/**', '**/wrapper/**',
'**/build/**', '**/build/**',
//Api Docs //Api Docs
'**/api-docs/*.*', '**/api-docs/*.*',
'**/docs/system-architecture/.htaccess', '**/docs/system-architecture/.htaccess',
@@ -318,14 +328,11 @@ rat {
'**/docs/system-architecture/**/*.xml', '**/docs/system-architecture/**/*.xml',
'**/bootstrap-3.0.0/assets/application.js', '**/bootstrap-3.0.0/assets/application.js',
'**/system-architecture/js/plugins.js', '**/system-architecture/js/plugins.js',
//Apache License //Apache License
'**/bootstrap-3.0.0/assets/less.js', '**/bootstrap-3.0.0/assets/less.js',
'**/css/bootstrap-3.0.0/**/*.*', '**/css/bootstrap-3.0.0/**/*.*',
//Public Domain See http://www.JSON.org/js.html //Public Domain See http://www.JSON.org/js.html
'**/bootstrap-3.0.0/assets/json2.js.htm', '**/bootstrap-3.0.0/assets/json2.js.htm',
// MIT License // MIT License
'**/modernizr-2.6.2.min.js', '**/modernizr-2.6.2.min.js',
'**/css/normalize.css', '**/css/normalize.css',
@@ -340,12 +347,10 @@ rat {
'**/system-architecture/js/vendor/toc-0.1.2/jquery.toc.min.js', '**/system-architecture/js/vendor/toc-0.1.2/jquery.toc.min.js',
'**/assets/respond.min.js', '**/assets/respond.min.js',
'**/assets/html5shiv.js', '**/assets/html5shiv.js',
//BSD License //BSD License
'**/assets/uglify.js', '**/assets/uglify.js',
//Ignore out folder //Ignore out folder
'**/out/**', '**/out/**',
// Git build info // Git build info
"**/git.properties", "**/git.properties",
] ]
@@ -374,12 +379,33 @@ configurations {
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.compilerArgs += ["-Xlint:unchecked","-Xlint:cast","-Xlint:auxiliaryclass","-Xlint:deprecation", options.compilerArgs += [
"-Xlint:dep-ann","-Xlint:divzero","-Xlint:empty","-Xlint:exports","-Xlint:fallthrough", "-Xlint:unchecked",
"-Xlint:finally","-Xlint:module","-Xlint:opens","-Xlint:options","-Xlint:overloads", "-Xlint:cast",
"-Xlint:overrides","-Xlint:path","-Xlint:processing","-Xlint:removal", "-Xlint:auxiliaryclass",
"-Xlint:requires-automatic","-Xlint:requires-transitive-automatic","-Xlint:try", "-Xlint:deprecation",
"-Xlint:varargs","-Xlint:preview","-Xlint:static","-Werror"] "-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:exports",
"-Xlint:fallthrough",
"-Xlint:finally",
"-Xlint:module",
"-Xlint:opens",
"-Xlint:options",
"-Xlint:overloads",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:removal",
"-Xlint:requires-automatic",
"-Xlint:requires-transitive-automatic",
"-Xlint:try",
"-Xlint:varargs",
"-Xlint:preview",
"-Xlint:static",
"-Werror"
]
// TODO FINERACT-959 (gradually) enable -Xlint:all (see "javac -help -X") // TODO FINERACT-959 (gradually) enable -Xlint:all (see "javac -help -X")
options.deprecation = true options.deprecation = true
@@ -477,7 +503,12 @@ tasks.withType(JavaCompile) {
// "FieldCanBeFinal" // "FieldCanBeFinal"
) )
} }
options.compilerArgs +=["-Xmaxwarns",1500,"-Xmaxerrs",1500] options.compilerArgs +=[
"-Xmaxwarns",
1500,
"-Xmaxerrs",
1500
]
} }
@@ -556,19 +587,23 @@ pmd {
*/ */
war { war {
from('../licenses/binary/') { // notice the parens from('../licenses/binary/') {
// notice the parens
into "WEB-INF/licenses/binary/" // no leading slash into "WEB-INF/licenses/binary/" // no leading slash
} }
from('../LICENSE_RELEASE') { // notice the parens from('../LICENSE_RELEASE') {
// notice the parens
into "WEB-INF/" // no leading slash into "WEB-INF/" // no leading slash
} }
from('../NOTICE_RELEASE') { // notice the parens from('../NOTICE_RELEASE') {
// notice the parens
into "WEB-INF/" // no leading slash into "WEB-INF/" // no leading slash
} }
rename ('LICENSE_RELEASE', 'LICENSE') rename ('LICENSE_RELEASE', 'LICENSE')
rename ('NOTICE_RELEASE', 'NOTICE') rename ('NOTICE_RELEASE', 'NOTICE')
from('../DISCLAIMER') { // notice the parens from('../DISCLAIMER') {
// notice the parens
into "WEB-INF/" // no leading slash into "WEB-INF/" // no leading slash
} }
war.finalizedBy(bootWar) war.finalizedBy(bootWar)
@@ -589,7 +624,11 @@ license {
} }
task licenseFormatBuildScripts (type:nl.javadude.gradle.plugins.license.License) { task licenseFormatBuildScripts (type:nl.javadude.gradle.plugins.license.License) {
source = fileTree(dir: '../', includes: ['**/*.bat', '**/*.sh', '**/*.sql']) source = fileTree(dir: '../', includes: [
'**/*.bat',
'**/*.sh',
'**/*.sql'
])
} }
licenseFormat.dependsOn licenseFormatBuildScripts licenseFormat.dependsOn licenseFormatBuildScripts
@@ -677,7 +716,8 @@ task integrationTest(type:Test) {
integrationTest { integrationTest {
useJUnitPlatform() useJUnitPlatform()
testLogging { // FINERACT-927 testLogging {
// FINERACT-927
events "skipped", "failed" events "skipped", "failed"
showStandardStreams = false showStandardStreams = false
exceptionFormat "full" exceptionFormat "full"
@@ -685,7 +725,8 @@ integrationTest {
} }
test { test {
useJUnitPlatform() useJUnitPlatform()
testLogging { // FINERACT-927 testLogging {
// FINERACT-927
events "skipped", "failed" events "skipped", "failed"
showStandardStreams = false showStandardStreams = false
exceptionFormat "full" exceptionFormat "full"