2019-01-16 05:07:50 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
#
|
|
|
|
# Dangerfile
|
|
|
|
# mas-cli
|
|
|
|
#
|
|
|
|
# https://danger.systems/guides/dangerfile.html
|
|
|
|
#
|
|
|
|
|
2018-01-28 01:58:33 +00:00
|
|
|
# Sometimes it's a README fix, or something like that - which isn't relevant for
|
|
|
|
# including in a project's CHANGELOG for example
|
2021-04-29 05:38:03 +00:00
|
|
|
has_app_changes = !git.modified_files.grep(/Sources/).empty?
|
|
|
|
has_test_changes = !git.modified_files.grep(/Tests/).empty?
|
2018-01-28 04:12:34 +00:00
|
|
|
|
2021-05-09 18:27:22 +00:00
|
|
|
# if has_app_changes && !has_test_changes
|
2018-01-28 04:12:34 +00:00
|
|
|
# warn("Tests were not updated", sticky: false)
|
|
|
|
# end
|
|
|
|
|
|
|
|
# Thanks other people!
|
2021-05-09 18:27:22 +00:00
|
|
|
message(":tada:") if github.pr_author != "phatblat"
|
2018-01-28 04:12:34 +00:00
|
|
|
|
|
|
|
# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title
|
|
|
|
if github.pr_body.length < 5
|
2018-01-28 04:44:13 +00:00
|
|
|
fail ":memo: Please provide a summary in the Pull Request description"
|
2018-01-28 04:12:34 +00:00
|
|
|
end
|
|
|
|
|
2018-01-28 01:58:33 +00:00
|
|
|
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
|
2018-01-28 04:44:13 +00:00
|
|
|
warn(":construction: PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
|
2018-01-28 01:58:33 +00:00
|
|
|
|
|
|
|
# Warn when there is a big PR
|
2018-01-28 04:44:13 +00:00
|
|
|
warn(":dizzy_face: Big PR") if git.lines_of_code > 500
|
2018-01-28 01:58:33 +00:00
|
|
|
|
2021-05-08 17:23:59 +00:00
|
|
|
# Don't let testing shortcuts get into main by accident
|
2018-01-28 04:12:34 +00:00
|
|
|
#fail("fdescribe left in tests") if `grep -r fdescribe Tests/ `.length > 1
|
|
|
|
#fail("fit left in tests") if `grep -r fit Tests/ `.length > 1
|