Skip to content

Commit 821594e

Browse files
committed
Soft-wrap hard-wrapped comments in ios_strings_file_validation_helper.rb
Use a longer line length and prefer semantic line breaks to hard-wraps. See #342 (comment)
1 parent 0127859 commit 821594e

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ class StringsFileValidationHelper
6060
}
6161
}.freeze
6262

63-
# Inspects the given `.strings` file for duplicated keys, returning them
64-
# if any.
63+
# Inspects the given `.strings` file for duplicated keys, returning them if any.
6564
#
6665
# @param [String] file The path to the file to inspect.
6766
# @return [Hash<String, Array<Int>] Hash with the dublipcated keys.
@@ -73,12 +72,10 @@ def self.find_duplicated_keys(file:)
7372

7473
File.readlines(file).each_with_index do |line, line_no|
7574
line.chars.each_with_index do |c, col_no|
76-
# Handle escaped characters at a global level. This is more
77-
# straightforward than having a `TRANSITIONS` table that account
78-
# for it.
75+
# Handle escaped characters at a global level.
76+
# This is more straightforward than having a `TRANSITIONS` table that account for it.
7977
if state.in_escaped_ctx || c == '\\'
80-
# Just because we check for escaped characters at the global
81-
# level, it doesn't mean we allow them in every context.
78+
# Just because we check for escaped characters at the global level, it doesn't mean we allow them in every context.
8279
allowed_contexts_for_escaped_characters = %i[in_quoted_key in_quoted_value in_block_comment in_line_comment]
8380
raise "Found escaped character outside of allowed contexts on line #{line_no + 1} (current context: #{state.context})" unless allowed_contexts_for_escaped_characters.include?(state.context)
8481

@@ -87,16 +84,14 @@ def self.find_duplicated_keys(file:)
8784
next
8885
end
8986

90-
# Look at the transitions table for the current context, and find
91-
# the first transition matching the current character
87+
# Look at the transitions table for the current context, and find the first transition matching the current character
9288
(_, next_context) = TRANSITIONS[state.context].find { |regex, _| c.match?(regex) } || [nil, nil]
9389
raise "Invalid character `#{c}` found on line #{line_no + 1}, col #{col_no + 1}" if next_context.nil?
9490

9591
state.context = next_context.is_a?(Proc) ? next_context.call(state, c) : next_context
9692
next unless state.found_key
9793

98-
# If we just exited the :in_quoted_key context and thus have found
99-
# a new key, process it
94+
# If we just exited the :in_quoted_key context and thus have found a new key, process it
10095
key = state.found_key.dup
10196
state.found_key = nil
10297

0 commit comments

Comments
 (0)