Skip to content

Commit 0e4d84b

Browse files
committed
RuboCop: resolve Style/WordArray issues
1 parent 99315b6 commit 0e4d84b

9 files changed

Lines changed: 21 additions & 28 deletions

File tree

.rubocop_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,13 +696,6 @@ Style/SymbolProc:
696696
- 'lib/stack_master/command.rb'
697697
- 'spec/support/validator_spec.rb'
698698

699-
# This cop supports safe autocorrection (--autocorrect).
700-
# Configuration parameters: WordRegex.
701-
# SupportedStyles: percent, brackets
702-
Style/WordArray:
703-
EnforcedStyle: percent
704-
MinSize: 4
705-
706699
# This cop supports unsafe autocorrection (--autocorrect-all).
707700
Style/ZeroLengthPredicate:
708701
Exclude:

lib/stack_master/change_set.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module StackMaster
22
class ChangeSet
3-
END_STATES = [
4-
'CREATE_COMPLETE',
5-
'DELETE_COMPLETE',
6-
'FAILED'
3+
END_STATES = %w[
4+
CREATE_COMPLETE
5+
DELETE_COMPLETE
6+
FAILED
77
]
88

99
def self.generate_change_set_name(stack_name)

lib/stack_master/commands/apply.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def stack_options
177177
stack_name: stack_name,
178178
parameters: proposed_stack.aws_parameters,
179179
tags: proposed_stack.aws_tags,
180-
capabilities: ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', 'CAPABILITY_AUTO_EXPAND'],
180+
capabilities: %w[CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND],
181181
role_arn: proposed_stack.role_arn,
182182
notification_arns: proposed_stack.notification_arns,
183183
template_method => template_value

lib/stack_master/commands/drift.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ class Drift
66
include Command
77
include Commander::UI
88

9-
DETECTION_COMPLETE_STATES = [
10-
'DETECTION_COMPLETE',
11-
'DETECTION_FAILED'
9+
DETECTION_COMPLETE_STATES = %w[
10+
DETECTION_COMPLETE
11+
DETECTION_FAILED
1212
]
1313

1414
def perform

spec/stack_master/commands/apply_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def apply
6161
tags: [
6262
{ key: 'environment', value: 'production' }
6363
],
64-
capabilities: ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', 'CAPABILITY_AUTO_EXPAND'],
64+
capabilities: %w[CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND],
6565
role_arn: role_arn,
6666
notification_arns: [notification_arn]
6767
)
@@ -182,7 +182,7 @@ def apply
182182
tags: [
183183
{ key: 'environment', value: 'production' }
184184
],
185-
capabilities: ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', 'CAPABILITY_AUTO_EXPAND'],
185+
capabilities: %w[CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND],
186186
role_arn: role_arn,
187187
notification_arns: [notification_arn],
188188
change_set_type: 'CREATE'
@@ -200,7 +200,7 @@ def apply
200200
template_body: proposed_stack.template_body,
201201
parameters: [{ parameter_key: 'param_1', parameter_value: 'hello' }],
202202
tags: [{ key: 'environment', value: 'production' }],
203-
capabilities: ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', 'CAPABILITY_AUTO_EXPAND'],
203+
capabilities: %w[CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND],
204204
role_arn: role_arn,
205205
notification_arns: [notification_arn],
206206
on_failure: 'ROLLBACK'

spec/stack_master/config_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
allowed_accounts: ["555555555"],
1111
tags: { 'application' => 'my-awesome-blog', 'environment' => 'production' },
1212
s3: { 'bucket' => 'my-bucket', 'region' => 'us-east-1' },
13-
notification_arns: ['test_arn', 'test_arn_2'],
13+
notification_arns: %w[test_arn test_arn_2],
1414
role_arn: 'test_service_role_arn2',
1515
base_dir: base_dir,
1616
stack_policy_file: 'my_policy.json',
@@ -154,7 +154,7 @@
154154
tags: { 'application' => 'my-awesome-blog', 'environment' => 'staging', 'test_override' => 1 },
155155
s3: { 'bucket' => 'my-bucket', 'region' => 'us-east-1' },
156156
role_arn: 'test_service_role_arn4',
157-
notification_arns: ['test_arn_3', 'test_arn_4'],
157+
notification_arns: %w[test_arn_3 test_arn_4],
158158
template: 'myapp_vpc.rb',
159159
base_dir: base_dir,
160160
additional_parameter_lookup_dirs: ['staging']
@@ -166,7 +166,7 @@
166166
stack_name: 'myapp-web',
167167
region: 'ap-southeast-2',
168168
region_alias: 'staging',
169-
allowed_accounts: ["1234567890", "9876543210"],
169+
allowed_accounts: %w[1234567890 9876543210],
170170
tags: { 'application' => 'my-awesome-blog', 'environment' => 'staging', 'test_override' => 2 },
171171
s3: { 'bucket' => 'my-bucket', 'region' => 'us-east-1' },
172172
role_arn: 'test_service_role_arn3',

spec/stack_master/parameter_resolvers/latest_container_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
registry_id: '012345678910',
6060
image_digest: 'sha256:decafc0ffee',
6161
image_pushed_at: Time.utc(2015, 1, 2, 0, 0),
62-
image_tags: ['v1', 'production']
62+
image_tags: %w[v1 production]
6363
},
6464
{
6565
registry_id: '012345678910',
@@ -137,7 +137,7 @@
137137
registry_id: '012345678910',
138138
image_digest: 'sha256:deadbeef',
139139
image_pushed_at: Time.utc(2015, 1, 3, 0, 0),
140-
image_tags: ['latest', 'v2']
140+
image_tags: %w[latest v2]
141141
}
142142
]
143143
},

spec/stack_master/sparkle_formation/compile_time/value_build_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
{ definition: { type: :string, default: 'a' }, parameter: nil, expected: 'a' },
88

99
{ definition: { type: :string, multiple: true }, parameter: 'a', expected: ['a'] },
10-
{ definition: { type: :string, multiple: true }, parameter: 'a,b', expected: ['a', 'b'] },
11-
{ definition: { type: :string, multiple: true }, parameter: 'a, b', expected: ['a', 'b'] },
10+
{ definition: { type: :string, multiple: true }, parameter: 'a,b', expected: %w[a b] },
11+
{ definition: { type: :string, multiple: true }, parameter: 'a, b', expected: %w[a b] },
1212

1313
{ definition: { type: :string, multiple: true, default: 'a' }, parameter: nil, expected: ['a'] },
1414

spec/stack_master/test_driver/cloud_formation_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
it 'creates and describes stacks' do
88
test_cf_driver.create_stack(stack_id: "1", stack_name: 'stack-1')
99
test_cf_driver.create_stack(stack_id: "2", stack_name: 'stack-2')
10-
expect(test_cf_driver.describe_stacks.stacks.map(&:stack_id)).to eq(["1", "2"])
10+
expect(test_cf_driver.describe_stacks.stacks.map(&:stack_id)).to eq(%w[1 2])
1111
end
1212

1313
it 'adds and gets stack events' do
1414
test_cf_driver.add_stack_event(stack_name: 'stack-1', resource_status: "UPDATE_COMPLETE")
1515
test_cf_driver.add_stack_event(stack_name: 'stack-1', resource_status: "UPDATE_COMPLETE")
1616
test_cf_driver.add_stack_event(stack_name: 'stack-2')
1717
expect(test_cf_driver.describe_stack_events(stack_name: 'stack-1').stack_events.map(&:stack_name))
18-
.to eq(['stack-1', 'stack-1'])
18+
.to eq(%w[stack-1 stack-1])
1919
end
2020

2121
it 'sets and gets templates' do
@@ -59,7 +59,7 @@
5959
)
6060
test_cf_driver.execute_change_set(change_set_name: change_set1.id)
6161
test_cf_driver.execute_change_set(change_set_name: change_set2.id)
62-
expect(test_cf_driver.describe_stacks.stacks.map(&:stack_name)).to eq(['stack-1', 'stack-2'])
62+
expect(test_cf_driver.describe_stacks.stacks.map(&:stack_name)).to eq(%w[stack-1 stack-2])
6363
end
6464
end
6565

0 commit comments

Comments
 (0)