Skip to content

Commit a5e7cec

Browse files
Apply rubocop corrections
1 parent f989c4a commit a5e7cec

29 files changed

+58
-58
lines changed

Dangerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ end
3232

3333
# Lint with Rubocop and report violations inline in GitHub
3434
github.dismiss_out_of_range_messages # This way, fixed violations should go
35-
renaming_map = (git.renamed_files || []).map { |e| [e[:before], e[:after]] }.to_h # when files are renamed, git.modified_files contains old name, not new one, so we need to do the convertion
35+
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
3636
rubocop.lint(
3737
files: git.added_files + (git.modified_files.map { |f| renaming_map[f] || f }) - git.deleted_files,
3838
inline_comment: true,

Rakefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ task :new_release do
4242

4343
## Print current info
4444
Console.header "Current version is: #{Fastlane::Wpmreleasetoolkit::VERSION}"
45-
Console.warning "Warning: Latest version number does not match latest version title in CHANGELOG (#{latest_version})!" unless Fastlane::Wpmreleasetoolkit::VERSION == latest_version
45+
Console.warning "Warning: Latest version number does not match latest version title in CHANGELOG (#{latest_version})!" unless latest_version == Fastlane::Wpmreleasetoolkit::VERSION
4646

4747
Console.header 'Pending CHANGELOG:'
4848
Console.print_indented_lines(parser.cleaned_pending_changelog_lines)
@@ -72,11 +72,11 @@ task :new_release do
7272
>>> WHAT'S NEXT
7373
7474
1. Create a PR against `trunk`.
75-
2. Once the PR is merged, publish a GitHub release for \`#{new_version}\`, targeting \`trunk\`,
76-
creating a new \`#{new_version} tag in the process.
75+
2. Once the PR is merged, publish a GitHub release for `#{new_version}`, targeting `trunk`,
76+
creating a new `#{new_version} tag in the process.
7777
7878
The creation of the new tag will trigger a CI workflow that will take care of doing the
79-
\`gem push\` of the new version to RubyGems.
79+
`gem push` of the new version to RubyGems.
8080
8181
INSTRUCTIONS
8282
end

fastlane-plugin-wpmreleasetoolkit.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ Gem::Specification.new do |spec|
1414

1515
spec.required_ruby_version = '>= 2.7'
1616

17-
spec.files = Dir['lib/**/*'] + %w[README.md LICENSE]
18-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17+
spec.files = Dir['lib/**/*'] + %w[README.md LICENSE]
1918

2019
# Bring in any generated executables
2120
spec.bindir = 'bin'
@@ -61,4 +60,5 @@ Gem::Specification.new do |spec|
6160
spec.add_development_dependency 'rubocop-require_tools', '~> 0.1.2'
6261
spec.add_development_dependency 'rubocop-rspec', '2.3.0'
6362
spec.add_development_dependency 'simplecov', '~> 0.16.1'
63+
spec.metadata['rubygems_mfa_required'] = 'true'
6464
end

lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def self.create_temp_po(params)
3737
target = self.create_target_file_path(orig)
3838

3939
# Clear if older exists
40-
File.delete(target) if File.exist? target
40+
FileUtils.rm_f(target)
4141

4242
# Create the new one
4343
begin
@@ -47,7 +47,7 @@ def self.create_temp_po(params)
4747
end
4848
end
4949
rescue
50-
File.delete(target) if File.exist? target
50+
FileUtils.rm_f(target)
5151
raise
5252
end
5353

@@ -57,7 +57,7 @@ def self.create_temp_po(params)
5757
# Deletes the old po and moves the temp one
5858
# to the final location
5959
def self.swap_po(orig_file_path, temp_file_path)
60-
File.delete(orig_file_path) if File.exist? orig_file_path
60+
FileUtils.rm_f(orig_file_path)
6161
File.rename(temp_file_path, orig_file_path)
6262
end
6363

lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def self.run(params)
1111
complete_path = "#{params[:download_path]}/#{loc[1]}/changelogs/#{params[:build_number]}.txt"
1212
if File.exist?(complete_path)
1313
f.puts("<#{loc[1]}>")
14-
f.puts(File.open(complete_path).read)
14+
f.puts(File.read(complete_path))
1515
f.puts("</#{loc[1]}>\n")
1616
else
1717
UI.message("File #{complete_path} not found. Skipping language #{loc[1]}")

lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def self.available_options
4848
env_name: 'FL_DOWNLOAD_TRANSLATIONS_RES_DIR',
4949
description: "The path to the Android project's `res` dir (typically the `<project name>/src/main/res` directory) containing the `values-*` subdirs",
5050
type: String,
51-
default_value: "#{ENV['PROJECT_NAME']}/src/main/res"
51+
default_value: "#{ENV.fetch('PROJECT_NAME', nil)}/src/main/res"
5252
),
5353
FastlaneCore::ConfigItem.new(
5454
key: :glotpress_url,

lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_for_toolkit_updates_action.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ def self.warn_on_breaking_update(current_version, latest_version)
4444
UI.important <<~BREAKING_CHANGE_MESSAGE
4545
The latest version available (#{latest_version}) introduces breaking changes compared to the #{current_version} you are currently using.
4646
47-
- To update to #{latest_version}, first edit your \`Pluginfile\` to use '#{new_semver_requirement}', run \`bundle update\`,
48-
then be sure to make all the necessary changes to your \`Fastfile\` (see the toolkit's CHANGELOG)
47+
- To update to #{latest_version}, first edit your `Pluginfile` to use '#{new_semver_requirement}', run `bundle update`,
48+
then be sure to make all the necessary changes to your `Fastfile` (see the toolkit's CHANGELOG)
4949
to take those breaking changes into account.
5050
5151
- If you are not ready to make the major version bump, you can still try to update to the latest compatible,
52-
non-breaking version by running \`bundle update\` now. This will not update to the latest #{latest_version}, but
52+
non-breaking version by running `bundle update` now. This will not update to the latest #{latest_version}, but
5353
might still update to a newer version compatible with '#{current_semver_requirement}' if one exists; which is still valuable
5454
to at least get bugfixes, until you are ready to jump to the next major version later.
5555
BREAKING_CHANGE_MESSAGE

lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def self.run(params)
1212
UI.message "Path: #{params[:download_path]}"
1313

1414
# Check download path
15-
Dir.mkdir(params[:download_path]) unless File.exist?(params[:download_path])
15+
FileUtils.mkdir_p(params[:download_path])
1616

1717
# Download
1818
downloader = Fastlane::Helper::MetadataDownloader.new(params[:download_path], params[:target_files])

lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def self.create_temp_po(params)
3636
target = self.create_target_file_path(orig)
3737

3838
# Clear if older exists
39-
File.delete(target) if File.exist? target
39+
FileUtils.rm_f(target)
4040

4141
# Create the new one
4242
begin
@@ -46,7 +46,7 @@ def self.create_temp_po(params)
4646
end
4747
end
4848
rescue
49-
File.delete(target) if File.exist? target
49+
FileUtils.rm_f(target)
5050
raise
5151
end
5252

@@ -56,7 +56,7 @@ def self.create_temp_po(params)
5656
# Deletes the old po and moves the temp one
5757
# to the final location
5858
def self.swap_po(orig_file_path, temp_file_path)
59-
File.delete(orig_file_path) if File.exist? orig_file_path
59+
FileUtils.rm_f(orig_file_path)
6060
File.rename(temp_file_path, orig_file_path)
6161
end
6262

lib/fastlane/plugin/wpmreleasetoolkit/actions/common/prototype_build_details_comment_action.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def self.build_install_links(app_center_info, download_url)
8787
end
8888
if app_center_info.org_name && app_center_info.app_name
8989
install_url = "https://install.appcenter.ms/orgs/#{app_center_info.org_name}/apps/#{app_center_info.app_name}/releases/#{app_center_info.release_id}"
90-
extra_metadata['App Center Build'] = "<a href='#{install_url}'>#{app_center_info.display_name} \##{app_center_info.release_id}</a>"
90+
extra_metadata['App Center Build'] = "<a href='#{install_url}'>#{app_center_info.display_name} ##{app_center_info.release_id}</a>"
9191
end
9292
UI.user_error!(NO_INSTALL_URL_ERROR_MESSAGE) if install_url.nil?
9393
qr_code_url = "https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl=#{CGI.escape(install_url)}&choe=UTF-8"

0 commit comments

Comments
 (0)