-
Notifications
You must be signed in to change notification settings - Fork 5
/
spotless.gradle
40 lines (34 loc) · 1.19 KB
/
spotless.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// spotless is a code formatter
spotless {
def ie3LicHead = '/*\n' +
' * © $YEAR. TU Dortmund University,\n' +
' * Institute of Energy Systems, Energy Efficiency and Energy Economics,\n' +
' * Research group Distribution grid planning and operation\n' +
'*/'
//sets a license header, removes unused imports and formats conforming to the google java format
java {
removeUnusedImports() // removes any unused imports
googleJavaFormat('1.13.0')
licenseHeader ie3LicHead
}
/* cf. https://github.com/diffplug/spotless/tree/master/plugin-gradle */
groovy {
licenseHeader ie3LicHead
// the Groovy Eclipse formatter extends the Java Eclipse formatter,
// so it formats Java files by default (unless `excludeJava` is used).
greclipse().configFile('greclipse.properties')
indentWithSpaces 2
}
groovyGradle {
// same as groovy, but for .gradle (defaults to '*.gradle')
target '*.gradle', 'gradle/scripts/*.gradle'
greclipse()
}
// removes unnecessary whitespace, indents with tabs and ends on new line for gradle, md and gitignore files and config-XMLs
format 'misc', {
target '**/.gitignore', 'configs/**'
trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
}