-
Notifications
You must be signed in to change notification settings - Fork 18
/
spotless.gradle
37 lines (32 loc) · 948 Bytes
/
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
apply plugin: "com.diffplug.spotless"
// 执行 commit 之前需要执行 ./gradlew spotlessApply 会按照定义好的规则去格式化项目
// 规则参考:https://github.com/diffplug/spotless/tree/master/plugin-gradle
spotless {
kotlin {
target '**/*.kt'
ktlint('0.40.0').userData(['disabled_rules': 'no-wildcard-imports'])
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
java {
target '**/*.java'
googleJavaFormat().aosp()
removeUnusedImports()
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
format 'xml', {
target '**/*.xml'
indentWithSpaces()
trimTrailingWhitespace()
endWithNewline()
}
format 'misc', {
target '**/*.gradle', '**/*.md', '**/.gitignore'
indentWithSpaces()
trimTrailingWhitespace()
endWithNewline()
}
}