Skip to content

Commit c43c900

Browse files
committed
rubocop: autofix
1 parent d6808d5 commit c43c900

43 files changed

Lines changed: 349 additions & 386 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.rubocop_todo.yml

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
2-
# `rubocop --auto-gen-config`
3-
# on 2023-08-17 21:33:46 UTC using RuboCop version 1.50.2.
2+
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
3+
# using RuboCop version 1.85.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -13,12 +13,52 @@ RSpec/BeEq:
1313
- 'spec/unit/puppet/provider/jenkins_job/cli_spec.rb'
1414
- 'spec/unit/puppet/x/jenkins/provider/cli_spec.rb'
1515

16+
# Offense count: 51
17+
# This cop supports unsafe autocorrection (--autocorrect-all).
18+
RSpec/IncludeExamples:
19+
Exclude:
20+
- 'spec/acceptance/class_spec.rb'
21+
- 'spec/acceptance/plugin_spec.rb'
22+
- 'spec/acceptance/slave_spec.rb'
23+
- 'spec/acceptance/xtypes/jenkins_job_spec.rb'
24+
- 'spec/defines/jenkins_plugin_spec.rb'
25+
- 'spec/unit/puppet/provider/jenkins_credentials/cli_spec.rb'
26+
- 'spec/unit/puppet/provider/jenkins_job/cli_spec.rb'
27+
- 'spec/unit/puppet/provider/jenkins_user/cli_spec.rb'
28+
- 'spec/unit/puppet/x/jenkins/config_spec.rb'
29+
- 'spec/unit/puppet/x/jenkins/provider/cli_spec.rb'
30+
31+
# Offense count: 16
32+
RSpec/LeakyLocalVariable:
33+
Exclude:
34+
- 'spec/acceptance/slave_spec.rb'
35+
- 'spec/acceptance/xtypes/jenkins_credentials_spec.rb'
36+
- 'spec/classes/jenkins_slave_spec.rb'
37+
- 'spec/defines/jenkins_job_present_spec.rb'
38+
- 'spec/defines/jenkins_job_spec.rb'
39+
1640
# Offense count: 2
1741
# This cop supports unsafe autocorrection (--autocorrect-all).
18-
# Configuration parameters: .
19-
# SupportedStyles: constant, string
2042
RSpec/VerifiedDoubleReference:
21-
EnforcedStyle: string
43+
Exclude:
44+
- 'spec/unit/puppet/x/jenkins/provider/cli_spec.rb'
45+
46+
# Offense count: 1
47+
# Configuration parameters: AllowedClasses.
48+
Style/OneClassPerFile:
49+
Exclude:
50+
- 'lib/puppet/x/jenkins.rb'
51+
52+
# Offense count: 8
53+
# This cop supports unsafe autocorrection (--autocorrect-all).
54+
Style/SelectByKind:
55+
Exclude:
56+
- 'lib/puppet/type/jenkins_authorization_strategy.rb'
57+
- 'lib/puppet/type/jenkins_credentials.rb'
58+
- 'lib/puppet/type/jenkins_job.rb'
59+
- 'lib/puppet/type/jenkins_num_executors.rb'
60+
- 'lib/puppet/type/jenkins_security_realm.rb'
61+
- 'lib/puppet/type/jenkins_slaveagent_port.rb'
2262

2363
# Offense count: 1
2464
# This cop supports unsafe autocorrection (--autocorrect-all).

lib/puppet/provider/jenkins_authorization_strategy/cli.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def self.from_hash(info)
4040
args = {
4141
name: class_name,
4242
ensure: :present,
43-
arguments: ctor_args
43+
arguments: ctor_args,
4444
}
4545

4646
# map nil -> :undef
@@ -85,8 +85,8 @@ def set_jenkins_instance(input = nil)
8585
def set_strategy_unsecured
8686
input = {
8787
'setAuthorizationStrategy' => {
88-
'hudson.security.AuthorizationStrategy$Unsecured' => []
89-
}
88+
'hudson.security.AuthorizationStrategy$Unsecured' => [],
89+
},
9090
}
9191
set_jenkins_instance(input)
9292
end

lib/puppet/provider/jenkins_credentials/cli.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def self.from_hash(info)
4444

4545
params = {
4646
name: info['id'],
47-
ensure: :present
47+
ensure: :present,
4848
}
4949

5050
%i[impl domain scope].each { |k| copy_key(params, info, k) }

lib/puppet/provider/jenkins_job/cli.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def self.instances(catalog = nil)
2020
name: job['name'],
2121
ensure: :present,
2222
config: job['config'],
23-
enable: job['enabled']
23+
enable: job['enabled'],
2424
)
2525
end
2626
end
@@ -80,7 +80,7 @@ def self.get_job(job, catalog = nil)
8080
# currently unused
8181
def self.job_enabled(job, catalog = nil)
8282
raw = clihelper(['job_enabled', job], catalog: catalog)
83-
raw =~ %r{true} ? true : false
83+
(raw =~ %r{true}) ? true : false
8484
end
8585
private_class_method :job_enabled
8686

lib/puppet/provider/jenkins_security_realm/cli.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def self.from_hash(info)
4040
args = {
4141
name: class_name,
4242
ensure: :present,
43-
arguments: ctor_args
43+
arguments: ctor_args,
4444
}
4545

4646
# map nil -> :undef
@@ -86,8 +86,8 @@ def set_jenkins_instance(input = nil)
8686
def set_security_none
8787
input = {
8888
'setSecurityRealm' => {
89-
'hudson.security.SecurityRealm$None' => []
90-
}
89+
'hudson.security.SecurityRealm$None' => [],
90+
},
9191
}
9292
set_jenkins_instance(input)
9393
end

lib/puppet/x/jenkins/config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class UnknownConfig < ArgumentError; end
2121
cli_username: nil,
2222
cli_password: nil,
2323
cli_password_file: '/tmp/jenkins_credentials_for_puppet',
24-
cli_password_file_exists: false
24+
cli_password_file_exists: false,
2525
}.freeze
2626
CONFIG_CLASS = 'jenkins::cli::config'
2727
FACT_PREFIX = 'jenkins_'

lib/puppet/x/jenkins/provider/cli.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def self.execute_with_retry(command, options = {}, cli_pre_cmd = [])
179179
command(:java),
180180
'-jar', cli_jar,
181181
'-s', url,
182-
'-logger', 'WARNING'
182+
'-logger', 'WARNING',
183183
]
184184

185185
cli_cmd = base_cmd + [command]
@@ -244,7 +244,7 @@ def self.execute_exceptionify(cmd, options)
244244
'You must authenticate to access this Jenkins.',
245245
'anonymous is missing the Overall/Read permission',
246246
'anonymous is missing the Overall/RunScripts permission',
247-
'anonymous is missing the Overall/Administer permission'
247+
'anonymous is missing the Overall/Administer permission',
248248
]
249249
# network errors / jenkins not ready for connections not related to
250250
# authenication failures
@@ -253,7 +253,7 @@ def self.execute_exceptionify(cmd, options)
253253
'java.net.SocketException: Connection reset',
254254
'java.net.ConnectException: Connection refused',
255255
'java.io.IOException: Failed to connect',
256-
'java.io.IOException: Server returned HTTP response code: 503'
256+
'java.io.IOException: Server returned HTTP response code: 503',
257257
]
258258

259259
if options.key?(:tmpfile_as_param)

lib/puppet/x/jenkins/util.rb

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

55
module Puppet::X::Jenkins::Util
66
def unundef(data)
7-
iterate(data) { |x| x == :undef ? nil : x }
7+
iterate(data) { |x| (x == :undef) ? nil : x }
88
end
99
module_function :unundef
1010

spec/acceptance/plugin_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"#{PDIR}/c.txt",
1313
"#{PDIR}/a/foo",
1414
"#{PDIR}/b/bar",
15-
"#{PDIR}/c/baz"
15+
"#{PDIR}/c/baz",
1616
].freeze
1717
DIRS = [
1818
"#{PDIR}/a",
1919
"#{PDIR}/b",
20-
"#{PDIR}/c"
20+
"#{PDIR}/c",
2121
].freeze
2222

2323
shared_examples 'has_plugin' do |plugin|

spec/classes/cli/config_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
let(:params) do
8585
{
8686
ssh_private_key: '/dne',
87-
ssh_private_key_content: 'foo'
87+
ssh_private_key_content: 'foo',
8888
}
8989
end
9090

@@ -99,7 +99,7 @@
9999
mode: '0400',
100100
backup: false,
101101
owner: nil,
102-
group: nil
102+
group: nil,
103103
)
104104
end
105105

@@ -117,7 +117,7 @@
117117
mode: '0400',
118118
backup: false,
119119
owner: 'jenkins',
120-
group: 'jenkins'
120+
group: 'jenkins',
121121
)
122122
end
123123

0 commit comments

Comments
 (0)