From 58367d47e4d83cac4e6c4a15dcebcace6464b15e Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 21 Sep 2023 17:04:52 +0200 Subject: [PATCH 01/20] Run rubocop -a --- .rubocop.yml | 2 - Rakefile | 2 +- .../android/android_betabuild_prechecks.rb | 2 +- .../android/android_create_avd_action.rb | 4 +- .../android_download_translations_action.rb | 4 +- .../actions/android/android_firebase_test.rb | 4 +- .../android/android_send_app_size_metrics.rb | 6 +- .../android/android_update_release_notes.rb | 2 +- .../common/buildkite_annotate_action.rb | 4 +- .../common/check_translation_progress.rb | 10 +-- .../actions/common/close_milestone_action.rb | 2 +- .../common/copy_branch_protection_action.rb | 4 +- .../common/create_new_milestone_action.rb | 4 +- .../actions/common/create_release_action.rb | 10 +-- .../actions/common/get_prs_between_tags.rb | 12 ++-- .../common/promo_screenshots_action.rb | 2 +- .../common/remove_branch_protection_action.rb | 2 +- .../common/set_branch_protection_action.rb | 4 +- .../actions/common/setfrozentag_action.rb | 2 +- .../actions/common/upload_to_s3.rb | 8 +-- .../configure_add_files_to_copy_action.rb | 2 +- ...s_download_strings_files_from_glotpress.rb | 2 +- .../actions/ios/ios_final_tag.rb | 2 +- .../actions/ios/ios_get_store_app_sizes.rb | 4 +- .../actions/ios/ios_lint_localizations.rb | 4 +- .../actions/ios/ios_send_app_size_metrics.rb | 2 +- .../actions/ios/ios_update_release_notes.rb | 2 +- .../helper/android/android_emulator_helper.rb | 4 +- .../helper/android/android_localize_helper.rb | 4 +- .../android/android_tools_path_helper.rb | 2 +- .../helper/app_size_metrics_helper.rb | 4 +- .../wpmreleasetoolkit/helper/ci_helper.rb | 2 +- .../helper/configure_helper.rb | 2 +- .../wpmreleasetoolkit/helper/git_helper.rb | 4 +- .../wpmreleasetoolkit/helper/github_helper.rb | 8 +-- .../helper/interactive_prompt_reminder.rb | 4 +- .../helper/ios/ios_l10n_linter_helper.rb | 2 +- .../helper/metadata_download_helper.rb | 2 +- .../wpmreleasetoolkit/models/configuration.rb | 10 +-- .../models/file_reference.rb | 2 +- .../models/firebase_test_runner.rb | 8 +-- rakelib/changelog_parser.rake | 4 +- spec/an_localize_libs_action_spec.rb | 10 +-- spec/android_send_app_size_metrics_spec.rb | 4 +- spec/buildkite_annotate_action_spec.rb | 2 +- spec/check_localization_progress_spec.rb | 10 +-- spec/configure_helper_spec.rb | 2 +- spec/copy_branch_protection_action_spec.rb | 24 +++---- spec/file_reference_spec.rb | 2 +- spec/firebase_device_spec.rb | 2 +- spec/firebase_test_runner_spec.rb | 20 +++--- spec/get_prs_between_tags_spec.rb | 12 ++-- spec/git_helper_spec.rb | 16 ++--- spec/github_helper_spec.rb | 40 +++++------ spec/ios_bump_version_release_spec.rb | 2 +- ...nload_strings_files_from_glotpress_spec.rb | 6 +- ...os_generate_strings_file_from_code_spec.rb | 10 +-- spec/ios_get_app_version_spec.rb | 12 ++-- spec/ios_get_build_number_spec.rb | 8 +-- spec/ios_git_helper_spec.rb | 4 +- spec/ios_l10n_helper_spec.rb | 16 ++--- spec/ios_send_app_size_metrics_spec.rb | 6 +- ...otype_build_details_comment_action_spec.rb | 18 ++--- spec/remove_branch_protection_action_spec.rb | 12 ++-- spec/set_branch_protection_action_spec.rb | 70 +++++++++---------- spec/spec_helper.rb | 2 +- spec/upload_to_s3_spec.rb | 8 +-- 67 files changed, 243 insertions(+), 245 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 8b263b19d..6af26c18d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,3 @@ -inherit_from: .rubocop_todo.yml - require: - rubocop-rspec diff --git a/Rakefile b/Rakefile index b4d036d3e..a1a836702 100644 --- a/Rakefile +++ b/Rakefile @@ -56,7 +56,7 @@ task :new_release do Console.header 'Update `VERSION` constant in `version.rb`...' update_version_constant(VERSION_FILE, new_version) Console.header 'Updating CHANGELOG...' - parser.update_for_new_release(new_version: new_version) + parser.update_for_new_release(new_version:) # Commit and push Console.header 'Commit and push changes...' diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb index 803e40d2c..2b1a11318 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb @@ -42,7 +42,7 @@ def self.run(params) # Check user overwrite unless params[:base_version].nil? - overwrite_version = get_user_build_version(version: params[:base_version], message: message) + overwrite_version = get_user_build_version(version: params[:base_version], message:) release_version = overwrite_version[0] alpha_release_version = overwrite_version[1] end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_avd_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_avd_action.rb index 8fd4c1416..4a72b36ae 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_avd_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_avd_action.rb @@ -16,9 +16,9 @@ def self.run(params) helper.create_avd( api: api_level, device: device_model, - system_image: system_image, + system_image:, name: avd_name, - sdcard: sdcard + sdcard: ) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb index ce89aea6c..6f503b2ba 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb @@ -11,11 +11,11 @@ def self.run(params) res_dir = File.join(project_root_folder || '.', params[:res_dir]) Fastlane::Helper::Android::LocalizeHelper.create_available_languages_file( - res_dir: res_dir, + res_dir:, locale_codes: [params[:source_locale]] + params[:locales].map { |h| h[:android] } ) Fastlane::Helper::Android::LocalizeHelper.download_from_glotpress( - res_dir: res_dir, + res_dir:, glotpress_project_url: params[:glotpress_url], glotpress_filters: params[:status_filter].map { |s| { status: s } }, locales_map: params[:locales] diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb index 31799dddd..6889e8b15 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb @@ -33,14 +33,14 @@ def self.run(params) project_id: params[:project_id], apk_path: params[:apk_path], test_apk_path: params[:test_apk_path], - device: device, + device:, test_targets: params[:test_targets], type: params[:type] ) # Download all of the outputs from the job to the local machine FirebaseTestRunner.download_result_files( - result: result, + result:, destination: test_dir, project_id: params[:project_id], key_file_path: params[:key_file] diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_send_app_size_metrics.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_send_app_size_metrics.rb index 075f528a7..183f4f37e 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_send_app_size_metrics.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_send_app_size_metrics.rb @@ -42,18 +42,18 @@ def self.run(params) unless params[:aab_path].nil? generate_split_apks(aab_path: params[:aab_path]) do |apk| split_name = File.basename(apk, '.apk') - add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin: apkanalyzer_bin, apk: apk, split_name: split_name) + add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin:, apk:, split_name:) end end unless params[:universal_apk_path].nil? - add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin: apkanalyzer_bin, apk: params[:universal_apk_path], split_name: UNIVERSAL_APK_SPLIT_NAME) + add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin:, apk: params[:universal_apk_path], split_name: UNIVERSAL_APK_SPLIT_NAME) end end # Send the payload metrics_helper.send_metrics( to: api_url, - api_token: api_token, + api_token:, use_gzip: params[:use_gzip_content_encoding] ) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb index 5924acdfc..60e4b7c79 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb @@ -13,7 +13,7 @@ def self.run(params) path = params[:release_notes_file_path] next_version = Fastlane::Helper::Android::VersionHelper.calc_next_release_short_version(params[:new_version]) - Fastlane::Helper::ReleaseNotesHelper.add_new_section(path: path, section_title: next_version) + Fastlane::Helper::ReleaseNotesHelper.add_new_section(path:, section_title: next_version) Fastlane::Helper::GitHelper.commit(message: "Release Notes: add new section for next version (#{next_version})", files: path) UI.message 'Done.' diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb index 2b0b2f34f..e8850fd59 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb @@ -14,8 +14,8 @@ def self.run(params) else # Add new annotation using `buildkite-agent` extra_params = { - context: context, - style: style + context:, + style: }.compact.flat_map { |k, v| ["--#{k}", v] } sh('buildkite-agent', 'annotate', *extra_params, params[:message]) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb index ff0a092b4..e02c82987 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb @@ -15,7 +15,7 @@ def self.run(params) unless under_threshold_langs.empty? check_results( - under_threshold_langs: under_threshold_langs, + under_threshold_langs:, threshold: params[:min_acceptable_translation_percentage], skip_confirm: params[:skip_confirm] ) @@ -37,7 +37,7 @@ def self.check_translations(glotpress_url:, language_codes:, abort_on_violations under_threshold_langs = [] data = begin - Fastlane::Helper::GlotPressHelper.get_translation_status_data(glotpress_url: glotpress_url) + Fastlane::Helper::GlotPressHelper.get_translation_status_data(glotpress_url:) rescue StandardError nil end @@ -47,8 +47,8 @@ def self.check_translations(glotpress_url:, language_codes:, abort_on_violations UI.message("> Getting translation status for #{language_code}") progress = begin Fastlane::Helper::GlotPressHelper.get_translation_status( - data: data, - language_code: language_code + data:, + language_code: ) rescue StandardError -1 @@ -60,7 +60,7 @@ def self.check_translations(glotpress_url:, language_codes:, abort_on_violations end UI.message("Language #{language_code} is #{progress}% translated.") - under_threshold_langs.push({ lang: language_code, progress: progress }) if progress < threshold + under_threshold_langs.push({ lang: language_code, progress: }) if progress < threshold end under_threshold_langs diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb index 72cbecfa6..708a811bc 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb @@ -15,7 +15,7 @@ def self.run(params) UI.user_error!("Milestone #{milestone_title} not found.") if milestone.nil? - github_helper.update_milestone(repository: repository, number: milestone[:number], state: 'closed') + github_helper.update_milestone(repository:, number: milestone[:number], state: 'closed') end def self.description diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/copy_branch_protection_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/copy_branch_protection_action.rb index 8263577e2..ad373c83f 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/copy_branch_protection_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/copy_branch_protection_action.rb @@ -13,7 +13,7 @@ def self.run(params) response = begin github_helper.get_branch_protection( - repository: repository, + repository:, branch: from_branch ) rescue Octokit::NotFound @@ -24,7 +24,7 @@ def self.run(params) response = begin github_helper.set_branch_protection( - repository: repository, + repository:, branch: to_branch, **settings ) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb index 505814e22..bd0e8f6a5 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb @@ -26,10 +26,10 @@ def self.run(params) UI.message("Next milestone: #{newmilestone_number} due on #{newmilestone_duedate}.") github_helper.create_milestone( - repository: repository, + repository:, title: newmilestone_number, due_date: newmilestone_duedate, - days_until_submission: days_until_submission, + days_until_submission:, days_until_release: number_of_days_from_code_freeze_to_release ) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb index f294a362b..635e3ffee 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb @@ -24,13 +24,13 @@ def self.run(params) github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token]) url = github_helper.create_release( - repository: repository, - version: version, + repository:, + version:, target: params[:target], description: release_notes, - assets: assets, - prerelease: prerelease, - is_draft: is_draft + assets:, + prerelease:, + is_draft: ) UI.success("Successfully created GitHub Release. You can see it at '#{url}'") url diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb index e4a7724ae..20f00ad47 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb @@ -16,11 +16,11 @@ def self.run(params) github_helper = Fastlane::Helper::GithubHelper.new(github_token: gh_token) changelog = begin github_helper.generate_release_notes( - repository: repository, - tag_name: tag_name, - previous_tag: previous_tag, - target_commitish: target_commitish, - config_file_path: config_file_path + repository:, + tag_name:, + previous_tag:, + target_commitish:, + config_file_path: ) rescue StandardError => e error_msg = "❌ Error computing the list of PRs since #{previous_tag || 'last release'}: `#{e.message}`" @@ -31,7 +31,7 @@ def self.run(params) previous_release_link = if previous_tag.nil? 'last release' else - link = github_helper.get_release_url(repository: repository, tag_name: previous_tag) + link = github_helper.get_release_url(repository:, tag_name: previous_tag) "[#{previous_tag}](#{link})" end changelog diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb index 0ec1960fe..4aeda482d 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb @@ -13,7 +13,7 @@ def self.run(params) config = helper.read_config(params[:config_file]) - helper.check_fonts_installed!(config: config) unless params[:skip_font_check] + helper.check_fonts_installed!(config:) unless params[:skip_font_check] translation_directories = subdirectories_for_path(params[:metadata_folder]) image_directories = subdirectories_for_path(params[:orig_folder]) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/remove_branch_protection_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/remove_branch_protection_action.rb index 5df37656e..8bb85cd5c 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/remove_branch_protection_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/remove_branch_protection_action.rb @@ -10,7 +10,7 @@ def self.run(params) github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token]) github_helper.remove_branch_protection( - repository: repository, + repository:, branch: branch_name ) rescue Octokit::NotFound diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/set_branch_protection_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/set_branch_protection_action.rb index 361f2199b..e40fda071 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/set_branch_protection_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/set_branch_protection_action.rb @@ -11,7 +11,7 @@ def self.run(params) settings = if params[:keep_existing_settings_unchanged] Fastlane::Helper::GithubHelper.branch_protection_api_response_to_normalized_hash( - github_helper.get_branch_protection(repository: repository, branch: branch_name) + github_helper.get_branch_protection(repository:, branch: branch_name) ) else {} @@ -58,7 +58,7 @@ def self.run(params) # API Call - See https://docs.github.com/en/rest/branches/branch-protection#update-branch-protection response = github_helper.set_branch_protection( - repository: repository, + repository:, branch: branch_name, **settings ) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb index ca5e5d5d8..f739c4e9e 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb @@ -29,7 +29,7 @@ def self.run(params) end UI.message("New milestone: #{mile_title}") - github_helper.update_milestone(repository: repository, number: milestone[:number], title: mile_title) + github_helper.update_milestone(repository:, number: milestone[:number], title: mile_title) end def self.is_frozen(milestone) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb index 22fbe4030..b9647bc04 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb @@ -42,8 +42,8 @@ def self.run(params) File.open(file_path, 'rb') do |file| Aws::S3::Client.new.put_object( body: file, - bucket: bucket, - key: key + bucket:, + key: ) rescue Aws::S3::Errors::ServiceError => e UI.crash!("Unable to upload file to S3: #{e.message}") @@ -58,8 +58,8 @@ def self.run(params) def self.file_is_already_uploaded?(bucket, key) response = Aws::S3::Client.new.head_object( - bucket: bucket, - key: key + bucket:, + key: ) response[:content_length].positive? rescue Aws::S3::Errors::NotFound diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb index 95cdeacd2..9570d04a9 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb @@ -55,7 +55,7 @@ def self.add_file encrypt = UI.confirm('Encrypt file?:') - Fastlane::Helper::ConfigureHelper.add_file(source: source, destination: destination, encrypt: encrypt) + Fastlane::Helper::ConfigureHelper.add_file(source:, destination:, encrypt:) end def self.secret_store_dir diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb index 6eab435ab..28d817176 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb @@ -19,7 +19,7 @@ def self.run(params) project_url: params[:project_url], locale: glotpress_locale, filters: params[:filters], - destination: destination + destination: ) # Do a quick check of the downloaded `.strings` file to ensure it looks valid validate_strings_file(destination) unless params[:skip_file_validation] diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb index 51c0b805f..d33289605 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb @@ -12,7 +12,7 @@ def self.run(params) Fastlane::Helper::GitHelper.create_tag(version) - other_action.ios_clear_intermediate_tags(version: version) + other_action.ios_clear_intermediate_tags(version:) end ##################################################### diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb index 10b9b20c0..26d3e84f6 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb @@ -18,10 +18,10 @@ def self.run(params) case params[:format] when 'csv' - csv = Helper.format_csv(app_sizes, devices: devices) + csv = Helper.format_csv(app_sizes, devices:) UI.message "Result (CSV)\n\n#{csv}\n" when 'markdown' - tables = Helper.format_markdown(app_sizes, devices: devices) + tables = Helper.format_markdown(app_sizes, devices:) tables.each do |table| UI.message "Result (Markdown)\n\n#{table}\n" end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb index 01f9fdde6..54a36a787 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb @@ -14,7 +14,7 @@ def self.run(params) end end - report(violations: violations, base_lang: params[:base_lang]) + report(violations:, base_lang: params[:base_lang]) break unless !violations.empty? && params[:allow_retry] && UI.confirm(RETRY_MESSAGE) end @@ -53,7 +53,7 @@ def self.find_duplicated_keys(params) language = File.basename(File.dirname(file), '.lproj') path = File.join(params[:input_dir], file) - file_type = Fastlane::Helper::Ios::L10nHelper.strings_file_type(path: path) + file_type = Fastlane::Helper::Ios::L10nHelper.strings_file_type(path:) if file_type == :text duplicates = Fastlane::Helper::Ios::StringsFileValidationHelper.find_duplicated_keys(file: path) duplicate_keys[language] = duplicates.map { |key, value| "`#{key}` was found at multiple lines: #{value.join(', ')}" } unless duplicates.empty? diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb index dd891108a..065c30232 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb @@ -44,7 +44,7 @@ def self.run(params) # Send the payload metrics_helper.send_metrics( to: api_url, - api_token: api_token, + api_token:, use_gzip: params[:use_gzip_content_encoding] ) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb index fbf31d381..99e311c25 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb @@ -13,7 +13,7 @@ def self.run(params) path = params[:release_notes_file_path] next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(params[:new_version]) - Fastlane::Helper::ReleaseNotesHelper.add_new_section(path: path, section_title: next_version) + Fastlane::Helper::ReleaseNotesHelper.add_new_section(path:, section_title: next_version) Fastlane::Helper::GitHelper.commit(message: "Release Notes: add new section for next version (#{next_version})", files: path) UI.message 'Done.' diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb index 141d0899b..ea3768811 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb @@ -21,7 +21,7 @@ def initialize # @return [String] The `sdkmanager` package specifier that has been installed # def install_system_image(api:) - package = system_image_package(api: api) + package = system_image_package(api:) UI.message("Installing System Image for Android #{api} (#{package})") Actions.sh(@tools.sdkmanager, '--install', package) @@ -39,7 +39,7 @@ def install_system_image(api:) # @return [String] The device name (i.e. either `name` if provided, or the derived `_API_` if provided `name` was `nil``) # def create_avd(api:, device:, system_image: nil, name: nil, sdcard: '512M') - package = system_image || system_image_package(api: api) + package = system_image || system_image_package(api:) device_name = name || "#{device.gsub(' ', '_').capitalize}_API_#{api}" UI.message("Creating AVD `#{device_name}` (#{device}, API #{api})") diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb index 74d6b6048..3aa8113dd 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb @@ -163,7 +163,7 @@ def self.verify_diff(diff_string, main_strings, lib_strings, library) diff_string = diff_string.slice(0..(end_index - 1)) lib_strings.xpath('//string').each do |string_node| - verify_string(main_strings, library, string_node) if string_node.attr('name') == diff_string + res = verify_string(main_strings, library, string_node) if string_node.attr('name') == diff_string end end @@ -243,7 +243,7 @@ def self.download_from_glotpress(res_dir:, glotpress_project_url:, locales_map:, locales_map.each do |lang_codes| all_xml_documents = glotpress_filters.map do |filters| UI.message "Downloading translations for '#{lang_codes[:android]}' from GlotPress (#{lang_codes[:glotpress]}) [#{filters}]..." - download_glotpress_export_file(project_url: glotpress_project_url, locale: lang_codes[:glotpress], filters: filters) + download_glotpress_export_file(project_url: glotpress_project_url, locale: lang_codes[:glotpress], filters:) end.compact next if all_xml_documents.empty? diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_tools_path_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_tools_path_helper.rb index 7d31aca45..59b8202a5 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_tools_path_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_tools_path_helper.rb @@ -39,7 +39,7 @@ def find_tool_path(binary:, search_paths:) # @return [String] The absolute path of the tool if found. # @raise [FastlaneCore::Interface::FastlaneError] If the tool couldn't be found. def find_tool_path!(binary:, search_paths:) - bin_path = find_tool_path(binary: binary, search_paths: search_paths) + bin_path = find_tool_path(binary:, search_paths:) UI.user_error!("Unable to find path for #{binary} in #{search_paths.inspect}. Verify you installed the proper Android tools.") if bin_path.nil? bin_path end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb index f200a160a..9dc08ce21 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb @@ -22,7 +22,7 @@ def initialize(metadata = {}) # @param [Hash] hash The metadata common to all the metrics of the payload built by that helper instance. Can be any arbitrary set of key/value pairs # def metadata=(hash) - @metadata = (hash.compact || {}).map { |key, value| { name: key.to_s, value: value } } + @metadata = (hash.compact || {}).map { |key, value| { name: key.to_s, value: } } end # Adds a single metric to the group of metrics @@ -32,7 +32,7 @@ def metadata=(hash) # @param [Hash] metadata The arbitrary dictionary of metadata to associate to that metric entry # def add_metric(name:, value:, metadata: nil) - metric = { name: name, value: value } + metric = { name:, value: } metadata = metadata&.compact || {} # Remove nil values if any (and use empty Hash if nil was provided) metric[:meta] = metadata.map { |meta_key, meta_value| { name: meta_key.to_s, value: meta_value } } unless metadata.empty? @metrics.append(metric) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb index f448df8be..105109ae2 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb @@ -80,7 +80,7 @@ def trigger_job(branch:, parameters: nil) Net::HTTP.start(command_uri.host, command_uri.port, use_ssl: true) do |http| request = Net::HTTP::Post.new(command_uri.request_uri, headers) - body = { branch: branch, parameters: parameters } + body = { branch:, parameters: } request.body = body.to_json response = http.request(request) return response diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb index 1fbd66406..434226d9a 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb @@ -193,7 +193,7 @@ def self.file_dependencies end end - files_to_copy.map(&:file) + expanded_file_dependencies + self.files_to_copy.map { |o| o.file } + expanded_file_dependencies end ## If we specify a directory in `file_dependencies` instead of listing each file diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb index dc8ddbb15..ece26fcff 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb @@ -16,7 +16,7 @@ module GitHelper # def self.is_git_repo?(path: Dir.pwd) # If the path doesn't exist, find its first ancestor. - path = first_existing_ancestor_of(path: path) + path = first_existing_ancestor_of(path:) # Get the path's directory, so we can look in it for the Git folder dir = path.directory? ? path : path.dirname @@ -230,7 +230,7 @@ def self.ensure_on_branch!(branch_name) # # @return [Bool] True if the given path is ignored or outside a Git repository, false otherwise. def self.is_ignored?(path:) - return true unless is_git_repo?(path: path) + return true unless is_git_repo?(path:) Actions.sh('git', 'check-ignore', path) do |status, _, _| status.success? diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb index f8649c645..37b877967 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb @@ -151,7 +151,7 @@ def create_release(repository:, version:, description:, assets:, prerelease:, is version, # tag name name: version, # release name target_commitish: target || Git.open(Dir.pwd).log.first.sha, - prerelease: prerelease, + prerelease:, draft: is_draft, body: description ) @@ -178,10 +178,10 @@ def generate_release_notes(repository:, tag_name:, previous_tag:, target_commiti api_url = "#{repo_path}/releases/generate-notes" res = client.post( api_url, - tag_name: tag_name, - target_commitish: target_commitish, # Only used if no git tag named `tag_name` exists yet + tag_name:, + target_commitish:, # Only used if no git tag named `tag_name` exists yet previous_tag_name: previous_tag, - config_file_path: config_file_path + config_file_path: ) res.body end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb index 09e97c58f..d528e9bf1 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb @@ -75,7 +75,7 @@ def self.monkey_patch_interactive_prompts_with_reminder(after: DEFAULT_PROMPT_RE old_method = instance_method(method_name) define_method(method_name) do |*args| - FastlaneCore::Shell.with_reminder(after: after, message: message) { old_method.bind(self).call(*args) } + FastlaneCore::Shell.with_reminder(after:, message:) { old_method.bind(self).call(*args) } end end end @@ -89,5 +89,5 @@ def self.monkey_patch_interactive_prompts_with_reminder(after: DEFAULT_PROMPT_RE delays = ENV['FASTLANE_PROMPT_REMINDER_DELAYS']&.split(',')&.map(&:to_i) || FastlaneCore::Shell::DEFAULT_PROMPT_REMINDER_DELAYS FastlaneCore::UI.verbose("Monkey-patching the UI interactive methods to add a reminder (#{delays.inspect}, #{message.inspect})") - FastlaneCore::Shell.monkey_patch_interactive_prompts_with_reminder(after: delays, message: message) + FastlaneCore::Shell.monkey_patch_interactive_prompts_with_reminder(after: delays, message:) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb index 969fb0bad..274fc71b8 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb @@ -62,7 +62,7 @@ def install_swiftgen! # def run(input_dir:, base_lang: DEFAULT_BASE_LANG, only_langs: nil) check_swiftgen_installed || install_swiftgen! - find_diffs(input_dir: input_dir, base_lang: base_lang, only_langs: only_langs) + find_diffs(input_dir:, base_lang:, only_langs:) end ################## diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb index aa73a845d..4eead17e3 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb @@ -21,7 +21,7 @@ def initialize(target_folder, target_files, auto_retry) def download(target_locale, glotpress_url, is_source) uri = URI(glotpress_url) response = Net::HTTP.get_response(uri) - handle_glotpress_download(response: response, locale: target_locale, is_source: is_source) + handle_glotpress_download(response:, locale: target_locale, is_source:) end # Parse JSON data and update the local files diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb b/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb index c1bc33124..ffad9e077 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb @@ -29,11 +29,11 @@ def add_file_to_copy(source, destination, encrypt: false) def to_hash { - project_name: project_name, - branch: branch, - pinned_hash: pinned_hash, - files_to_copy: files_to_copy.map(&:to_hash), - file_dependencies: file_dependencies + project_name: self.project_name, + branch: self.branch, + pinned_hash: self.pinned_hash, + files_to_copy: self.files_to_copy.map { |f| f.to_hash }, + file_dependencies: self.file_dependencies } end end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb b/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb index 9874a183d..78b9ddf39 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb @@ -74,7 +74,7 @@ def encryption_key end def to_hash - { file: file, destination: destination, encrypt: encrypt } + { file: self.file, destination: self.destination, encrypt: self.encrypt } end end end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_runner.rb b/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_runner.rb index 8310b4253..d1a0c7cb2 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_runner.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_runner.rb @@ -27,7 +27,7 @@ def self.run_tests(project_id:, apk_path:, test_apk_path:, device:, test_targets params = { project: project_id, - type: type, + type:, app: apk_path, test: test_apk_path, 'test-targets': test_targets, @@ -42,7 +42,7 @@ def self.run_tests(project_id:, apk_path:, test_apk_path:, device:, test_targets Action.sh("#{command} 2>&1 | tee #{log_file_path}") # Make the file object available to other tasks - result = FirebaseTestLabResult.new(log_file_path: log_file_path) + result = FirebaseTestLabResult.new(log_file_path:) Fastlane::Actions.lane_context[:FIREBASE_TEST_LOG_FILE] = result result @@ -64,7 +64,7 @@ def self.download_result_files(result:, destination:, project_id:, key_file_path FileUtils.mkdir_p(destination) unless File.directory?(destination) storage = Google::Cloud::Storage.new( - project_id: project_id, + project_id:, credentials: key_file_path ) @@ -74,7 +74,7 @@ def self.download_result_files(result:, destination:, project_id:, key_file_path # Download the files UI.header "Downloading Results Files to #{destination}" - files_to_download.each { |file| download_file(file: file, destination: destination) } + files_to_download.each { |file| download_file(file:, destination:) } end # Download a Google Cloud Storage file to the local machine, creating intermediate directories as needed. diff --git a/rakelib/changelog_parser.rake b/rakelib/changelog_parser.rake index cc7ab00ea..6ba0046f2 100644 --- a/rakelib/changelog_parser.rake +++ b/rakelib/changelog_parser.rake @@ -18,12 +18,12 @@ class ChangelogParser prev_subtitle = nil loop do (lines, next_level, next_subtitle) = advance_to_next_header(level: 2..3) - subsections.append({ title: prev_subtitle, lines: lines }) unless lines.reject { |l| l.chomp.empty? || l.chomp == EMPTY_PLACEHOLDER }.empty? + subsections.append({ title: prev_subtitle, lines: }) unless lines.reject { |l| l.chomp.empty? || l.chomp == EMPTY_PLACEHOLDER }.empty? prev_subtitle = next_subtitle break if next_level < 3 end - @pending_section = { lines_before: lines_before_first_section, subsections: subsections, next_title: prev_subtitle } + @pending_section = { lines_before: lines_before_first_section, subsections:, next_title: prev_subtitle } prev_subtitle end diff --git a/spec/an_localize_libs_action_spec.rb b/spec/an_localize_libs_action_spec.rb index e3d97b586..3586048d0 100644 --- a/spec/an_localize_libs_action_spec.rb +++ b/spec/an_localize_libs_action_spec.rb @@ -32,7 +32,7 @@ def write_android_xml(path, lines) File.write(lib2_strings_path, android_xml_with_lines(['test from lib 2'])) run_described_fastlane_action( - app_strings_path: app_strings_path, + app_strings_path:, libs_strings_path: [ { library: 'lib_1', strings_path: lib1_strings_path, exclusions: [] }, { library: 'lib_2', strings_path: lib2_strings_path, exclusions: [] }, @@ -67,7 +67,7 @@ def write_android_xml(path, lines) File.write(lib_strings_path, android_xml_with_lines(lib_xml_lines)) run_described_fastlane_action( - app_strings_path: app_strings_path, + app_strings_path:, libs_strings_path: [ { library: 'lib', strings_path: lib_strings_path, exclusions: [] }, ] @@ -108,7 +108,7 @@ def write_android_xml(path, lines) File.write(lib2_strings_path, android_xml_with_lines(lib2_xml_lines)) run_described_fastlane_action( - app_strings_path: app_strings_path, + app_strings_path:, libs_strings_path: [ { library: 'lib1', strings_path: lib1_strings_path, source_id: 'lib1-id' }, { library: 'lib2', strings_path: lib2_strings_path, source_id: 'lib2-id' }, @@ -157,7 +157,7 @@ def write_android_xml(path, lines) File.write(lib2_strings_path, android_xml_with_lines(lib2_xml_lines)) run_described_fastlane_action( - app_strings_path: app_strings_path, + app_strings_path:, libs_strings_path: [ { library: 'lib1', strings_path: lib1_strings_path, source_id: 'lib1', add_ignore_attr: true }, { library: 'lib2', strings_path: lib2_strings_path, source_id: 'lib2' }, @@ -201,7 +201,7 @@ def write_android_xml(path, lines) File.write(lib_strings_path, android_xml_with_lines(lib_xml_lines)) run_described_fastlane_action( - app_strings_path: app_strings_path, + app_strings_path:, libs_strings_path: [ { library: 'lib', strings_path: lib_strings_path, exclusions: ['override-missing'] }, ] diff --git a/spec/android_send_app_size_metrics_spec.rb b/spec/android_send_app_size_metrics_spec.rb index 2f0455587..3f536f9e8 100644 --- a/spec/android_send_app_size_metrics_spec.rb +++ b/spec/android_send_app_size_metrics_spec.rb @@ -49,8 +49,8 @@ def test_app_size_action(fake_aab_size:, fake_apks:, fake_universal_apk_sizes:, # Act action_params = { api_url: File.join('file://localhost/', output_file), - aab_path: aab_path, - universal_apk_path: universal_apk_path, + aab_path:, + universal_apk_path:, **other_action_args }.compact code = run_described_fastlane_action(action_params) diff --git a/spec/buildkite_annotate_action_spec.rb b/spec/buildkite_annotate_action_spec.rb index f042acee7..fa98be7a4 100644 --- a/spec/buildkite_annotate_action_spec.rb +++ b/spec/buildkite_annotate_action_spec.rb @@ -17,7 +17,7 @@ expect(FastlaneCore::UI).not_to receive(:user_error!) cmd = run_described_fastlane_action( context: 'ctx', - style: style, + style:, message: 'message' ) expect(cmd).to eq("buildkite-agent annotate --context ctx --style #{style} message") diff --git a/spec/check_localization_progress_spec.rb b/spec/check_localization_progress_spec.rb index d9275d98d..c3726fe6f 100644 --- a/spec/check_localization_progress_spec.rb +++ b/spec/check_localization_progress_spec.rb @@ -336,11 +336,11 @@ def generate_glotpress_response_header def generate_glotpress_response_for_language(lang:, lang_code:, current:, fuzzy:, waiting:, untranslated:, progress:) res = "\n" - res << generate_glotpress_response_header_for_language(lang: lang, lang_code: lang_code, progress: progress) - res << generate_glotpress_response_for_language_status(lang_code: lang_code, status_main: 'translated', status: 'current', string_count: current) - res << generate_glotpress_response_for_language_status(lang_code: lang_code, status_main: 'fuzzy', status: 'fuzzy', string_count: fuzzy) - res << generate_glotpress_response_for_language_status(lang_code: lang_code, status_main: 'untranslated', status: 'untranslated', string_count: waiting) - res << generate_glotpress_response_for_language_status(lang_code: lang_code, status_main: 'waiting', status: 'waiting', string_count: untranslated) + res << generate_glotpress_response_header_for_language(lang:, lang_code:, progress:) + res << generate_glotpress_response_for_language_status(lang_code:, status_main: 'translated', status: 'current', string_count: current) + res << generate_glotpress_response_for_language_status(lang_code:, status_main: 'fuzzy', status: 'fuzzy', string_count: fuzzy) + res << generate_glotpress_response_for_language_status(lang_code:, status_main: 'untranslated', status: 'untranslated', string_count: waiting) + res << generate_glotpress_response_for_language_status(lang_code:, status_main: 'waiting', status: 'waiting', string_count: untranslated) res << '' end diff --git a/spec/configure_helper_spec.rb b/spec/configure_helper_spec.rb index ab01e1372..2afb5457d 100644 --- a/spec/configure_helper_spec.rb +++ b/spec/configure_helper_spec.rb @@ -17,7 +17,7 @@ expect(Fastlane::UI).to receive(:user_error!) - described_class.add_file(source: 'path/to/source', destination: destination, encrypt: true) + described_class.add_file(source: 'path/to/source', destination:, encrypt: true) end end end diff --git a/spec/copy_branch_protection_action_spec.rb b/spec/copy_branch_protection_action_spec.rb index c97bb3c5a..8368c9fef 100644 --- a/spec/copy_branch_protection_action_spec.rb +++ b/spec/copy_branch_protection_action_spec.rb @@ -32,9 +32,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - from_branch: from_branch, - to_branch: to_branch, - github_token: github_token + from_branch:, + to_branch:, + github_token: ) end @@ -44,9 +44,9 @@ def fixture(file) expect do run_described_fastlane_action( repository: repo, - from_branch: from_branch, - to_branch: to_branch, - github_token: github_token + from_branch:, + to_branch:, + github_token: ) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Branch `#{from_branch}` of repository `#{repo}` was not found.") end @@ -57,9 +57,9 @@ def fixture(file) expect do run_described_fastlane_action( repository: repo, - from_branch: from_branch, - to_branch: to_branch, - github_token: github_token + from_branch:, + to_branch:, + github_token: ) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Branch `#{from_branch}` does not have any branch protection set up.") end @@ -73,9 +73,9 @@ def fixture(file) expect do run_described_fastlane_action( repository: repo, - from_branch: from_branch, - to_branch: to_branch, - github_token: github_token + from_branch:, + to_branch:, + github_token: ) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Branch `#{to_branch}` of repository `#{repo}` was not found.") end diff --git a/spec/file_reference_spec.rb b/spec/file_reference_spec.rb index 689616819..2100b1bff 100644 --- a/spec/file_reference_spec.rb +++ b/spec/file_reference_spec.rb @@ -128,6 +128,6 @@ def stub_path_as_ignored(path:, ignored:) allow(Fastlane::Helper::GitHelper).to receive(:is_ignored?) - .with(path: path) + .with(path:) .and_return(ignored) end diff --git a/spec/firebase_device_spec.rb b/spec/firebase_device_spec.rb index dd15f0625..8e2344d6a 100644 --- a/spec/firebase_device_spec.rb +++ b/spec/firebase_device_spec.rb @@ -14,7 +14,7 @@ end def create_model(model: 'Nexus5', version: 27, locale: 'en', orientation: 'portrait') - described_class.new(model: model, version: version, locale: locale, orientation: orientation) + described_class.new(model:, version:, locale:, orientation:) end describe 'initialization' do diff --git a/spec/firebase_test_runner_spec.rb b/spec/firebase_test_runner_spec.rb index 92ebcfcdd..c76d93e82 100644 --- a/spec/firebase_test_runner_spec.rb +++ b/spec/firebase_test_runner_spec.rb @@ -76,12 +76,12 @@ def run_tests(project_id: 'foo-bar-baz', apk_path: default_file, test_apk_path: default_file, device: 'device', test_targets: nil, type: 'instrumentation') Fastlane::Actions.lane_context[:FIREBASE_TEST_LOG_FILE_PATH] = runner_temp_file described_class.run_tests( - project_id: project_id, - apk_path: apk_path, - test_apk_path: test_apk_path, - device: device, - test_targets: test_targets, - type: type + project_id:, + apk_path:, + test_apk_path:, + device:, + test_targets:, + type: ) end end @@ -100,10 +100,10 @@ def run_tests(project_id: 'foo-bar-baz', apk_path: default_file, test_apk_path: def run_download(result: passed_test_log, destination: '/tmp/test', project_id: 'foo-bar-baz', key_file_path: 'invalid') described_class.download_result_files( - result: result, - destination: destination, - project_id: project_id, - key_file_path: key_file_path + result:, + destination:, + project_id:, + key_file_path: ) end end diff --git a/spec/get_prs_between_tags_spec.rb b/spec/get_prs_between_tags_spec.rb index ad27285ff..15c60c1f2 100644 --- a/spec/get_prs_between_tags_spec.rb +++ b/spec/get_prs_between_tags_spec.rb @@ -60,9 +60,9 @@ def test_with_params(target_commitish: nil, previous_tag: nil, configuration_fil github_token: test_token, repository: test_repo, tag_name: test_tag_name, - target_commitish: target_commitish, - previous_tag: previous_tag, - configuration_file_path: configuration_file_path + target_commitish:, + previous_tag:, + configuration_file_path: ) # Assert @@ -120,9 +120,9 @@ def test_with_params(target_commitish: nil, previous_tag: nil, configuration_fil github_token: test_token, repository: test_repo, tag_name: test_tag_name, - target_commitish: target_commitish, - previous_tag: previous_tag, - configuration_file_path: configuration_file_path + target_commitish:, + previous_tag:, + configuration_file_path: ) # Assert diff --git a/spec/git_helper_spec.rb b/spec/git_helper_spec.rb index 3a814a59f..5b4963957 100644 --- a/spec/git_helper_spec.rb +++ b/spec/git_helper_spec.rb @@ -49,7 +49,7 @@ `git -C #{dir} init --initial-branch main || git -C #{dir} init` path = File.join(dir, 'a', 'b') `mkdir -p #{path}` - expect(described_class.is_git_repo?(path: path)).to be true + expect(described_class.is_git_repo?(path:)).to be true end end @@ -101,7 +101,7 @@ files = ['file 1', 'file 2', 'file 3'] expect_shell_command('git', 'add', files[0], files[1], files[2]) expect_shell_command('git', 'commit', '-m', @message) - described_class.commit(message: @message, files: files) + described_class.commit(message: @message, files:) end it 'adds all pending file changes before commit if :all is provided as `files`' do @@ -118,7 +118,7 @@ dummy_file_path: path, add_file_to_gitignore: false ) - expect(described_class.is_ignored?(path: path)).to be false + expect(described_class.is_ignored?(path:)).to be false end context 'when the path is in the .gitignore' do @@ -132,7 +132,7 @@ add_file_to_gitignore: true, commit_gitignore: false ) - expect(described_class.is_ignored?(path: path)).to be true + expect(described_class.is_ignored?(path:)).to be true end it 'returns true when the .gitignore has no uncommitted changes' do @@ -141,7 +141,7 @@ add_file_to_gitignore: true, commit_gitignore: true ) - expect(described_class.is_ignored?(path: path)).to be true + expect(described_class.is_ignored?(path:)).to be true end end @@ -149,7 +149,7 @@ # We need the ability to tell if a path result is ignored, regardless of whether it exists yet. it 'returns false for files not yet created but part of the repository' do setup_git_repo - expect(described_class.is_ignored?(path: path)).to be false + expect(described_class.is_ignored?(path:)).to be false end it 'returns true when the path is outside the repository folder' do @@ -157,14 +157,14 @@ path = File.join(@path, '..', 'dummy.txt') setup_git_repo(dummy_file_path: path, add_file_to_gitignore: false) - expect(described_class.is_ignored?(path: path)).to be true + expect(described_class.is_ignored?(path:)).to be true end # This is sort of redundant given the previous example already ensures the same logic. # But, we'll be using paths starting with `~` as part of our configurations, so it felt appopriate to explicitly ensure this important use case is respected. it 'returns true when the path is in the home folder ' do path = '~/a/path' - expect(described_class.is_ignored?(path: path)).to be true + expect(described_class.is_ignored?(path:)).to be true end end end diff --git a/spec/github_helper_spec.rb b/spec/github_helper_spec.rb index 15db5bf35..a45d33a3b 100644 --- a/spec/github_helper_spec.rb +++ b/spec/github_helper_spec.rb @@ -40,7 +40,7 @@ def download_file_from_tag(download_folder:) helper = described_class.new(github_token: 'Fake-GitHubToken-123') - helper.download_file_from_tag(repository: test_repo, tag: test_tag, file_path: test_file, download_folder: download_folder) + helper.download_file_from_tag(repository: test_repo, tag: test_tag, file_path: test_file, download_folder:) end end @@ -67,12 +67,12 @@ def download_file_from_tag(download_folder:) end def mock_milestone(title) - { title: title } + { title: } end def get_last_milestone(repository:) helper = described_class.new(github_token: 'Fake-GitHubToken-123') - helper.get_last_milestone(repository: repository) + helper.get_last_milestone(repository:) end end @@ -332,7 +332,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date: due_date, days_until_submission: 4, days_until_release: 7) + create_milestone(due_date:, days_until_submission: 4, days_until_release: 7) end it 'computes the correct dates when submission and release dates are in the same day' do @@ -343,7 +343,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date: due_date, days_until_submission: 1, days_until_release: 1) + create_milestone(due_date:, days_until_submission: 1, days_until_release: 1) end it 'computes the correct dates when the due date is on the verge of a DST day change' do @@ -359,7 +359,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date: due_date, days_until_submission: 2, days_until_release: 3) + create_milestone(due_date:, days_until_submission: 2, days_until_release: 3) end end @@ -376,7 +376,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date: due_date, days_until_submission: 2, days_until_release: 3) + create_milestone(due_date:, days_until_submission: 2, days_until_release: 3) end end @@ -392,7 +392,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date: due_date, days_until_submission: 2, days_until_release: 3) + create_milestone(due_date:, days_until_submission: 2, days_until_release: 3) end end @@ -406,7 +406,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date: due_date, days_until_submission: 140, days_until_release: 146) + create_milestone(due_date:, days_until_submission: 140, days_until_release: 146) end end @@ -420,7 +420,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date: due_date, days_until_submission: 216, days_until_release: 217) + create_milestone(due_date:, days_until_submission: 216, days_until_release: 217) end end @@ -435,7 +435,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date: due_date, days_until_submission: 60, days_until_release: 61) + create_milestone(due_date:, days_until_submission: 60, days_until_release: 61) end end @@ -450,25 +450,25 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date: due_date, days_until_submission: 60, days_until_release: 61) + create_milestone(due_date:, days_until_submission: 60, days_until_release: 61) end end it 'raises an error if days_until_submission is less than or equal zero' do due_date = '2022-10-20T08:00:00Z'.to_time.utc - expect { create_milestone(due_date: due_date, days_until_submission: 0, days_until_release: 5) } + expect { create_milestone(due_date:, days_until_submission: 0, days_until_release: 5) } .to raise_error(FastlaneCore::Interface::FastlaneError, 'days_until_submission must be greater than zero.') end it 'raises an error if days_until_release is less than or equal zero' do due_date = '2022-10-20T08:00:00Z'.to_time.utc - expect { create_milestone(due_date: due_date, days_until_submission: 12, days_until_release: -8) } + expect { create_milestone(due_date:, days_until_submission: 12, days_until_release: -8) } .to raise_error(FastlaneCore::Interface::FastlaneError, 'days_until_release must be greater than zero.') end it 'raises an error if days_until_submission is greater than days_until_release' do due_date = '2022-10-20T08:00:00Z'.to_time.utc - expect { create_milestone(due_date: due_date, days_until_submission: 14, days_until_release: 3) } + expect { create_milestone(due_date:, days_until_submission: 14, days_until_release: 3) } .to raise_error(FastlaneCore::Interface::FastlaneError, 'days_until_release must be greater or equal to days_until_submission.') end @@ -477,9 +477,9 @@ def create_milestone(due_date:, days_until_submission:, days_until_release:) helper.create_milestone( repository: test_repo, title: test_milestone_number, - due_date: due_date, - days_until_submission: days_until_submission, - days_until_release: days_until_release + due_date:, + days_until_submission:, + days_until_release: ) end end @@ -542,9 +542,9 @@ def create_release(is_draft:, assets: []) version: test_tag, target: test_target, description: test_description, - assets: assets, + assets:, prerelease: false, - is_draft: is_draft + is_draft: ) end end diff --git a/spec/ios_bump_version_release_spec.rb b/spec/ios_bump_version_release_spec.rb index fe273ea35..73219001b 100644 --- a/spec/ios_bump_version_release_spec.rb +++ b/spec/ios_bump_version_release_spec.rb @@ -22,7 +22,7 @@ expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump) run_described_fastlane_action( - default_branch: default_branch + default_branch: ) end end diff --git a/spec/ios_download_strings_files_from_glotpress_spec.rb b/spec/ios_download_strings_files_from_glotpress_spec.rb index 8b9db9b08..a940db1d8 100644 --- a/spec/ios_download_strings_files_from_glotpress_spec.rb +++ b/spec/ios_download_strings_files_from_glotpress_spec.rb @@ -7,7 +7,7 @@ let(:locales_subset) { { 'fr-FR': 'fr', 'zh-cn': 'zh-Hans' } } def gp_stub(locale:, query:) - stub_request(:get, "#{gp_fake_url}/#{locale}/default/export-translations/").with(query: query) + stub_request(:get, "#{gp_fake_url}/#{locale}/default/export-translations/").with(query:) end describe 'downloading export files from GlotPress' do @@ -26,7 +26,7 @@ def test_gp_download(filters:, tablename:, expected_gp_params:) locales: locales_subset, download_dir: tmp_dir, table_basename: tablename, - filters: filters + filters: }.compact) # Assert @@ -95,7 +95,7 @@ def test_gp_download(filters:, tablename:, expected_gp_params:) run_described_fastlane_action( project_url: gp_fake_url, locales: { 'fr-FR': 'fr' }, - download_dir: download_dir + download_dir: ) end diff --git a/spec/ios_generate_strings_file_from_code_spec.rb b/spec/ios_generate_strings_file_from_code_spec.rb index 0d4346e4e..158c6acd7 100644 --- a/spec/ios_generate_strings_file_from_code_spec.rb +++ b/spec/ios_generate_strings_file_from_code_spec.rb @@ -143,7 +143,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: true, swiftui: false }, expected_dir_name: 'expected-pods-noswiftui', - expected_logs: expected_logs + expected_logs: ) end @@ -156,7 +156,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: false, swiftui: false }, expected_dir_name: 'expected-pods-noswiftui', - expected_logs: expected_logs + expected_logs: ) end @@ -168,7 +168,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: true, swiftui: false, routines: 'PodLocalizedString', fail_on_error: false }, expected_dir_name: 'expected-custom-routine', - expected_logs: expected_logs, + expected_logs:, expected_failures: [] ) end @@ -181,7 +181,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: true, swiftui: false, routines: 'PodLocalizedString', fail_on_error: true }, expected_dir_name: 'expected-custom-routine', - expected_logs: expected_logs, + expected_logs:, expected_failures: [expected_logs.last] ) end @@ -195,7 +195,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: false, swiftui: false, fail_on_error: true }, expected_dir_name: 'expected-pods-noswiftui', - expected_logs: expected_logs, + expected_logs:, expected_failures: [] ) end diff --git a/spec/ios_get_app_version_spec.rb b/spec/ios_get_app_version_spec.rb index 0355fd175..eda850a8f 100644 --- a/spec/ios_get_app_version_spec.rb +++ b/spec/ios_get_app_version_spec.rb @@ -9,7 +9,7 @@ VERSION_LONG = 6.30.0 CONTENT - expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: '6.30') + expect_version(xcconfig_mock_content:, expected_version: '6.30') end it 'parses the xcconfig file format correctly and gets the public hotfix version' do @@ -19,7 +19,7 @@ VERSION_LONG = 6.30.1 CONTENT - expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: '6.30.1') + expect_version(xcconfig_mock_content:, expected_version: '6.30.1') end it 'parses the xcconfig with keys without spacing and gets the public version' do @@ -29,7 +29,7 @@ VERSION_LONG=6.30.0 CONTENT - expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: '6.30') + expect_version(xcconfig_mock_content:, expected_version: '6.30') end it 'parses the xcconfig with keys without spacing and gets the public hotfix version' do @@ -39,7 +39,7 @@ VERSION_LONG=6.30.1 CONTENT - expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: '6.30.1') + expect_version(xcconfig_mock_content:, expected_version: '6.30.1') end it 'fails to extract the version from an xcconfig file with an invalid format' do @@ -49,7 +49,7 @@ CONTENT expect do - expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: 'n/a') + expect_version(xcconfig_mock_content:, expected_version: 'n/a') end.to raise_error(FastlaneCore::Interface::FastlaneError) end @@ -70,7 +70,7 @@ CONTENT expect do - expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: 'n/a') + expect_version(xcconfig_mock_content:, expected_version: 'n/a') end.to raise_error(FastlaneCore::Interface::FastlaneError) end diff --git a/spec/ios_get_build_number_spec.rb b/spec/ios_get_build_number_spec.rb index dadba9c8d..2db7f12c6 100644 --- a/spec/ios_get_build_number_spec.rb +++ b/spec/ios_get_build_number_spec.rb @@ -10,7 +10,7 @@ BUILD_NUMBER=1940 CONTENT - expect_build_number(xcconfig_mock_content: xcconfig_mock_content, expected_build_number: '1940') + expect_build_number(xcconfig_mock_content:, expected_build_number: '1940') end it 'parses an xcconfig file with keys with spaces and returns the correct build number' do @@ -20,7 +20,7 @@ BUILD_NUMBER = 1940 CONTENT - expect_build_number(xcconfig_mock_content: xcconfig_mock_content, expected_build_number: '1940') + expect_build_number(xcconfig_mock_content:, expected_build_number: '1940') end it 'parses an xcconfig file with an invalid format and returns a nil build number' do @@ -30,7 +30,7 @@ BUILD_NUMBER 1940 CONTENT - expect_build_number(xcconfig_mock_content: xcconfig_mock_content, expected_build_number: nil) + expect_build_number(xcconfig_mock_content:, expected_build_number: nil) end it 'parses an xcconfig file with no build number and returns a nil build number' do @@ -39,7 +39,7 @@ // a comment CONTENT - expect_build_number(xcconfig_mock_content: xcconfig_mock_content, expected_build_number: nil) + expect_build_number(xcconfig_mock_content:, expected_build_number: nil) end it 'throws an error when the xcconfig file does not exist' do diff --git a/spec/ios_git_helper_spec.rb b/spec/ios_git_helper_spec.rb index 7c2f35c01..eacdf8a43 100644 --- a/spec/ios_git_helper_spec.rb +++ b/spec/ios_git_helper_spec.rb @@ -8,14 +8,14 @@ ENV[key] = nil expect(FastlaneCore::UI).to receive(:user_error!) - described_class.get_from_env!(key: key) + described_class.get_from_env!(key:) end it 'returns the value when in the environment' do ENV[key] = 'abc123' expect(FastlaneCore::UI).not_to receive(:user_error!) - expect(described_class.get_from_env!(key: key)).to eq('abc123') + expect(described_class.get_from_env!(key:)).to eq('abc123') end end end diff --git a/spec/ios_l10n_helper_spec.rb b/spec/ios_l10n_helper_spec.rb index 997f7a3fc..a6cdebf9b 100644 --- a/spec/ios_l10n_helper_spec.rb +++ b/spec/ios_l10n_helper_spec.rb @@ -50,7 +50,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') - described_class.merge_strings(paths: paths, output_path: output_file) + described_class.merge_strings(paths:, output_path: output_file) expect(File.read(output_file)).to eq(File.read(fixture('expected-merged.strings'))) expect(file_encoding(output_file)).to eq(Encoding::UTF_8) end @@ -62,7 +62,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| paths.each { |f| FileUtils.cp(f, tmp_dir) } paths = paths.to_h { |f| [File.join(tmp_dir, File.basename(f)), nil] } - described_class.merge_strings(paths: paths, output_path: paths.keys.first) + described_class.merge_strings(paths:, output_path: paths.keys.first) expect(File.read(paths.keys.first)).to eq(File.read(fixture('expected-merged.strings'))) end end @@ -82,7 +82,7 @@ def file_encoding(path) } Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') - duplicates = described_class.merge_strings(paths: paths, output_path: output_file) + duplicates = described_class.merge_strings(paths:, output_path: output_file) expect(File.read(output_file)).to eq(File.read(fixture('expected-merged-prefixed.strings'))) # We should also not find duplicates anymore, given that `key1` and `key2` (duplicates from `Localizable-utf16.strings` # and `non-latin-utf16.strings` files) will now be prefixed differently, and thus made different during merge @@ -94,7 +94,7 @@ def file_encoding(path) paths = { fixture('Localizable-utf16.strings') => nil, fixture('non-latin-utf16.strings') => nil } Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') - duplicates = described_class.merge_strings(paths: paths, output_path: output_file) + duplicates = described_class.merge_strings(paths:, output_path: output_file) expect(duplicates).to eq(%w[key1 key2]) end end @@ -104,7 +104,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') expect do - described_class.merge_strings(paths: paths, output_path: output_file) + described_class.merge_strings(paths:, output_path: output_file) end.to raise_exception(RuntimeError, "The file `#{paths.keys[1]}` is in xml format but we currently only support merging `.strings` files in text format.") end end @@ -114,7 +114,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') expect do - described_class.merge_strings(paths: paths, output_path: output_file) + described_class.merge_strings(paths:, output_path: output_file) end.to raise_exception(RuntimeError, "The file `#{paths.keys[1]}` does not exist or is of unknown format.") end end @@ -178,7 +178,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') # 3. Generate XML strings file from the filtered hash - described_class.generate_strings_file_from_hash(translations: translations, output_path: output_file) + described_class.generate_strings_file_from_hash(translations:, output_path: output_file) expect(File.read(output_file)).to eq(File.read(expected_file)) end end @@ -242,7 +242,7 @@ def file_encoding(path) # Note: in practice it seems that GlotPress's `.strings` exports are using UTF-8 (but served as `application/octet-stream`) # but it does not hurt to ensure the download to a file can work with UTF-16 (and copy the binary stream verbatim) body = File.read(fixture('Localizable-utf16.strings')) - stub = stub_request(:get, "#{gp_fake_url}/fr/default/export-translations/").with(query: { format: 'strings' }).to_return(body: body) + stub = stub_request(:get, "#{gp_fake_url}/fr/default/export-translations/").with(query: { format: 'strings' }).to_return(body:) dest = File.join(tmp_dir, 'export.strings') # Act described_class.download_glotpress_export_file(project_url: gp_fake_url, locale: 'fr', filters: nil, destination: dest) diff --git a/spec/ios_send_app_size_metrics_spec.rb b/spec/ios_send_app_size_metrics_spec.rb index 0fb1389b4..4de1fbd9c 100644 --- a/spec/ios_send_app_size_metrics_spec.rb +++ b/spec/ios_send_app_size_metrics_spec.rb @@ -15,7 +15,7 @@ def test_app_size_action(fake_ipa_size:, expected_payload:, **other_action_args) # Act code = run_described_fastlane_action( api_url: File.join('file://localhost/', output_file), - ipa_path: ipa_path, + ipa_path:, **other_action_args ) @@ -89,9 +89,9 @@ def test_app_size_action(fake_ipa_size:, expected_payload:, **other_action_args) expected = JSON.parse(File.read(expected_fixture)) test_app_size_action( - fake_ipa_size: fake_ipa_size, + fake_ipa_size:, expected_payload: expected, - app_thinning_plist_path: app_thinning_plist_path, + app_thinning_plist_path:, app_name: 'wordpress', build_type: 'internal', app_version: '19.8.0.2', diff --git a/spec/prototype_build_details_comment_action_spec.rb b/spec/prototype_build_details_comment_action_spec.rb index 9c74a9e09..23d9f8cc4 100644 --- a/spec/prototype_build_details_comment_action_spec.rb +++ b/spec/prototype_build_details_comment_action_spec.rb @@ -132,7 +132,7 @@ app_center_org_name: 'My-Org', app_center_app_name: 'My-App', app_center_release_id: '1337', - metadata: metadata + metadata: ) expect(comment).to include 'App Name My App' expect(comment).to include 'Version:Short28.1' @@ -168,7 +168,7 @@ app_center_org_name: 'BestOrg', app_center_app_name: 'BestApp', app_center_release_id: '8888', - metadata: metadata, + metadata:, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -201,7 +201,7 @@ app_center_app_name: 'BestApp', app_center_release_id: '8888', download_url: 'https://bestfront.cloudfront.net/feed42/bestapp-pr1357-a1b2c3f.apk', - metadata: metadata + metadata: ) expect(comment).to eq <<~EXPECTED_COMMENT @@ -235,7 +235,7 @@ app_center_app_name: 'BestApp', app_center_release_id: '1234', fold: true, - metadata: metadata, + metadata:, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -309,7 +309,7 @@ comment = run_described_fastlane_action( app_display_name: 'My App', app_center_org_name: 'My-Org', - metadata: metadata + metadata: ) expect(comment).to include 'Version42.3' # explicitly provided, overriding the implicit value expect(comment).not_to include 'Version28.7' # otherwise implicitly added if it were not overridden @@ -378,7 +378,7 @@ comment = run_described_fastlane_action( app_display_name: 'The Best App', app_center_org_name: 'BestOrg', - metadata: metadata, + metadata:, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -434,7 +434,7 @@ app_display_name: 'The Best App', app_center_org_name: 'BestOrg', fold: true, - metadata: metadata, + metadata:, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -514,7 +514,7 @@ comment = run_described_fastlane_action( app_display_name: 'The Best App', download_url: 'https://bestfront.cloudfront.net/feed42/bestapp-pr1357-a1b2c3f.apk', - metadata: metadata, + metadata:, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -547,7 +547,7 @@ app_display_name: 'The Best App', download_url: 'https://bestfront.cloudfront.net/feed42/bestapp-pr1357-a1b2c3f.apk', fold: true, - metadata: metadata, + metadata:, footnote: 'Note: Google Sign-In in not available in those builds' ) diff --git a/spec/remove_branch_protection_action_spec.rb b/spec/remove_branch_protection_action_spec.rb index 06254a599..5f4791921 100644 --- a/spec/remove_branch_protection_action_spec.rb +++ b/spec/remove_branch_protection_action_spec.rb @@ -22,8 +22,8 @@ run_described_fastlane_action( repository: repo, - branch: branch, - github_token: github_token + branch:, + github_token: ) end @@ -36,8 +36,8 @@ run_described_fastlane_action( repository: repo, - branch: branch, - github_token: github_token + branch:, + github_token: ) end @@ -48,8 +48,8 @@ expect do run_described_fastlane_action( repository: repo, - branch: branch, - github_token: github_token + branch:, + github_token: ) end.to raise_error FastlaneCore::Interface::FastlaneError, "Branch `#{branch}` of repository `#{repo}` was not found." end diff --git a/spec/set_branch_protection_action_spec.rb b/spec/set_branch_protection_action_spec.rb index 835377ab5..a9abef9a9 100644 --- a/spec/set_branch_protection_action_spec.rb +++ b/spec/set_branch_protection_action_spec.rb @@ -31,15 +31,15 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: restrictions + restrictions: } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch: branch, - github_token: github_token, + branch:, + github_token:, **additional_options ) end @@ -52,16 +52,16 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: restrictions + restrictions: } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, required_ci_checks: [], - github_token: github_token, + github_token:, **additional_options ) end @@ -81,16 +81,16 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: restrictions + restrictions: } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, required_ci_checks: %w[check1 check2 check3], - github_token: github_token, + github_token:, **additional_options ) end @@ -103,16 +103,16 @@ def fixture(file) require_code_owner_reviews: false, required_approving_review_count: 3 }, - restrictions: restrictions + restrictions: } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, required_approving_review_count: 3, - github_token: github_token, + github_token:, **additional_options ) end @@ -124,16 +124,16 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: restrictions + restrictions: } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, enforce_admins: true, - github_token: github_token, + github_token:, **additional_options ) end @@ -145,7 +145,7 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: restrictions, + restrictions:, allow_force_pushes: true } @@ -153,9 +153,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, allow_force_pushes: true, - github_token: github_token, + github_token:, **additional_options ) end @@ -167,7 +167,7 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: restrictions, + restrictions:, lock_branch: true } @@ -175,9 +175,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, lock_branch: true, - github_token: github_token, + github_token:, **additional_options ) end @@ -241,8 +241,8 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch: branch, - github_token: github_token + branch:, + github_token: ) end @@ -254,9 +254,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, required_ci_checks: [], - github_token: github_token + github_token: ) end @@ -272,9 +272,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, required_ci_checks: %w[new/check1 new/check2 new/check3], - github_token: github_token + github_token: ) end @@ -287,9 +287,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, required_approving_review_count: 3, - github_token: github_token + github_token: ) end @@ -302,9 +302,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, enforce_admins: false, - github_token: github_token + github_token: ) end @@ -317,9 +317,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, allow_force_pushes: false, - github_token: github_token + github_token: ) end @@ -332,9 +332,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch: branch, + branch:, lock_branch: false, - github_token: github_token + github_token: ) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d21849441..97193de2a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -54,7 +54,7 @@ def allow_fastlane_action_sh def expect_shell_command(*, exitstatus: 0, output: '') mock_input = double(:input) mock_output = StringIO.new(output) - mock_status = double(:status, exitstatus: exitstatus) + mock_status = double(:status, exitstatus:) mock_thread = double(:thread, value: mock_status) expect(Open3).to receive(:popen2e).with(*).and_yield(mock_input, mock_output, mock_thread) diff --git a/spec/upload_to_s3_spec.rb b/spec/upload_to_s3_spec.rb index 733a19ce1..bc1a6c53a 100644 --- a/spec/upload_to_s3_spec.rb +++ b/spec/upload_to_s3_spec.rb @@ -12,8 +12,8 @@ def stub_s3_response_for_file(key, exists: true) content_length = exists == true ? 1 : 0 allow(client).to(receive(:head_object)) - .with(bucket: test_bucket, key: key) - .and_return(Aws::S3::Types::HeadObjectOutput.new(content_length: content_length)) + .with(bucket: test_bucket, key:) + .and_return(Aws::S3::Types::HeadObjectOutput.new(content_length:)) end describe 'uploading a file with valid parameters' do @@ -308,8 +308,8 @@ def stub_s3_response_for_file(key, exists: true) bucket: test_bucket, key: 'existing-key', file: file_path, - if_exists: if_exists, - skip_if_exists: skip_if_exists + if_exists:, + skip_if_exists: ) end.to raise_error(FastlaneCore::Interface::FastlaneError, 'You cannot set both :skip_if_exists and :if_exists. Please only use :if_exists.') end From 474d4ad6f0330b72e5d0053f00fd86adb11bed92 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 5 Oct 2023 21:36:49 +0200 Subject: [PATCH 02/20] Fix additional Rubocop offenses --- .../versioning/calculators/date_version_calculator.rb | 2 +- .../calculators/marketing_version_calculator.rb | 2 +- .../versioning/calculators/semantic_version_calculator.rb | 2 +- spec/android_version_file_spec.rb | 4 ++-- spec/date_build_code_calculator_spec.rb | 2 +- spec/date_version_calculator_spec.rb | 6 +++--- spec/derived_build_code_formatter_spec.rb | 4 ++-- spec/four_part_build_code_formatter_spec.rb | 2 +- spec/ios_version_file_spec.rb | 8 ++++---- spec/marketing_version_calculator_spec.rb | 6 +++--- spec/semantic_version_calculator_spec.rb | 2 +- spec/simple_build_code_calculator_spec.rb | 2 +- spec/simple_build_code_formatter_spec.rb | 2 +- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb index 795e6da2c..fbaa89246 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb @@ -28,7 +28,7 @@ def next_release_version(version:) new_version else - next_minor_version(version: version) + next_minor_version(version:) end end end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/marketing_version_calculator.rb b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/marketing_version_calculator.rb index 686bc3617..092653e65 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/marketing_version_calculator.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/marketing_version_calculator.rb @@ -18,7 +18,7 @@ class MarketingVersionCalculator < AbstractVersionCalculator def next_release_version(version:) UI.user_error!('Marketing Versioning: The minor version cannot be greater than 9') if version.minor > 9 - version.minor == 9 ? next_major_version(version: version) : next_minor_version(version: version) + version.minor == 9 ? next_major_version(version:) : next_minor_version(version:) end end end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/semantic_version_calculator.rb b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/semantic_version_calculator.rb index 6e29da361..66f52cbb5 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/semantic_version_calculator.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/semantic_version_calculator.rb @@ -13,7 +13,7 @@ class SemanticVersionCalculator < AbstractVersionCalculator # @return [AppVersion] The next semantic release version. # def next_release_version(version:) - next_minor_version(version: version) + next_minor_version(version:) end end end diff --git a/spec/android_version_file_spec.rb b/spec/android_version_file_spec.rb index cd21f84cb..9162fa5d9 100644 --- a/spec/android_version_file_spec.rb +++ b/spec/android_version_file_spec.rb @@ -131,7 +131,7 @@ CONTENT with_tmp_file(named: 'version.properties', content: existing_content) do |tmp_file_path| - described_class.new(version_properties_path: tmp_file_path).write_version(version_name: version_name, version_code: version_code) + described_class.new(version_properties_path: tmp_file_path).write_version(version_name:, version_code:) current_content = File.read(tmp_file_path) expect(current_content).to eq(expected_content.strip) @@ -153,7 +153,7 @@ CONTENT with_tmp_file(named: 'version.properties', content: existing_content) do |tmp_file_path| - described_class.new(version_properties_path: tmp_file_path).write_version(version_name: version_name, version_code: version_code) + described_class.new(version_properties_path: tmp_file_path).write_version(version_name:, version_code:) current_content = File.read(tmp_file_path) expect(current_content).to eq(expected_content.strip) diff --git a/spec/date_build_code_calculator_spec.rb b/spec/date_build_code_calculator_spec.rb index 28a5cdb44..046afdb27 100644 --- a/spec/date_build_code_calculator_spec.rb +++ b/spec/date_build_code_calculator_spec.rb @@ -5,7 +5,7 @@ it 'returns an AppVersion object with the build number set to today\'s date' do allow(DateTime).to receive(:now).and_return(DateTime.new(2024, 4, 15)) version = Fastlane::Models::AppVersion.new(19, 3, 1, 1) - formatted_version = described_class.new.next_build_code(version: version) + formatted_version = described_class.new.next_build_code(version:) # Test that the original version is not modified expect(version.to_s).to eq('19.3.1.1') expect(formatted_version.to_s).to eq('19.3.1.20240415') diff --git a/spec/date_version_calculator_spec.rb b/spec/date_version_calculator_spec.rb index c0b4a53fd..6493d2ae3 100644 --- a/spec/date_version_calculator_spec.rb +++ b/spec/date_version_calculator_spec.rb @@ -6,7 +6,7 @@ it 'increments the minor version number without prompting the user' do allow(Time).to receive(:now).and_return(Time.new(2024, 4, 15)) version = Fastlane::Models::AppVersion.new(2024, 13, 1, 1) - bumped_version = described_class.new.next_release_version(version: version) + bumped_version = described_class.new.next_release_version(version:) # Test that the original version is not modified expect(version.to_s).to eq('2024.13.1.1') expect(bumped_version.to_s).to eq('2024.14.0.0') @@ -19,7 +19,7 @@ allow(Time).to receive(:now).and_return(Time.new(2023, 12, 3)) allow(FastlaneCore::UI).to receive(:confirm).and_return(true) version = Fastlane::Models::AppVersion.new(2023, 30, 1, 2) - bumped_version = described_class.new.next_release_version(version: version) + bumped_version = described_class.new.next_release_version(version:) # Test that the original version is not modified expect(version.to_s).to eq('2023.30.1.2') expect(bumped_version.to_s).to eq('2024.1.0.0') @@ -31,7 +31,7 @@ allow(Time).to receive(:now).and_return(Time.new(2023, 12, 1)) allow(FastlaneCore::UI).to receive(:confirm).and_return(false) version = Fastlane::Models::AppVersion.new(2023, 30, 1, 2) - bumped_version = described_class.new.next_release_version(version: version) + bumped_version = described_class.new.next_release_version(version:) # Test that the original version is not modified expect(version.to_s).to eq('2023.30.1.2') expect(bumped_version.to_s).to eq('2023.31.0.0') diff --git a/spec/derived_build_code_formatter_spec.rb b/spec/derived_build_code_formatter_spec.rb index 46dfcce4c..2f9cf2f50 100644 --- a/spec/derived_build_code_formatter_spec.rb +++ b/spec/derived_build_code_formatter_spec.rb @@ -4,13 +4,13 @@ describe 'derives a build code from an AppVersion object' do it 'derives the build code from version numbers that are single digits' do version = Fastlane::Models::AppVersion.new(1, 2, 3, 4) - build_code_string = described_class.new.build_code(version: version) + build_code_string = described_class.new.build_code(version:) expect(build_code_string.to_s).to eq('101020304') end it 'derives the build code from version numbers that are two digits' do version = Fastlane::Models::AppVersion.new(12, 34, 56, 78) - build_code_string = described_class.new.build_code(version: version) + build_code_string = described_class.new.build_code(version:) expect(build_code_string.to_s).to eq('112345678') end end diff --git a/spec/four_part_build_code_formatter_spec.rb b/spec/four_part_build_code_formatter_spec.rb index c065f3c76..7f92a7372 100644 --- a/spec/four_part_build_code_formatter_spec.rb +++ b/spec/four_part_build_code_formatter_spec.rb @@ -4,7 +4,7 @@ describe 'formats an AppVersion object as a four part build code' do it 'returns the four part build code as a string' do version = Fastlane::Models::AppVersion.new(1, 2, 3, 4) - build_code_string = described_class.new.build_code(version: version) + build_code_string = described_class.new.build_code(version:) expect(build_code_string.to_s).to eq('1.2.3.4') end end diff --git a/spec/ios_version_file_spec.rb b/spec/ios_version_file_spec.rb index 37177af3b..518ba3ef5 100644 --- a/spec/ios_version_file_spec.rb +++ b/spec/ios_version_file_spec.rb @@ -22,9 +22,9 @@ with_tmp_file(named: 'test.xcconfig', content: existing_content) do |tmp_file_path| described_class.new(xcconfig_path: tmp_file_path).write( - version_short: version_short, - version_long: version_long, - build_number: build_number + version_short:, + version_long:, + build_number: ) current_content = File.read(tmp_file_path) @@ -38,7 +38,7 @@ version_short = '1.2.3' it 'raises an error' do - expect { described_class.new(xcconfig_path: file_path).write(version_short: version_short) } + expect { described_class.new(xcconfig_path: file_path).write(version_short:) } .to raise_error(FastlaneCore::Interface::FastlaneError, ".xcconfig file not found at this path: #{file_path}") end end diff --git a/spec/marketing_version_calculator_spec.rb b/spec/marketing_version_calculator_spec.rb index ef463c32a..44858d92e 100644 --- a/spec/marketing_version_calculator_spec.rb +++ b/spec/marketing_version_calculator_spec.rb @@ -6,13 +6,13 @@ it 'raises an error when the minor version is greater than 9' do version = Fastlane::Models::AppVersion.new(13, 10, 1, 1) expect do - described_class.new.next_release_version(version: version) + described_class.new.next_release_version(version:) end.to raise_error(FastlaneCore::Interface::FastlaneError), 'Marketing Versioning: The minor version cannot be greater than 9' end it 'increments the minor version when the minor version is less than 9' do version = Fastlane::Models::AppVersion.new(13, 5, 1, 1) - bumped_version = described_class.new.next_release_version(version: version) + bumped_version = described_class.new.next_release_version(version:) # Test that the original version is not modified expect(version.to_s).to eq('13.5.1.1') expect(bumped_version.to_s).to eq('13.6.0.0') @@ -22,7 +22,7 @@ context 'when the minor number is 9' do it 'increments the major version and sets the minor version to 0 ' do version = Fastlane::Models::AppVersion.new(13, 9, 1, 1) - bumped_version = described_class.new.next_release_version(version: version) + bumped_version = described_class.new.next_release_version(version:) # Test that the original version is not modified expect(version.to_s).to eq('13.9.1.1') expect(bumped_version.to_s).to eq('14.0.0.0') diff --git a/spec/semantic_version_calculator_spec.rb b/spec/semantic_version_calculator_spec.rb index af649197c..23cc05b46 100644 --- a/spec/semantic_version_calculator_spec.rb +++ b/spec/semantic_version_calculator_spec.rb @@ -4,7 +4,7 @@ describe 'calculates the next release version when using semantic versioning' do it 'increments the minor version' do version = Fastlane::Models::AppVersion.new(13, 5, 1, 1) - bumped_version = described_class.new.next_release_version(version: version) + bumped_version = described_class.new.next_release_version(version:) # Test that the original version is not modified expect(version.to_s).to eq('13.5.1.1') expect(bumped_version.to_s).to eq('13.6.0.0') diff --git a/spec/simple_build_code_calculator_spec.rb b/spec/simple_build_code_calculator_spec.rb index e1a50e0af..e956697c8 100644 --- a/spec/simple_build_code_calculator_spec.rb +++ b/spec/simple_build_code_calculator_spec.rb @@ -4,7 +4,7 @@ describe 'calculates the next build code' do it 'increments the build code by 1' do build_code = Fastlane::Models::BuildCode.new(123) - bumped_build_code = described_class.new.next_build_code(build_code: build_code) + bumped_build_code = described_class.new.next_build_code(build_code:) # Test that the original build code is not modified expect(build_code.to_s).to eq('123') expect(bumped_build_code.to_s).to eq('124') diff --git a/spec/simple_build_code_formatter_spec.rb b/spec/simple_build_code_formatter_spec.rb index 1505c1468..3cda07b0c 100644 --- a/spec/simple_build_code_formatter_spec.rb +++ b/spec/simple_build_code_formatter_spec.rb @@ -4,7 +4,7 @@ describe 'formats a BuildCode object as a build code' do it 'returns the integer build code as a string' do build_code = Fastlane::Models::BuildCode.new(735) - build_code_string = described_class.new.build_code(build_code: build_code) + build_code_string = described_class.new.build_code(build_code:) expect(build_code_string.to_s).to eq('735') end end From fc99e29550d49ffa73ed901ee93c7f636aaa3377 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 30 Oct 2023 15:30:03 +0100 Subject: [PATCH 03/20] Update Rubocop to not allow Ruby 3.1 hash values and value arguments omission --- .../versioning/calculators/date_version_calculator.rb | 2 +- .../calculators/marketing_version_calculator.rb | 2 +- .../versioning/calculators/semantic_version_calculator.rb | 2 +- spec/android_version_file_spec.rb | 4 ++-- spec/date_build_code_calculator_spec.rb | 2 +- spec/date_version_calculator_spec.rb | 6 +++--- spec/derived_build_code_formatter_spec.rb | 4 ++-- spec/four_part_build_code_formatter_spec.rb | 2 +- spec/ios_version_file_spec.rb | 8 ++++---- spec/marketing_version_calculator_spec.rb | 6 +++--- spec/semantic_version_calculator_spec.rb | 2 +- spec/simple_build_code_calculator_spec.rb | 2 +- spec/simple_build_code_formatter_spec.rb | 2 +- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb index fbaa89246..795e6da2c 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb @@ -28,7 +28,7 @@ def next_release_version(version:) new_version else - next_minor_version(version:) + next_minor_version(version: version) end end end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/marketing_version_calculator.rb b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/marketing_version_calculator.rb index 092653e65..686bc3617 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/marketing_version_calculator.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/marketing_version_calculator.rb @@ -18,7 +18,7 @@ class MarketingVersionCalculator < AbstractVersionCalculator def next_release_version(version:) UI.user_error!('Marketing Versioning: The minor version cannot be greater than 9') if version.minor > 9 - version.minor == 9 ? next_major_version(version:) : next_minor_version(version:) + version.minor == 9 ? next_major_version(version: version) : next_minor_version(version: version) end end end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/semantic_version_calculator.rb b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/semantic_version_calculator.rb index 66f52cbb5..6e29da361 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/semantic_version_calculator.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/semantic_version_calculator.rb @@ -13,7 +13,7 @@ class SemanticVersionCalculator < AbstractVersionCalculator # @return [AppVersion] The next semantic release version. # def next_release_version(version:) - next_minor_version(version:) + next_minor_version(version: version) end end end diff --git a/spec/android_version_file_spec.rb b/spec/android_version_file_spec.rb index 9162fa5d9..cd21f84cb 100644 --- a/spec/android_version_file_spec.rb +++ b/spec/android_version_file_spec.rb @@ -131,7 +131,7 @@ CONTENT with_tmp_file(named: 'version.properties', content: existing_content) do |tmp_file_path| - described_class.new(version_properties_path: tmp_file_path).write_version(version_name:, version_code:) + described_class.new(version_properties_path: tmp_file_path).write_version(version_name: version_name, version_code: version_code) current_content = File.read(tmp_file_path) expect(current_content).to eq(expected_content.strip) @@ -153,7 +153,7 @@ CONTENT with_tmp_file(named: 'version.properties', content: existing_content) do |tmp_file_path| - described_class.new(version_properties_path: tmp_file_path).write_version(version_name:, version_code:) + described_class.new(version_properties_path: tmp_file_path).write_version(version_name: version_name, version_code: version_code) current_content = File.read(tmp_file_path) expect(current_content).to eq(expected_content.strip) diff --git a/spec/date_build_code_calculator_spec.rb b/spec/date_build_code_calculator_spec.rb index 046afdb27..28a5cdb44 100644 --- a/spec/date_build_code_calculator_spec.rb +++ b/spec/date_build_code_calculator_spec.rb @@ -5,7 +5,7 @@ it 'returns an AppVersion object with the build number set to today\'s date' do allow(DateTime).to receive(:now).and_return(DateTime.new(2024, 4, 15)) version = Fastlane::Models::AppVersion.new(19, 3, 1, 1) - formatted_version = described_class.new.next_build_code(version:) + formatted_version = described_class.new.next_build_code(version: version) # Test that the original version is not modified expect(version.to_s).to eq('19.3.1.1') expect(formatted_version.to_s).to eq('19.3.1.20240415') diff --git a/spec/date_version_calculator_spec.rb b/spec/date_version_calculator_spec.rb index 6493d2ae3..c0b4a53fd 100644 --- a/spec/date_version_calculator_spec.rb +++ b/spec/date_version_calculator_spec.rb @@ -6,7 +6,7 @@ it 'increments the minor version number without prompting the user' do allow(Time).to receive(:now).and_return(Time.new(2024, 4, 15)) version = Fastlane::Models::AppVersion.new(2024, 13, 1, 1) - bumped_version = described_class.new.next_release_version(version:) + bumped_version = described_class.new.next_release_version(version: version) # Test that the original version is not modified expect(version.to_s).to eq('2024.13.1.1') expect(bumped_version.to_s).to eq('2024.14.0.0') @@ -19,7 +19,7 @@ allow(Time).to receive(:now).and_return(Time.new(2023, 12, 3)) allow(FastlaneCore::UI).to receive(:confirm).and_return(true) version = Fastlane::Models::AppVersion.new(2023, 30, 1, 2) - bumped_version = described_class.new.next_release_version(version:) + bumped_version = described_class.new.next_release_version(version: version) # Test that the original version is not modified expect(version.to_s).to eq('2023.30.1.2') expect(bumped_version.to_s).to eq('2024.1.0.0') @@ -31,7 +31,7 @@ allow(Time).to receive(:now).and_return(Time.new(2023, 12, 1)) allow(FastlaneCore::UI).to receive(:confirm).and_return(false) version = Fastlane::Models::AppVersion.new(2023, 30, 1, 2) - bumped_version = described_class.new.next_release_version(version:) + bumped_version = described_class.new.next_release_version(version: version) # Test that the original version is not modified expect(version.to_s).to eq('2023.30.1.2') expect(bumped_version.to_s).to eq('2023.31.0.0') diff --git a/spec/derived_build_code_formatter_spec.rb b/spec/derived_build_code_formatter_spec.rb index 2f9cf2f50..46dfcce4c 100644 --- a/spec/derived_build_code_formatter_spec.rb +++ b/spec/derived_build_code_formatter_spec.rb @@ -4,13 +4,13 @@ describe 'derives a build code from an AppVersion object' do it 'derives the build code from version numbers that are single digits' do version = Fastlane::Models::AppVersion.new(1, 2, 3, 4) - build_code_string = described_class.new.build_code(version:) + build_code_string = described_class.new.build_code(version: version) expect(build_code_string.to_s).to eq('101020304') end it 'derives the build code from version numbers that are two digits' do version = Fastlane::Models::AppVersion.new(12, 34, 56, 78) - build_code_string = described_class.new.build_code(version:) + build_code_string = described_class.new.build_code(version: version) expect(build_code_string.to_s).to eq('112345678') end end diff --git a/spec/four_part_build_code_formatter_spec.rb b/spec/four_part_build_code_formatter_spec.rb index 7f92a7372..c065f3c76 100644 --- a/spec/four_part_build_code_formatter_spec.rb +++ b/spec/four_part_build_code_formatter_spec.rb @@ -4,7 +4,7 @@ describe 'formats an AppVersion object as a four part build code' do it 'returns the four part build code as a string' do version = Fastlane::Models::AppVersion.new(1, 2, 3, 4) - build_code_string = described_class.new.build_code(version:) + build_code_string = described_class.new.build_code(version: version) expect(build_code_string.to_s).to eq('1.2.3.4') end end diff --git a/spec/ios_version_file_spec.rb b/spec/ios_version_file_spec.rb index 518ba3ef5..37177af3b 100644 --- a/spec/ios_version_file_spec.rb +++ b/spec/ios_version_file_spec.rb @@ -22,9 +22,9 @@ with_tmp_file(named: 'test.xcconfig', content: existing_content) do |tmp_file_path| described_class.new(xcconfig_path: tmp_file_path).write( - version_short:, - version_long:, - build_number: + version_short: version_short, + version_long: version_long, + build_number: build_number ) current_content = File.read(tmp_file_path) @@ -38,7 +38,7 @@ version_short = '1.2.3' it 'raises an error' do - expect { described_class.new(xcconfig_path: file_path).write(version_short:) } + expect { described_class.new(xcconfig_path: file_path).write(version_short: version_short) } .to raise_error(FastlaneCore::Interface::FastlaneError, ".xcconfig file not found at this path: #{file_path}") end end diff --git a/spec/marketing_version_calculator_spec.rb b/spec/marketing_version_calculator_spec.rb index 44858d92e..ef463c32a 100644 --- a/spec/marketing_version_calculator_spec.rb +++ b/spec/marketing_version_calculator_spec.rb @@ -6,13 +6,13 @@ it 'raises an error when the minor version is greater than 9' do version = Fastlane::Models::AppVersion.new(13, 10, 1, 1) expect do - described_class.new.next_release_version(version:) + described_class.new.next_release_version(version: version) end.to raise_error(FastlaneCore::Interface::FastlaneError), 'Marketing Versioning: The minor version cannot be greater than 9' end it 'increments the minor version when the minor version is less than 9' do version = Fastlane::Models::AppVersion.new(13, 5, 1, 1) - bumped_version = described_class.new.next_release_version(version:) + bumped_version = described_class.new.next_release_version(version: version) # Test that the original version is not modified expect(version.to_s).to eq('13.5.1.1') expect(bumped_version.to_s).to eq('13.6.0.0') @@ -22,7 +22,7 @@ context 'when the minor number is 9' do it 'increments the major version and sets the minor version to 0 ' do version = Fastlane::Models::AppVersion.new(13, 9, 1, 1) - bumped_version = described_class.new.next_release_version(version:) + bumped_version = described_class.new.next_release_version(version: version) # Test that the original version is not modified expect(version.to_s).to eq('13.9.1.1') expect(bumped_version.to_s).to eq('14.0.0.0') diff --git a/spec/semantic_version_calculator_spec.rb b/spec/semantic_version_calculator_spec.rb index 23cc05b46..af649197c 100644 --- a/spec/semantic_version_calculator_spec.rb +++ b/spec/semantic_version_calculator_spec.rb @@ -4,7 +4,7 @@ describe 'calculates the next release version when using semantic versioning' do it 'increments the minor version' do version = Fastlane::Models::AppVersion.new(13, 5, 1, 1) - bumped_version = described_class.new.next_release_version(version:) + bumped_version = described_class.new.next_release_version(version: version) # Test that the original version is not modified expect(version.to_s).to eq('13.5.1.1') expect(bumped_version.to_s).to eq('13.6.0.0') diff --git a/spec/simple_build_code_calculator_spec.rb b/spec/simple_build_code_calculator_spec.rb index e956697c8..e1a50e0af 100644 --- a/spec/simple_build_code_calculator_spec.rb +++ b/spec/simple_build_code_calculator_spec.rb @@ -4,7 +4,7 @@ describe 'calculates the next build code' do it 'increments the build code by 1' do build_code = Fastlane::Models::BuildCode.new(123) - bumped_build_code = described_class.new.next_build_code(build_code:) + bumped_build_code = described_class.new.next_build_code(build_code: build_code) # Test that the original build code is not modified expect(build_code.to_s).to eq('123') expect(bumped_build_code.to_s).to eq('124') diff --git a/spec/simple_build_code_formatter_spec.rb b/spec/simple_build_code_formatter_spec.rb index 3cda07b0c..1505c1468 100644 --- a/spec/simple_build_code_formatter_spec.rb +++ b/spec/simple_build_code_formatter_spec.rb @@ -4,7 +4,7 @@ describe 'formats a BuildCode object as a build code' do it 'returns the integer build code as a string' do build_code = Fastlane::Models::BuildCode.new(735) - build_code_string = described_class.new.build_code(build_code:) + build_code_string = described_class.new.build_code(build_code: build_code) expect(build_code_string.to_s).to eq('735') end end From 51aa3c28db07f680939f47459d017fe71141d118 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 21 Sep 2023 16:59:18 +0200 Subject: [PATCH 04/20] Setup Dangermattic --- .buildkite/commands/danger-pr-check.sh | 7 + .buildkite/{ => commands}/gem-push.sh | 0 Dangerfile => .buildkite/danger/Dangerfile | 31 +++-- .buildkite/pipeline.yml | 13 +- .rubocop.yml | 2 + Gemfile | 3 +- Gemfile.lock | 152 +++++++++++++-------- 7 files changed, 134 insertions(+), 74 deletions(-) create mode 100755 .buildkite/commands/danger-pr-check.sh rename .buildkite/{ => commands}/gem-push.sh (100%) rename Dangerfile => .buildkite/danger/Dangerfile (55%) diff --git a/.buildkite/commands/danger-pr-check.sh b/.buildkite/commands/danger-pr-check.sh new file mode 100755 index 000000000..300bfa595 --- /dev/null +++ b/.buildkite/commands/danger-pr-check.sh @@ -0,0 +1,7 @@ +#!/bin/bash -eu + +echo "--- :rubygems: Setting up Gems" +bundle install + +echo "--- Running Danger: PR Check" +bundle exec danger --fail-on-errors=true --dangerfile=.buildkite/danger/Dangerfile --remove-previous-comments --danger_id=pr-check diff --git a/.buildkite/gem-push.sh b/.buildkite/commands/gem-push.sh similarity index 100% rename from .buildkite/gem-push.sh rename to .buildkite/commands/gem-push.sh diff --git a/Dangerfile b/.buildkite/danger/Dangerfile similarity index 55% rename from Dangerfile rename to .buildkite/danger/Dangerfile index e1c346be0..34fbac350 100644 --- a/Dangerfile +++ b/.buildkite/danger/Dangerfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + def version lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) @@ -10,16 +12,19 @@ def gemfile_lock_version gemfile_lock.scan(/fastlane-plugin-wpmreleasetoolkit \((\d+.\d+.\d+)\)/).last.first end +return if github.pr_labels.include?('Releases') + # Before checking the version, get rid of any change that `bundle install` # might have done. `git checkout Gemfile.lock &> /dev/null` if version.to_s != gemfile_lock_version.to_s - message = %{ -The version in the `Gemfile.lock` (`#{gemfile_lock_version}`) doesn't match the one in `version.rb` (`#{version}`). + message = <<~MESSAGE + The version in the `Gemfile.lock` (`#{gemfile_lock_version}`) doesn't match the one in `version.rb` (`#{version}`). + + Please run `bundle install` to make sure they match. + MESSAGE -Please run `bundle install` to make sure they match. -} failure(message) end @@ -30,11 +35,15 @@ unless git.modified_files.include?('CHANGELOG.md') warn 'Please add an entry in the CHANGELOG.md file to describe the changes made by this PR' end -# Lint with Rubocop and report violations inline in GitHub -github.dismiss_out_of_range_messages # This way, fixed violations should go -renaming_map = (git.renamed_files || []).to_h { |e| [e[:before], e[:after]] } # when files are renamed, git.modified_files contains old name, not new one, so we need to do the convertion -rubocop.lint( - files: git.added_files + (git.modified_files.map { |f| renaming_map[f] || f }) - git.deleted_files, - inline_comment: true, - fail_on_inline_comment: true # Make the inline comments failures +manifest_pr_checker.check_gemfile_lock_updated +labels_checker.check( + required_labels: [//], + required_labels_error: 'PR is missing at least one label.' ) +pr_size_checker.check_diff_size +milestone_checker.check_milestone_due_date(days_before_due: 5) + +github.dismiss_out_of_range_messages +rubocop.lint inline_comment: true, fail_on_inline_comment: true, include_cop_names: true + +warn "No reviewers have been set for this PR yet. Please request a review from **@\u2028wordpress-mobile/apps-infrastructure**." unless github.pr_json['assignee'] diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 45c919611..c6d71221a 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -71,15 +71,16 @@ steps: ################# # Danger ################# - - label: "⛔️ Danger" + - label: "☢️ Danger - PR Check" key: danger - command: | - bundle install - echo "--- :rubocop: Run Danger" - bundle exec danger + command: .buildkite/commands/danger-pr-check.sh plugins: [*docker_plugin_with_danger_token] agents: queue: "default" + retry: + manual: + permit_on_passed: true + if: "build.pull_request.id != null" ################# # Push to RubyGems @@ -94,7 +95,7 @@ steps: # Note: We intentionally call a separate `.sh` script here (as opposed to having all the # commands written inline) to avoid leaking a key used in the process in clear in the # BUILDKITE_COMMAND environment variable. - command: .buildkite/gem-push.sh + command: .buildkite/commands/gem-push.sh plugins: [*docker_plugin] agents: queue: "default" diff --git a/.rubocop.yml b/.rubocop.yml index 6af26c18d..8b263b19d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,5 @@ +inherit_from: .rubocop_todo.yml + require: - rubocop-rspec diff --git a/Gemfile b/Gemfile index ba277fc93..5e4633a59 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,6 @@ gemspec gem 'buildkite-test_collector', '~> 2.3' gem 'codecov', require: false -gem 'danger', '~> 9.3' -gem 'danger-rubocop', '~> 0.6' +gem 'danger-dangermattic', git: 'https://github.com/Automattic/dangermattic' gem 'webmock', require: false gem 'yard' diff --git a/Gemfile.lock b/Gemfile.lock index eaa690dfb..bc54c7f3e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,16 @@ +GIT + remote: https://github.com/Automattic/dangermattic + revision: 0635de8b07954c70a4ed908fc1619774cb8fd10d + specs: + danger-dangermattic (0.0.1) + danger (~> 9.3) + danger-junit (~> 1.0) + danger-plugin-api (~> 1.0) + danger-rubocop (~> 0.11) + danger-swiftlint (~> 0.29) + danger-xcode_summary (~> 1.0) + rubocop (~> 1.56) + PATH remote: . specs: @@ -24,12 +37,17 @@ GEM specs: CFPropertyList (3.0.6) rexml - activesupport (7.0.4.3) + activesupport (7.1.0) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - addressable (2.8.4) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) @@ -38,25 +56,27 @@ GEM ast (2.4.2) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.752.0) - aws-sdk-core (3.171.0) + aws-partitions (1.834.0) + aws-sdk-core (3.185.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.63.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-kms (1.72.0) + aws-sdk-core (~> 3, >= 3.184.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.121.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-s3 (1.136.0) + aws-sdk-core (~> 3, >= 3.181.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.4) - aws-sigv4 (1.5.2) + aws-sigv4 (~> 1.6) + aws-sigv4 (1.6.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) + base64 (0.1.1) + bigdecimal (3.1.4) buildkit (1.5.0) sawyer (>= 0.6) - buildkite-test_collector (2.3.1) + buildkite-test_collector (2.3.2) activesupport (>= 4.2) chroma (0.2.0) claide (1.1.0) @@ -64,10 +84,10 @@ GEM cork nap open4 (~> 1.3) - cocoapods (1.12.1) + cocoapods (1.13.0) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.12.1) + cocoapods-core (= 1.13.0) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.6.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -81,8 +101,8 @@ GEM molinillo (~> 0.8.0) nap (~> 1.0) ruby-macho (>= 2.3.0, < 3.0) - xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.12.1) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.13.0) activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -109,11 +129,12 @@ GEM commander (4.6.0) highline (~> 2.0.0) concurrent-ruby (1.2.2) + connection_pool (2.4.1) cork (0.3.0) colored2 (~> 3.1) crack (0.4.5) rexml - danger (9.3.1) + danger (9.3.2) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) @@ -126,23 +147,37 @@ GEM no_proxy_fix octokit (~> 6.0) terminal-table (>= 1, < 4) - danger-rubocop (0.10.0) + danger-junit (1.0.2) + danger (> 2.0) + ox (~> 2.0) + danger-plugin-api (1.0.0) + danger (> 2.0) + danger-rubocop (0.12.0) danger rubocop (~> 1.0) + danger-swiftlint (0.33.0) + danger + rake (> 10) + thor (~> 0.19) + danger-xcode_summary (1.2.0) + danger-plugin-api (~> 1.0) + xcresult (~> 0.2) declarative (0.0.20) diff-lcs (1.5.0) diffy (3.4.2) - digest-crc (0.6.4) + digest-crc (0.6.5) rake (>= 12.0.0, < 14.0.0) docile (1.4.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (2.8.1) + drb (2.1.1) + ruby2_keywords emoji_regex (3.2.3) escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - excon (0.99.0) + excon (0.104.0) faraday (1.10.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) @@ -173,8 +208,8 @@ GEM faraday-retry (1.0.3) faraday_middleware (1.2.0) faraday (~> 1.0) - fastimage (2.2.6) - fastlane (2.213.0) + fastimage (2.2.7) + fastlane (2.216.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -195,6 +230,7 @@ GEM google-apis-playcustomapp_v1 (~> 0.1) google-cloud-storage (~> 1.31) highline (~> 2.0) + http-cookie (~> 1.0.5) json (< 3.0.0) jwt (>= 2.1.0, < 3) mini_magick (>= 4.9.4, < 5.0.0) @@ -206,23 +242,23 @@ GEM security (= 0.1.3) simctl (~> 1.6.3) terminal-notifier (>= 2.0.0, < 3.0.0) - terminal-table (>= 1.4.5, < 2.0.0) + terminal-table (~> 3) tty-screen (>= 0.6.3, < 1.0.0) tty-spinner (>= 0.8.0, < 1.0.0) word_wrap (~> 1.0.0) xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) - ffi (1.15.5) + ffi (1.16.3) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - git (1.13.2) + git (1.18.0) addressable (~> 2.8) rchardet (~> 1.8) - google-apis-androidpublisher_v3 (0.39.0) + google-apis-androidpublisher_v3 (0.50.0) google-apis-core (>= 0.11.0, < 2.a) - google-apis-core (0.11.0) + google-apis-core (0.11.1) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -251,10 +287,9 @@ GEM google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (1.5.2) + googleauth (1.8.1) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) - memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) @@ -263,32 +298,33 @@ GEM http-cookie (1.0.5) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) java-properties (0.3.0) jmespath (1.6.2) json (2.6.3) - jwt (2.7.0) + jwt (2.7.1) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - memoist (0.16.2) + language_server-protocol (3.17.0.3) method_source (0.9.2) mini_magick (4.12.0) - mini_mime (1.1.2) - mini_portile2 (2.8.1) - minitest (5.18.0) + mini_mime (1.1.5) + mini_portile2 (2.8.4) + minitest (5.20.0) molinillo (0.8.0) multi_json (1.15.0) - multipart-post (2.0.0) + multipart-post (2.3.0) + mutex_m (0.1.2) nanaimo (0.3.0) nap (1.1.0) naturally (2.2.1) netrc (0.11.0) no_proxy_fix (0.1.2) - nokogiri (1.14.3) - mini_portile2 (~> 2.8.0) + nokogiri (1.15.4) + mini_portile2 (~> 2.8.2) racc (~> 1.4) octokit (6.1.1) faraday (>= 1, < 3) @@ -297,9 +333,11 @@ GEM options (2.3.2) optparse (0.1.1) os (1.1.4) + ox (2.14.17) parallel (1.23.0) - parser (3.2.2.0) + parser (3.2.2.4) ast (~> 2.4.1) + racc plist (3.7.0) progress_bar (1.3.3) highline (>= 1.6, < 3) @@ -308,19 +346,19 @@ GEM coderay (~> 1.1.0) method_source (~> 0.9.0) public_suffix (4.0.7) - racc (1.6.2) + racc (1.7.1) rainbow (3.1.1) rake (13.0.6) - rake-compiler (1.2.1) + rake-compiler (1.2.5) rake rchardet (1.8.0) - regexp_parser (2.8.0) + regexp_parser (2.8.1) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.5) + rexml (3.2.6) rmagick (4.3.0) rouge (2.0.7) rspec (3.12.0) @@ -332,23 +370,25 @@ GEM rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.5) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-support (3.12.0) + rspec-support (3.12.1) rspec_junit_formatter (0.4.1) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.50.2) + rubocop (1.56.4) + base64 (~> 0.1.1) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) + rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.28.0) + rubocop-ast (1.29.0) parser (>= 3.2.1.0) rubocop-require_tools (0.1.2) rubocop (>= 0.49.1) @@ -363,7 +403,7 @@ GEM addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) security (0.1.3) - signet (0.17.0) + signet (0.18.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) @@ -377,7 +417,9 @@ GEM simplecov-html (~> 0.10.0) simplecov-html (0.10.2) terminal-notifier (2.0.0) - terminal-table (1.6.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + thor (0.20.3) trailblazer-option (0.1.2) tty-cursor (0.7.1) tty-screen (0.8.1) @@ -391,14 +433,14 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.8.2) - unicode-display_width (2.4.2) - webmock (3.18.1) + unicode-display_width (2.5.0) + webmock (3.19.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) webrick (1.8.1) word_wrap (1.0.0) - xcodeproj (1.22.0) + xcodeproj (1.23.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -409,6 +451,7 @@ GEM rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) + xcresult (0.2.1) yard (0.9.34) PLATFORMS @@ -419,8 +462,7 @@ DEPENDENCIES bundler (~> 2.0) cocoapods (~> 1.10) codecov - danger (~> 9.3) - danger-rubocop (~> 0.6) + danger-dangermattic! fastlane (~> 2.210) fastlane-plugin-wpmreleasetoolkit! pry (~> 0.12.2) From 9e8cf7e94147ac9762237ebc8d50696f4e7d959f Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 25 Oct 2023 19:48:30 +0200 Subject: [PATCH 05/20] Move Dangerfile to project root, per Danger standard --- .buildkite/commands/danger-pr-check.sh | 2 +- .buildkite/danger/Dangerfile => Dangerfile | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .buildkite/danger/Dangerfile => Dangerfile (100%) diff --git a/.buildkite/commands/danger-pr-check.sh b/.buildkite/commands/danger-pr-check.sh index 300bfa595..0ad81cfed 100755 --- a/.buildkite/commands/danger-pr-check.sh +++ b/.buildkite/commands/danger-pr-check.sh @@ -4,4 +4,4 @@ echo "--- :rubygems: Setting up Gems" bundle install echo "--- Running Danger: PR Check" -bundle exec danger --fail-on-errors=true --dangerfile=.buildkite/danger/Dangerfile --remove-previous-comments --danger_id=pr-check +bundle exec danger --fail-on-errors=true --remove-previous-comments --danger_id=pr-check diff --git a/.buildkite/danger/Dangerfile b/Dangerfile similarity index 100% rename from .buildkite/danger/Dangerfile rename to Dangerfile From b12c0c9c3e87be68fc6b5676c975210aa66b6ffc Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 26 Oct 2023 11:34:46 +0200 Subject: [PATCH 06/20] Update Dangermattic gem --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bc54c7f3e..d95ae57e4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/Automattic/dangermattic - revision: 0635de8b07954c70a4ed908fc1619774cb8fd10d + revision: 451932e8870ef3c52de0d8bea80edcfa3d879e53 specs: danger-dangermattic (0.0.1) danger (~> 9.3) @@ -352,7 +352,7 @@ GEM rake-compiler (1.2.5) rake rchardet (1.8.0) - regexp_parser (2.8.1) + regexp_parser (2.8.2) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -376,12 +376,12 @@ GEM rspec-support (3.12.1) rspec_junit_formatter (0.4.1) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.56.4) + rubocop (1.57.1) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) @@ -477,4 +477,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.4.14 + 2.4.20 From 2ea8a1af4823728c047faa4e10e76ba78ea20ca6 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 26 Oct 2023 19:05:13 +0200 Subject: [PATCH 07/20] Improve code for no reviewers check --- Dangerfile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Dangerfile b/Dangerfile index 34fbac350..62c889dbe 100644 --- a/Dangerfile +++ b/Dangerfile @@ -12,6 +12,18 @@ def gemfile_lock_version gemfile_lock.scan(/fastlane-plugin-wpmreleasetoolkit \((\d+.\d+.\d+)\)/).last.first end +def finished_reviews? + repo_name = github.pr_json['base']['repo']['full_name'] + pr_number = github.pr_json['number'] + + !github.api.pull_request_reviews(repo_name, pr_number).empty? +end + +def requested_reviewers? + has_requested_reviews = !github.pr_json['requested_teams'].to_a.empty? || !github.pr_json['requested_reviewers'].to_a.empty? + has_requested_reviews || finished_reviews? +end + return if github.pr_labels.include?('Releases') # Before checking the version, get rid of any change that `bundle install` @@ -46,4 +58,4 @@ milestone_checker.check_milestone_due_date(days_before_due: 5) github.dismiss_out_of_range_messages rubocop.lint inline_comment: true, fail_on_inline_comment: true, include_cop_names: true -warn "No reviewers have been set for this PR yet. Please request a review from **@\u2028wordpress-mobile/apps-infrastructure**." unless github.pr_json['assignee'] +warn "No reviewers have been set for this PR yet. Please request a review from **@\u2028wordpress-mobile/apps-infrastructure**." unless requested_reviewers? From 9de1ae501affd5efccfaf067a0a6797424d3316e Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 30 Oct 2023 19:09:56 +0100 Subject: [PATCH 08/20] Improve Dangerfile code --- Dangerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Dangerfile b/Dangerfile index 62c889dbe..515d89a83 100644 --- a/Dangerfile +++ b/Dangerfile @@ -26,6 +26,8 @@ end return if github.pr_labels.include?('Releases') +github.dismiss_out_of_range_messages + # Before checking the version, get rid of any change that `bundle install` # might have done. `git checkout Gemfile.lock &> /dev/null` @@ -48,14 +50,16 @@ unless git.modified_files.include?('CHANGELOG.md') end manifest_pr_checker.check_gemfile_lock_updated + labels_checker.check( required_labels: [//], - required_labels_error: 'PR is missing at least one label.' + required_labels_error: 'PR requires at least one label.' ) + pr_size_checker.check_diff_size + milestone_checker.check_milestone_due_date(days_before_due: 5) -github.dismiss_out_of_range_messages -rubocop.lint inline_comment: true, fail_on_inline_comment: true, include_cop_names: true +rubocop.lint(inline_comment: true, fail_on_inline_comment: true, include_cop_names: true) -warn "No reviewers have been set for this PR yet. Please request a review from **@\u2028wordpress-mobile/apps-infrastructure**." unless requested_reviewers? +warn("No reviewers have been set for this PR yet. Please request a review from **@\u2028wordpress-mobile/apps-infrastructure**.") unless requested_reviewers? From b08d91b4e5d9077358c332863551313b70debdf9 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 6 Nov 2023 14:57:17 +0100 Subject: [PATCH 09/20] Remove redundant RuboCop step as it is already run via Danger --- .buildkite/pipeline.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index c6d71221a..8f07d3576 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -55,19 +55,6 @@ steps: ruby: - 3.2.2 - ################# - # Lint - ################# - - label: "🧹 Lint (Rubocop)" - key: rubocop - command: | - bundle install - echo "--- :rubocop: Run Rubocop" - bundle exec rubocop - plugins: [*docker_plugin] - agents: - queue: "default" - ################# # Danger ################# From c981973fb95bfa2d0d4a393b79597fb47c8313bb Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 6 Nov 2023 15:01:22 +0100 Subject: [PATCH 10/20] Improve reviewers check method naming and comments --- Dangerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dangerfile b/Dangerfile index 515d89a83..a86d1754b 100644 --- a/Dangerfile +++ b/Dangerfile @@ -12,16 +12,18 @@ def gemfile_lock_version gemfile_lock.scan(/fastlane-plugin-wpmreleasetoolkit \((\d+.\d+.\d+)\)/).last.first end -def finished_reviews? +# these are reviewers actively providing feedback and potentially changing the state of the PR (approved, changes-requested) +def active_reviewers? repo_name = github.pr_json['base']['repo']['full_name'] pr_number = github.pr_json['number'] !github.api.pull_request_reviews(repo_name, pr_number).empty? end +# requested_teams / requested_reviewers are users initially requested to review a PR, who haven't reacted yet def requested_reviewers? has_requested_reviews = !github.pr_json['requested_teams'].to_a.empty? || !github.pr_json['requested_reviewers'].to_a.empty? - has_requested_reviews || finished_reviews? + has_requested_reviews || active_reviewers? end return if github.pr_labels.include?('Releases') From f872d3805510123d8d3628dd6862dd8976e5c020 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 8 Nov 2023 14:51:22 +0100 Subject: [PATCH 11/20] Fix RuboCop offenses after rebase; update rubocop_todo --- .rubocop_todo.yml | 18 ++--- Rakefile | 2 +- .../android/android_betabuild_prechecks.rb | 2 +- .../android/android_create_avd_action.rb | 4 +- .../android_download_translations_action.rb | 4 +- .../actions/android/android_firebase_test.rb | 4 +- .../android/android_send_app_size_metrics.rb | 6 +- .../android/android_update_release_notes.rb | 2 +- .../common/buildkite_annotate_action.rb | 4 +- .../common/check_translation_progress.rb | 10 +-- .../actions/common/close_milestone_action.rb | 2 +- .../common/copy_branch_protection_action.rb | 4 +- .../common/create_new_milestone_action.rb | 4 +- .../actions/common/create_release_action.rb | 10 +-- .../actions/common/get_prs_between_tags.rb | 12 ++-- .../common/promo_screenshots_action.rb | 2 +- .../common/remove_branch_protection_action.rb | 2 +- .../common/set_branch_protection_action.rb | 4 +- .../actions/common/setfrozentag_action.rb | 2 +- .../actions/common/upload_to_s3.rb | 8 +-- .../configure_add_files_to_copy_action.rb | 2 +- ...s_download_strings_files_from_glotpress.rb | 2 +- .../actions/ios/ios_final_tag.rb | 2 +- .../actions/ios/ios_get_store_app_sizes.rb | 4 +- .../actions/ios/ios_lint_localizations.rb | 4 +- .../actions/ios/ios_send_app_size_metrics.rb | 2 +- .../actions/ios/ios_update_release_notes.rb | 2 +- .../helper/android/android_emulator_helper.rb | 4 +- .../helper/android/android_localize_helper.rb | 4 +- .../android/android_tools_path_helper.rb | 2 +- .../helper/app_size_metrics_helper.rb | 4 +- .../wpmreleasetoolkit/helper/ci_helper.rb | 2 +- .../wpmreleasetoolkit/helper/git_helper.rb | 4 +- .../wpmreleasetoolkit/helper/github_helper.rb | 8 +-- .../helper/interactive_prompt_reminder.rb | 4 +- .../helper/ios/ios_l10n_linter_helper.rb | 2 +- .../helper/metadata_download_helper.rb | 2 +- .../models/firebase_test_runner.rb | 8 +-- rakelib/changelog_parser.rake | 4 +- spec/an_localize_libs_action_spec.rb | 10 +-- spec/android_send_app_size_metrics_spec.rb | 4 +- spec/buildkite_annotate_action_spec.rb | 2 +- spec/check_localization_progress_spec.rb | 10 +-- spec/configure_helper_spec.rb | 2 +- spec/copy_branch_protection_action_spec.rb | 24 +++---- spec/file_reference_spec.rb | 2 +- spec/firebase_device_spec.rb | 2 +- spec/firebase_test_runner_spec.rb | 20 +++--- spec/get_prs_between_tags_spec.rb | 12 ++-- spec/git_helper_spec.rb | 16 ++--- spec/github_helper_spec.rb | 40 +++++------ spec/ios_bump_version_release_spec.rb | 2 +- ...nload_strings_files_from_glotpress_spec.rb | 6 +- ...os_generate_strings_file_from_code_spec.rb | 10 +-- spec/ios_get_app_version_spec.rb | 12 ++-- spec/ios_get_build_number_spec.rb | 8 +-- spec/ios_git_helper_spec.rb | 4 +- spec/ios_l10n_helper_spec.rb | 16 ++--- spec/ios_send_app_size_metrics_spec.rb | 6 +- ...otype_build_details_comment_action_spec.rb | 18 ++--- spec/remove_branch_protection_action_spec.rb | 12 ++-- spec/set_branch_protection_action_spec.rb | 70 +++++++++---------- spec/spec_helper.rb | 2 +- spec/upload_to_s3_spec.rb | 8 +-- 64 files changed, 241 insertions(+), 249 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2a6baa19c..fed1b0906 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-09-21 15:44:18 UTC using RuboCop version 1.56.3. +# on 2023-11-08 13:49:19 UTC using RuboCop version 1.57.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -14,24 +14,16 @@ Gemspec/DevelopmentDependencies: Exclude: - 'fastlane-plugin-wpmreleasetoolkit.gemspec' -# Offense count: 1 -# Configuration parameters: Severity, Include. -# Include: **/*.gemspec -Gemspec/RequiredRubyVersion: - Exclude: - - 'fastlane-plugin-wpmreleasetoolkit.gemspec' - # Offense count: 3 Lint/NonLocalExitFromIterator: Exclude: - 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb' - 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb' -# Offense count: 7 +# Offense count: 4 Naming/AccessorMethodName: Exclude: - 'lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb' - - 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb' - 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb' # Offense count: 2 @@ -42,7 +34,7 @@ Naming/MethodParameterName: - 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb' - 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb' -# Offense count: 108 +# Offense count: 109 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. # NamePrefix: is_, has_, have_ # ForbiddenPrefixes: is_, has_, have_ @@ -68,7 +60,7 @@ RSpec/ContextWording: - 'spec/git_helper_spec.rb' - 'spec/ios_lint_localizations_spec.rb' -# Offense count: 45 +# Offense count: 61 # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. # Include: **/*_spec*rb*, **/spec/**/* RSpec/FilePath: @@ -96,7 +88,7 @@ RSpec/NamedSubject: - 'spec/configuration_spec.rb' - 'spec/file_reference_spec.rb' -# Offense count: 10 +# Offense count: 14 RSpec/NestedGroups: Max: 5 diff --git a/Rakefile b/Rakefile index a1a836702..b4d036d3e 100644 --- a/Rakefile +++ b/Rakefile @@ -56,7 +56,7 @@ task :new_release do Console.header 'Update `VERSION` constant in `version.rb`...' update_version_constant(VERSION_FILE, new_version) Console.header 'Updating CHANGELOG...' - parser.update_for_new_release(new_version:) + parser.update_for_new_release(new_version: new_version) # Commit and push Console.header 'Commit and push changes...' diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb index 2b1a11318..803e40d2c 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb @@ -42,7 +42,7 @@ def self.run(params) # Check user overwrite unless params[:base_version].nil? - overwrite_version = get_user_build_version(version: params[:base_version], message:) + overwrite_version = get_user_build_version(version: params[:base_version], message: message) release_version = overwrite_version[0] alpha_release_version = overwrite_version[1] end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_avd_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_avd_action.rb index 4a72b36ae..8fd4c1416 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_avd_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_avd_action.rb @@ -16,9 +16,9 @@ def self.run(params) helper.create_avd( api: api_level, device: device_model, - system_image:, + system_image: system_image, name: avd_name, - sdcard: + sdcard: sdcard ) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb index 6f503b2ba..ce89aea6c 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb @@ -11,11 +11,11 @@ def self.run(params) res_dir = File.join(project_root_folder || '.', params[:res_dir]) Fastlane::Helper::Android::LocalizeHelper.create_available_languages_file( - res_dir:, + res_dir: res_dir, locale_codes: [params[:source_locale]] + params[:locales].map { |h| h[:android] } ) Fastlane::Helper::Android::LocalizeHelper.download_from_glotpress( - res_dir:, + res_dir: res_dir, glotpress_project_url: params[:glotpress_url], glotpress_filters: params[:status_filter].map { |s| { status: s } }, locales_map: params[:locales] diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb index 6889e8b15..31799dddd 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb @@ -33,14 +33,14 @@ def self.run(params) project_id: params[:project_id], apk_path: params[:apk_path], test_apk_path: params[:test_apk_path], - device:, + device: device, test_targets: params[:test_targets], type: params[:type] ) # Download all of the outputs from the job to the local machine FirebaseTestRunner.download_result_files( - result:, + result: result, destination: test_dir, project_id: params[:project_id], key_file_path: params[:key_file] diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_send_app_size_metrics.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_send_app_size_metrics.rb index 183f4f37e..075f528a7 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_send_app_size_metrics.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_send_app_size_metrics.rb @@ -42,18 +42,18 @@ def self.run(params) unless params[:aab_path].nil? generate_split_apks(aab_path: params[:aab_path]) do |apk| split_name = File.basename(apk, '.apk') - add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin:, apk:, split_name:) + add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin: apkanalyzer_bin, apk: apk, split_name: split_name) end end unless params[:universal_apk_path].nil? - add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin:, apk: params[:universal_apk_path], split_name: UNIVERSAL_APK_SPLIT_NAME) + add_apk_size_metrics(helper: metrics_helper, apkanalyzer_bin: apkanalyzer_bin, apk: params[:universal_apk_path], split_name: UNIVERSAL_APK_SPLIT_NAME) end end # Send the payload metrics_helper.send_metrics( to: api_url, - api_token:, + api_token: api_token, use_gzip: params[:use_gzip_content_encoding] ) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb index 60e4b7c79..5924acdfc 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb @@ -13,7 +13,7 @@ def self.run(params) path = params[:release_notes_file_path] next_version = Fastlane::Helper::Android::VersionHelper.calc_next_release_short_version(params[:new_version]) - Fastlane::Helper::ReleaseNotesHelper.add_new_section(path:, section_title: next_version) + Fastlane::Helper::ReleaseNotesHelper.add_new_section(path: path, section_title: next_version) Fastlane::Helper::GitHelper.commit(message: "Release Notes: add new section for next version (#{next_version})", files: path) UI.message 'Done.' diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb index e8850fd59..2b0b2f34f 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb @@ -14,8 +14,8 @@ def self.run(params) else # Add new annotation using `buildkite-agent` extra_params = { - context:, - style: + context: context, + style: style }.compact.flat_map { |k, v| ["--#{k}", v] } sh('buildkite-agent', 'annotate', *extra_params, params[:message]) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb index e02c82987..ff0a092b4 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb @@ -15,7 +15,7 @@ def self.run(params) unless under_threshold_langs.empty? check_results( - under_threshold_langs:, + under_threshold_langs: under_threshold_langs, threshold: params[:min_acceptable_translation_percentage], skip_confirm: params[:skip_confirm] ) @@ -37,7 +37,7 @@ def self.check_translations(glotpress_url:, language_codes:, abort_on_violations under_threshold_langs = [] data = begin - Fastlane::Helper::GlotPressHelper.get_translation_status_data(glotpress_url:) + Fastlane::Helper::GlotPressHelper.get_translation_status_data(glotpress_url: glotpress_url) rescue StandardError nil end @@ -47,8 +47,8 @@ def self.check_translations(glotpress_url:, language_codes:, abort_on_violations UI.message("> Getting translation status for #{language_code}") progress = begin Fastlane::Helper::GlotPressHelper.get_translation_status( - data:, - language_code: + data: data, + language_code: language_code ) rescue StandardError -1 @@ -60,7 +60,7 @@ def self.check_translations(glotpress_url:, language_codes:, abort_on_violations end UI.message("Language #{language_code} is #{progress}% translated.") - under_threshold_langs.push({ lang: language_code, progress: }) if progress < threshold + under_threshold_langs.push({ lang: language_code, progress: progress }) if progress < threshold end under_threshold_langs diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb index 708a811bc..72cbecfa6 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb @@ -15,7 +15,7 @@ def self.run(params) UI.user_error!("Milestone #{milestone_title} not found.") if milestone.nil? - github_helper.update_milestone(repository:, number: milestone[:number], state: 'closed') + github_helper.update_milestone(repository: repository, number: milestone[:number], state: 'closed') end def self.description diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/copy_branch_protection_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/copy_branch_protection_action.rb index ad373c83f..8263577e2 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/copy_branch_protection_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/copy_branch_protection_action.rb @@ -13,7 +13,7 @@ def self.run(params) response = begin github_helper.get_branch_protection( - repository:, + repository: repository, branch: from_branch ) rescue Octokit::NotFound @@ -24,7 +24,7 @@ def self.run(params) response = begin github_helper.set_branch_protection( - repository:, + repository: repository, branch: to_branch, **settings ) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb index bd0e8f6a5..505814e22 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb @@ -26,10 +26,10 @@ def self.run(params) UI.message("Next milestone: #{newmilestone_number} due on #{newmilestone_duedate}.") github_helper.create_milestone( - repository:, + repository: repository, title: newmilestone_number, due_date: newmilestone_duedate, - days_until_submission:, + days_until_submission: days_until_submission, days_until_release: number_of_days_from_code_freeze_to_release ) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb index 635e3ffee..f294a362b 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb @@ -24,13 +24,13 @@ def self.run(params) github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token]) url = github_helper.create_release( - repository:, - version:, + repository: repository, + version: version, target: params[:target], description: release_notes, - assets:, - prerelease:, - is_draft: + assets: assets, + prerelease: prerelease, + is_draft: is_draft ) UI.success("Successfully created GitHub Release. You can see it at '#{url}'") url diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb index 20f00ad47..e4a7724ae 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb @@ -16,11 +16,11 @@ def self.run(params) github_helper = Fastlane::Helper::GithubHelper.new(github_token: gh_token) changelog = begin github_helper.generate_release_notes( - repository:, - tag_name:, - previous_tag:, - target_commitish:, - config_file_path: + repository: repository, + tag_name: tag_name, + previous_tag: previous_tag, + target_commitish: target_commitish, + config_file_path: config_file_path ) rescue StandardError => e error_msg = "❌ Error computing the list of PRs since #{previous_tag || 'last release'}: `#{e.message}`" @@ -31,7 +31,7 @@ def self.run(params) previous_release_link = if previous_tag.nil? 'last release' else - link = github_helper.get_release_url(repository:, tag_name: previous_tag) + link = github_helper.get_release_url(repository: repository, tag_name: previous_tag) "[#{previous_tag}](#{link})" end changelog diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb index 4aeda482d..0ec1960fe 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb @@ -13,7 +13,7 @@ def self.run(params) config = helper.read_config(params[:config_file]) - helper.check_fonts_installed!(config:) unless params[:skip_font_check] + helper.check_fonts_installed!(config: config) unless params[:skip_font_check] translation_directories = subdirectories_for_path(params[:metadata_folder]) image_directories = subdirectories_for_path(params[:orig_folder]) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/remove_branch_protection_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/remove_branch_protection_action.rb index 8bb85cd5c..5df37656e 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/remove_branch_protection_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/remove_branch_protection_action.rb @@ -10,7 +10,7 @@ def self.run(params) github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token]) github_helper.remove_branch_protection( - repository:, + repository: repository, branch: branch_name ) rescue Octokit::NotFound diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/set_branch_protection_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/set_branch_protection_action.rb index e40fda071..361f2199b 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/set_branch_protection_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/set_branch_protection_action.rb @@ -11,7 +11,7 @@ def self.run(params) settings = if params[:keep_existing_settings_unchanged] Fastlane::Helper::GithubHelper.branch_protection_api_response_to_normalized_hash( - github_helper.get_branch_protection(repository:, branch: branch_name) + github_helper.get_branch_protection(repository: repository, branch: branch_name) ) else {} @@ -58,7 +58,7 @@ def self.run(params) # API Call - See https://docs.github.com/en/rest/branches/branch-protection#update-branch-protection response = github_helper.set_branch_protection( - repository:, + repository: repository, branch: branch_name, **settings ) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb index f739c4e9e..ca5e5d5d8 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb @@ -29,7 +29,7 @@ def self.run(params) end UI.message("New milestone: #{mile_title}") - github_helper.update_milestone(repository:, number: milestone[:number], title: mile_title) + github_helper.update_milestone(repository: repository, number: milestone[:number], title: mile_title) end def self.is_frozen(milestone) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb index b9647bc04..22fbe4030 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb @@ -42,8 +42,8 @@ def self.run(params) File.open(file_path, 'rb') do |file| Aws::S3::Client.new.put_object( body: file, - bucket:, - key: + bucket: bucket, + key: key ) rescue Aws::S3::Errors::ServiceError => e UI.crash!("Unable to upload file to S3: #{e.message}") @@ -58,8 +58,8 @@ def self.run(params) def self.file_is_already_uploaded?(bucket, key) response = Aws::S3::Client.new.head_object( - bucket:, - key: + bucket: bucket, + key: key ) response[:content_length].positive? rescue Aws::S3::Errors::NotFound diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb index 9570d04a9..95cdeacd2 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb @@ -55,7 +55,7 @@ def self.add_file encrypt = UI.confirm('Encrypt file?:') - Fastlane::Helper::ConfigureHelper.add_file(source:, destination:, encrypt:) + Fastlane::Helper::ConfigureHelper.add_file(source: source, destination: destination, encrypt: encrypt) end def self.secret_store_dir diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb index 28d817176..6eab435ab 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb @@ -19,7 +19,7 @@ def self.run(params) project_url: params[:project_url], locale: glotpress_locale, filters: params[:filters], - destination: + destination: destination ) # Do a quick check of the downloaded `.strings` file to ensure it looks valid validate_strings_file(destination) unless params[:skip_file_validation] diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb index d33289605..51c0b805f 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb @@ -12,7 +12,7 @@ def self.run(params) Fastlane::Helper::GitHelper.create_tag(version) - other_action.ios_clear_intermediate_tags(version:) + other_action.ios_clear_intermediate_tags(version: version) end ##################################################### diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb index 26d3e84f6..10b9b20c0 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb @@ -18,10 +18,10 @@ def self.run(params) case params[:format] when 'csv' - csv = Helper.format_csv(app_sizes, devices:) + csv = Helper.format_csv(app_sizes, devices: devices) UI.message "Result (CSV)\n\n#{csv}\n" when 'markdown' - tables = Helper.format_markdown(app_sizes, devices:) + tables = Helper.format_markdown(app_sizes, devices: devices) tables.each do |table| UI.message "Result (Markdown)\n\n#{table}\n" end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb index 54a36a787..01f9fdde6 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb @@ -14,7 +14,7 @@ def self.run(params) end end - report(violations:, base_lang: params[:base_lang]) + report(violations: violations, base_lang: params[:base_lang]) break unless !violations.empty? && params[:allow_retry] && UI.confirm(RETRY_MESSAGE) end @@ -53,7 +53,7 @@ def self.find_duplicated_keys(params) language = File.basename(File.dirname(file), '.lproj') path = File.join(params[:input_dir], file) - file_type = Fastlane::Helper::Ios::L10nHelper.strings_file_type(path:) + file_type = Fastlane::Helper::Ios::L10nHelper.strings_file_type(path: path) if file_type == :text duplicates = Fastlane::Helper::Ios::StringsFileValidationHelper.find_duplicated_keys(file: path) duplicate_keys[language] = duplicates.map { |key, value| "`#{key}` was found at multiple lines: #{value.join(', ')}" } unless duplicates.empty? diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb index 065c30232..dd891108a 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb @@ -44,7 +44,7 @@ def self.run(params) # Send the payload metrics_helper.send_metrics( to: api_url, - api_token:, + api_token: api_token, use_gzip: params[:use_gzip_content_encoding] ) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb index 99e311c25..fbf31d381 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb @@ -13,7 +13,7 @@ def self.run(params) path = params[:release_notes_file_path] next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(params[:new_version]) - Fastlane::Helper::ReleaseNotesHelper.add_new_section(path:, section_title: next_version) + Fastlane::Helper::ReleaseNotesHelper.add_new_section(path: path, section_title: next_version) Fastlane::Helper::GitHelper.commit(message: "Release Notes: add new section for next version (#{next_version})", files: path) UI.message 'Done.' diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb index ea3768811..141d0899b 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb @@ -21,7 +21,7 @@ def initialize # @return [String] The `sdkmanager` package specifier that has been installed # def install_system_image(api:) - package = system_image_package(api:) + package = system_image_package(api: api) UI.message("Installing System Image for Android #{api} (#{package})") Actions.sh(@tools.sdkmanager, '--install', package) @@ -39,7 +39,7 @@ def install_system_image(api:) # @return [String] The device name (i.e. either `name` if provided, or the derived `_API_` if provided `name` was `nil``) # def create_avd(api:, device:, system_image: nil, name: nil, sdcard: '512M') - package = system_image || system_image_package(api:) + package = system_image || system_image_package(api: api) device_name = name || "#{device.gsub(' ', '_').capitalize}_API_#{api}" UI.message("Creating AVD `#{device_name}` (#{device}, API #{api})") diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb index 3aa8113dd..74d6b6048 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb @@ -163,7 +163,7 @@ def self.verify_diff(diff_string, main_strings, lib_strings, library) diff_string = diff_string.slice(0..(end_index - 1)) lib_strings.xpath('//string').each do |string_node| - res = verify_string(main_strings, library, string_node) if string_node.attr('name') == diff_string + verify_string(main_strings, library, string_node) if string_node.attr('name') == diff_string end end @@ -243,7 +243,7 @@ def self.download_from_glotpress(res_dir:, glotpress_project_url:, locales_map:, locales_map.each do |lang_codes| all_xml_documents = glotpress_filters.map do |filters| UI.message "Downloading translations for '#{lang_codes[:android]}' from GlotPress (#{lang_codes[:glotpress]}) [#{filters}]..." - download_glotpress_export_file(project_url: glotpress_project_url, locale: lang_codes[:glotpress], filters:) + download_glotpress_export_file(project_url: glotpress_project_url, locale: lang_codes[:glotpress], filters: filters) end.compact next if all_xml_documents.empty? diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_tools_path_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_tools_path_helper.rb index 59b8202a5..7d31aca45 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_tools_path_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_tools_path_helper.rb @@ -39,7 +39,7 @@ def find_tool_path(binary:, search_paths:) # @return [String] The absolute path of the tool if found. # @raise [FastlaneCore::Interface::FastlaneError] If the tool couldn't be found. def find_tool_path!(binary:, search_paths:) - bin_path = find_tool_path(binary:, search_paths:) + bin_path = find_tool_path(binary: binary, search_paths: search_paths) UI.user_error!("Unable to find path for #{binary} in #{search_paths.inspect}. Verify you installed the proper Android tools.") if bin_path.nil? bin_path end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb index 9dc08ce21..f200a160a 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb @@ -22,7 +22,7 @@ def initialize(metadata = {}) # @param [Hash] hash The metadata common to all the metrics of the payload built by that helper instance. Can be any arbitrary set of key/value pairs # def metadata=(hash) - @metadata = (hash.compact || {}).map { |key, value| { name: key.to_s, value: } } + @metadata = (hash.compact || {}).map { |key, value| { name: key.to_s, value: value } } end # Adds a single metric to the group of metrics @@ -32,7 +32,7 @@ def metadata=(hash) # @param [Hash] metadata The arbitrary dictionary of metadata to associate to that metric entry # def add_metric(name:, value:, metadata: nil) - metric = { name:, value: } + metric = { name: name, value: value } metadata = metadata&.compact || {} # Remove nil values if any (and use empty Hash if nil was provided) metric[:meta] = metadata.map { |meta_key, meta_value| { name: meta_key.to_s, value: meta_value } } unless metadata.empty? @metrics.append(metric) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb index 105109ae2..f448df8be 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb @@ -80,7 +80,7 @@ def trigger_job(branch:, parameters: nil) Net::HTTP.start(command_uri.host, command_uri.port, use_ssl: true) do |http| request = Net::HTTP::Post.new(command_uri.request_uri, headers) - body = { branch:, parameters: } + body = { branch: branch, parameters: parameters } request.body = body.to_json response = http.request(request) return response diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb index ece26fcff..dc8ddbb15 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb @@ -16,7 +16,7 @@ module GitHelper # def self.is_git_repo?(path: Dir.pwd) # If the path doesn't exist, find its first ancestor. - path = first_existing_ancestor_of(path:) + path = first_existing_ancestor_of(path: path) # Get the path's directory, so we can look in it for the Git folder dir = path.directory? ? path : path.dirname @@ -230,7 +230,7 @@ def self.ensure_on_branch!(branch_name) # # @return [Bool] True if the given path is ignored or outside a Git repository, false otherwise. def self.is_ignored?(path:) - return true unless is_git_repo?(path:) + return true unless is_git_repo?(path: path) Actions.sh('git', 'check-ignore', path) do |status, _, _| status.success? diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb index 37b877967..f8649c645 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb @@ -151,7 +151,7 @@ def create_release(repository:, version:, description:, assets:, prerelease:, is version, # tag name name: version, # release name target_commitish: target || Git.open(Dir.pwd).log.first.sha, - prerelease:, + prerelease: prerelease, draft: is_draft, body: description ) @@ -178,10 +178,10 @@ def generate_release_notes(repository:, tag_name:, previous_tag:, target_commiti api_url = "#{repo_path}/releases/generate-notes" res = client.post( api_url, - tag_name:, - target_commitish:, # Only used if no git tag named `tag_name` exists yet + tag_name: tag_name, + target_commitish: target_commitish, # Only used if no git tag named `tag_name` exists yet previous_tag_name: previous_tag, - config_file_path: + config_file_path: config_file_path ) res.body end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb index d528e9bf1..09e97c58f 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/interactive_prompt_reminder.rb @@ -75,7 +75,7 @@ def self.monkey_patch_interactive_prompts_with_reminder(after: DEFAULT_PROMPT_RE old_method = instance_method(method_name) define_method(method_name) do |*args| - FastlaneCore::Shell.with_reminder(after:, message:) { old_method.bind(self).call(*args) } + FastlaneCore::Shell.with_reminder(after: after, message: message) { old_method.bind(self).call(*args) } end end end @@ -89,5 +89,5 @@ def self.monkey_patch_interactive_prompts_with_reminder(after: DEFAULT_PROMPT_RE delays = ENV['FASTLANE_PROMPT_REMINDER_DELAYS']&.split(',')&.map(&:to_i) || FastlaneCore::Shell::DEFAULT_PROMPT_REMINDER_DELAYS FastlaneCore::UI.verbose("Monkey-patching the UI interactive methods to add a reminder (#{delays.inspect}, #{message.inspect})") - FastlaneCore::Shell.monkey_patch_interactive_prompts_with_reminder(after: delays, message:) + FastlaneCore::Shell.monkey_patch_interactive_prompts_with_reminder(after: delays, message: message) end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb index 274fc71b8..969fb0bad 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb @@ -62,7 +62,7 @@ def install_swiftgen! # def run(input_dir:, base_lang: DEFAULT_BASE_LANG, only_langs: nil) check_swiftgen_installed || install_swiftgen! - find_diffs(input_dir:, base_lang:, only_langs:) + find_diffs(input_dir: input_dir, base_lang: base_lang, only_langs: only_langs) end ################## diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb index 4eead17e3..aa73a845d 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb @@ -21,7 +21,7 @@ def initialize(target_folder, target_files, auto_retry) def download(target_locale, glotpress_url, is_source) uri = URI(glotpress_url) response = Net::HTTP.get_response(uri) - handle_glotpress_download(response:, locale: target_locale, is_source:) + handle_glotpress_download(response: response, locale: target_locale, is_source: is_source) end # Parse JSON data and update the local files diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_runner.rb b/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_runner.rb index d1a0c7cb2..8310b4253 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_runner.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_runner.rb @@ -27,7 +27,7 @@ def self.run_tests(project_id:, apk_path:, test_apk_path:, device:, test_targets params = { project: project_id, - type:, + type: type, app: apk_path, test: test_apk_path, 'test-targets': test_targets, @@ -42,7 +42,7 @@ def self.run_tests(project_id:, apk_path:, test_apk_path:, device:, test_targets Action.sh("#{command} 2>&1 | tee #{log_file_path}") # Make the file object available to other tasks - result = FirebaseTestLabResult.new(log_file_path:) + result = FirebaseTestLabResult.new(log_file_path: log_file_path) Fastlane::Actions.lane_context[:FIREBASE_TEST_LOG_FILE] = result result @@ -64,7 +64,7 @@ def self.download_result_files(result:, destination:, project_id:, key_file_path FileUtils.mkdir_p(destination) unless File.directory?(destination) storage = Google::Cloud::Storage.new( - project_id:, + project_id: project_id, credentials: key_file_path ) @@ -74,7 +74,7 @@ def self.download_result_files(result:, destination:, project_id:, key_file_path # Download the files UI.header "Downloading Results Files to #{destination}" - files_to_download.each { |file| download_file(file:, destination:) } + files_to_download.each { |file| download_file(file: file, destination: destination) } end # Download a Google Cloud Storage file to the local machine, creating intermediate directories as needed. diff --git a/rakelib/changelog_parser.rake b/rakelib/changelog_parser.rake index 6ba0046f2..cc7ab00ea 100644 --- a/rakelib/changelog_parser.rake +++ b/rakelib/changelog_parser.rake @@ -18,12 +18,12 @@ class ChangelogParser prev_subtitle = nil loop do (lines, next_level, next_subtitle) = advance_to_next_header(level: 2..3) - subsections.append({ title: prev_subtitle, lines: }) unless lines.reject { |l| l.chomp.empty? || l.chomp == EMPTY_PLACEHOLDER }.empty? + subsections.append({ title: prev_subtitle, lines: lines }) unless lines.reject { |l| l.chomp.empty? || l.chomp == EMPTY_PLACEHOLDER }.empty? prev_subtitle = next_subtitle break if next_level < 3 end - @pending_section = { lines_before: lines_before_first_section, subsections:, next_title: prev_subtitle } + @pending_section = { lines_before: lines_before_first_section, subsections: subsections, next_title: prev_subtitle } prev_subtitle end diff --git a/spec/an_localize_libs_action_spec.rb b/spec/an_localize_libs_action_spec.rb index 3586048d0..e3d97b586 100644 --- a/spec/an_localize_libs_action_spec.rb +++ b/spec/an_localize_libs_action_spec.rb @@ -32,7 +32,7 @@ def write_android_xml(path, lines) File.write(lib2_strings_path, android_xml_with_lines(['test from lib 2'])) run_described_fastlane_action( - app_strings_path:, + app_strings_path: app_strings_path, libs_strings_path: [ { library: 'lib_1', strings_path: lib1_strings_path, exclusions: [] }, { library: 'lib_2', strings_path: lib2_strings_path, exclusions: [] }, @@ -67,7 +67,7 @@ def write_android_xml(path, lines) File.write(lib_strings_path, android_xml_with_lines(lib_xml_lines)) run_described_fastlane_action( - app_strings_path:, + app_strings_path: app_strings_path, libs_strings_path: [ { library: 'lib', strings_path: lib_strings_path, exclusions: [] }, ] @@ -108,7 +108,7 @@ def write_android_xml(path, lines) File.write(lib2_strings_path, android_xml_with_lines(lib2_xml_lines)) run_described_fastlane_action( - app_strings_path:, + app_strings_path: app_strings_path, libs_strings_path: [ { library: 'lib1', strings_path: lib1_strings_path, source_id: 'lib1-id' }, { library: 'lib2', strings_path: lib2_strings_path, source_id: 'lib2-id' }, @@ -157,7 +157,7 @@ def write_android_xml(path, lines) File.write(lib2_strings_path, android_xml_with_lines(lib2_xml_lines)) run_described_fastlane_action( - app_strings_path:, + app_strings_path: app_strings_path, libs_strings_path: [ { library: 'lib1', strings_path: lib1_strings_path, source_id: 'lib1', add_ignore_attr: true }, { library: 'lib2', strings_path: lib2_strings_path, source_id: 'lib2' }, @@ -201,7 +201,7 @@ def write_android_xml(path, lines) File.write(lib_strings_path, android_xml_with_lines(lib_xml_lines)) run_described_fastlane_action( - app_strings_path:, + app_strings_path: app_strings_path, libs_strings_path: [ { library: 'lib', strings_path: lib_strings_path, exclusions: ['override-missing'] }, ] diff --git a/spec/android_send_app_size_metrics_spec.rb b/spec/android_send_app_size_metrics_spec.rb index 3f536f9e8..2f0455587 100644 --- a/spec/android_send_app_size_metrics_spec.rb +++ b/spec/android_send_app_size_metrics_spec.rb @@ -49,8 +49,8 @@ def test_app_size_action(fake_aab_size:, fake_apks:, fake_universal_apk_sizes:, # Act action_params = { api_url: File.join('file://localhost/', output_file), - aab_path:, - universal_apk_path:, + aab_path: aab_path, + universal_apk_path: universal_apk_path, **other_action_args }.compact code = run_described_fastlane_action(action_params) diff --git a/spec/buildkite_annotate_action_spec.rb b/spec/buildkite_annotate_action_spec.rb index fa98be7a4..f042acee7 100644 --- a/spec/buildkite_annotate_action_spec.rb +++ b/spec/buildkite_annotate_action_spec.rb @@ -17,7 +17,7 @@ expect(FastlaneCore::UI).not_to receive(:user_error!) cmd = run_described_fastlane_action( context: 'ctx', - style:, + style: style, message: 'message' ) expect(cmd).to eq("buildkite-agent annotate --context ctx --style #{style} message") diff --git a/spec/check_localization_progress_spec.rb b/spec/check_localization_progress_spec.rb index c3726fe6f..d9275d98d 100644 --- a/spec/check_localization_progress_spec.rb +++ b/spec/check_localization_progress_spec.rb @@ -336,11 +336,11 @@ def generate_glotpress_response_header def generate_glotpress_response_for_language(lang:, lang_code:, current:, fuzzy:, waiting:, untranslated:, progress:) res = "\n" - res << generate_glotpress_response_header_for_language(lang:, lang_code:, progress:) - res << generate_glotpress_response_for_language_status(lang_code:, status_main: 'translated', status: 'current', string_count: current) - res << generate_glotpress_response_for_language_status(lang_code:, status_main: 'fuzzy', status: 'fuzzy', string_count: fuzzy) - res << generate_glotpress_response_for_language_status(lang_code:, status_main: 'untranslated', status: 'untranslated', string_count: waiting) - res << generate_glotpress_response_for_language_status(lang_code:, status_main: 'waiting', status: 'waiting', string_count: untranslated) + res << generate_glotpress_response_header_for_language(lang: lang, lang_code: lang_code, progress: progress) + res << generate_glotpress_response_for_language_status(lang_code: lang_code, status_main: 'translated', status: 'current', string_count: current) + res << generate_glotpress_response_for_language_status(lang_code: lang_code, status_main: 'fuzzy', status: 'fuzzy', string_count: fuzzy) + res << generate_glotpress_response_for_language_status(lang_code: lang_code, status_main: 'untranslated', status: 'untranslated', string_count: waiting) + res << generate_glotpress_response_for_language_status(lang_code: lang_code, status_main: 'waiting', status: 'waiting', string_count: untranslated) res << '' end diff --git a/spec/configure_helper_spec.rb b/spec/configure_helper_spec.rb index 2afb5457d..ab01e1372 100644 --- a/spec/configure_helper_spec.rb +++ b/spec/configure_helper_spec.rb @@ -17,7 +17,7 @@ expect(Fastlane::UI).to receive(:user_error!) - described_class.add_file(source: 'path/to/source', destination:, encrypt: true) + described_class.add_file(source: 'path/to/source', destination: destination, encrypt: true) end end end diff --git a/spec/copy_branch_protection_action_spec.rb b/spec/copy_branch_protection_action_spec.rb index 8368c9fef..c97bb3c5a 100644 --- a/spec/copy_branch_protection_action_spec.rb +++ b/spec/copy_branch_protection_action_spec.rb @@ -32,9 +32,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - from_branch:, - to_branch:, - github_token: + from_branch: from_branch, + to_branch: to_branch, + github_token: github_token ) end @@ -44,9 +44,9 @@ def fixture(file) expect do run_described_fastlane_action( repository: repo, - from_branch:, - to_branch:, - github_token: + from_branch: from_branch, + to_branch: to_branch, + github_token: github_token ) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Branch `#{from_branch}` of repository `#{repo}` was not found.") end @@ -57,9 +57,9 @@ def fixture(file) expect do run_described_fastlane_action( repository: repo, - from_branch:, - to_branch:, - github_token: + from_branch: from_branch, + to_branch: to_branch, + github_token: github_token ) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Branch `#{from_branch}` does not have any branch protection set up.") end @@ -73,9 +73,9 @@ def fixture(file) expect do run_described_fastlane_action( repository: repo, - from_branch:, - to_branch:, - github_token: + from_branch: from_branch, + to_branch: to_branch, + github_token: github_token ) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Branch `#{to_branch}` of repository `#{repo}` was not found.") end diff --git a/spec/file_reference_spec.rb b/spec/file_reference_spec.rb index 2100b1bff..689616819 100644 --- a/spec/file_reference_spec.rb +++ b/spec/file_reference_spec.rb @@ -128,6 +128,6 @@ def stub_path_as_ignored(path:, ignored:) allow(Fastlane::Helper::GitHelper).to receive(:is_ignored?) - .with(path:) + .with(path: path) .and_return(ignored) end diff --git a/spec/firebase_device_spec.rb b/spec/firebase_device_spec.rb index 8e2344d6a..dd15f0625 100644 --- a/spec/firebase_device_spec.rb +++ b/spec/firebase_device_spec.rb @@ -14,7 +14,7 @@ end def create_model(model: 'Nexus5', version: 27, locale: 'en', orientation: 'portrait') - described_class.new(model:, version:, locale:, orientation:) + described_class.new(model: model, version: version, locale: locale, orientation: orientation) end describe 'initialization' do diff --git a/spec/firebase_test_runner_spec.rb b/spec/firebase_test_runner_spec.rb index c76d93e82..92ebcfcdd 100644 --- a/spec/firebase_test_runner_spec.rb +++ b/spec/firebase_test_runner_spec.rb @@ -76,12 +76,12 @@ def run_tests(project_id: 'foo-bar-baz', apk_path: default_file, test_apk_path: default_file, device: 'device', test_targets: nil, type: 'instrumentation') Fastlane::Actions.lane_context[:FIREBASE_TEST_LOG_FILE_PATH] = runner_temp_file described_class.run_tests( - project_id:, - apk_path:, - test_apk_path:, - device:, - test_targets:, - type: + project_id: project_id, + apk_path: apk_path, + test_apk_path: test_apk_path, + device: device, + test_targets: test_targets, + type: type ) end end @@ -100,10 +100,10 @@ def run_tests(project_id: 'foo-bar-baz', apk_path: default_file, test_apk_path: def run_download(result: passed_test_log, destination: '/tmp/test', project_id: 'foo-bar-baz', key_file_path: 'invalid') described_class.download_result_files( - result:, - destination:, - project_id:, - key_file_path: + result: result, + destination: destination, + project_id: project_id, + key_file_path: key_file_path ) end end diff --git a/spec/get_prs_between_tags_spec.rb b/spec/get_prs_between_tags_spec.rb index 15c60c1f2..ad27285ff 100644 --- a/spec/get_prs_between_tags_spec.rb +++ b/spec/get_prs_between_tags_spec.rb @@ -60,9 +60,9 @@ def test_with_params(target_commitish: nil, previous_tag: nil, configuration_fil github_token: test_token, repository: test_repo, tag_name: test_tag_name, - target_commitish:, - previous_tag:, - configuration_file_path: + target_commitish: target_commitish, + previous_tag: previous_tag, + configuration_file_path: configuration_file_path ) # Assert @@ -120,9 +120,9 @@ def test_with_params(target_commitish: nil, previous_tag: nil, configuration_fil github_token: test_token, repository: test_repo, tag_name: test_tag_name, - target_commitish:, - previous_tag:, - configuration_file_path: + target_commitish: target_commitish, + previous_tag: previous_tag, + configuration_file_path: configuration_file_path ) # Assert diff --git a/spec/git_helper_spec.rb b/spec/git_helper_spec.rb index 5b4963957..3a814a59f 100644 --- a/spec/git_helper_spec.rb +++ b/spec/git_helper_spec.rb @@ -49,7 +49,7 @@ `git -C #{dir} init --initial-branch main || git -C #{dir} init` path = File.join(dir, 'a', 'b') `mkdir -p #{path}` - expect(described_class.is_git_repo?(path:)).to be true + expect(described_class.is_git_repo?(path: path)).to be true end end @@ -101,7 +101,7 @@ files = ['file 1', 'file 2', 'file 3'] expect_shell_command('git', 'add', files[0], files[1], files[2]) expect_shell_command('git', 'commit', '-m', @message) - described_class.commit(message: @message, files:) + described_class.commit(message: @message, files: files) end it 'adds all pending file changes before commit if :all is provided as `files`' do @@ -118,7 +118,7 @@ dummy_file_path: path, add_file_to_gitignore: false ) - expect(described_class.is_ignored?(path:)).to be false + expect(described_class.is_ignored?(path: path)).to be false end context 'when the path is in the .gitignore' do @@ -132,7 +132,7 @@ add_file_to_gitignore: true, commit_gitignore: false ) - expect(described_class.is_ignored?(path:)).to be true + expect(described_class.is_ignored?(path: path)).to be true end it 'returns true when the .gitignore has no uncommitted changes' do @@ -141,7 +141,7 @@ add_file_to_gitignore: true, commit_gitignore: true ) - expect(described_class.is_ignored?(path:)).to be true + expect(described_class.is_ignored?(path: path)).to be true end end @@ -149,7 +149,7 @@ # We need the ability to tell if a path result is ignored, regardless of whether it exists yet. it 'returns false for files not yet created but part of the repository' do setup_git_repo - expect(described_class.is_ignored?(path:)).to be false + expect(described_class.is_ignored?(path: path)).to be false end it 'returns true when the path is outside the repository folder' do @@ -157,14 +157,14 @@ path = File.join(@path, '..', 'dummy.txt') setup_git_repo(dummy_file_path: path, add_file_to_gitignore: false) - expect(described_class.is_ignored?(path:)).to be true + expect(described_class.is_ignored?(path: path)).to be true end # This is sort of redundant given the previous example already ensures the same logic. # But, we'll be using paths starting with `~` as part of our configurations, so it felt appopriate to explicitly ensure this important use case is respected. it 'returns true when the path is in the home folder ' do path = '~/a/path' - expect(described_class.is_ignored?(path:)).to be true + expect(described_class.is_ignored?(path: path)).to be true end end end diff --git a/spec/github_helper_spec.rb b/spec/github_helper_spec.rb index a45d33a3b..15db5bf35 100644 --- a/spec/github_helper_spec.rb +++ b/spec/github_helper_spec.rb @@ -40,7 +40,7 @@ def download_file_from_tag(download_folder:) helper = described_class.new(github_token: 'Fake-GitHubToken-123') - helper.download_file_from_tag(repository: test_repo, tag: test_tag, file_path: test_file, download_folder:) + helper.download_file_from_tag(repository: test_repo, tag: test_tag, file_path: test_file, download_folder: download_folder) end end @@ -67,12 +67,12 @@ def download_file_from_tag(download_folder:) end def mock_milestone(title) - { title: } + { title: title } end def get_last_milestone(repository:) helper = described_class.new(github_token: 'Fake-GitHubToken-123') - helper.get_last_milestone(repository:) + helper.get_last_milestone(repository: repository) end end @@ -332,7 +332,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date:, days_until_submission: 4, days_until_release: 7) + create_milestone(due_date: due_date, days_until_submission: 4, days_until_release: 7) end it 'computes the correct dates when submission and release dates are in the same day' do @@ -343,7 +343,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date:, days_until_submission: 1, days_until_release: 1) + create_milestone(due_date: due_date, days_until_submission: 1, days_until_release: 1) end it 'computes the correct dates when the due date is on the verge of a DST day change' do @@ -359,7 +359,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date:, days_until_submission: 2, days_until_release: 3) + create_milestone(due_date: due_date, days_until_submission: 2, days_until_release: 3) end end @@ -376,7 +376,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date:, days_until_submission: 2, days_until_release: 3) + create_milestone(due_date: due_date, days_until_submission: 2, days_until_release: 3) end end @@ -392,7 +392,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date:, days_until_submission: 2, days_until_release: 3) + create_milestone(due_date: due_date, days_until_submission: 2, days_until_release: 3) end end @@ -406,7 +406,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date:, days_until_submission: 140, days_until_release: 146) + create_milestone(due_date: due_date, days_until_submission: 140, days_until_release: 146) end end @@ -420,7 +420,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date:, days_until_submission: 216, days_until_release: 217) + create_milestone(due_date: due_date, days_until_submission: 216, days_until_release: 217) end end @@ -435,7 +435,7 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date:, days_until_submission: 60, days_until_release: 61) + create_milestone(due_date: due_date, days_until_submission: 60, days_until_release: 61) end end @@ -450,25 +450,25 @@ def get_milestone(milestone_name:) } expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options) - create_milestone(due_date:, days_until_submission: 60, days_until_release: 61) + create_milestone(due_date: due_date, days_until_submission: 60, days_until_release: 61) end end it 'raises an error if days_until_submission is less than or equal zero' do due_date = '2022-10-20T08:00:00Z'.to_time.utc - expect { create_milestone(due_date:, days_until_submission: 0, days_until_release: 5) } + expect { create_milestone(due_date: due_date, days_until_submission: 0, days_until_release: 5) } .to raise_error(FastlaneCore::Interface::FastlaneError, 'days_until_submission must be greater than zero.') end it 'raises an error if days_until_release is less than or equal zero' do due_date = '2022-10-20T08:00:00Z'.to_time.utc - expect { create_milestone(due_date:, days_until_submission: 12, days_until_release: -8) } + expect { create_milestone(due_date: due_date, days_until_submission: 12, days_until_release: -8) } .to raise_error(FastlaneCore::Interface::FastlaneError, 'days_until_release must be greater than zero.') end it 'raises an error if days_until_submission is greater than days_until_release' do due_date = '2022-10-20T08:00:00Z'.to_time.utc - expect { create_milestone(due_date:, days_until_submission: 14, days_until_release: 3) } + expect { create_milestone(due_date: due_date, days_until_submission: 14, days_until_release: 3) } .to raise_error(FastlaneCore::Interface::FastlaneError, 'days_until_release must be greater or equal to days_until_submission.') end @@ -477,9 +477,9 @@ def create_milestone(due_date:, days_until_submission:, days_until_release:) helper.create_milestone( repository: test_repo, title: test_milestone_number, - due_date:, - days_until_submission:, - days_until_release: + due_date: due_date, + days_until_submission: days_until_submission, + days_until_release: days_until_release ) end end @@ -542,9 +542,9 @@ def create_release(is_draft:, assets: []) version: test_tag, target: test_target, description: test_description, - assets:, + assets: assets, prerelease: false, - is_draft: + is_draft: is_draft ) end end diff --git a/spec/ios_bump_version_release_spec.rb b/spec/ios_bump_version_release_spec.rb index 73219001b..fe273ea35 100644 --- a/spec/ios_bump_version_release_spec.rb +++ b/spec/ios_bump_version_release_spec.rb @@ -22,7 +22,7 @@ expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump) run_described_fastlane_action( - default_branch: + default_branch: default_branch ) end end diff --git a/spec/ios_download_strings_files_from_glotpress_spec.rb b/spec/ios_download_strings_files_from_glotpress_spec.rb index a940db1d8..8b9db9b08 100644 --- a/spec/ios_download_strings_files_from_glotpress_spec.rb +++ b/spec/ios_download_strings_files_from_glotpress_spec.rb @@ -7,7 +7,7 @@ let(:locales_subset) { { 'fr-FR': 'fr', 'zh-cn': 'zh-Hans' } } def gp_stub(locale:, query:) - stub_request(:get, "#{gp_fake_url}/#{locale}/default/export-translations/").with(query:) + stub_request(:get, "#{gp_fake_url}/#{locale}/default/export-translations/").with(query: query) end describe 'downloading export files from GlotPress' do @@ -26,7 +26,7 @@ def test_gp_download(filters:, tablename:, expected_gp_params:) locales: locales_subset, download_dir: tmp_dir, table_basename: tablename, - filters: + filters: filters }.compact) # Assert @@ -95,7 +95,7 @@ def test_gp_download(filters:, tablename:, expected_gp_params:) run_described_fastlane_action( project_url: gp_fake_url, locales: { 'fr-FR': 'fr' }, - download_dir: + download_dir: download_dir ) end diff --git a/spec/ios_generate_strings_file_from_code_spec.rb b/spec/ios_generate_strings_file_from_code_spec.rb index 158c6acd7..0d4346e4e 100644 --- a/spec/ios_generate_strings_file_from_code_spec.rb +++ b/spec/ios_generate_strings_file_from_code_spec.rb @@ -143,7 +143,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: true, swiftui: false }, expected_dir_name: 'expected-pods-noswiftui', - expected_logs: + expected_logs: expected_logs ) end @@ -156,7 +156,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: false, swiftui: false }, expected_dir_name: 'expected-pods-noswiftui', - expected_logs: + expected_logs: expected_logs ) end @@ -168,7 +168,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: true, swiftui: false, routines: 'PodLocalizedString', fail_on_error: false }, expected_dir_name: 'expected-custom-routine', - expected_logs:, + expected_logs: expected_logs, expected_failures: [] ) end @@ -181,7 +181,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: true, swiftui: false, routines: 'PodLocalizedString', fail_on_error: true }, expected_dir_name: 'expected-custom-routine', - expected_logs:, + expected_logs: expected_logs, expected_failures: [expected_logs.last] ) end @@ -195,7 +195,7 @@ def test_genstrings(params:, expected_dir_name:, expected_logs: nil, expected_fa test_genstrings( params: { paths: [app_src_dir, pods_src_dir], quiet: false, swiftui: false, fail_on_error: true }, expected_dir_name: 'expected-pods-noswiftui', - expected_logs:, + expected_logs: expected_logs, expected_failures: [] ) end diff --git a/spec/ios_get_app_version_spec.rb b/spec/ios_get_app_version_spec.rb index eda850a8f..0355fd175 100644 --- a/spec/ios_get_app_version_spec.rb +++ b/spec/ios_get_app_version_spec.rb @@ -9,7 +9,7 @@ VERSION_LONG = 6.30.0 CONTENT - expect_version(xcconfig_mock_content:, expected_version: '6.30') + expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: '6.30') end it 'parses the xcconfig file format correctly and gets the public hotfix version' do @@ -19,7 +19,7 @@ VERSION_LONG = 6.30.1 CONTENT - expect_version(xcconfig_mock_content:, expected_version: '6.30.1') + expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: '6.30.1') end it 'parses the xcconfig with keys without spacing and gets the public version' do @@ -29,7 +29,7 @@ VERSION_LONG=6.30.0 CONTENT - expect_version(xcconfig_mock_content:, expected_version: '6.30') + expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: '6.30') end it 'parses the xcconfig with keys without spacing and gets the public hotfix version' do @@ -39,7 +39,7 @@ VERSION_LONG=6.30.1 CONTENT - expect_version(xcconfig_mock_content:, expected_version: '6.30.1') + expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: '6.30.1') end it 'fails to extract the version from an xcconfig file with an invalid format' do @@ -49,7 +49,7 @@ CONTENT expect do - expect_version(xcconfig_mock_content:, expected_version: 'n/a') + expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: 'n/a') end.to raise_error(FastlaneCore::Interface::FastlaneError) end @@ -70,7 +70,7 @@ CONTENT expect do - expect_version(xcconfig_mock_content:, expected_version: 'n/a') + expect_version(xcconfig_mock_content: xcconfig_mock_content, expected_version: 'n/a') end.to raise_error(FastlaneCore::Interface::FastlaneError) end diff --git a/spec/ios_get_build_number_spec.rb b/spec/ios_get_build_number_spec.rb index 2db7f12c6..dadba9c8d 100644 --- a/spec/ios_get_build_number_spec.rb +++ b/spec/ios_get_build_number_spec.rb @@ -10,7 +10,7 @@ BUILD_NUMBER=1940 CONTENT - expect_build_number(xcconfig_mock_content:, expected_build_number: '1940') + expect_build_number(xcconfig_mock_content: xcconfig_mock_content, expected_build_number: '1940') end it 'parses an xcconfig file with keys with spaces and returns the correct build number' do @@ -20,7 +20,7 @@ BUILD_NUMBER = 1940 CONTENT - expect_build_number(xcconfig_mock_content:, expected_build_number: '1940') + expect_build_number(xcconfig_mock_content: xcconfig_mock_content, expected_build_number: '1940') end it 'parses an xcconfig file with an invalid format and returns a nil build number' do @@ -30,7 +30,7 @@ BUILD_NUMBER 1940 CONTENT - expect_build_number(xcconfig_mock_content:, expected_build_number: nil) + expect_build_number(xcconfig_mock_content: xcconfig_mock_content, expected_build_number: nil) end it 'parses an xcconfig file with no build number and returns a nil build number' do @@ -39,7 +39,7 @@ // a comment CONTENT - expect_build_number(xcconfig_mock_content:, expected_build_number: nil) + expect_build_number(xcconfig_mock_content: xcconfig_mock_content, expected_build_number: nil) end it 'throws an error when the xcconfig file does not exist' do diff --git a/spec/ios_git_helper_spec.rb b/spec/ios_git_helper_spec.rb index eacdf8a43..7c2f35c01 100644 --- a/spec/ios_git_helper_spec.rb +++ b/spec/ios_git_helper_spec.rb @@ -8,14 +8,14 @@ ENV[key] = nil expect(FastlaneCore::UI).to receive(:user_error!) - described_class.get_from_env!(key:) + described_class.get_from_env!(key: key) end it 'returns the value when in the environment' do ENV[key] = 'abc123' expect(FastlaneCore::UI).not_to receive(:user_error!) - expect(described_class.get_from_env!(key:)).to eq('abc123') + expect(described_class.get_from_env!(key: key)).to eq('abc123') end end end diff --git a/spec/ios_l10n_helper_spec.rb b/spec/ios_l10n_helper_spec.rb index a6cdebf9b..997f7a3fc 100644 --- a/spec/ios_l10n_helper_spec.rb +++ b/spec/ios_l10n_helper_spec.rb @@ -50,7 +50,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') - described_class.merge_strings(paths:, output_path: output_file) + described_class.merge_strings(paths: paths, output_path: output_file) expect(File.read(output_file)).to eq(File.read(fixture('expected-merged.strings'))) expect(file_encoding(output_file)).to eq(Encoding::UTF_8) end @@ -62,7 +62,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| paths.each { |f| FileUtils.cp(f, tmp_dir) } paths = paths.to_h { |f| [File.join(tmp_dir, File.basename(f)), nil] } - described_class.merge_strings(paths:, output_path: paths.keys.first) + described_class.merge_strings(paths: paths, output_path: paths.keys.first) expect(File.read(paths.keys.first)).to eq(File.read(fixture('expected-merged.strings'))) end end @@ -82,7 +82,7 @@ def file_encoding(path) } Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') - duplicates = described_class.merge_strings(paths:, output_path: output_file) + duplicates = described_class.merge_strings(paths: paths, output_path: output_file) expect(File.read(output_file)).to eq(File.read(fixture('expected-merged-prefixed.strings'))) # We should also not find duplicates anymore, given that `key1` and `key2` (duplicates from `Localizable-utf16.strings` # and `non-latin-utf16.strings` files) will now be prefixed differently, and thus made different during merge @@ -94,7 +94,7 @@ def file_encoding(path) paths = { fixture('Localizable-utf16.strings') => nil, fixture('non-latin-utf16.strings') => nil } Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') - duplicates = described_class.merge_strings(paths:, output_path: output_file) + duplicates = described_class.merge_strings(paths: paths, output_path: output_file) expect(duplicates).to eq(%w[key1 key2]) end end @@ -104,7 +104,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') expect do - described_class.merge_strings(paths:, output_path: output_file) + described_class.merge_strings(paths: paths, output_path: output_file) end.to raise_exception(RuntimeError, "The file `#{paths.keys[1]}` is in xml format but we currently only support merging `.strings` files in text format.") end end @@ -114,7 +114,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') expect do - described_class.merge_strings(paths:, output_path: output_file) + described_class.merge_strings(paths: paths, output_path: output_file) end.to raise_exception(RuntimeError, "The file `#{paths.keys[1]}` does not exist or is of unknown format.") end end @@ -178,7 +178,7 @@ def file_encoding(path) Dir.mktmpdir('a8c-release-toolkit-l10n-helper-tests-') do |tmp_dir| output_file = File.join(tmp_dir, 'output.strings') # 3. Generate XML strings file from the filtered hash - described_class.generate_strings_file_from_hash(translations:, output_path: output_file) + described_class.generate_strings_file_from_hash(translations: translations, output_path: output_file) expect(File.read(output_file)).to eq(File.read(expected_file)) end end @@ -242,7 +242,7 @@ def file_encoding(path) # Note: in practice it seems that GlotPress's `.strings` exports are using UTF-8 (but served as `application/octet-stream`) # but it does not hurt to ensure the download to a file can work with UTF-16 (and copy the binary stream verbatim) body = File.read(fixture('Localizable-utf16.strings')) - stub = stub_request(:get, "#{gp_fake_url}/fr/default/export-translations/").with(query: { format: 'strings' }).to_return(body:) + stub = stub_request(:get, "#{gp_fake_url}/fr/default/export-translations/").with(query: { format: 'strings' }).to_return(body: body) dest = File.join(tmp_dir, 'export.strings') # Act described_class.download_glotpress_export_file(project_url: gp_fake_url, locale: 'fr', filters: nil, destination: dest) diff --git a/spec/ios_send_app_size_metrics_spec.rb b/spec/ios_send_app_size_metrics_spec.rb index 4de1fbd9c..0fb1389b4 100644 --- a/spec/ios_send_app_size_metrics_spec.rb +++ b/spec/ios_send_app_size_metrics_spec.rb @@ -15,7 +15,7 @@ def test_app_size_action(fake_ipa_size:, expected_payload:, **other_action_args) # Act code = run_described_fastlane_action( api_url: File.join('file://localhost/', output_file), - ipa_path:, + ipa_path: ipa_path, **other_action_args ) @@ -89,9 +89,9 @@ def test_app_size_action(fake_ipa_size:, expected_payload:, **other_action_args) expected = JSON.parse(File.read(expected_fixture)) test_app_size_action( - fake_ipa_size:, + fake_ipa_size: fake_ipa_size, expected_payload: expected, - app_thinning_plist_path:, + app_thinning_plist_path: app_thinning_plist_path, app_name: 'wordpress', build_type: 'internal', app_version: '19.8.0.2', diff --git a/spec/prototype_build_details_comment_action_spec.rb b/spec/prototype_build_details_comment_action_spec.rb index 23d9f8cc4..9c74a9e09 100644 --- a/spec/prototype_build_details_comment_action_spec.rb +++ b/spec/prototype_build_details_comment_action_spec.rb @@ -132,7 +132,7 @@ app_center_org_name: 'My-Org', app_center_app_name: 'My-App', app_center_release_id: '1337', - metadata: + metadata: metadata ) expect(comment).to include 'App Name My App' expect(comment).to include 'Version:Short28.1' @@ -168,7 +168,7 @@ app_center_org_name: 'BestOrg', app_center_app_name: 'BestApp', app_center_release_id: '8888', - metadata:, + metadata: metadata, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -201,7 +201,7 @@ app_center_app_name: 'BestApp', app_center_release_id: '8888', download_url: 'https://bestfront.cloudfront.net/feed42/bestapp-pr1357-a1b2c3f.apk', - metadata: + metadata: metadata ) expect(comment).to eq <<~EXPECTED_COMMENT @@ -235,7 +235,7 @@ app_center_app_name: 'BestApp', app_center_release_id: '1234', fold: true, - metadata:, + metadata: metadata, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -309,7 +309,7 @@ comment = run_described_fastlane_action( app_display_name: 'My App', app_center_org_name: 'My-Org', - metadata: + metadata: metadata ) expect(comment).to include 'Version42.3' # explicitly provided, overriding the implicit value expect(comment).not_to include 'Version28.7' # otherwise implicitly added if it were not overridden @@ -378,7 +378,7 @@ comment = run_described_fastlane_action( app_display_name: 'The Best App', app_center_org_name: 'BestOrg', - metadata:, + metadata: metadata, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -434,7 +434,7 @@ app_display_name: 'The Best App', app_center_org_name: 'BestOrg', fold: true, - metadata:, + metadata: metadata, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -514,7 +514,7 @@ comment = run_described_fastlane_action( app_display_name: 'The Best App', download_url: 'https://bestfront.cloudfront.net/feed42/bestapp-pr1357-a1b2c3f.apk', - metadata:, + metadata: metadata, footnote: 'Note: Google Sign-In in not available in those builds' ) @@ -547,7 +547,7 @@ app_display_name: 'The Best App', download_url: 'https://bestfront.cloudfront.net/feed42/bestapp-pr1357-a1b2c3f.apk', fold: true, - metadata:, + metadata: metadata, footnote: 'Note: Google Sign-In in not available in those builds' ) diff --git a/spec/remove_branch_protection_action_spec.rb b/spec/remove_branch_protection_action_spec.rb index 5f4791921..06254a599 100644 --- a/spec/remove_branch_protection_action_spec.rb +++ b/spec/remove_branch_protection_action_spec.rb @@ -22,8 +22,8 @@ run_described_fastlane_action( repository: repo, - branch:, - github_token: + branch: branch, + github_token: github_token ) end @@ -36,8 +36,8 @@ run_described_fastlane_action( repository: repo, - branch:, - github_token: + branch: branch, + github_token: github_token ) end @@ -48,8 +48,8 @@ expect do run_described_fastlane_action( repository: repo, - branch:, - github_token: + branch: branch, + github_token: github_token ) end.to raise_error FastlaneCore::Interface::FastlaneError, "Branch `#{branch}` of repository `#{repo}` was not found." end diff --git a/spec/set_branch_protection_action_spec.rb b/spec/set_branch_protection_action_spec.rb index a9abef9a9..835377ab5 100644 --- a/spec/set_branch_protection_action_spec.rb +++ b/spec/set_branch_protection_action_spec.rb @@ -31,15 +31,15 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: + restrictions: restrictions } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch:, - github_token:, + branch: branch, + github_token: github_token, **additional_options ) end @@ -52,16 +52,16 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: + restrictions: restrictions } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, required_ci_checks: [], - github_token:, + github_token: github_token, **additional_options ) end @@ -81,16 +81,16 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: + restrictions: restrictions } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, required_ci_checks: %w[check1 check2 check3], - github_token:, + github_token: github_token, **additional_options ) end @@ -103,16 +103,16 @@ def fixture(file) require_code_owner_reviews: false, required_approving_review_count: 3 }, - restrictions: + restrictions: restrictions } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, required_approving_review_count: 3, - github_token:, + github_token: github_token, **additional_options ) end @@ -124,16 +124,16 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions: + restrictions: restrictions } expect(client).to receive(:protect_branch).with(repo, branch, expected_options) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, enforce_admins: true, - github_token:, + github_token: github_token, **additional_options ) end @@ -145,7 +145,7 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions:, + restrictions: restrictions, allow_force_pushes: true } @@ -153,9 +153,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, allow_force_pushes: true, - github_token:, + github_token: github_token, **additional_options ) end @@ -167,7 +167,7 @@ def fixture(file) dismiss_stale_reviews: false, require_code_owner_reviews: false }, - restrictions:, + restrictions: restrictions, lock_branch: true } @@ -175,9 +175,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, lock_branch: true, - github_token:, + github_token: github_token, **additional_options ) end @@ -241,8 +241,8 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch:, - github_token: + branch: branch, + github_token: github_token ) end @@ -254,9 +254,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, required_ci_checks: [], - github_token: + github_token: github_token ) end @@ -272,9 +272,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, required_ci_checks: %w[new/check1 new/check2 new/check3], - github_token: + github_token: github_token ) end @@ -287,9 +287,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, required_approving_review_count: 3, - github_token: + github_token: github_token ) end @@ -302,9 +302,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, enforce_admins: false, - github_token: + github_token: github_token ) end @@ -317,9 +317,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, allow_force_pushes: false, - github_token: + github_token: github_token ) end @@ -332,9 +332,9 @@ def fixture(file) run_described_fastlane_action( repository: repo, - branch:, + branch: branch, lock_branch: false, - github_token: + github_token: github_token ) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 97193de2a..d21849441 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -54,7 +54,7 @@ def allow_fastlane_action_sh def expect_shell_command(*, exitstatus: 0, output: '') mock_input = double(:input) mock_output = StringIO.new(output) - mock_status = double(:status, exitstatus:) + mock_status = double(:status, exitstatus: exitstatus) mock_thread = double(:thread, value: mock_status) expect(Open3).to receive(:popen2e).with(*).and_yield(mock_input, mock_output, mock_thread) diff --git a/spec/upload_to_s3_spec.rb b/spec/upload_to_s3_spec.rb index bc1a6c53a..733a19ce1 100644 --- a/spec/upload_to_s3_spec.rb +++ b/spec/upload_to_s3_spec.rb @@ -12,8 +12,8 @@ def stub_s3_response_for_file(key, exists: true) content_length = exists == true ? 1 : 0 allow(client).to(receive(:head_object)) - .with(bucket: test_bucket, key:) - .and_return(Aws::S3::Types::HeadObjectOutput.new(content_length:)) + .with(bucket: test_bucket, key: key) + .and_return(Aws::S3::Types::HeadObjectOutput.new(content_length: content_length)) end describe 'uploading a file with valid parameters' do @@ -308,8 +308,8 @@ def stub_s3_response_for_file(key, exists: true) bucket: test_bucket, key: 'existing-key', file: file_path, - if_exists:, - skip_if_exists: + if_exists: if_exists, + skip_if_exists: skip_if_exists ) end.to raise_error(FastlaneCore::Interface::FastlaneError, 'You cannot set both :skip_if_exists and :if_exists. Please only use :if_exists.') end From 28da7be6f8caf76637af8395c0e8f374dcce220f Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 1 Feb 2024 17:31:05 +0100 Subject: [PATCH 12/20] Run rubocop -a after rebase --- .../wpmreleasetoolkit/helper/configure_helper.rb | 2 +- .../plugin/wpmreleasetoolkit/models/configuration.rb | 10 +++++----- .../plugin/wpmreleasetoolkit/models/file_reference.rb | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb index 434226d9a..ee43e8958 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb @@ -193,7 +193,7 @@ def self.file_dependencies end end - self.files_to_copy.map { |o| o.file } + expanded_file_dependencies + files_to_copy.map { |o| o.file } + expanded_file_dependencies end ## If we specify a directory in `file_dependencies` instead of listing each file diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb b/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb index ffad9e077..bbc41670b 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb @@ -29,11 +29,11 @@ def add_file_to_copy(source, destination, encrypt: false) def to_hash { - project_name: self.project_name, - branch: self.branch, - pinned_hash: self.pinned_hash, - files_to_copy: self.files_to_copy.map { |f| f.to_hash }, - file_dependencies: self.file_dependencies + project_name: project_name, + branch: branch, + pinned_hash: pinned_hash, + files_to_copy: files_to_copy.map { |f| f.to_hash }, + file_dependencies: file_dependencies } end end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb b/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb index 78b9ddf39..9874a183d 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb @@ -74,7 +74,7 @@ def encryption_key end def to_hash - { file: self.file, destination: self.destination, encrypt: self.encrypt } + { file: file, destination: destination, encrypt: encrypt } end end end From da39684086e99326ee77905dab7aba2d407d6a95 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 1 Feb 2024 17:31:22 +0100 Subject: [PATCH 13/20] Run Rubocop -A after rebase --- .../plugin/wpmreleasetoolkit/helper/configure_helper.rb | 2 +- lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb b/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb index ee43e8958..1fbd66406 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb @@ -193,7 +193,7 @@ def self.file_dependencies end end - files_to_copy.map { |o| o.file } + expanded_file_dependencies + files_to_copy.map(&:file) + expanded_file_dependencies end ## If we specify a directory in `file_dependencies` instead of listing each file diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb b/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb index bbc41670b..c1bc33124 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb @@ -32,7 +32,7 @@ def to_hash project_name: project_name, branch: branch, pinned_hash: pinned_hash, - files_to_copy: files_to_copy.map { |f| f.to_hash }, + files_to_copy: files_to_copy.map(&:to_hash), file_dependencies: file_dependencies } end From 8b8401e3abd6c59899485fb4e9f05439c42696bc Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 7 Feb 2024 18:42:58 +0100 Subject: [PATCH 14/20] Update danger version and setup --- .buildkite/commands/danger-pr-check.sh | 7 ---- .buildkite/pipeline.yml | 22 ----------- .github/workflows/run-danger.yml | 11 ++++++ Dangerfile | 32 ++++++---------- Gemfile.lock | 51 +++++++++++++------------- 5 files changed, 48 insertions(+), 75 deletions(-) delete mode 100755 .buildkite/commands/danger-pr-check.sh create mode 100644 .github/workflows/run-danger.yml diff --git a/.buildkite/commands/danger-pr-check.sh b/.buildkite/commands/danger-pr-check.sh deleted file mode 100755 index 0ad81cfed..000000000 --- a/.buildkite/commands/danger-pr-check.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -eu - -echo "--- :rubygems: Setting up Gems" -bundle install - -echo "--- Running Danger: PR Check" -bundle exec danger --fail-on-errors=true --remove-previous-comments --danger_id=pr-check diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 8f07d3576..65705ebd2 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -13,13 +13,6 @@ common_params: propagate-environment: true environment: - "RUBYGEMS_API_KEY" - - &docker_plugin_with_danger_token - docker#v5.8.0: - image: *ruby_version - propagate-environment: true - environment: - - "DANGER_GITHUB_API_TOKEN" - steps: ################# @@ -55,20 +48,6 @@ steps: ruby: - 3.2.2 - ################# - # Danger - ################# - - label: "☢️ Danger - PR Check" - key: danger - command: .buildkite/commands/danger-pr-check.sh - plugins: [*docker_plugin_with_danger_token] - agents: - queue: "default" - retry: - manual: - permit_on_passed: true - if: "build.pull_request.id != null" - ################# # Push to RubyGems ################# @@ -78,7 +57,6 @@ steps: depends_on: - test - rubocop - - danger # Note: We intentionally call a separate `.sh` script here (as opposed to having all the # commands written inline) to avoid leaking a key used in the process in clear in the # BUILDKITE_COMMAND environment variable. diff --git a/.github/workflows/run-danger.yml b/.github/workflows/run-danger.yml new file mode 100644 index 000000000..d61c24218 --- /dev/null +++ b/.github/workflows/run-danger.yml @@ -0,0 +1,11 @@ +name: ☢️ Danger + +on: + pull_request: + types: [opened, synchronize, edited, review_requested, review_request_removed, labeled, unlabeled, milestoned, demilestoned] + +jobs: + dangermattic: + uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@trunk + secrets: + github-token: ${{ secrets.DANGERMATTIC_GITHUB_TOKEN }} diff --git a/Dangerfile b/Dangerfile index a86d1754b..491cda327 100644 --- a/Dangerfile +++ b/Dangerfile @@ -12,23 +12,18 @@ def gemfile_lock_version gemfile_lock.scan(/fastlane-plugin-wpmreleasetoolkit \((\d+.\d+.\d+)\)/).last.first end -# these are reviewers actively providing feedback and potentially changing the state of the PR (approved, changes-requested) -def active_reviewers? - repo_name = github.pr_json['base']['repo']['full_name'] - pr_number = github.pr_json['number'] +github.dismiss_out_of_range_messages - !github.api.pull_request_reviews(repo_name, pr_number).empty? -end +# `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) -# requested_teams / requested_reviewers are users initially requested to review a PR, who haven't reacted yet -def requested_reviewers? - has_requested_reviews = !github.pr_json['requested_teams'].to_a.empty? || !github.pr_json['requested_reviewers'].to_a.empty? - has_requested_reviews || active_reviewers? -end - -return if github.pr_labels.include?('Releases') +manifest_pr_checker.check_gemfile_lock_updated -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 # Before checking the version, get rid of any change that `bundle install` # might have done. @@ -51,17 +46,14 @@ unless git.modified_files.include?('CHANGELOG.md') warn 'Please add an entry in the CHANGELOG.md file to describe the changes made by this PR' end -manifest_pr_checker.check_gemfile_lock_updated - labels_checker.check( + do_not_merge_labels: ['Do Not Merge'], required_labels: [//], required_labels_error: 'PR requires at least one label.' ) -pr_size_checker.check_diff_size +pr_size_checker.check_diff_size(max_size: 500) milestone_checker.check_milestone_due_date(days_before_due: 5) -rubocop.lint(inline_comment: true, fail_on_inline_comment: true, include_cop_names: true) - -warn("No reviewers have been set for this PR yet. Please request a review from **@\u2028wordpress-mobile/apps-infrastructure**.") unless requested_reviewers? +warn("No reviewers have been set for this PR yet. Please request a review from **@\u2060wordpress-mobile/apps-infrastructure**.") unless github_utils.requested_reviewers? || github.pr_draft? diff --git a/Gemfile.lock b/Gemfile.lock index d95ae57e4..8bb1af70e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,15 +1,15 @@ GIT remote: https://github.com/Automattic/dangermattic - revision: 451932e8870ef3c52de0d8bea80edcfa3d879e53 + revision: 16456c92c298a795d9dab86fb20b62ae0c6436c4 specs: danger-dangermattic (0.0.1) - danger (~> 9.3) + danger (~> 9.4) danger-junit (~> 1.0) danger-plugin-api (~> 1.0) - danger-rubocop (~> 0.11) - danger-swiftlint (~> 0.29) + danger-rubocop (~> 0.12) + danger-swiftlint (~> 0.35) danger-xcode_summary (~> 1.0) - rubocop (~> 1.56) + rubocop (~> 1.60) PATH remote: . @@ -47,7 +47,7 @@ GEM minitest (>= 5.1) mutex_m tzinfo (~> 2.0) - addressable (2.8.5) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) @@ -72,7 +72,7 @@ GEM aws-sigv4 (1.6.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) - base64 (0.1.1) + base64 (0.2.0) bigdecimal (3.1.4) buildkit (1.5.0) sawyer (>= 0.6) @@ -134,7 +134,7 @@ GEM colored2 (~> 3.1) crack (0.4.5) rexml - danger (9.3.2) + danger (9.4.3) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) @@ -145,7 +145,7 @@ GEM kramdown (~> 2.3) kramdown-parser-gfm (~> 1.0) no_proxy_fix - octokit (~> 6.0) + octokit (>= 4.0) terminal-table (>= 1, < 4) danger-junit (1.0.2) danger (> 2.0) @@ -155,10 +155,10 @@ GEM danger-rubocop (0.12.0) danger rubocop (~> 1.0) - danger-swiftlint (0.33.0) + danger-swiftlint (0.35.0) danger rake (> 10) - thor (~> 0.19) + thor (~> 1.0.0) danger-xcode_summary (1.2.0) danger-plugin-api (~> 1.0) xcresult (~> 0.2) @@ -196,7 +196,7 @@ GEM faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) - faraday-http-cache (2.5.0) + faraday-http-cache (2.5.1) faraday (>= 0.8) faraday-httpclient (1.0.1) faraday-multipart (1.0.4) @@ -253,7 +253,7 @@ GEM fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - git (1.18.0) + git (1.19.1) addressable (~> 2.8) rchardet (~> 1.8) google-apis-androidpublisher_v3 (0.50.0) @@ -302,7 +302,7 @@ GEM concurrent-ruby (~> 1.0) java-properties (0.3.0) jmespath (1.6.2) - json (2.6.3) + json (2.7.1) jwt (2.7.1) kramdown (2.4.0) rexml @@ -316,7 +316,7 @@ GEM minitest (5.20.0) molinillo (0.8.0) multi_json (1.15.0) - multipart-post (2.3.0) + multipart-post (2.4.0) mutex_m (0.1.2) nanaimo (0.3.0) nap (1.1.0) @@ -334,8 +334,8 @@ GEM optparse (0.1.1) os (1.1.4) ox (2.14.17) - parallel (1.23.0) - parser (3.2.2.4) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) racc plist (3.7.0) @@ -346,13 +346,13 @@ GEM coderay (~> 1.1.0) method_source (~> 0.9.0) public_suffix (4.0.7) - racc (1.7.1) + racc (1.7.3) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rake-compiler (1.2.5) rake rchardet (1.8.0) - regexp_parser (2.8.2) + regexp_parser (2.9.0) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -376,19 +376,18 @@ GEM rspec-support (3.12.1) rspec_junit_formatter (0.4.1) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.57.1) - base64 (~> 0.1.1) + rubocop (1.60.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.4) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) rubocop-require_tools (0.1.2) rubocop (>= 0.49.1) @@ -419,7 +418,7 @@ GEM terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (0.20.3) + thor (1.0.1) trailblazer-option (0.1.2) tty-cursor (0.7.1) tty-screen (0.8.1) From ac0ecb5fbe41a37d84e09270dead234d5f86afd1 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 7 Feb 2024 18:44:35 +0100 Subject: [PATCH 15/20] Run latest RuboCop version --- .rubocop_todo.yml | 10 +++++----- .../actions/ios/ios_extract_keys_from_strings_files.rb | 2 +- .../actions/ios/ios_send_app_size_metrics.rb | 2 +- .../actions/ios/ios_update_metadata_source.rb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index fed1b0906..4f2be7855 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-11-08 13:49:19 UTC using RuboCop version 1.57.1. +# on 2024-02-07 17:44:01 UTC using RuboCop version 1.60.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -34,7 +34,7 @@ Naming/MethodParameterName: - 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb' - 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb' -# Offense count: 109 +# Offense count: 110 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. # NamePrefix: is_, has_, have_ # ForbiddenPrefixes: is_, has_, have_ @@ -60,7 +60,7 @@ RSpec/ContextWording: - 'spec/git_helper_spec.rb' - 'spec/ios_lint_localizations_spec.rb' -# Offense count: 61 +# Offense count: 62 # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. # Include: **/*_spec*rb*, **/spec/**/* RSpec/FilePath: @@ -73,7 +73,7 @@ RSpec/InstanceVariable: - 'spec/git_helper_spec.rb' - 'spec/ios_lint_localizations_spec.rb' -# Offense count: 109 +# Offense count: 122 # Configuration parameters: . # SupportedStyles: have_received, receive RSpec/MessageSpies: @@ -116,7 +116,7 @@ Security/Open: - 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb' - 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb' -# Offense count: 123 +# Offense count: 124 # Configuration parameters: AllowedConstants. Style/Documentation: Enabled: false diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_extract_keys_from_strings_files.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_extract_keys_from_strings_files.rb index 64c24a2f4..411c8a54a 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_extract_keys_from_strings_files.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_extract_keys_from_strings_files.rb @@ -108,7 +108,7 @@ def self.available_options type: Hash, verify_block: proc do |values| UI.user_error!('`target_original_files` must contain at least one path to an original `.strings` file.') if values.empty? - values.each do |path, _| + values.each_key do |path| UI.user_error!("Path `#{path}` (found in `target_original_files`) does not exist.") unless File.exist?(path) UI.user_error! "Expected `#{path}` (found in `target_original_files`) to be a path ending in a `*.lproj/*.strings`." unless File.extname(path) == '.strings' && File.extname(File.dirname(path)) == '.lproj' end diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb index dd891108a..303a60098 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb @@ -31,7 +31,7 @@ def self.run(params) app_thinning_plist_path = params[:app_thinning_plist_path] || File.join(File.dirname(params[:ipa_path]), 'app-thinning.plist') if File.exist?(app_thinning_plist_path) plist = Plist.parse_xml(app_thinning_plist_path) - plist['variants'].each do |_key, variant| + plist['variants'].each_value do |variant| variant_descriptors = variant['variantDescriptors'] || [{ 'device' => 'Universal' }] variant_descriptors.each do |desc| variant_metadata = { device: desc['device'], 'OS Version': desc['os-version'] } diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb index d86b2e889..36096f34d 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb @@ -10,7 +10,7 @@ def self.run(params) release_version: params[:release_version]) Action.sh("git add #{params[:po_file_path]}") - params[:source_files].each do |_key, file| + params[:source_files].each_value do |file| Action.sh("git add #{file}") end From d2e1f6ec5fc203ab29916618dacc7677d61f2669 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 7 Feb 2024 20:39:58 +0100 Subject: [PATCH 16/20] Fix Ruby 3 migration version --- MIGRATION.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index 3450db15f..b3e72f6f4 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,11 +1,8 @@ # Migration Instructions for Major Releases -## From `10.0.0` to `11.0.0` - - - The new minimum required Ruby version is `3.2.2`. Please make sure to upgrade your projects before upgrading to this version to avoid compatibility issues. - ## From `9.0.0` to `10.0.0` + - The new minimum required Ruby version is `3.2.2`. Please make sure to upgrade your projects before upgrading to this version to avoid compatibility issues. - Action `addbranchprotection` has been renamed `set_branch_protection`. Besides, you might want to use the new `copy_branch_protection(from_branch: to_branch:)` instead (especially for protecting the `release/*` branch after code-freeze). - Action `removebranchprotection` has been renamed `remove_branch_protection`. From 42d0f9442d5d83690395a1051e1d1dcc79c805ec Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 8 Feb 2024 15:16:49 +0100 Subject: [PATCH 17/20] Use published Dangermattic Gem --- Gemfile | 2 +- Gemfile.lock | 23 +++++++++-------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index 5e4633a59..679bb9223 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,6 @@ gemspec gem 'buildkite-test_collector', '~> 2.3' gem 'codecov', require: false -gem 'danger-dangermattic', git: 'https://github.com/Automattic/dangermattic' +gem 'danger-dangermattic', '~> 1.0' gem 'webmock', require: false gem 'yard' diff --git a/Gemfile.lock b/Gemfile.lock index 8bb1af70e..858b5a8b0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,16 +1,3 @@ -GIT - remote: https://github.com/Automattic/dangermattic - revision: 16456c92c298a795d9dab86fb20b62ae0c6436c4 - specs: - danger-dangermattic (0.0.1) - danger (~> 9.4) - danger-junit (~> 1.0) - danger-plugin-api (~> 1.0) - danger-rubocop (~> 0.12) - danger-swiftlint (~> 0.35) - danger-xcode_summary (~> 1.0) - rubocop (~> 1.60) - PATH remote: . specs: @@ -147,6 +134,14 @@ GEM no_proxy_fix octokit (>= 4.0) terminal-table (>= 1, < 4) + danger-dangermattic (1.0.0) + danger (~> 9.4) + danger-junit (~> 1.0) + danger-plugin-api (~> 1.0) + danger-rubocop (~> 0.12) + danger-swiftlint (~> 0.35) + danger-xcode_summary (~> 1.0) + rubocop (~> 1.60) danger-junit (1.0.2) danger (> 2.0) ox (~> 2.0) @@ -461,7 +456,7 @@ DEPENDENCIES bundler (~> 2.0) cocoapods (~> 1.10) codecov - danger-dangermattic! + danger-dangermattic (~> 1.0) fastlane (~> 2.210) fastlane-plugin-wpmreleasetoolkit! pry (~> 0.12.2) From 7b87bae3e54a166540cba0c2b1dfb920bf6fac1d Mon Sep 17 00:00:00 2001 From: Ian Guedes Maia Date: Thu, 8 Feb 2024 19:18:24 +0100 Subject: [PATCH 18/20] Update .buildkite/pipeline.yml Co-authored-by: Olivier Halligon --- .buildkite/pipeline.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 65705ebd2..f7d9d6642 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -56,7 +56,6 @@ steps: if: build.tag != null depends_on: - test - - rubocop # Note: We intentionally call a separate `.sh` script here (as opposed to having all the # commands written inline) to avoid leaking a key used in the process in clear in the # BUILDKITE_COMMAND environment variable. From f25551402735a77d73db3b73e38351bec4f37f0b Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 12 Feb 2024 17:58:21 +0100 Subject: [PATCH 19/20] Remove unnecessary statement --- Dangerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dangerfile b/Dangerfile index 491cda327..ec5cc8d88 100644 --- a/Dangerfile +++ b/Dangerfile @@ -25,10 +25,6 @@ if github.pr_labels.include?('Releases') return end -# Before checking the version, get rid of any change that `bundle install` -# might have done. -`git checkout Gemfile.lock &> /dev/null` - if version.to_s != gemfile_lock_version.to_s message = <<~MESSAGE The version in the `Gemfile.lock` (`#{gemfile_lock_version}`) doesn't match the one in `version.rb` (`#{version}`). From e6edae52e6c69e2a1a02d2171c47f7fd4014ceea Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Tue, 13 Feb 2024 18:05:26 +0100 Subject: [PATCH 20/20] Add Dangerfile improvements from other PRs --- .github/workflows/run-danger.yml | 6 ++++-- Dangerfile | 14 ++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run-danger.yml b/.github/workflows/run-danger.yml index d61c24218..85d1675d0 100644 --- a/.github/workflows/run-danger.yml +++ b/.github/workflows/run-danger.yml @@ -2,10 +2,12 @@ name: ☢️ Danger on: pull_request: - types: [opened, synchronize, edited, review_requested, review_request_removed, labeled, unlabeled, milestoned, demilestoned] + types: [opened, reopened, ready_for_review, synchronize, edited, review_requested, review_request_removed, labeled, unlabeled, milestoned, demilestoned] jobs: dangermattic: - uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@trunk + # runs on draft PRs only for opened / synchronize events + if: ${{ (github.event.pull_request.draft == false) || (github.event.pull_request.draft == true && contains(fromJSON('["opened", "synchronize"]'), github.event.action)) }} + uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@v1.0.0 secrets: github-token: ${{ secrets.DANGERMATTIC_GITHUB_TOKEN }} diff --git a/Dangerfile b/Dangerfile index ec5cc8d88..ec646a641 100644 --- a/Dangerfile +++ b/Dangerfile @@ -19,7 +19,7 @@ rubocop.lint(files: [], force_exclusion: true, inline_comment: true, fail_on_inl manifest_pr_checker.check_gemfile_lock_updated -# skip remaining checks if we're during the release process +# 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 @@ -42,14 +42,20 @@ unless git.modified_files.include?('CHANGELOG.md') warn 'Please add an entry in the CHANGELOG.md file to describe the changes made by this PR' end +pr_size_checker.check_diff_size(max_size: 500) + +# 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: ['Do Not Merge'], required_labels: [//], required_labels_error: 'PR requires at least one label.' ) -pr_size_checker.check_diff_size(max_size: 500) - milestone_checker.check_milestone_due_date(days_before_due: 5) -warn("No reviewers have been set for this PR yet. Please request a review from **@\u2060wordpress-mobile/apps-infrastructure**.") unless github_utils.requested_reviewers? || github.pr_draft? +warn("No reviewers have been set for this PR yet. Please request a review from **@\u2060wordpress-mobile/apps-infrastructure**.") unless github_utils.requested_reviewers?