-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Dangerfile
41 lines (28 loc) · 1.19 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
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true
def release_branch?
danger.github.branch_for_base.start_with?('release/') || danger.github.branch_for_base.start_with?('hotfix/')
end
def main_branch?
danger.github.branch_for_base == 'trunk'
end
def wip_feature?
has_wip_label = github.pr_labels.any? { |label| label.include?('WIP') }
has_wip_title = github.pr_title.include?('WIP')
has_wip_label || has_wip_title
end
return if github.pr_labels.include?('Releases')
github.dismiss_out_of_range_messages
manifest_pr_checker.check_gemfile_lock_updated
labels_checker.check(
required_labels: [//],
required_labels_error: 'PR requires at least one label.'
)
view_changes_need_screenshots.view_changes_need_screenshots
pr_size_checker.check_diff_size(
file_selector: ->(path) { !path.include?('/src/test') },
max_size: 300
)
android_unit_test_checker.check_missing_tests
# skip check for draft PRs and for WIP features unless the PR is against the main branch or release branch
milestone_checker.check_milestone_due_date(days_before_due: 4) unless github.pr_draft? || (wip_feature? && !(release_branch? || main_branch?))
rubocop.lint(inline_comment: true, fail_on_inline_comment: true, include_cop_names: true)