Skip to content

Commit 937f2f2

Browse files
committed
(PUP-11993) Style/TrailingCommaInArguments
This commit enables the Style/TrailingCommaInArguments cop and fixes 17 autocorrectable offenses.
1 parent 06c4a92 commit 937f2f2

File tree

11 files changed

+16
-33
lines changed

11 files changed

+16
-33
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -734,23 +734,6 @@ Style/SymbolArray:
734734
Style/TernaryParentheses:
735735
Enabled: false
736736

737-
# This cop supports safe auto-correction (--auto-correct).
738-
# Configuration parameters: EnforcedStyleForMultiline.
739-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
740-
Style/TrailingCommaInArguments:
741-
Exclude:
742-
- 'lib/puppet/defaults.rb'
743-
- 'lib/puppet/ffi/windows/functions.rb'
744-
- 'lib/puppet/ffi/windows/structs.rb'
745-
- 'lib/puppet/http/service/compiler.rb'
746-
- 'lib/puppet/http/service/report.rb'
747-
- 'lib/puppet/indirector/file_bucket_file/rest.rb'
748-
- 'lib/puppet/indirector/file_content/rest.rb'
749-
- 'lib/puppet/indirector/file_metadata/rest.rb'
750-
- 'lib/puppet/pops/types/p_uri_type.rb'
751-
- 'lib/puppet/util/windows/adsi.rb'
752-
- 'lib/puppet/util/windows/service.rb'
753-
754737
# This cop supports safe auto-correction (--auto-correct).
755738
# Configuration parameters: EnforcedStyleForMultiline.
756739
# SupportedStylesForMultiline: comma, consistent_comma, no_comma

lib/puppet/defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ def self.initialize_default_settings!(settings)
12981298
:sourceaddress => {
12991299
:default => nil,
13001300
:desc => "The address the agent should use to initiate requests.",
1301-
},
1301+
}
13021302
)
13031303

13041304
settings.define_settings(:environment,

lib/puppet/ffi/windows/functions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ module Functions
287287
# LPDWORD pcbBytesNeeded
288288
# );
289289
SC_STATUS_TYPE = enum(
290-
:SC_STATUS_PROCESS_INFO, 0,
290+
:SC_STATUS_PROCESS_INFO, 0
291291
)
292292
ffi_lib :advapi32
293293
attach_function_private :QueryServiceStatusEx,
@@ -425,7 +425,7 @@ module Functions
425425
# LPCWSTR pszGroupName
426426
# );
427427
SC_ENUM_TYPE = enum(
428-
:SC_ENUM_PROCESS_INFO, 0,
428+
:SC_ENUM_PROCESS_INFO, 0
429429
)
430430
ffi_lib :advapi32
431431
attach_function_private :EnumServicesStatusExW,

lib/puppet/ffi/windows/structs.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class SERVICE_STATUS < FFI::Struct
198198
:dwWin32ExitCode, :dword,
199199
:dwServiceSpecificExitCode, :dword,
200200
:dwCheckPoint, :dword,
201-
:dwWaitHint, :dword,
201+
:dwWaitHint, :dword
202202
)
203203
end
204204

@@ -223,7 +223,7 @@ class QUERY_SERVICE_CONFIGW < FFI::Struct
223223
:dwTagId, :dword,
224224
:lpDependencies, :pointer,
225225
:lpServiceStartName, :pointer,
226-
:lpDisplayName, :pointer,
226+
:lpDisplayName, :pointer
227227
)
228228
end
229229

lib/puppet/http/service/compiler.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def post_catalog(name, facts:, environment:, configured_environment: nil, check_
118118
body,
119119
headers: headers,
120120
# for legacy reasons we always send environment as a query parameter too
121-
params: { environment: environment },
121+
params: { environment: environment }
122122
)
123123

124124
if (compiler = response['X-Puppet-Compiler-Name'])
@@ -248,7 +248,7 @@ def put_facts(name, environment:, facts:)
248248
with_base_url("/facts/#{name}"),
249249
serialize(formatter, facts),
250250
headers: headers,
251-
params: { environment: environment },
251+
params: { environment: environment }
252252
)
253253

254254
process_response(response)

lib/puppet/http/service/report.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def put_report(name, report, environment:)
4747
with_base_url("/report/#{name}"),
4848
serialize(formatter, report),
4949
headers: headers,
50-
params: { environment: environment },
50+
params: { environment: environment }
5151
)
5252

5353
# override parent's process_response handling

lib/puppet/indirector/file_bucket_file/rest.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def head(request)
1313
api.head_filebucket_file(
1414
request.key,
1515
environment: request.environment.to_s,
16-
bucket_path: request.options[:bucket_path],
16+
bucket_path: request.options[:bucket_path]
1717
)
1818
rescue Puppet::HTTP::ResponseError => e
1919
return nil if e.response.code == 404
@@ -31,7 +31,7 @@ def find(request)
3131
diff_with: request.options[:diff_with],
3232
list_all: request.options[:list_all],
3333
fromdate: request.options[:fromdate],
34-
todate: request.options[:todate],
34+
todate: request.options[:todate]
3535
)
3636
filebucket_file
3737
rescue Puppet::HTTP::ResponseError => e
@@ -44,7 +44,7 @@ def save(request)
4444
api.put_filebucket_file(
4545
request.key,
4646
body: request.instance.render,
47-
environment: request.environment.to_s,
47+
environment: request.environment.to_s
4848
)
4949
rescue Puppet::HTTP::ResponseError => e
5050
raise convert_to_http_error(e.response)

lib/puppet/indirector/file_content/rest.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def find(request)
1717

1818
api.get_file_content(
1919
path: Puppet::Util.uri_unescape(url.path),
20-
environment: request.environment.to_s,
20+
environment: request.environment.to_s
2121
) do |data|
2222
content << data
2323
end

lib/puppet/indirector/file_metadata/rest.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def search(request)
4646
ignore: request.options[:ignore],
4747
links: request.options[:links],
4848
checksum_type: request.options[:checksum_type],
49-
source_permissions: request.options[:source_permissions],
49+
source_permissions: request.options[:source_permissions]
5050
)
5151
file_metadatas
5252
rescue Puppet::HTTP::ResponseError => e

lib/puppet/pops/types/p_uri_type.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class PURIType < PAnyType
3434
TypeFactory.optional(PATH) => PStringType::NON_EMPTY,
3535
TypeFactory.optional(QUERY) => PStringType::NON_EMPTY,
3636
TypeFactory.optional(FRAGMENT) => PStringType::NON_EMPTY,
37-
TypeFactory.optional(OPAQUE) => PStringType::NON_EMPTY,
37+
TypeFactory.optional(OPAQUE) => PStringType::NON_EMPTY
3838
)
3939

4040
TYPE_STRING_PARAM =
@@ -66,7 +66,7 @@ class PURIType < PAnyType
6666
TypeFactory.optional(PATH) => TYPE_STRING_PARAM,
6767
TypeFactory.optional(QUERY) => TYPE_STRING_PARAM,
6868
TypeFactory.optional(FRAGMENT) => TYPE_STRING_PARAM,
69-
TypeFactory.optional(OPAQUE) => TYPE_STRING_PARAM,
69+
TypeFactory.optional(OPAQUE) => TYPE_STRING_PARAM
7070
)
7171

7272
TYPE_URI_PARAM_TYPE = PVariantType.new([PStringType::NON_EMPTY, TYPE_URI_PARAM_HASH_TYPE])

0 commit comments

Comments
 (0)