Skip to content

Commit 079709b

Browse files
committed
Fix rubocop violations
1 parent 4795969 commit 079709b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,10 @@ def self.merge_xml_documents(all_xmls)
342342
#
343343
def self.post_process_xml!(translated_xml, locale_code:, original_xml:)
344344
copy_orig_attributes = lambda do |node, xpath|
345-
orig_attributes = original_xml.xpath(xpath)&.first&.attribute_nodes&.to_h do |attr|
345+
found_node = original_xml.xpath(xpath)&.first
346+
return unless found_node
347+
348+
orig_attributes = found_node.attribute_nodes&.to_h do |attr|
346349
[[attr.namespace&.prefix, attr.name].compact.join(':'), attr.value]
347350
end
348351
orig_attributes&.each { |k, v| node[k] = v unless k == 'name' }

lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def self.format_csv(app_sizes, devices: nil)
5454
csv = "Version\t#{devices.join("\t")}\n"
5555
app_sizes.each do |details|
5656
build_number = details['cfBundleVersion']
57-
sizes = details['sizesInBytes'].select { |name, _| devices.include?(name) }
57+
sizes = details['sizesInBytes'].slice(*devices)
5858
csv += "#{build_number}\t" + devices.map { |d| sz(sizes[d]['compressed']) }.join("\t") + "\n"
5959
end
6060
csv
@@ -64,7 +64,7 @@ def self.format_markdown(app_sizes, devices: nil)
6464
devices = DEFAULT_DEVICES if devices.nil? || devices.empty?
6565
app_sizes.map do |details|
6666
build_number = details['cfBundleVersion']
67-
sizes = details['sizesInBytes'].select { |name, _| devices.include?(name) }
67+
sizes = details['sizesInBytes'].slice(*devices)
6868
col_size = devices.map(&:length).max
6969
table = "| #{build_number.ljust(col_size)} | Download | Install |\n"
7070
table += "|:#{'-' * col_size}-|---------:|---------:|\n"

lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_strings_file_validation_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ class StringsFileValidationHelper
6565
# Inspects the given `.strings` file for duplicated keys, returning them if any.
6666
#
6767
# @param [String] file The path to the file to inspect.
68-
# @return [Hash<String, Array<Int>] Hash with the dublipcated keys.
68+
# @return [Hash<String, Array<Int>] Hash with the duplicated keys.
6969
# Each element has the duplicated key (from the `.strings`) as key and an array of line numbers where the key occurs as value.
7070
def self.find_duplicated_keys(file:)
71-
keys_with_lines = Hash.new([])
71+
keys_with_lines = Hash.new { |h, k| h[k] = [] }
7272

7373
state = State.new(context: :root, buffer: StringIO.new, in_escaped_ctx: false, found_key: nil)
7474

0 commit comments

Comments
 (0)