Skip to content

Commit e88dde0

Browse files
committed
Layout/IndentationConsistency
This commit enables the Rubocop Layout/IndentationConsistency cop and addresses all offenses.
1 parent 65b5421 commit e88dde0

File tree

21 files changed

+434
-440
lines changed

21 files changed

+434
-440
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-
# Configuration parameters: EnforcedStyle.
27-
# SupportedStyles: normal, indented_internal_methods
28-
Layout/IndentationConsistency:
29-
Enabled: false
30-
3125
# This cop supports safe auto-correction (--auto-correct).
3226
# Configuration parameters: IndentationWidth, EnforcedStyle.
3327
# SupportedStyles: spaces, tabs

lib/puppet/application/resource.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,16 @@ def main
149149

150150
resources = find_or_save_resources(type, name, params)
151151

152-
if options[:to_yaml]
153-
data = resources.map do |resource|
154-
resource.prune_parameters(:parameters_to_include => @extra_params).to_hiera_hash
155-
end.inject(:merge!)
156-
text = YAML.dump(type.downcase => data)
157-
else
158-
text = resources.map do |resource|
159-
resource.prune_parameters(:parameters_to_include => @extra_params).to_manifest.force_encoding(Encoding.default_external)
160-
end.join("\n")
161-
end
152+
if options[:to_yaml]
153+
data = resources.map do |resource|
154+
resource.prune_parameters(:parameters_to_include => @extra_params).to_hiera_hash
155+
end.inject(:merge!)
156+
text = YAML.dump(type.downcase => data)
157+
else
158+
text = resources.map do |resource|
159+
resource.prune_parameters(:parameters_to_include => @extra_params).to_manifest.force_encoding(Encoding.default_external)
160+
end.join("\n")
161+
end
162162

163163
options[:edit] ?
164164
handle_editing(text) :

lib/puppet/external/dot.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,13 @@ def to_s(t = '')
212212
}.join( "| \\\n" ) + " \\\n" +
213213
t + $tab + '"' + "\n"
214214

215-
t + "#{@name} [\n" +
216-
@options.to_a.collect{ |i|
217-
i[1] && i[0] != 'label' ?
218-
t + $tab + "#{i[0]} = #{i[1]}" : nil
219-
}.compact.join( ",\n" ) + ( label != '' ? ",\n" : "\n" ) +
220-
label +
221-
t + "]\n"
215+
t + "#{@name} [\n" +
216+
@options.to_a.collect{ |i|
217+
i[1] && i[0] != 'label' ?
218+
t + $tab + "#{i[0]} = #{i[1]}" : nil
219+
}.compact.join( ",\n" ) + ( label != '' ? ",\n" : "\n" ) +
220+
label +
221+
t + "]\n"
222222
end
223223

224224
private

lib/puppet/ffi/windows/structs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ class OSVERSIONINFO < FFI::Struct
258258
)
259259
end
260260

261-
MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384
261+
MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384
262262

263263
# SYMLINK_REPARSE_DATA_BUFFER
264264
# https://msdn.microsoft.com/en-us/library/cc232006.aspx

lib/puppet/functions/getvar.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
Puppet::Functions.create_function(:getvar, Puppet::Functions::InternalFunction) do
4848
dispatch :get_from_navigation do
4949
scope_param
50-
param 'Pattern[/\A(?:::)?(?:[a-z]\w*::)*[a-z_]\w*(?:\.|\Z)/]', :get_string
50+
param 'Pattern[/\A(?:::)?(?:[a-z]\w*::)*[a-z_]\w*(?:\.|\Z)/]', :get_string
5151
optional_param 'Any', :default_value
5252
optional_block_param 'Callable[1,1]', :block
5353
end

lib/puppet/network/http/api/indirected_routes.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ def indirection_method(http_method, indirection)
246246
raise Puppet::Network::HTTP::Error::HTTPMethodNotAllowedError.new(
247247
_("No support for http method %{http_method}") % { http_method: http_method }) unless METHOD_MAP[http_method]
248248

249-
method = METHOD_MAP[http_method][plurality(indirection)]
250-
unless method
251-
raise Puppet::Network::HTTP::Error::HTTPBadRequestError.new(
252-
_("No support for plurality %{indirection} for %{http_method} operations") % { indirection: plurality(indirection), http_method: http_method })
253-
end
249+
method = METHOD_MAP[http_method][plurality(indirection)]
250+
unless method
251+
raise Puppet::Network::HTTP::Error::HTTPBadRequestError.new(
252+
_("No support for plurality %{indirection} for %{http_method} operations") % { indirection: plurality(indirection), http_method: http_method })
253+
end
254254

255255
method
256256
end

lib/puppet/parser/functions/inline_template.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313

1414
require 'erb'
1515

16-
vals.collect do |string|
17-
# Use a wrapper, so the template can't get access to the full
18-
# Scope object.
16+
vals.collect do |string|
17+
# Use a wrapper, so the template can't get access to the full
18+
# Scope object.
1919

20-
wrapper = Puppet::Parser::TemplateWrapper.new(self)
21-
begin
22-
wrapper.result(string)
23-
rescue => detail
24-
raise Puppet::ParseError, _("Failed to parse inline template: %{detail}") % { detail: detail }, detail.backtrace
25-
end
26-
end.join("")
20+
wrapper = Puppet::Parser::TemplateWrapper.new(self)
21+
begin
22+
wrapper.result(string)
23+
rescue => detail
24+
raise Puppet::ParseError, _("Failed to parse inline template: %{detail}") % { detail: detail }, detail.backtrace
25+
end
26+
end.join("")
2727
end

0 commit comments

Comments
 (0)