Skip to content

Commit 9c3a51c

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

File tree

23 files changed

+154
-155
lines changed

23 files changed

+154
-155
lines changed

.rubocop.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ Layout/ElseAlignment:
3333
Exclude:
3434
- 'lib/puppet/provider/package/*.rb'
3535

36+
# Formatting in defaults is unusual
37+
Layout/FirstArgumentIndentation:
38+
Exclude:
39+
- 'lib/puppet/defaults.rb'
40+
3641
# puppet uses symbol booleans in types and providers to work around long standing
3742
# bugs when trying to manage falsey pararameters and properties
3843
Lint/BooleanSymbol:

.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, IndentationWidth.
27-
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
28-
Layout/FirstArgumentIndentation:
29-
Enabled: false
30-
3125
# This cop supports safe auto-correction (--auto-correct).
3226
# Configuration parameters: EnforcedStyle, IndentationWidth.
3327
# SupportedStyles: special_inside_parentheses, consistent, align_brackets

lib/puppet/application.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ def initialize(command_line = Puppet::Util::CommandLine.new)
365365
# @api public
366366
def app_defaults
367367
Puppet::Settings.app_defaults_for_run_mode(self.class.run_mode).merge(
368-
:name => name
369-
)
368+
:name => name
369+
)
370370
end
371371

372372
# Initialize application defaults. It's usually not necessary to override this method.

lib/puppet/error.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ def self.from_issue_and_stack(issue, args = {})
9999
filename, line = Puppet::Pops::PuppetStack.top_of_stack
100100

101101
self.new(
102-
issue.format(args),
103-
filename,
104-
line,
105-
nil,
106-
nil,
107-
issue.issue_code,
108-
args)
102+
issue.format(args),
103+
filename,
104+
line,
105+
nil,
106+
nil,
107+
issue.issue_code,
108+
args)
109109
end
110110
end
111111

lib/puppet/ffi/windows/constants.rb

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -163,48 +163,48 @@ module Constants
163163

164164
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379626(v=vs.85).aspx
165165
TOKEN_INFORMATION_CLASS = enum(
166-
:TokenUser, 1,
167-
:TokenGroups,
168-
:TokenPrivileges,
169-
:TokenOwner,
170-
:TokenPrimaryGroup,
171-
:TokenDefaultDacl,
172-
:TokenSource,
173-
:TokenType,
174-
:TokenImpersonationLevel,
175-
:TokenStatistics,
176-
:TokenRestrictedSids,
177-
:TokenSessionId,
178-
:TokenGroupsAndPrivileges,
179-
:TokenSessionReference,
180-
:TokenSandBoxInert,
181-
:TokenAuditPolicy,
182-
:TokenOrigin,
183-
:TokenElevationType,
184-
:TokenLinkedToken,
185-
:TokenElevation,
186-
:TokenHasRestrictions,
187-
:TokenAccessInformation,
188-
:TokenVirtualizationAllowed,
189-
:TokenVirtualizationEnabled,
190-
:TokenIntegrityLevel,
191-
:TokenUIAccess,
192-
:TokenMandatoryPolicy,
193-
:TokenLogonSid,
194-
:TokenIsAppContainer,
195-
:TokenCapabilities,
196-
:TokenAppContainerSid,
197-
:TokenAppContainerNumber,
198-
:TokenUserClaimAttributes,
199-
:TokenDeviceClaimAttributes,
200-
:TokenRestrictedUserClaimAttributes,
201-
:TokenRestrictedDeviceClaimAttributes,
202-
:TokenDeviceGroups,
203-
:TokenRestrictedDeviceGroups,
204-
:TokenSecurityAttributes,
205-
:TokenIsRestricted,
206-
:MaxTokenInfoClass
207-
)
166+
:TokenUser, 1,
167+
:TokenGroups,
168+
:TokenPrivileges,
169+
:TokenOwner,
170+
:TokenPrimaryGroup,
171+
:TokenDefaultDacl,
172+
:TokenSource,
173+
:TokenType,
174+
:TokenImpersonationLevel,
175+
:TokenStatistics,
176+
:TokenRestrictedSids,
177+
:TokenSessionId,
178+
:TokenGroupsAndPrivileges,
179+
:TokenSessionReference,
180+
:TokenSandBoxInert,
181+
:TokenAuditPolicy,
182+
:TokenOrigin,
183+
:TokenElevationType,
184+
:TokenLinkedToken,
185+
:TokenElevation,
186+
:TokenHasRestrictions,
187+
:TokenAccessInformation,
188+
:TokenVirtualizationAllowed,
189+
:TokenVirtualizationEnabled,
190+
:TokenIntegrityLevel,
191+
:TokenUIAccess,
192+
:TokenMandatoryPolicy,
193+
:TokenLogonSid,
194+
:TokenIsAppContainer,
195+
:TokenCapabilities,
196+
:TokenAppContainerSid,
197+
:TokenAppContainerNumber,
198+
:TokenUserClaimAttributes,
199+
:TokenDeviceClaimAttributes,
200+
:TokenRestrictedUserClaimAttributes,
201+
:TokenRestrictedDeviceClaimAttributes,
202+
:TokenDeviceGroups,
203+
:TokenRestrictedDeviceGroups,
204+
:TokenSecurityAttributes,
205+
:TokenIsRestricted,
206+
:MaxTokenInfoClass
207+
)
208208

209209
# Service error codes
210210
# https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--1000-1299-

lib/puppet/functions/dig.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ def dig(data, *args)
4444
t = Puppet::Pops::Types::TypeCalculator.infer(d)
4545
msg = _("The given data does not contain a Collection at %{walked_path}, got '%{type}'") % { walked_path: walked_path, type: t }
4646
error_data = Puppet::DataTypes::Error.new(
47-
msg,
48-
'SLICE_ERROR',
49-
{'walked_path' => walked_path, 'value_type' => t},
50-
'EXPECTED_COLLECTION'
51-
)
47+
msg,
48+
'SLICE_ERROR',
49+
{'walked_path' => walked_path, 'value_type' => t},
50+
'EXPECTED_COLLECTION'
51+
)
5252
raise Puppet::ErrorWithData.new(error_data, msg)
5353
end
5454

@@ -57,11 +57,11 @@ def dig(data, *args)
5757
t = Puppet::Pops::Types::TypeCalculator.infer(k)
5858
msg = _("The given data requires an Integer index at %{walked_path}, got '%{type}'") % { walked_path: walked_path, type: t }
5959
error_data = Puppet::DataTypes::Error.new(
60-
msg,
61-
'SLICE_ERROR',
62-
{'walked_path' => walked_path, 'index_type' => t},
63-
'EXPECTED_INTEGER_INDEX'
64-
)
60+
msg,
61+
'SLICE_ERROR',
62+
{'walked_path' => walked_path, 'index_type' => t},
63+
'EXPECTED_INTEGER_INDEX'
64+
)
6565
raise Puppet::ErrorWithData.new(error_data, msg)
6666
end
6767
d[k]

lib/puppet/module_tool/applications/installer.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ def run
184184
end
185185

186186
raise NoVersionsSatisfyError, results.merge(
187-
:requested_name => name,
188-
:requested_version => options[:version] || graph.dependencies[name].max.version.to_s,
189-
:unsatisfied => unsatisfied
190-
)
187+
:requested_name => name,
188+
:requested_version => options[:version] || graph.dependencies[name].max.version.to_s,
189+
:unsatisfied => unsatisfied
190+
)
191191
end
192192

193193
unless forced?

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ def first_response_formatter_for(model, request, key, &block)
207207
return formatter if formatter
208208

209209
raise Puppet::Network::HTTP::Error::HTTPNotAcceptableError.new(
210-
_("No supported formats are acceptable (Accept: %{accepted_formats})") % { accepted_formats: formats.map(&:mime).join(', ') },
211-
Puppet::Network::HTTP::Issues::UNSUPPORTED_FORMAT)
210+
_("No supported formats are acceptable (Accept: %{accepted_formats})") % { accepted_formats: formats.map(&:mime).join(', ') },
211+
Puppet::Network::HTTP::Issues::UNSUPPORTED_FORMAT)
212212
end
213213

214214
# Return an array of response formatters that the client accepts and
@@ -249,7 +249,7 @@ def indirection_method(http_method, indirection)
249249
method = METHOD_MAP[http_method][plurality(indirection)]
250250
unless method
251251
raise Puppet::Network::HTTP::Error::HTTPBadRequestError.new(
252-
_("No support for plurality %{indirection} for %{http_method} operations") % { indirection: plurality(indirection), http_method: http_method })
252+
_("No support for plurality %{indirection} for %{http_method} operations") % { indirection: plurality(indirection), http_method: http_method })
253253
end
254254

255255
method

lib/puppet/network/http/handler.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def find_route_or_raise(request)
111111
return route
112112
else
113113
raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new(
114-
_("No route for %{request} %{path}") % { request: request.method, path: request.path },
115-
HANDLER_NOT_FOUND)
114+
_("No route for %{request} %{path}") % { request: request.method, path: request.path },
115+
HANDLER_NOT_FOUND)
116116
end
117117
end
118118

lib/puppet/network/http/request.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ def formatter
3737

3838
#TRANSLATORS "mime-type" is a keyword and should not be translated
3939
raise Puppet::Network::HTTP::Error::HTTPUnsupportedMediaTypeError.new(
40-
_("Client sent a mime-type (%{header}) that doesn't correspond to a format we support") % { header: headers['content-type'] },
41-
Puppet::Network::HTTP::Issues::UNSUPPORTED_MEDIA_TYPE)
40+
_("Client sent a mime-type (%{header}) that doesn't correspond to a format we support") % { header: headers['content-type'] },
41+
Puppet::Network::HTTP::Issues::UNSUPPORTED_MEDIA_TYPE)
4242
end
4343

4444
raise Puppet::Network::HTTP::Error::HTTPBadRequestError.new(
45-
_("No Content-Type header was received, it isn't possible to unserialize the request"),
46-
Puppet::Network::HTTP::Issues::MISSING_HEADER_FIELD)
45+
_("No Content-Type header was received, it isn't possible to unserialize the request"),
46+
Puppet::Network::HTTP::Issues::MISSING_HEADER_FIELD)
4747
end
4848

4949
def response_formatters_for(supported_formats, default_accepted_formats = nil)

0 commit comments

Comments
 (0)