From 67d8aa913508815f7ecccc827e3ce37e4477b539 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Tue, 6 Feb 2024 16:48:04 +0100 Subject: [PATCH] Update Dangerfile to use latest Dangermattic plugins --- Dangerfile | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Dangerfile b/Dangerfile index 7fb50ff0d8f5..e9ace0b99553 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1,41 +1,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 +github.dismiss_out_of_range_messages -def main_branch? - danger.github.branch_for_base == 'trunk' -end +rubocop.lint(files: [], force_exclusion: true, inline_comment: true, fail_on_inline_comment: true, include_cop_names: true) -def wip_feature? - has_wip_label = github.pr_labels.any? { |label| label.include?('WIP') } - has_wip_title = github.pr_title.include?('WIP') +manifest_pr_checker.check_gemfile_lock_updated - has_wip_label || has_wip_title -end +android_release_checker.check_release_notes_and_play_store_strings -return if github.pr_labels.include?('Releases') +android_strings_checker.check_strings_do_not_refer_resource -github.dismiss_out_of_range_messages +# skip remaining checks if we're during the release process +if github.pr_labels.include?('Releases') + message("This PR has the 'Releases' label: some checks will be skipped.") + return +end -manifest_pr_checker.check_gemfile_lock_updated +common_release_checker.check_internal_release_notes_changed(report_type: :message) + +android_release_checker.check_modified_strings_on_release labels_checker.check( + do_not_merge_labels: ['Do Not Merge'], required_labels: [//], required_labels_error: 'PR requires at least one label.' ) -view_changes_need_screenshots.view_changes_need_screenshots +view_changes_checker.check pr_size_checker.check_diff_size( - file_selector: ->(path) { !path.include?('/src/test') }, - max_size: 300 + max_size: 300, + file_selector: ->(path) { !path.include?('/src/test') } ) 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) +unless github.pr_draft? || (github_utils.wip_feature? && !(github_utils.release_branch? || github_utils.main_branch?)) + milestone_checker.check_milestone_due_date(days_before_due: 4) +end