Skip to content

Commit 0e84ac5

Browse files
authored
Soft-wrap some previously hard-wrapped comments (#356)
2 parents 7f0ee13 + 25945b7 commit 0e84ac5

14 files changed

+50
-86
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_download_action.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def self.run(params = {})
1717
end
1818

1919
# Ensure the git repository at `~/.mobile-secrets` is up to date.
20-
# If the secrets repo is in a detached HEAD state, skip the pull,
21-
# since it will fail.
20+
# If the secrets repo is in a detached HEAD state, skip the pull, since it will fail.
2221
def self.update_repository
2322
secrets_repo_branch = Fastlane::Helper::ConfigureHelper.repo_branch_name
2423

lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def self.run(params = {})
1515
# otherwise, the error messaging isn't as helpful.
1616
validate_that_secrets_repo_is_clean
1717

18-
# Update the repository to get the latest version of the configuration secrets – that's
19-
# how we'll know if we're behind in subsequent validations
18+
# Update the repository to get the latest version of the configuration secrets
19+
# – that's how we'll know if we're behind in subsequent validations
2020
ConfigureDownloadAction.run
2121

2222
validate_that_branches_match

lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,31 @@ module GitHelper
88
# Fallback default branch of the client repository.
99
DEFAULT_GIT_BRANCH = 'trunk'.freeze
1010

11-
# Checks if the given path, or current directory if no path is given, is
12-
# inside a Git repository
11+
# Checks if the given path, or current directory if no path is given, is inside a Git repository
1312
#
14-
# @param [String] path An optional path where to check if a Git repo
15-
# exists.
13+
# @param [String] path An optional path where to check if a Git repo exists.
1614
#
17-
# @return [Bool] True if the current directory is the root of a git repo
18-
# (i.e. a local working copy) or a subdirectory of one.
15+
# @return [Bool] True if the current directory is the root of a git repo (i.e. a local working copy) or a subdirectory of one.
1916
#
2017
def self.is_git_repo?(path: Dir.pwd)
2118
# If the path doesn't exist, find its first ancestor.
2219
path = first_existing_ancestor_of(path: path)
2320
# Get the path's directory, so we can look in it for the Git folder
2421
dir = path.directory? ? path : path.dirname
2522

26-
# Recursively look for the Git folder until it's found or we read the
27-
# the file system root
23+
# Recursively look for the Git folder until it's found or we read the the file system root
2824
dir = dir.parent until Dir.entries(dir).include?('.git') || dir.root?
2925

30-
# If we reached the root, we haven't found a repo. (Technically, there
31-
# could be a repo in the root of the system, but that's a usecase that
32-
# we don't need to support at this time)
26+
# If we reached the root, we haven't found a repo.
27+
# (Technically, there could be a repo in the root of the system, but that's a usecase that we don't need to support at this time)
3328
return dir.root? == false
3429
end
3530

36-
# Travels back the hierarchy of the given path until it finds an existing
37-
# ancestor, or it reaches the root of the file system.
31+
# Travels back the hierarchy of the given path until it finds an existing ancestor, or it reaches the root of the file system.
3832
#
3933
# @param [String] path The path to inspect
4034
#
41-
# @return [Pathname] The first existing ancestor, or `path` itself if it
42-
# exists
35+
# @return [Pathname] The first existing ancestor, or `path` itself if it exists
4336
#
4437
def self.first_existing_ancestor_of(path:)
4538
p = Pathname(path).expand_path
@@ -106,7 +99,7 @@ def self.create_branch(branch_name, from: nil, push: true)
10699
#
107100
# @param [String] message The commit message to use
108101
# @param [String|Array<String>] files A file or array of files to git-add before creating the commit.
109-
# use `nil` or `[]` if you already added the files in a separate step and don't wan't this method to add any new file before commit.
102+
# Use `nil` or `[]` if you already added the files in a separate step and don't wan't this method to add any new file before commit.
110103
# Also accepts the special symbol `:all` to add all the files (`git commit -a -m …`).
111104
# @param [Bool] push If true, will `git push` to `origin` after the commit has been created. Defaults to `false`.
112105
#
@@ -209,8 +202,7 @@ def self.ensure_on_branch!(branch_name)
209202
UI.user_error!("This command works only on #{branch_name} branch") unless current_branch_name.include?(branch_name)
210203
end
211204

212-
# Checks whether a given path is ignored by Git, relying on Git's
213-
# `check-ignore` under the hood.
205+
# Checks whether a given path is ignored by Git, relying on Git's `check-ignore` under the hood.
214206
#
215207
# @param [String] path The path to check against `.gitignore`
216208
#

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 to account for it in the `TRANSITIONS` table.
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

lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ def initialize(target_folder, target_files)
1212
@alternates = {}
1313
end
1414

15-
# Downloads data from GlotPress,
16-
# in JSON format
15+
# Downloads data from GlotPress, in JSON format
1716
def download(target_locale, glotpress_url, is_source)
1817
uri = URI(glotpress_url)
1918
response = Net::HTTP.get_response(uri)
@@ -80,8 +79,7 @@ def update_key(target_locale, key, file, data, msg)
8079
end
8180
end
8281

83-
# Writes the downloaded content
84-
# to the target file
82+
# Writes the downloaded content to the target file
8583
def save_metadata(locale, file_name, content)
8684
file_path = get_target_file_path(locale, file_name)
8785

lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ def draw_device_frame_to_canvas(device, canvas)
117117
end
118118

119119
def draw_screenshot_to_canvas(entry, canvas, device)
120-
# Don't require a screenshot to be present – we can just skip
121-
# this function if one doesn't exist.
120+
# Don't require a screenshot to be present – we can just skip this function if one doesn't exist.
122121
return canvas if entry['screenshot'].nil?
123122

124123
device_mask = device['screenshot_mask']

lib/fastlane/plugin/wpmreleasetoolkit/helper/release_notes_helper.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ module ReleaseNotesHelper
99
def self.add_new_section(path:, section_title:)
1010
lines = File.readlines(path)
1111

12-
# Find the index of the first non-empty line that is also NOT a comment. That way we keep commment headers as the very top of the file
12+
# Find the index of the first non-empty line that is also NOT a comment.
13+
# That way we keep commment headers as the very top of the file
1314
line_idx = lines.find_index { |l| !l.start_with?('***') && !l.start_with?('//') && !l.chomp.empty? }
14-
# Put back the header, then the new entry, then the rest (note: '...' excludes the higher bound of the range, unlike '..')
15+
# Put back the header, then the new entry, then the rest
16+
# (note: '...' excludes the higher bound of the range, unlike '..')
1517
new_lines = lines[0...line_idx] + ["#{section_title}\n", "-----\n", "\n", "\n"] + lines[line_idx..]
1618

1719
File.write(path, new_lines.join)

lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ def update
4040
end
4141

4242
# "Applies" the instruction described in the instance to the file system.
43-
# That is, copies the content of the source `file` to the `destination`
44-
# path.
43+
# That is, copies the content of the source `file` to the `destination` path.
4544
#
46-
# @raise [StandardError] For security reasons, it will raise if
47-
# `destination` is not ignored under Git.
45+
# @raise [StandardError] For security reasons, it will raise if `destination` is not ignored under Git.
4846
def apply
4947
# Only decrypt the file if the destination is ignored in Git
5048
unless Fastlane::Helper::GitHelper.is_ignored?(path: destination_file_path)

spec/an_localize_libs_action_spec.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
require 'spec_helper'
22

33
describe Fastlane::Actions::AnLocalizeLibsAction do
4-
# This test is more of a way of ensuring `run_described_fastlane_action` handles array
5-
# of hashes properly than a comprehensive test for the
6-
# `an_localize_libs_action` action.
4+
# This test is more of a way of ensuring `run_described_fastlane_action` handles array of hashes properly than a comprehensive test for the `an_localize_libs_action` action.
75
#
8-
# Please consider expanding this test if you'll find yourself working on its
9-
# action.
6+
# Please consider expanding this test if you'll find yourself working on its action.
107
it 'merges the strings from the given array into the given main strings file' do
118
in_tmp_dir do |tmp_dir|
129
app_strings_path = File.join(tmp_dir, 'app.xml')
@@ -37,12 +34,9 @@
3734
end
3835

3936
def android_xml_with_content(content)
40-
# I couldn't find a way to interpolate a multiline string preserving its
41-
# indentation in the heredoc below, so I hacked the following transformation
42-
# of the input that adds the desired indentation to all lines.
37+
# I couldn't find a way to interpolate a multiline string preserving its indentation in the heredoc below, so I hacked the following transformation of the input that adds the desired indentation to all lines.
4338
#
44-
# The desired indentation is 4 spaces to stay aligned with the production
45-
# code applies when merging the XMLs.
39+
# The desired indentation is 4 spaces to stay aligned with the production code applies when merging the XMLs.
4640
indented_content = content.chomp.lines.map { |l| " #{l}" }.join
4741

4842
return <<~XML

spec/an_metadata_update_helper_spec.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
output_io = StringIO.new
1818
described_class.new('any-key', input_path).generate_block(output_io)
1919

20-
# Ensure the output matches the expectation: the trailing new line has
21-
# been stripped.
20+
# Ensure the output matches the expectation: the trailing new line has been stripped.
2221
#
23-
# Note that the final new line is intentional. It's part of the
24-
# formatting at the time of writing.
22+
# Note that the final new line is intentional. It's part of the formatting at the time of writing.
2523
expect(output_io.string).to eq <<~EXP
2624
msgctxt "any-key"
2725
msgid "Single line message with new line"
@@ -39,13 +37,11 @@
3937
input_path = File.join(dir, 'input')
4038
File.write(input_path, input)
4139

42-
# Write the .pot block in a StringIO to bypass the filesystem and have
43-
# faster tests
40+
# Write the .pot block in a StringIO to bypass the filesystem and have faster tests
4441
output_io = StringIO.new
4542
described_class.new('any-key', input_path).generate_block(output_io)
4643

47-
# Note that the new line after `msgstr` is intentional. It's part of the
48-
# formatting at the time of writing.
44+
# Note that the new line after `msgstr` is intentional. It's part of the formatting at the time of writing.
4945
expect(output_io.string).to eq <<~'EXP'
5046
msgctxt "any-key"
5147
msgid ""

0 commit comments

Comments
 (0)