Skip to content

Commit d110d95

Browse files
committed
Layout/ArrayAlignment
This commit enables the Rubocop Layout/ArrayAlignment cop and addresses all offenses.
1 parent b8d5099 commit d110d95

File tree

9 files changed

+24
-37
lines changed

9 files changed

+24
-37
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +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: with_first_element, with_fixed_indentation
28-
Layout/ArrayAlignment:
29-
Exclude:
30-
- 'lib/puppet/module/plan.rb'
31-
- 'lib/puppet/pops/model/model_tree_dumper.rb'
32-
- 'lib/puppet/pops/parser/heredoc_support.rb'
33-
- 'lib/puppet/pops/parser/lexer2.rb'
34-
- 'lib/puppet/provider/service/init.rb'
35-
- 'lib/puppet/util/log/destinations.rb'
36-
- 'lib/puppet/util/posix.rb'
37-
- 'lib/puppet/util/windows/registry.rb'
38-
3925
# This cop supports safe auto-correction (--auto-correct).
4026
# Configuration parameters: IndentationWidth.
4127
Layout/AssignmentIndentation:

lib/puppet/module/plan.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ def initialize(plan_name, module_name)
4646

4747
ALLOWED_EXTENSIONS = %w{.pp .yaml}
4848
RESERVED_WORDS = %w{and application attr case class consumes default else
49-
elsif environment false function if import in inherits node or private
50-
produces site true type undef unless}
49+
elsif environment false function if import in inherits node or private
50+
produces site true type undef unless}
5151
RESERVED_DATA_TYPES = %w{any array boolean catalogentry class collection
52-
callable data default enum float hash integer numeric optional pattern
53-
resource runtime scalar string struct tuple type undef variant}
52+
callable data default enum float hash integer numeric optional pattern
53+
resource runtime scalar string struct tuple type undef variant}
5454

5555
def self.is_plan_name?(name)
5656
return true if name =~ /^[a-z][a-z0-9_]*$/

lib/puppet/pops/model/model_tree_dumper.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,21 +319,21 @@ def dump_Program(o)
319319

320320
def dump_IfExpression o
321321
result = ["if", do_dump(o.test), :indent, :break,
322-
["then", :indent, do_dump(o.then_expr), :dedent]]
322+
["then", :indent, do_dump(o.then_expr), :dedent]]
323323
result +=
324324
[:break,
325-
["else", :indent, do_dump(o.else_expr), :dedent],
326-
:dedent] unless is_nop? o.else_expr
325+
["else", :indent, do_dump(o.else_expr), :dedent],
326+
:dedent] unless is_nop? o.else_expr
327327
result
328328
end
329329

330330
def dump_UnlessExpression o
331331
result = ["unless", do_dump(o.test), :indent, :break,
332-
["then", :indent, do_dump(o.then_expr), :dedent]]
332+
["then", :indent, do_dump(o.then_expr), :dedent]]
333333
result +=
334334
[:break,
335-
["else", :indent, do_dump(o.else_expr), :dedent],
336-
:dedent] unless is_nop? o.else_expr
335+
["else", :indent, do_dump(o.else_expr), :dedent],
336+
:dedent] unless is_nop? o.else_expr
337337
result
338338
end
339339

lib/puppet/pops/parser/heredoc_support.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ def heredoc
106106
# Emit a token that provides the grammar with location information about the lines on which the heredoc
107107
# content is based.
108108
enqueue([:SUBLOCATE,
109-
LexerSupport::TokenValue.new([:SUBLOCATE,
110-
lines, lines.reduce(0) {|size, s| size + s.length} ],
111-
heredoc_offset,
112-
locator)])
109+
LexerSupport::TokenValue.new([:SUBLOCATE,
110+
lines, lines.reduce(0) {|size, s| size + s.length} ],
111+
heredoc_offset,
112+
locator)])
113113

114114
sublexer.lex_unquoted_string(str, locator, resulting_escapes, dqstring_style)
115115
sublexer.interpolate_uq_to(self)

lib/puppet/pops/parser/lexer2.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def initialize()
524524
end
525525
end
526526
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
527-
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '_'].each do |c|
527+
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '_'].each do |c|
528528
@selector[c] = lambda do
529529
scn = @scanner
530530
before = scn.pos
@@ -547,7 +547,7 @@ def initialize()
547547
end
548548

549549
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
550-
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'].each do |c|
550+
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'].each do |c|
551551
@selector[c] = lambda do
552552
scn = @scanner
553553
before = scn.pos

lib/puppet/provider/service/init.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def self.excludes
5454
# Prevent puppet failing on unsafe scripts from Yocto Linux
5555
if Puppet.runtime[:facter].value('os.family') == "cisco-wrlinux"
5656
excludes += %w{banner.sh bootmisc.sh checkroot.sh devpts.sh dmesg.sh
57-
hostname.sh mountall.sh mountnfs.sh populate-volatile.sh
58-
rmnologin.sh save-rtc.sh sendsigs sysfs.sh umountfs
59-
umountnfs.sh}
57+
hostname.sh mountall.sh mountnfs.sh populate-volatile.sh
58+
rmnologin.sh save-rtc.sh sendsigs sysfs.sh umountfs
59+
umountnfs.sh}
6060
end
6161
# Prevent puppet failing to get status of the new service introduced
6262
# by the fix for this (bug https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/982889)

lib/puppet/util/log/destinations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def handle(msg)
3636
else
3737
msg.to_s.split("\n").each do |line|
3838
@syslog.send(msg.level, "(%s) %s" % [msg.source.to_s.delete("%"),
39-
line.gsub("%", '%%')
39+
line.gsub("%", '%%')
4040
]
4141
)
4242
end

lib/puppet/util/posix.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Puppet::Util::POSIX
44

55
# This is a list of environment variables that we will set when we want to override the POSIX locale
66
LOCALE_ENV_VARS = ['LANG', 'LC_ALL', 'LC_MESSAGES', 'LANGUAGE',
7-
'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME']
7+
'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME']
88

99
# This is a list of user-related environment variables that we will unset when we want to provide a pristine
1010
# environment for "exec" runs

lib/puppet/util/windows/registry.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ def reg_delete_key_ex(key, name, regsam = KEY64)
401401
# );
402402
ffi_lib :advapi32
403403
attach_function_private :RegQueryInfoKeyW,
404-
[:handle, :lpwstr, :lpdword, :lpdword, :lpdword, :lpdword, :lpdword,
405-
:lpdword, :lpdword, :lpdword, :lpdword, :pointer], :win32_long
404+
[:handle, :lpwstr, :lpdword, :lpdword, :lpdword,
405+
:lpdword, :lpdword, :lpdword, :lpdword, :lpdword,
406+
:lpdword, :pointer], :win32_long
406407
end
407408
end

0 commit comments

Comments
 (0)