Skip to content

Commit 5279caa

Browse files
committed
Layout/SpaceInsideRangeLiteral
This commit enables the Rubocop Layout/SpaceInsideRangeLiteral cop and addresses all offenses.
1 parent 89aa3f8 commit 5279caa

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

.rubocop_todo.yml

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

25-
# This cop supports safe auto-correction (--auto-correct).
26-
Layout/SpaceInsideRangeLiteral:
27-
Exclude:
28-
- 'lib/puppet/pops/validation/checker4_0.rb'
29-
- 'lib/puppet/util/command_line/trollop.rb'
30-
3125
# This cop supports safe auto-correction (--auto-correct).
3226
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
3327
# SupportedStyles: space, no_space

lib/puppet/pops/validation/checker4_0.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,14 +651,14 @@ def dir_to_names(relative_path)
651651
# and from the manifests dir there. This may never get used...
652652
return BAD_MODULE_FILE unless dir == 'manifests' || dir == 'functions' || dir == 'types' || dir == 'plans'
653653

654-
names = path_components[2 .. -2] # Directories inside module
654+
names = path_components[2..-2] # Directories inside module
655655
names.unshift(path_components[0]) # Name of the module itself
656656

657657
# Do not include name of module init file at top level of module
658658
# e.g. <module name>/manifests/init.pp
659659
filename = path_components[-1]
660660
if !(path_components.length == 3 && filename == 'init.pp')
661-
names.push(filename[0 .. -4]) # Remove .pp from filename
661+
names.push(filename[0..-4]) # Remove .pp from filename
662662
end
663663

664664
names

lib/puppet/util/command_line/trollop.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,12 +570,12 @@ def each_arg args
570570

571571
until i >= args.length
572572
if @stop_words.member? args[i]
573-
remains += args[i .. -1]
573+
remains += args[i..-1]
574574
return remains
575575
end
576576
case args[i]
577577
when /^--$/ # arg terminator
578-
remains += args[(i + 1) .. -1]
578+
remains += args[(i + 1)..-1]
579579
return remains
580580
when /^--(\S+?)=(.*)$/ # long argument with equals
581581
yield "--#{$1}", [$2]
@@ -586,7 +586,7 @@ def each_arg args
586586
num_params_taken = yield args[i], params
587587
unless num_params_taken
588588
if @stop_on_unknown
589-
remains += args[i + 1 .. -1]
589+
remains += args[i + 1..-1]
590590
return remains
591591
else
592592
remains += params
@@ -606,7 +606,7 @@ def each_arg args
606606
num_params_taken = yield "-#{a}", params
607607
unless num_params_taken
608608
if @stop_on_unknown
609-
remains += args[i + 1 .. -1]
609+
remains += args[i + 1..-1]
610610
return remains
611611
else
612612
remains += params
@@ -623,7 +623,7 @@ def each_arg args
623623
end
624624
else
625625
if @stop_on_unknown
626-
remains += args[i .. -1]
626+
remains += args[i..-1]
627627
return remains
628628
else
629629
remains << args[i]
@@ -699,7 +699,7 @@ def wrap_line str, opts = {}
699699
x = str.index(/\s/, start) if x && x < start
700700
x || str.length
701701
end
702-
ret << (ret.empty? ? "" : " " * prefix) + str[start ... nextt]
702+
ret << (ret.empty? ? "" : " " * prefix) + str[start...nextt]
703703
start = nextt + 1
704704
end
705705
ret

0 commit comments

Comments
 (0)