-
Notifications
You must be signed in to change notification settings - Fork 106
/
Dangerfile
29 lines (23 loc) 路 1.23 KB
/
Dangerfile
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
# Display a friendly welcoming message to non-contributors
contributors = github.api.contributors("JohnSundell/ImagineEngine").map { |user| user.login }
unless contributors.include? github.pr_author
message "Hi @#{github.pr_author} 馃憢! Thank you for contributing to Imagine Engine! I'm the CI Bot for this project, and will assist you in getting your PR merged 馃憤"
end
# Show SwiftLint warnings inline in the diff
swiftlint.lint_files inline_mode: true
# Warning to discourage big PRs
if git.lines_of_code > 500
warn "Your PR has over 500 lines of code 馃槺 Try to break it up into separate PRs if possible 馃憤"
end
# Warning to encourage a PR description
if github.pr_body.length == 0
warn "Please add a decription to your PR to make it easier to review 馃憣"
end
# Encourage rebases instead of including merge commits
if git.commits.any? { |c| c.message =~ /^Merge branch 'master'/ }
warn "Please rebase to get rid of the merge commits in this PR 馃檹"
end
# If changes have been made in sources, encourage tests
if !git.modified_files.grep(/Sources/).empty? && git.modified_files.grep(/Tests/).empty?
warn "Remember to write tests in case you have added a new API or fixed a bug. Feel free to ask for help if you need it 馃憤"
end