Skip to content

Commit 03507b3

Browse files
committed
feat: handle remaining rubocop offenses
1 parent 453e786 commit 03507b3

File tree

5 files changed

+67
-54
lines changed

5 files changed

+67
-54
lines changed

fastlane-plugin-instabug-stores-upload.gemspec

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ Gem::Specification.new do |spec|
1717
spec.metadata['rubygems_mfa_required'] = 'true'
1818
spec.required_ruby_version = '>= 3.2.2'
1919

20-
spec.add_development_dependency 'bundler'
21-
spec.add_development_dependency 'rspec'
22-
spec.add_development_dependency 'rake'
23-
spec.add_development_dependency 'rubocop', '1.50.2'
24-
spec.add_development_dependency 'rubocop-performance'
25-
spec.add_development_dependency 'rubocop-require_tools'
26-
spec.add_development_dependency 'simplecov'
27-
spec.add_development_dependency 'fastlane', '~> 2.228.0'
20+
spec.add_development_dependency('bundler')
21+
spec.add_development_dependency('fastlane', '~> 2.228.0')
22+
spec.add_development_dependency('rake')
23+
spec.add_development_dependency('rspec')
24+
spec.add_development_dependency('rubocop', '1.50.2')
25+
spec.add_development_dependency('rubocop-performance')
26+
spec.add_development_dependency('rubocop-require_tools')
27+
spec.add_development_dependency('simplecov')
2828
end

lib/fastlane/plugin/instabug_stores_upload/actions/instabug_upload_to_app_store_action.rb

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ module Actions
66
class InstabugUploadToAppStoreAction < Action
77
def self.run(params)
88
UI.message("Starting Instabug App Store upload...")
9-
9+
1010
# Extract Instabug-specific parameters
1111
branch_name = params.delete(:branch_name)
1212
instabug_api_key = params.delete(:instabug_api_key)
13-
13+
1414
# Validate required parameters
1515
if branch_name.nil? || branch_name.empty?
1616
UI.user_error!("branch_name is required for Instabug reporting")
1717
end
18-
18+
1919
begin
2020
# Report upload start to Instabug
2121
Helper::InstabugStoresUploadHelper.report_status(
22-
branch_name: branch_name,
22+
branch_name:,
2323
api_key: instabug_api_key,
2424
status: "inprogress",
2525
step: "upload_to_the_store"
@@ -30,23 +30,24 @@ def self.run(params)
3030

3131
# Report upload success to Instabug
3232
Helper::InstabugStoresUploadHelper.report_status(
33-
branch_name: branch_name,
33+
branch_name:,
3434
api_key: instabug_api_key,
3535
status: "success",
3636
step: "upload_to_the_store"
3737
)
3838

3939
UI.success("App Store upload completed successfully!")
4040
result
41-
rescue => e
41+
rescue StandardError => e
4242
UI.error("App Store upload failed: #{e.message}")
4343

4444
# Report upload failure to Instabug
4545
Helper::InstabugStoresUploadHelper.report_status(
46-
branch_name: branch_name,
46+
branch_name:,
4747
api_key: instabug_api_key,
4848
status: "failure",
49-
step: "upload_to_the_store"
49+
step: "upload_to_the_store",
50+
error_message: e.message
5051
)
5152
raise e
5253
end
@@ -71,7 +72,7 @@ def self.details
7172
def self.available_options
7273
# Start with the original upload_to_app_store options
7374
options = Actions::UploadToAppStoreAction.available_options
74-
75+
7576
# Add Instabug-specific options
7677
instabug_options = [
7778
FastlaneCore::ConfigItem.new(
@@ -88,9 +89,9 @@ def self.available_options
8889
optional: false,
8990
type: String,
9091
sensitive: true
91-
)
92+
)
9293
]
93-
94+
9495
# Combine both sets of options
9596
options + instabug_options
9697
end
@@ -116,4 +117,4 @@ def self.category
116117
end
117118
end
118119
end
119-
end
120+
end

lib/fastlane/plugin/instabug_stores_upload/actions/instabug_upload_to_play_store_action.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Actions
66
class InstabugUploadToPlayStoreAction < Action
77
def self.run(params)
88
UI.message("Starting Instabug Play Store upload...")
9-
9+
1010
# Extract Instabug-specific parameters
1111
branch_name = params.delete(:branch_name)
1212
instabug_api_key = params.delete(:instabug_api_key)
@@ -19,35 +19,35 @@ def self.run(params)
1919
begin
2020
# Report upload start to Instabug
2121
Helper::InstabugStoresUploadHelper.report_status(
22-
branch_name: branch_name,
22+
branch_name:,
2323
api_key: instabug_api_key,
2424
status: "inprogress",
2525
step: "upload_to_the_store"
2626
)
2727

2828
# Execute the actual upload to Play Store
2929
result = Actions::UploadToPlayStoreAction.run(params)
30-
30+
3131
# Report upload success to Instabug
3232
Helper::InstabugStoresUploadHelper.report_status(
33-
branch_name: branch_name,
33+
branch_name:,
3434
api_key: instabug_api_key,
3535
status: "success",
3636
step: "upload_to_the_store"
3737
)
38-
38+
3939
UI.success("Play Store upload completed successfully!")
4040
result
41-
42-
rescue => e
41+
rescue StandardError => e
4342
UI.error("Play Store upload failed: #{e.message}")
4443

4544
# Report upload failure to Instabug
4645
Helper::InstabugStoresUploadHelper.report_status(
47-
branch_name: branch_name,
46+
branch_name:,
4847
api_key: instabug_api_key,
4948
status: "failure",
50-
step: "upload_to_the_store"
49+
step: "upload_to_the_store",
50+
error_message: e.message
5151
)
5252
raise e
5353
end
@@ -72,7 +72,7 @@ def self.details
7272
def self.available_options
7373
# Start with the original upload_to_play_store options
7474
options = Actions::UploadToPlayStoreAction.available_options
75-
75+
7676
# Add Instabug-specific options
7777
instabug_options = [
7878
FastlaneCore::ConfigItem.new(
@@ -91,7 +91,7 @@ def self.available_options
9191
sensitive: true
9292
)
9393
]
94-
94+
9595
# Combine both sets of options
9696
options + instabug_options
9797
end
@@ -118,4 +118,4 @@ def self.category
118118
end
119119
end
120120
end
121-
end
121+
end

spec/instabug_upload_to_app_store_action_spec.rb

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
body: {
3333
branch_name: 'crash-fix/instabug-crash-123',
3434
status: 'inprogress',
35-
step: 'upload_to_the_store'
35+
step: 'upload_to_the_store',
36+
extras: {},
37+
error_message: nil
3638
}.to_json,
3739
headers: {
3840
'Content-Type' => 'application/json',
@@ -46,7 +48,9 @@
4648
body: {
4749
branch_name: 'crash-fix/instabug-crash-123',
4850
status: 'success',
49-
step: 'upload_to_the_store'
51+
step: 'upload_to_the_store',
52+
extras: {},
53+
error_message: nil
5054
}.to_json,
5155
headers: {
5256
'Content-Type' => 'application/json',
@@ -63,16 +67,18 @@
6367
expect(Fastlane::Actions::UploadToAppStoreAction).to receive(:run)
6468
.and_raise(error)
6569

66-
expect {
70+
expect do
6771
described_class.run(valid_params)
68-
}.to raise_error(StandardError, 'Upload failed')
72+
end.to raise_error(StandardError, 'Upload failed')
6973

7074
expect(WebMock).to have_requested(:patch, api_endpoint)
7175
.with(
7276
body: {
7377
branch_name: 'crash-fix/instabug-crash-123',
7478
status: 'failure',
75-
step: 'upload_to_the_store'
79+
step: 'upload_to_the_store',
80+
extras: {},
81+
error_message: 'Upload failed'
7682
}.to_json
7783
)
7884
end
@@ -82,26 +88,26 @@
8288
it 'raises user error' do
8389
params = valid_params.merge(branch_name: nil)
8490

85-
expect {
91+
expect do
8692
described_class.run(params)
87-
}.to raise_error(FastlaneCore::Interface::FastlaneError, 'branch_name is required for Instabug reporting')
93+
end.to raise_error(FastlaneCore::Interface::FastlaneError, 'branch_name is required for Instabug reporting')
8894
end
8995
end
9096

9197
context 'when branch_name is empty' do
9298
it 'raises user error' do
9399
params = valid_params.merge(branch_name: '')
94100

95-
expect {
101+
expect do
96102
described_class.run(params)
97-
}.to raise_error(FastlaneCore::Interface::FastlaneError, 'branch_name is required for Instabug reporting')
103+
end.to raise_error(FastlaneCore::Interface::FastlaneError, 'branch_name is required for Instabug reporting')
98104
end
99105
end
100106

101107
context 'when branch name does not match instabug pattern' do
102108
it 'does not make API calls but still runs upload' do
103109
params = valid_params.merge(branch_name: 'feature/new-feature')
104-
110+
105111
expect(Fastlane::Actions::UploadToAppStoreAction).to receive(:run)
106112
.and_return('upload_result')
107113

@@ -128,4 +134,4 @@
128134
expect(described_class.category).to eq(:app_store_connect)
129135
end
130136
end
131-
end
137+
end

spec/instabug_upload_to_play_store_action_spec.rb

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
body: {
3434
branch_name: 'crash-fix/instabug-crash-456',
3535
status: 'inprogress',
36-
step: 'upload_to_the_store'
36+
step: 'upload_to_the_store',
37+
extras: {},
38+
error_message: nil
3739
}.to_json,
3840
headers: {
3941
'Content-Type' => 'application/json',
@@ -47,7 +49,9 @@
4749
body: {
4850
branch_name: 'crash-fix/instabug-crash-456',
4951
status: 'success',
50-
step: 'upload_to_the_store'
52+
step: 'upload_to_the_store',
53+
extras: {},
54+
error_message: nil
5155
}.to_json,
5256
headers: {
5357
'Content-Type' => 'application/json',
@@ -64,16 +68,18 @@
6468
expect(Fastlane::Actions::UploadToPlayStoreAction).to receive(:run)
6569
.and_raise(error)
6670

67-
expect {
71+
expect do
6872
described_class.run(valid_params)
69-
}.to raise_error(StandardError, 'Upload failed')
73+
end.to raise_error(StandardError, 'Upload failed')
7074

7175
expect(WebMock).to have_requested(:patch, api_endpoint)
7276
.with(
7377
body: {
7478
branch_name: 'crash-fix/instabug-crash-456',
7579
status: 'failure',
76-
step: 'upload_to_the_store'
80+
step: 'upload_to_the_store',
81+
extras: {},
82+
error_message: 'Upload failed'
7783
}.to_json
7884
)
7985
end
@@ -83,26 +89,26 @@
8389
it 'raises user error' do
8490
params = valid_params.merge(branch_name: nil)
8591

86-
expect {
92+
expect do
8793
described_class.run(params)
88-
}.to raise_error(FastlaneCore::Interface::FastlaneError, 'branch_name is required for Instabug reporting')
94+
end.to raise_error(FastlaneCore::Interface::FastlaneError, 'branch_name is required for Instabug reporting')
8995
end
9096
end
9197

9298
context 'when branch_name is empty' do
9399
it 'raises user error' do
94100
params = valid_params.merge(branch_name: '')
95101

96-
expect {
102+
expect do
97103
described_class.run(params)
98-
}.to raise_error(FastlaneCore::Interface::FastlaneError, 'branch_name is required for Instabug reporting')
104+
end.to raise_error(FastlaneCore::Interface::FastlaneError, 'branch_name is required for Instabug reporting')
99105
end
100106
end
101107

102108
context 'when branch name does not match instabug pattern' do
103109
it 'does not make API calls but still runs upload' do
104110
params = valid_params.merge(branch_name: 'feature/new-feature')
105-
111+
106112
expect(Fastlane::Actions::UploadToPlayStoreAction).to receive(:run)
107113
.and_return('upload_result')
108114

@@ -129,4 +135,4 @@
129135
expect(described_class.category).to eq(:google_play_console)
130136
end
131137
end
132-
end
138+
end

0 commit comments

Comments
 (0)