forked from OpenCombine/OpenCombine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDangerfile.swift
39 lines (29 loc) · 884 Bytes
/
Dangerfile.swift
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
import Danger
let danger = Danger()
do {
let addedTestFiles = danger
.git
.createdFiles
.filter { $0.hasSuffix("Tests.swift") }
let modifiedXCTestManifests = danger
.git
.modifiedFiles
.contains { $0.hasSuffix("XCTestManifests.swift") }
if !addedTestFiles.isEmpty && !modifiedXCTestManifests {
let addedTestsClasses = addedTestFiles.map {
"- `\($0.split(separator: "/").last!.dropLast(6))`\n"
}.joined()
fail("""
You've added the following test classes:
\(addedTestsClasses)
but forgot to modify `XCTestManifests.swift`.
""")
}
}
SwiftLint.lint(inline: true,
configFile: ".swiftlint.yml",
strict: true,
lintAllFiles: true)
if danger.warnings.isEmpty, danger.fails.isEmpty {
markdown("LGTM")
}