-
-
Notifications
You must be signed in to change notification settings - Fork 141
/
Dangerfile.swift
33 lines (25 loc) · 1 KB
/
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
import Danger
import Foundation
let danger = Danger()
// fileImport: DangerfileExtensions/ChangelogCheck.swift
checkChangelog()
if danger.git.createdFiles.count + danger.git.modifiedFiles.count - danger.git.deletedFiles.count > 300 {
warn("Big PR, try to keep changes smaller if you can")
}
let swiftFilesWithCopyright = danger.git.createdFiles.filter {
$0.fileType == .swift
&& danger.utils.readFile($0).contains("// Created by")
}
if !swiftFilesWithCopyright.isEmpty {
let files = swiftFilesWithCopyright.joined(separator: ", ")
warn("In Danger JS we don't include copyright headers, found them in: \(files)")
}
let filesToLint = (danger.git.modifiedFiles + danger.git.createdFiles).filter { !$0.contains("Documentation/") }
SwiftLint.lint(.files(filesToLint), inline: true)
// Support running via `danger local`
if danger.github != nil {
// These checks only happen on a PR
if danger.github.pullRequest.title.contains("WIP") {
warn("PR is classed as Work in Progress")
}
}