debian-mirror-gitlab/danger/metadata/Dangerfile

45 lines
1.5 KiB
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# rubocop:disable Style/SignalException
2019-09-30 21:07:59 +05:30
THROUGHPUT_LABELS = [
'Community contribution',
'security',
'bug',
'feature',
'backstage'
].freeze
2018-11-18 11:00:15 +05:30
if gitlab.mr_body.size < 5
fail "Please provide a proper merge request description."
end
if gitlab.mr_labels.empty?
fail "Please add labels to this merge request."
end
2019-09-30 21:07:59 +05:30
if (THROUGHPUT_LABELS & gitlab.mr_labels).empty?
warn 'Please add a [throughput label](https://about.gitlab.com/handbook/engineering/management/throughput/#implementation) to this merge request.'
end
2018-11-18 11:00:15 +05:30
unless gitlab.mr_json["assignee"]
warn "This merge request does not have any assignee yet. Setting an assignee clarifies who needs to take action on the merge request at any given time."
end
has_milestone = !gitlab.mr_json["milestone"].nil?
unless has_milestone
warn "This merge request does not refer to an existing milestone.", sticky: false
end
has_pick_into_stable_label = gitlab.mr_labels.find { |label| label.start_with?('Pick into') }
2020-01-12 00:16:45 +05:30
if gitlab.branch_for_base != "master" && !has_pick_into_stable_label && !helper.security_mr?
2018-11-20 20:47:30 +05:30
warn "Most of the time, merge requests should target `master`. Otherwise, please set the relevant `Pick into X.Y` label."
2018-11-18 11:00:15 +05:30
end
2018-12-13 13:39:08 +05:30
if gitlab.mr_json['title'].length > 72
warn 'The title of this merge request is longer than 72 characters and ' \
'would violate our commit message rules when using the Squash on Merge ' \
'feature. Please consider adjusting the title, or rebase the ' \
"commits manually and don't use Squash on Merge."
end