From 7458f0686c0099fc690baec488e18f45e6745513 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 30 Oct 2023 15:55:07 +0100 Subject: [PATCH] Update Rubocop config to not allow Ruby 3.1 hash and arguments values omission --- .rubocop.yml | 3 +++ fastlane/helpers/github.rb | 2 +- fastlane/lanes/build.rb | 24 ++++++++++++------------ fastlane/lanes/localization.rb | 12 ++++++------ fastlane/lanes/screenshots.rb | 18 +++++++++--------- 5 files changed, 31 insertions(+), 28 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 4734900957c6..4aa15c60b2a4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -19,3 +19,6 @@ Layout/LineLength: Lint/ConstantDefinitionInBlock: Exclude: - fastlane/lanes/localization.rb + +Style/HashSyntax: + EnforcedShorthandSyntax: never diff --git a/fastlane/helpers/github.rb b/fastlane/helpers/github.rb index 3dbe499dc3b4..cfcd94acd96e 100644 --- a/fastlane/helpers/github.rb +++ b/fastlane/helpers/github.rb @@ -4,7 +4,7 @@ def create_release_management_pull_request(base_branch, title) create_pull_request( api_token: ENV.fetch('GITHUB_TOKEN', nil), repo: GHHELPER_REPO, - title:, + title: title, head: Fastlane::Helper::GitHelper.current_git_branch, base: base_branch, labels: 'Releases' diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index 5bd122eeda5e..3c1122ac5e51 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -34,11 +34,11 @@ # Create the file names app = get_app_name_option!(options) version_name = current_version_name - build_bundle(app:, version_name:, build_code: current_build_code, flavor: 'Vanilla', buildType: 'Release') + build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: 'Vanilla', buildType: 'Release') - upload_build_to_play_store(app:, version_name:, track: 'production') + upload_build_to_play_store(app: app, version_name: version_name, track: 'production') - create_gh_release(app:, version_name:) if options[:create_release] + create_gh_release(app: app, version_name: version_name) if options[:create_release] end ##################################################################################### @@ -69,7 +69,7 @@ end app = get_app_name_option!(options) - build_beta(app:, skip_prechecks: true, skip_confirm: options[:skip_confirm], upload_to_play_store: true, create_release: options[:create_release]) + build_beta(app: app, skip_prechecks: true, skip_confirm: options[:skip_confirm], upload_to_play_store: true, create_release: options[:create_release]) end ##################################################################################### @@ -102,11 +102,11 @@ # Create the file names app = get_app_name_option!(options) version_name = current_version_name - build_bundle(app:, version_name:, build_code: current_build_code, flavor: 'Vanilla', buildType: 'Release') + build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: 'Vanilla', buildType: 'Release') - upload_build_to_play_store(app:, version_name:, track: 'beta') if options[:upload_to_play_store] + upload_build_to_play_store(app: app, version_name: version_name, track: 'beta') if options[:upload_to_play_store] - create_gh_release(app:, version_name:, prerelease: true) if options[:create_release] + create_gh_release(app: app, version_name: version_name, prerelease: true) if options[:create_release] end ##################################################################################### @@ -140,7 +140,7 @@ retry_count = 2 begin upload_to_play_store( - package_name:, + package_name: package_name, aab: aab_file_path, track: options[:track], release_status: 'draft', @@ -188,7 +188,7 @@ package_name = APP_SPECIFIC_VALUES[app.to_sym][:package_name] download_universal_apk_from_google_play( - package_name:, + package_name: package_name, version_code: build_code, destination: signed_apk_path(app, current_version_name), json_key: UPLOAD_TO_PLAY_STORE_JSON_KEY @@ -216,7 +216,7 @@ properties: { prototypeBuildVersionName: version_name } ) - upload_prototype_build(product: 'WordPress', version_name:) + upload_prototype_build(product: 'WordPress', version_name: version_name) end ##################################################################################### @@ -239,7 +239,7 @@ properties: { prototypeBuildVersionName: version_name } ) - upload_prototype_build(product: 'Jetpack', version_name:) + upload_prototype_build(product: 'Jetpack', version_name: version_name) end ##################################################################################### @@ -339,7 +339,7 @@ def upload_prototype_build(product:, version_name:) return unless ENV['BUILDKITE'] message = "#{product} Prototype Build: [#{filename}](#{install_url})" - buildkite_annotate(style: 'info', context: "prototype-build-#{product}", message:) + buildkite_annotate(style: 'info', context: "prototype-build-#{product}", message: message) buildkite_metadata(set: { versionName: version_name, 'build:flavor': PROTOTYPE_BUILD_FLAVOR, 'build:type': PROTOTYPE_BUILD_TYPE }) end diff --git a/fastlane/lanes/localization.rb b/fastlane/lanes/localization.rb index ddb989213315..fffe98fc7830 100644 --- a/fastlane/lanes/localization.rb +++ b/fastlane/lanes/localization.rb @@ -149,7 +149,7 @@ metadata_dir = File.join(FASTLANE_FOLDER, APP_SPECIFIC_VALUES[app.to_sym][:metadata_dir], 'android') upload_to_play_store( - package_name:, + package_name: package_name, track: 'production', version_code: current_build_code, # Apparently required by fastlane… even if the "Main Store Listing" isn't be attached to a specific build ¯\_(ツ)_/¯ metadata_path: metadata_dir, @@ -196,7 +196,7 @@ play_store_desc: { desc: 'full_description.txt', max_size: 4000 } } unless skip_release_notes - delete_old_changelogs(app:, build: build_number) + delete_old_changelogs(app: app, build: build_number) version_suffix = version.split('.').join files["release_note_#{version_suffix}"] = { desc: "changelogs/#{build_number}.txt", max_size: 500, alternate_key: "release_note_short_#{version_suffix}" } end @@ -212,8 +212,8 @@ gp_downloadmetadata( project_url: app_values[:glotpress_metadata_project], target_files: files, - locales:, - download_path: + locales: locales, + download_path: download_path ) # Copy the source `.txt` files (used as source of truth when we generated the `.po`) to the `fastlane/*metadata/android/en-US` dir, @@ -228,7 +228,7 @@ git_add(path: download_path) message = "Update #{app_values[:display_name]} metadata translations" message += " for #{version}" unless version.nil? - git_commit(path: download_path, message:, allow_nothing_to_commit: true) + git_commit(path: download_path, message: message, allow_nothing_to_commit: true) end push_to_git_remote unless skip_commit || skip_git_push end @@ -369,7 +369,7 @@ def update_po_file_for_metadata_localization(po_path:, sources:, release_version an_update_metadata_source( po_file_path: po_path, source_files: sources, - release_version: + release_version: release_version ) git_add(path: po_path) diff --git a/fastlane/lanes/screenshots.rb b/fastlane/lanes/screenshots.rb index 7be107b20901..65b59b86c5f7 100644 --- a/fastlane/lanes/screenshots.rb +++ b/fastlane/lanes/screenshots.rb @@ -50,7 +50,7 @@ apk_dir = File.join('WordPress', 'build', 'outputs', 'apk') package_name = APP_SPECIFIC_VALUES[app.to_sym][:package_name] test_class = APP_SPECIFIC_VALUES[app.to_sym][:screenshots_test_class] - output_dir = screenshots_dir(app:, subfolder: 'raw') + output_dir = screenshots_dir(app: app, subfolder: 'raw') screenshot_devices.each do |device| name = android_create_avd(device_model: device[:device], api_level: device[:api]) # Create the AVD for device, API and system image we need @@ -63,7 +63,7 @@ clear_previous_screenshots: should_clear_previous_screenshots, app_package_name: package_name, tests_package_name: "#{package_name}.test", - locales:, + locales: locales, output_directory: output_dir, skip_open_summary: is_ci, use_tests_in_classes: test_class, @@ -97,7 +97,7 @@ app = get_app_name_option!(options) folder_mapping = { options[:phone] => 'phoneScreenshots', options[:tenInch] => 'tenInchScreenshots' } - raw_screenshots_dir = screenshots_dir(app:, subfolder: 'raw') + raw_screenshots_dir = screenshots_dir(app: app, subfolder: 'raw') FileUtils.rm_rf(raw_screenshots_dir) FileUtils.mkdir_p(raw_screenshots_dir) @@ -141,12 +141,12 @@ end app = get_app_name_option!(options) - download_metadata_strings(app:, skip_release_notes: true, skip_git_push: true) unless options.fetch(:skip_download_strings, false) + download_metadata_strings(app: app, skip_release_notes: true, skip_git_push: true) unless options.fetch(:skip_download_strings, false) # Define intermediate folders - raw_screenshots_dir = screenshots_dir(app:, subfolder: 'raw') - raw_screenshots_processing_dir = screenshots_dir(app:, subfolder: 'raw_tmp') - promo_screenshots_processing_dir = screenshots_dir(app:, subfolder: 'promo_tmp') + raw_screenshots_dir = screenshots_dir(app: app, subfolder: 'raw') + raw_screenshots_processing_dir = screenshots_dir(app: app, subfolder: 'raw_tmp') + promo_screenshots_processing_dir = screenshots_dir(app: app, subfolder: 'promo_tmp') final_metadata_dir = File.join(FASTLANE_FOLDER, APP_SPECIFIC_VALUES[app.to_sym][:metadata_dir], 'android') # Clean temporary folder from previous runs @@ -157,7 +157,7 @@ FileUtils.rm_rf(raw_screenshots_processing_dir) FileUtils.copy_entry(raw_screenshots_dir, raw_screenshots_processing_dir) - clean_raw_screenshot_filenames(app:, dir: raw_screenshots_processing_dir) + clean_raw_screenshot_filenames(app: app, dir: raw_screenshots_processing_dir) locales = ALL_LOCALES .reject { |h| h[:google_play].nil? } @@ -230,7 +230,7 @@ metadata_dir = File.join(FASTLANE_FOLDER, APP_SPECIFIC_VALUES[app.to_sym][:metadata_dir], 'android') upload_to_play_store( - package_name:, + package_name: package_name, metadata_path: metadata_dir, skip_upload_apk: true, skip_upload_aab: true,