Skip to content

Commit 6c7e2b2

Browse files
authored
Merge pull request #517 from wordpress-mobile/update/ruby3
Ruby 3 Upgrade
2 parents aad3399 + 24291dd commit 6c7e2b2

File tree

82 files changed

+286
-417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+286
-417
lines changed

.buildkite/pipeline.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ common_params:
88
- &ci_toolkit
99
automattic/a8c-ci-toolkit#2.18.2: ~
1010
- &docker_plugin
11-
docker#v3.8.0:
12-
image: &ruby_version "ruby:2.7.4"
11+
docker#v5.8.0:
12+
image: &ruby_version "public.ecr.aws/docker/library/ruby:3.2.2"
1313
propagate-environment: true
1414
environment:
1515
- "RUBYGEMS_API_KEY"
1616
- &docker_plugin_with_danger_token
17-
docker#v3.8.0:
17+
docker#v5.8.0:
1818
image: *ruby_version
1919
propagate-environment: true
2020
environment:
@@ -53,7 +53,6 @@ steps:
5353
matrix:
5454
setup:
5555
ruby:
56-
- 2.7.4
5756
- 3.2.2
5857

5958
#################

.rubocop.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ require:
66
# Enable new cops when we update rubocop to a newer version
77
AllCops:
88
NewCops: enable
9-
TargetRubyVersion: 2.7
109

1110
########## Lint / CodeStyle
1211

@@ -56,7 +55,12 @@ Style/StringConcatenation:
5655
# for more discussion
5756
Style/FetchEnvVar:
5857
Enabled: false
59-
58+
59+
# Rule enforced after migrating to Ruby 3, to prevent the new syntax which allows for hash values and keyword arguments
60+
# omission, such as `myMethod(x:, y:)` and `h = { a:, b: }`.
61+
Style/HashSyntax:
62+
EnforcedShorthandSyntax: never
63+
6064
########## Gemspec Rules
6165

6266
# This was turned on by default after updating Rubocop to `1.50.2`. We want to disable this for now because
@@ -107,3 +111,6 @@ RSpec/ExampleLength:
107111
# Same for number of let/subject
108112
RSpec/MultipleMemoizedHelpers:
109113
Enabled: false
114+
115+
RSpec/MultipleExpectations:
116+
Enabled: false

.rubocop_todo.yml

Lines changed: 23 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2023-06-14 05:10:53 UTC using RuboCop version 1.50.2.
3+
# on 2023-09-21 15:44:18 UTC using RuboCop version 1.56.3.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 11
10+
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
11+
# SupportedStyles: Gemfile, gems.rb, gemspec
12+
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
13+
Gemspec/DevelopmentDependencies:
14+
Exclude:
15+
- 'fastlane-plugin-wpmreleasetoolkit.gemspec'
16+
17+
# Offense count: 1
18+
# Configuration parameters: Severity, Include.
19+
# Include: **/*.gemspec
20+
Gemspec/RequiredRubyVersion:
21+
Exclude:
22+
- 'fastlane-plugin-wpmreleasetoolkit.gemspec'
23+
924
# Offense count: 3
1025
Lint/NonLocalExitFromIterator:
1126
Exclude:
1227
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb'
1328
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb'
1429

15-
# Offense count: 5
16-
Lint/UselessAssignment:
17-
Exclude:
18-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb'
19-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb'
20-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb'
21-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb'
22-
23-
# Offense count: 8
30+
# Offense count: 7
2431
Naming/AccessorMethodName:
2532
Exclude:
2633
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb'
2734
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb'
2835
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb'
2936

30-
# Offense count: 19
37+
# Offense count: 2
3138
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
3239
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
3340
Naming/MethodParameterName:
3441
Exclude:
3542
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb'
3643
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb'
37-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb'
38-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb'
39-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb'
40-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb'
4144

42-
# Offense count: 111
45+
# Offense count: 108
4346
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
4447
# NamePrefix: is_, has_, have_
4548
# ForbiddenPrefixes: is_, has_, have_
@@ -65,41 +68,25 @@ RSpec/ContextWording:
6568
- 'spec/git_helper_spec.rb'
6669
- 'spec/ios_lint_localizations_spec.rb'
6770

68-
# Offense count: 39
71+
# Offense count: 45
6972
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
7073
# Include: **/*_spec*rb*, **/spec/**/*
7174
RSpec/FilePath:
7275
Enabled: false
7376

74-
# Offense count: 8
75-
# This cop supports safe autocorrection (--autocorrect).
76-
# Configuration parameters: EnforcedStyle.
77-
# SupportedStyles: implicit, each, example
78-
RSpec/HookArgument:
79-
Exclude:
80-
- 'spec/configuration_spec.rb'
81-
- 'spec/encryption_helper_spec.rb'
82-
- 'spec/file_reference_spec.rb'
83-
- 'spec/git_helper_spec.rb'
84-
- 'spec/ios_lint_localizations_spec.rb'
85-
8677
# Offense count: 25
8778
# Configuration parameters: AssignmentOnly.
8879
RSpec/InstanceVariable:
8980
Exclude:
9081
- 'spec/git_helper_spec.rb'
9182
- 'spec/ios_lint_localizations_spec.rb'
9283

93-
# Offense count: 89
84+
# Offense count: 109
9485
# Configuration parameters: .
9586
# SupportedStyles: have_received, receive
9687
RSpec/MessageSpies:
9788
EnforcedStyle: receive
9889

99-
# Offense count: 88
100-
RSpec/MultipleExpectations:
101-
Max: 7
102-
10390
# Offense count: 48
10491
# Configuration parameters: IgnoreSharedExamples.
10592
RSpec/NamedSubject:
@@ -109,7 +96,7 @@ RSpec/NamedSubject:
10996
- 'spec/configuration_spec.rb'
11097
- 'spec/file_reference_spec.rb'
11198

112-
# Offense count: 8
99+
# Offense count: 10
113100
RSpec/NestedGroups:
114101
Max: 5
115102

@@ -137,7 +124,7 @@ Security/Open:
137124
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb'
138125
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb'
139126

140-
# Offense count: 126
127+
# Offense count: 123
141128
# Configuration parameters: AllowedConstants.
142129
Style/Documentation:
143130
Enabled: false
@@ -148,18 +135,6 @@ Style/GlobalVars:
148135
Exclude:
149136
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb'
150137

151-
# Offense count: 10
152-
# This cop supports safe autocorrection (--autocorrect).
153-
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
154-
Style/GuardClause:
155-
Exclude:
156-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb'
157-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb'
158-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb'
159-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb'
160-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb'
161-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb'
162-
163138
# Offense count: 1
164139
Style/MixinUsage:
165140
Exclude:
@@ -171,116 +146,3 @@ Style/MultilineBlockChain:
171146
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb'
172147
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb'
173148
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb'
174-
175-
# Offense count: 23
176-
# This cop supports unsafe autocorrection (--autocorrect-all).
177-
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
178-
# SupportedStyles: predicate, comparison
179-
Style/NumericPredicate:
180-
Exclude:
181-
- 'spec/**/*'
182-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb'
183-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb'
184-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb'
185-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb'
186-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb'
187-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb'
188-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb'
189-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb'
190-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb'
191-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb'
192-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb'
193-
194-
# Offense count: 1
195-
# This cop supports safe autocorrection (--autocorrect).
196-
Style/RedundantBegin:
197-
Exclude:
198-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb'
199-
200-
# Offense count: 54
201-
# This cop supports safe autocorrection (--autocorrect).
202-
# Configuration parameters: AllowMultipleReturnValues.
203-
Style/RedundantReturn:
204-
Enabled: false
205-
206-
# Offense count: 37
207-
# This cop supports safe autocorrection (--autocorrect).
208-
Style/RedundantSelf:
209-
Exclude:
210-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb'
211-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb'
212-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb'
213-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb'
214-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb'
215-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb'
216-
- 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb'
217-
- 'lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb'
218-
219-
# Offense count: 6
220-
# This cop supports safe autocorrection (--autocorrect).
221-
Style/RescueModifier:
222-
Exclude:
223-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb'
224-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb'
225-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb'
226-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb'
227-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb'
228-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb'
229-
230-
# Offense count: 11
231-
# This cop supports safe autocorrection (--autocorrect).
232-
# Configuration parameters: EnforcedStyle.
233-
# SupportedStyles: implicit, explicit
234-
Style/RescueStandardError:
235-
Exclude:
236-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb'
237-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_preflight.rb'
238-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb'
239-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb'
240-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb'
241-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb'
242-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb'
243-
244-
# Offense count: 2
245-
# This cop supports unsafe autocorrection (--autocorrect-all).
246-
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
247-
# AllowedMethods: present?, blank?, presence, try, try!
248-
Style/SafeNavigation:
249-
Exclude:
250-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb'
251-
252-
# Offense count: 1
253-
# This cop supports safe autocorrection (--autocorrect).
254-
# Configuration parameters: EnforcedStyle.
255-
# SupportedStyles: only_raise, only_fail, semantic
256-
Style/SignalException:
257-
Exclude:
258-
- 'Dangerfile'
259-
260-
# Offense count: 1
261-
# This cop supports unsafe autocorrection (--autocorrect-all).
262-
# Configuration parameters: RequireEnglish, EnforcedStyle.
263-
# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
264-
Style/SpecialGlobalVars:
265-
Exclude:
266-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb'
267-
268-
# Offense count: 28
269-
# This cop supports safe autocorrection (--autocorrect).
270-
# Configuration parameters: .
271-
# SupportedStyles: percent, brackets
272-
Style/SymbolArray:
273-
EnforcedStyle: percent
274-
MinSize: 3
275-
276-
# Offense count: 7
277-
# This cop supports unsafe autocorrection (--autocorrect-all).
278-
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
279-
# AllowedMethods: define_method
280-
Style/SymbolProc:
281-
Exclude:
282-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb'
283-
- 'lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb'
284-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb'
285-
- 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb'
286-
- 'lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb'

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.4
1+
3.2.2

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
### Breaking Changes
88

9-
_None_
9+
- Upgraded the minimum required Ruby version to `3.2.2`. [#517]
1010

1111
### New Features
1212

Dangerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The version in the `Gemfile.lock` (`#{gemfile_lock_version}`) doesn't match the
2020
2121
Please run `bundle install` to make sure they match.
2222
}
23-
fail(message)
23+
failure(message)
2424
end
2525

2626
# Check that the PR contains changes to the CHANGELOG.md file.

MIGRATION.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Migration Instructions for Major Releases
22

3+
## From `10.0.0` to `11.0.0`
4+
5+
- The new minimum required Ruby version is `3.2.2`. Please make sure to upgrade your projects before upgrading to this version to avoid compatibility issues.
6+
37
## From `9.0.0` to `10.0.0`
48

59
- Action `addbranchprotection` has been renamed `set_branch_protection`. Besides, you might want to use the new `copy_branch_protection(from_branch: to_branch:)` instead (especially for protecting the `release/*` branch after code-freeze).

fastlane-plugin-wpmreleasetoolkit.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
1212
spec.homepage = 'https://github.com/wordpress-mobile/release-toolkit'
1313
spec.license = 'MIT'
1414

15-
spec.required_ruby_version = '>= 2.7'
15+
spec.required_ruby_version = '>= 3.2.2'
1616

1717
spec.files = Dir['lib/**/*'] + %w[README.md LICENSE]
1818

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def self.available_options
5656
end
5757

5858
def self.is_supported?(platform)
59-
return platform == :android
59+
platform == :android
6060
end
6161
end
6262
end

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def self.check_source_files(source_files)
3636
# .po fo the others.
3737
def self.create_temp_po(params)
3838
orig = params[:po_file_path]
39-
target = self.create_target_file_path(orig)
39+
target = create_target_file_path(orig)
4040

4141
# Clear if older exists
4242
FileUtils.rm_f(target)
@@ -48,7 +48,7 @@ def self.create_temp_po(params)
4848
write_target_block(fw, fr)
4949
end
5050
end
51-
rescue
51+
rescue StandardError
5252
FileUtils.rm_f(target)
5353
raise
5454
end

0 commit comments

Comments
 (0)