-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dangerfile.df.kts
53 lines (41 loc) · 1.56 KB
/
Dangerfile.df.kts
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
41
42
43
44
45
46
47
48
49
50
51
52
53
@file:DependsOn("com.gianluz:danger-kotlin-android-lint-plugin:0.1.0")
import com.gianluz.dangerkotlin.androidlint.AndroidLint
import com.gianluz.dangerkotlin.androidlint.androidLint
import systems.danger.kotlin.*
register plugin AndroidLint
danger(args) {
val allSourceFiles = git.modifiedFiles + git.createdFiles
val changelogChanged = allSourceFiles.contains("CHANGELOG.md")
val sourceChanges = allSourceFiles.firstOrNull { it.contains("src") }
onGitHub {
val isTrivial = pullRequest.title.contains("#trivial")
message("This PR has been checked by Danger")
// Changelog
if (!isTrivial && !changelogChanged && sourceChanges != null) {
warn(
"any changes to library code should be reflected in the Changelog.\n\n" +
"Please consider adding a note there and adhere to the " +
"[Changelog Guidelines](https://github.com/Moya/contributors/blob/master/Changelog%20Guidelines.md).",
)
}
// Big PR Check
if ((pullRequest.additions ?: 0) - (pullRequest.deletions ?: 0) > 300) {
warn("Big PR, try to keep changes smaller if you can")
}
// Work in progress check
if (pullRequest.title.contains("WIP", false)) {
warn("PR is classed as Work in Progress")
}
if (git.linesOfCode > 500) {
warn("This PR is original Xbox Huge! Consider breaking into smaller PRs")
}
}
androidLint {
val moduleLintFilesPaths = find(
projectDir = ".",
"lint-results-debug.xml",
"lint-results-release.xml",
).toTypedArray()
reportDistinct(*moduleLintFilesPaths)
}
}