-
Notifications
You must be signed in to change notification settings - Fork 137
/
Dangerfile
62 lines (48 loc) · 1.9 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# frozen_string_literal: true
github.dismiss_out_of_range_messages
# `files: []` forces rubocop to scan all files, not just the ones modified in the PR
rubocop.lint(files: [], force_exclusion: true, inline_comment: true, fail_on_inline_comment: true, include_cop_names: true)
manifest_pr_checker.check_gemfile_lock_updated
android_release_checker.check_release_notes_and_play_store_strings
android_strings_checker.check_strings_do_not_refer_resource
# skip remaining checks if we're in a release-process PR
if github.pr_labels.include?('Releases')
message('This PR has the `Releases` label: some checks will be skipped.')
return
end
common_release_checker.check_internal_release_notes_changed(report_type: :message)
tracks_checker.check_tracks_changes(
tracks_files: [
'AnalyticsTracker.kt',
'AnalyticsEvent.kt',
'LoginAnalyticsTracker.kt'
],
tracks_usage_matchers: [
/AnalyticsTracker\.track/
],
tracks_label: 'category: tracks'
)
view_changes_checker.check
pr_size_checker.check_diff_size(
max_size: 300,
file_selector: ->(path) { !path.include?('/src/test') }
)
android_unit_test_checker.check_missing_tests
# skip remaining checks if the PR is still a Draft
if github.pr_draft?
message('This PR is still a Draft: some checks will be skipped.')
return
end
labels_checker.check(
do_not_merge_labels: ['status: do not merge'],
required_labels: [//],
required_labels_error: 'PR requires at least one label.'
)
# runs the milestone check if this is not a WIP feature and the PR is against the main branch or the release branch
if (github_utils.main_branch? || github_utils.release_branch?) && !github_utils.wip_feature?
report_type = github.pr_labels.include?('milestone-not-required') || github.pr_labels.include?('status: feature-flagged') ? :message : :error
milestone_checker.check_milestone_due_date(
days_before_due: 2,
report_type_if_no_milestone: report_type
)
end