Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Linter helper in preparation for new upcoming actions #328

Merged
merged 2 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ Style/MutableConstant:
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/version.rb'
- 'spec/release_notes_helper_spec.rb'

Expand Down Expand Up @@ -403,7 +403,7 @@ Style/RescueStandardError:
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb'
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb'

# Offense count: 2
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ _None_
### Internal Changes

* Ensure that the `gem push` step only runs on CI if lint, test and danger steps passed before it. [#325]
* Rename internal `Ios::L10nHelper` to `Ios::L10nLinterHelper`. [#328]

## 2.3.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def self.run(params)
def self.run_linter(params)
UI.message 'Linting localizations for parameter placeholders consistency...'

require_relative '../../helper/ios/ios_l10n_helper'
helper = Fastlane::Helper::Ios::L10nHelper.new(
require_relative '../../helper/ios/ios_l10n_linter_helper'
helper = Fastlane::Helper::Ios::L10nLinterHelper.new(
install_path: resolve_path(params[:install_path]),
version: params[:version]
)
Expand Down Expand Up @@ -92,15 +92,15 @@ def self.available_options
description: 'The path where to install the SwiftGen tooling needed to run the linting process. If a relative path, should be relative to your repo_root',
type: String,
optional: true,
default_value: "vendor/swiftgen/#{Fastlane::Helper::Ios::L10nHelper::SWIFTGEN_VERSION}"
default_value: "vendor/swiftgen/#{Fastlane::Helper::Ios::L10nLinterHelper::SWIFTGEN_VERSION}"
),
FastlaneCore::ConfigItem.new(
key: :version,
env_name: 'FL_IOS_LINT_TRANSLATIONS_SWIFTGEN_VERSION',
description: 'The version of SwiftGen to install and use for linting',
type: String,
optional: true,
default_value: Fastlane::Helper::Ios::L10nHelper::SWIFTGEN_VERSION
default_value: Fastlane::Helper::Ios::L10nLinterHelper::SWIFTGEN_VERSION
),
FastlaneCore::ConfigItem.new(
key: :input_dir,
Expand All @@ -115,7 +115,7 @@ def self.available_options
description: 'The language that should be used as the base language that every other language will be compared against',
type: String,
optional: true,
default_value: Fastlane::Helper::Ios::L10nHelper::DEFAULT_BASE_LANG
default_value: Fastlane::Helper::Ios::L10nLinterHelper::DEFAULT_BASE_LANG
),
FastlaneCore::ConfigItem.new(
key: :only_langs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module Fastlane
module Helper
module Ios
class L10nHelper
class L10nLinterHelper
SWIFTGEN_VERSION = '6.4.0'
DEFAULT_BASE_LANG = 'en'
CONFIG_FILE_NAME = 'swiftgen-stringtypes.yml'
Expand Down
6 changes: 3 additions & 3 deletions spec/ios_lint_localizations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# First run: expect curl, unzip and cp_r to be called to install SwiftGen before running the action
# See spec_helper.rb for documentation about `expect_shell_command`.
expect_shell_command('curl', any_args, %r{/.*swiftgen-#{Fastlane::Helper::Ios::L10nHelper::SWIFTGEN_VERSION}.zip})
expect_shell_command('curl', any_args, %r{/.*swiftgen-#{Fastlane::Helper::Ios::L10nLinterHelper::SWIFTGEN_VERSION}.zip})
expect_shell_command('unzip', any_args)
expect(FileUtils).to receive(:cp_r)
expect_shell_command("#{install_dir}/bin/swiftgen", 'config', 'run', '--config', anything)
Expand All @@ -33,7 +33,7 @@
script = <<~SCRIPT
#!/bin/sh
if [[ "$1" == "--version" ]]; then
echo "SwiftGen v#{Fastlane::Helper::Ios::L10nHelper::SWIFTGEN_VERSION} (Fake binstub)"
echo "SwiftGen v#{Fastlane::Helper::Ios::L10nLinterHelper::SWIFTGEN_VERSION} (Fake binstub)"
fi
SCRIPT
FileUtils.mkdir_p File.join(install_dir, 'bin')
Expand Down Expand Up @@ -102,7 +102,7 @@ def run_l10n_linter_test(data_file)
# Note: We will install SwiftGen in vendor/swiftgen if it's not already installed yet, and intentionally won't
# remove this after the test ends, so that further executions of the test run faster.
# Only the first execution of the tests might take longer if it needs to install SwiftGen first to be able to run the tests.
install_dir = "vendor/swiftgen/#{Fastlane::Helper::Ios::L10nHelper::SWIFTGEN_VERSION}"
install_dir = "vendor/swiftgen/#{Fastlane::Helper::Ios::L10nLinterHelper::SWIFTGEN_VERSION}"
result = Fastlane::Actions::IosLintLocalizationsAction.run(
install_path: install_dir,
input_dir: @test_data_dir,
Expand Down