Skip to content

Commit b775813

Browse files
committed
Layout/FirstArrayElementIndentation
This commit enables the Rubocop Layout/FirstArrayElementIndentation cop and addresses all offenses.
1 parent 9c3a51c commit b775813

File tree

12 files changed

+156
-163
lines changed

12 files changed

+156
-163
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,6 @@ I18n/GetText/DecorateStringFormattingUsingPercent:
2222
I18n/RailsI18n/DecorateString:
2323
Enabled: false
2424

25-
# This cop supports safe auto-correction (--auto-correct).
26-
# Configuration parameters: EnforcedStyle, IndentationWidth.
27-
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
28-
Layout/FirstArrayElementIndentation:
29-
Exclude:
30-
- 'lib/puppet/file_serving/mount/file.rb'
31-
- 'lib/puppet/functions/lookup.rb'
32-
- 'lib/puppet/pops/loader/static_loader.rb'
33-
- 'lib/puppet/pops/model/ast.rb'
34-
- 'lib/puppet/pops/model/pn_transformer.rb'
35-
- 'lib/puppet/pops/resource/resource_type_impl.rb'
36-
- 'lib/puppet/pops/types/iterable.rb'
37-
- 'lib/puppet/pops/types/p_uri_type.rb'
38-
- 'lib/puppet/pops/types/types.rb'
39-
- 'lib/puppet/provider/nameservice/pw.rb'
40-
- 'lib/puppet/type/file/content.rb'
41-
4225
# This cop supports safe auto-correction (--auto-correct).
4326
# Configuration parameters: EnforcedStyle, IndentationWidth.
4427
# SupportedStyles: special_inside_parentheses, consistent, align_braces

lib/puppet/file_serving/mount/file.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ def self.localmap
77
@localmap ||= {
88
"h" => Puppet.runtime[:facter].value('networking.hostname'),
99
"H" => [
10-
Puppet.runtime[:facter].value('networking.hostname'),
11-
Puppet.runtime[:facter].value('networking.domain')
12-
].join("."),
10+
Puppet.runtime[:facter].value('networking.hostname'),
11+
Puppet.runtime[:facter].value('networking.domain')
12+
].join("."),
1313
"d" => Puppet.runtime[:facter].value('networking.domain')
1414
}
1515
end

lib/puppet/functions/lookup.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@ def do_lookup(scope, name, value_type, default_value, has_default, override, def
213213

214214
def hash_args(options_hash)
215215
[
216-
options_hash['value_type'],
217-
options_hash['default_value'],
218-
options_hash.include?('default_value'),
219-
options_hash['override'] || {},
220-
options_hash['default_values_hash'] || {},
221-
options_hash['merge']
216+
options_hash['value_type'],
217+
options_hash['default_value'],
218+
options_hash.include?('default_value'),
219+
options_hash['override'] || {},
220+
options_hash['default_values_hash'] || {},
221+
options_hash['merge']
222222
]
223223
end
224224
end

lib/puppet/pops/loader/static_loader.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ module Puppet::Pops
77
module Loader
88
class StaticLoader < Loader
99
BUILTIN_TYPE_NAMES = %w{
10-
Component
11-
Exec
12-
File
13-
Filebucket
14-
Group
15-
Node
16-
Notify
17-
Package
18-
Resources
19-
Schedule
20-
Service
21-
Stage
22-
Tidy
23-
User
24-
Whit
25-
}.freeze
10+
Component
11+
Exec
12+
File
13+
Filebucket
14+
Group
15+
Node
16+
Notify
17+
Package
18+
Resources
19+
Schedule
20+
Service
21+
Stage
22+
Tidy
23+
User
24+
Whit
25+
}.freeze
2626

2727
BUILTIN_TYPE_NAMES_LC = Set.new(BUILTIN_TYPE_NAMES.map { |n| n.downcase }).freeze
2828

lib/puppet/pops/model/ast.rb

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -4572,90 +4572,90 @@ def self.register_pcore_types
45724572

45734573
@@pcore_ast_initialized = true
45744574
all_types = [
4575-
Parser::Locator::Locator19,
4576-
Model::PopsObject,
4577-
Model::Positioned,
4578-
Model::Expression,
4579-
Model::Nop,
4580-
Model::BinaryExpression,
4581-
Model::UnaryExpression,
4582-
Model::ParenthesizedExpression,
4583-
Model::NotExpression,
4584-
Model::UnaryMinusExpression,
4585-
Model::UnfoldExpression,
4586-
Model::AssignmentExpression,
4587-
Model::ArithmeticExpression,
4588-
Model::RelationshipExpression,
4589-
Model::AccessExpression,
4590-
Model::ComparisonExpression,
4591-
Model::MatchExpression,
4592-
Model::InExpression,
4593-
Model::BooleanExpression,
4594-
Model::AndExpression,
4595-
Model::OrExpression,
4596-
Model::LiteralList,
4597-
Model::KeyedEntry,
4598-
Model::LiteralHash,
4599-
Model::BlockExpression,
4600-
Model::ApplyBlockExpression,
4601-
Model::CaseOption,
4602-
Model::CaseExpression,
4603-
Model::QueryExpression,
4604-
Model::ExportedQuery,
4605-
Model::VirtualQuery,
4606-
Model::AbstractAttributeOperation,
4607-
Model::AttributeOperation,
4608-
Model::AttributesOperation,
4609-
Model::CollectExpression,
4610-
Model::Parameter,
4611-
Model::Definition,
4612-
Model::NamedDefinition,
4613-
Model::FunctionDefinition,
4614-
Model::ResourceTypeDefinition,
4615-
Model::QRefDefinition,
4616-
Model::TypeAlias,
4617-
Model::TypeMapping,
4618-
Model::TypeDefinition,
4619-
Model::NodeDefinition,
4620-
Model::HeredocExpression,
4621-
Model::HostClassDefinition,
4622-
Model::PlanDefinition,
4623-
Model::LambdaExpression,
4624-
Model::ApplyExpression,
4625-
Model::IfExpression,
4626-
Model::UnlessExpression,
4627-
Model::CallExpression,
4628-
Model::CallFunctionExpression,
4629-
Model::CallNamedFunctionExpression,
4630-
Model::CallMethodExpression,
4631-
Model::Literal,
4632-
Model::LiteralValue,
4633-
Model::LiteralRegularExpression,
4634-
Model::LiteralString,
4635-
Model::LiteralNumber,
4636-
Model::LiteralInteger,
4637-
Model::LiteralFloat,
4638-
Model::LiteralUndef,
4639-
Model::LiteralDefault,
4640-
Model::LiteralBoolean,
4641-
Model::TextExpression,
4642-
Model::ConcatenatedString,
4643-
Model::QualifiedName,
4644-
Model::ReservedWord,
4645-
Model::QualifiedReference,
4646-
Model::VariableExpression,
4647-
Model::EppExpression,
4648-
Model::RenderStringExpression,
4649-
Model::RenderExpression,
4650-
Model::ResourceBody,
4651-
Model::AbstractResource,
4652-
Model::ResourceExpression,
4653-
Model::ResourceDefaultsExpression,
4654-
Model::ResourceOverrideExpression,
4655-
Model::SelectorEntry,
4656-
Model::SelectorExpression,
4657-
Model::NamedAccessExpression,
4658-
Model::Program]
4575+
Parser::Locator::Locator19,
4576+
Model::PopsObject,
4577+
Model::Positioned,
4578+
Model::Expression,
4579+
Model::Nop,
4580+
Model::BinaryExpression,
4581+
Model::UnaryExpression,
4582+
Model::ParenthesizedExpression,
4583+
Model::NotExpression,
4584+
Model::UnaryMinusExpression,
4585+
Model::UnfoldExpression,
4586+
Model::AssignmentExpression,
4587+
Model::ArithmeticExpression,
4588+
Model::RelationshipExpression,
4589+
Model::AccessExpression,
4590+
Model::ComparisonExpression,
4591+
Model::MatchExpression,
4592+
Model::InExpression,
4593+
Model::BooleanExpression,
4594+
Model::AndExpression,
4595+
Model::OrExpression,
4596+
Model::LiteralList,
4597+
Model::KeyedEntry,
4598+
Model::LiteralHash,
4599+
Model::BlockExpression,
4600+
Model::ApplyBlockExpression,
4601+
Model::CaseOption,
4602+
Model::CaseExpression,
4603+
Model::QueryExpression,
4604+
Model::ExportedQuery,
4605+
Model::VirtualQuery,
4606+
Model::AbstractAttributeOperation,
4607+
Model::AttributeOperation,
4608+
Model::AttributesOperation,
4609+
Model::CollectExpression,
4610+
Model::Parameter,
4611+
Model::Definition,
4612+
Model::NamedDefinition,
4613+
Model::FunctionDefinition,
4614+
Model::ResourceTypeDefinition,
4615+
Model::QRefDefinition,
4616+
Model::TypeAlias,
4617+
Model::TypeMapping,
4618+
Model::TypeDefinition,
4619+
Model::NodeDefinition,
4620+
Model::HeredocExpression,
4621+
Model::HostClassDefinition,
4622+
Model::PlanDefinition,
4623+
Model::LambdaExpression,
4624+
Model::ApplyExpression,
4625+
Model::IfExpression,
4626+
Model::UnlessExpression,
4627+
Model::CallExpression,
4628+
Model::CallFunctionExpression,
4629+
Model::CallNamedFunctionExpression,
4630+
Model::CallMethodExpression,
4631+
Model::Literal,
4632+
Model::LiteralValue,
4633+
Model::LiteralRegularExpression,
4634+
Model::LiteralString,
4635+
Model::LiteralNumber,
4636+
Model::LiteralInteger,
4637+
Model::LiteralFloat,
4638+
Model::LiteralUndef,
4639+
Model::LiteralDefault,
4640+
Model::LiteralBoolean,
4641+
Model::TextExpression,
4642+
Model::ConcatenatedString,
4643+
Model::QualifiedName,
4644+
Model::ReservedWord,
4645+
Model::QualifiedReference,
4646+
Model::VariableExpression,
4647+
Model::EppExpression,
4648+
Model::RenderStringExpression,
4649+
Model::RenderExpression,
4650+
Model::ResourceBody,
4651+
Model::AbstractResource,
4652+
Model::ResourceExpression,
4653+
Model::ResourceDefaultsExpression,
4654+
Model::ResourceOverrideExpression,
4655+
Model::SelectorEntry,
4656+
Model::SelectorExpression,
4657+
Model::NamedAccessExpression,
4658+
Model::Program]
46594659

46604660
# Create and register a TypeSet that corresponds to all types in the AST model
46614661
types_map = {}

lib/puppet/pops/model/pn_transformer.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ def transform_ReservedWord(e)
247247

248248
def transform_ResourceBody(e)
249249
PN::Map.new([
250-
transform(e.title).with_name('title'),
251-
transform(e.operations).with_name('ops')
252-
]).as_call('resource_body')
250+
transform(e.title).with_name('title'),
251+
transform(e.operations).with_name('ops')
252+
]).as_call('resource_body')
253253
end
254254

255255
def transform_ResourceDefaultsExpression(e)

lib/puppet/pops/resource/resource_type_impl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def <=>(other)
9090
:before,
9191
:notify,
9292
:stage
93-
].freeze
93+
].freeze
9494

9595
# Speed up lookup
9696
METAPARAMSET = Set.new(METAPARAMS).freeze

lib/puppet/pops/types/iterable.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@ def self.on(o, element_type = nil, infer_elements = true)
8585
else
8686
if element_type.nil? && infer_elements
8787
tc = TypeCalculator.singleton
88-
element_type = PTupleType.new([
89-
PVariantType.maybe_create(o.keys.map {|e| tc.infer_set(e) }),
90-
PVariantType.maybe_create(o.values.map {|e| tc.infer_set(e) })], PHashType::KEY_PAIR_TUPLE_SIZE)
88+
element_type =
89+
PTupleType
90+
.new([
91+
PVariantType.maybe_create(o.keys.map {|e| tc.infer_set(e) }),
92+
PVariantType.maybe_create(o.values.map {|e| tc.infer_set(e) })
93+
],
94+
PHashType::KEY_PAIR_TUPLE_SIZE)
9195
end
9296
HashIterator.new(element_type, o.each_pair)
9397
end

lib/puppet/pops/types/p_uri_type.rb

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,26 @@ class PURIType < PAnyType
3737
TypeFactory.optional(OPAQUE) => PStringType::NON_EMPTY,
3838
)
3939

40-
TYPE_STRING_PARAM = TypeFactory.optional(PVariantType.new([
41-
PStringType::NON_EMPTY,
42-
PRegexpType::DEFAULT,
43-
TypeFactory.type_type(PPatternType::DEFAULT),
44-
TypeFactory.type_type(PEnumType::DEFAULT),
45-
TypeFactory.type_type(PNotUndefType::DEFAULT),
46-
TypeFactory.type_type(PUndefType::DEFAULT),
47-
]))
48-
49-
TYPE_INTEGER_PARAM = TypeFactory.optional(PVariantType.new([
50-
PIntegerType.new(0),
51-
TypeFactory.type_type(PNotUndefType::DEFAULT),
52-
TypeFactory.type_type(PUndefType::DEFAULT),
53-
]))
40+
TYPE_STRING_PARAM =
41+
TypeFactory
42+
.optional(PVariantType
43+
.new([
44+
PStringType::NON_EMPTY,
45+
PRegexpType::DEFAULT,
46+
TypeFactory.type_type(PPatternType::DEFAULT),
47+
TypeFactory.type_type(PEnumType::DEFAULT),
48+
TypeFactory.type_type(PNotUndefType::DEFAULT),
49+
TypeFactory.type_type(PUndefType::DEFAULT),
50+
]))
51+
52+
TYPE_INTEGER_PARAM =
53+
TypeFactory
54+
.optional(PVariantType
55+
.new([
56+
PIntegerType.new(0),
57+
TypeFactory.type_type(PNotUndefType::DEFAULT),
58+
TypeFactory.type_type(PUndefType::DEFAULT),
59+
]))
5460

5561
TYPE_URI_PARAM_HASH_TYPE = TypeFactory.struct(
5662
TypeFactory.optional(SCHEME) => TYPE_STRING_PARAM,

lib/puppet/pops/types/types.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,8 +2051,8 @@ def iterable_type(guard = nil)
20512051
else
20522052
PIterableType.new(
20532053
PTupleType.new([
2054-
PVariantType.maybe_create(@elements.map {|se| se.key_type }),
2055-
PVariantType.maybe_create(@elements.map {|se| se.value_type })],
2054+
PVariantType.maybe_create(@elements.map {|se| se.key_type }),
2055+
PVariantType.maybe_create(@elements.map {|se| se.value_type })],
20562056
PHashType::KEY_PAIR_TUPLE_SIZE))
20572057
end
20582058
end

0 commit comments

Comments
 (0)