Skip to content

Commit 2e8a8f5

Browse files
committed
rubocop: autofix
1 parent a9a7aec commit 2e8a8f5

17 files changed

Lines changed: 211 additions & 219 deletions

File tree

.rubocop_todo.yml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
# This configuration was generated by
2-
# `rubocop --auto-gen-config`
3-
# on 2023-08-17 21:34:59 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
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 1
10-
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
11-
Lint/DuplicateBranch:
12-
Exclude:
13-
- 'lib/puppet/provider/mongodb.rb'
14-
159
# Offense count: 1
1610
# Configuration parameters: AllowComments, AllowEmptyLambdas.
1711
Lint/EmptyBlock:
1812
Exclude:
1913
- 'spec/unit/puppet/provider/mongodb_shard/mongodb_spec.rb'
2014

2115
# Offense count: 1
16+
Lint/LiteralAssignmentInCondition:
17+
Exclude:
18+
- 'lib/puppet/type/mongodb_replset.rb'
19+
20+
# Offense count: 1
21+
# Configuration parameters: AllowRBSInlineAnnotation.
2222
Lint/SelfAssignment:
2323
Exclude:
2424
- 'lib/puppet/provider/mongodb_replset/mongo.rb'
2525

2626
# Offense count: 7
2727
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
2828
# SupportedStyles: snake_case, normalcase, non_integer
29-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
29+
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
3030
Naming/VariableNumber:
3131
Exclude:
3232
- 'lib/puppet/provider/mongodb_user/mongodb.rb'
@@ -38,9 +38,26 @@ RSpec/BeEq:
3838
Exclude:
3939
- 'spec/functions/mongodb_password_spec.rb'
4040

41-
# Offense count: 1
42-
RSpec/MultipleExpectations:
43-
Max: 2
41+
# Offense count: 11
42+
RSpec/LeakyLocalVariable:
43+
Exclude:
44+
- 'spec/acceptance/database_spec.rb'
45+
- 'spec/acceptance/mongos_spec.rb'
46+
- 'spec/acceptance/replset_spec.rb'
47+
- 'spec/acceptance/server_spec.rb'
48+
- 'spec/acceptance/sharding_spec.rb'
49+
- 'spec/acceptance/user_spec.rb'
50+
- 'spec/classes/mongos_spec.rb'
51+
- 'spec/unit/puppet/provider/mongodb_replset/mongodb_spec.rb'
52+
- 'spec/unit/puppet/provider/mongodb_spec.rb'
53+
54+
# Offense count: 10
55+
# This cop supports unsafe autocorrection (--autocorrect-all).
56+
RSpec/ReceiveMessages:
57+
Exclude:
58+
- 'spec/unit/puppet/provider/mongodb_database/mongodb_spec.rb'
59+
- 'spec/unit/puppet/provider/mongodb_replset/mongodb_spec.rb'
60+
- 'spec/unit/puppet/provider/mongodb_user/mongodb_spec.rb'
4461

4562
# Offense count: 6
4663
RSpec/RepeatedExampleGroupBody:
@@ -55,33 +72,18 @@ RSpec/VariableName:
5572
Exclude:
5673
- 'spec/classes/server_spec.rb'
5774

58-
# Offense count: 44
75+
# Offense count: 1
5976
# This cop supports unsafe autocorrection (--autocorrect-all).
6077
# Configuration parameters: EnforcedStyle.
6178
# SupportedStyles: always, always_true, never
6279
Style/FrozenStringLiteralComment:
63-
Enabled: false
64-
65-
# Offense count: 1
66-
# This cop supports unsafe autocorrection (--autocorrect-all).
67-
# Configuration parameters: AllowedReceivers.
68-
# AllowedReceivers: Thread.current
69-
Style/HashEachMethods:
7080
Exclude:
71-
- 'lib/puppet/provider/mongodb_database/mongodb.rb'
81+
- '**/*.arb'
82+
- 'spec/unit/puppet/util/mongodb_output_spec.rb'
7283

73-
# Offense count: 1
84+
# Offense count: 14
7485
# This cop supports unsafe autocorrection (--autocorrect-all).
75-
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
76-
# SupportedStyles: predicate, comparison
77-
Style/NumericPredicate:
86+
Style/HashFetchChain:
7887
Exclude:
79-
- 'spec/**/*'
88+
- 'lib/facter/is_master.rb'
8089
- 'lib/puppet/provider/mongodb.rb'
81-
82-
# Offense count: 1
83-
# This cop supports unsafe autocorrection (--autocorrect-all).
84-
# Configuration parameters: Mode.
85-
Style/StringConcatenation:
86-
Exclude:
87-
- 'lib/puppet/provider/mongodb_database/mongodb.rb'

lib/puppet/provider/mongodb_replset/mongo.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
mk_resource_methods
1919

2020
def initialize(resource = {})
21-
super(resource)
21+
super
2222
@property_flush = {}
2323
end
2424

@@ -164,7 +164,7 @@ def self.replset_properties
164164
ensure: :present,
165165
members: output['members'],
166166
settings: output['settings'],
167-
provider: :mongo
167+
provider: :mongo,
168168
}
169169
end
170170
nil
@@ -272,7 +272,7 @@ def create_replica_set(alive_hosts)
272272
replset_conf = {
273273
_id: name,
274274
members: members_conf,
275-
settings: (@property_flush[:settings].nil? ? {} : @property_flush[:settings])
275+
settings: (@property_flush[:settings].nil? ? {} : @property_flush[:settings]),
276276
}.to_json
277277

278278
Puppet.debug "Starting replset config is #{replset_conf.to_json}"

lib/puppet/provider/mongodb_shard/mongo.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
commands mongosh: 'mongosh'
1717

1818
def initialize(value = {})
19-
super(value)
19+
super
2020
@property_flush = {}
2121
end
2222

@@ -111,7 +111,7 @@ def self.shard_properties(shard)
111111
ensure: :present,
112112
member: s['host'],
113113
keys: shard_collection_details(output['databases'], s['_id']),
114-
provider: :mongo
114+
provider: :mongo,
115115
}
116116
end
117117
properties
@@ -128,7 +128,7 @@ def self.shards_properties
128128
ensure: :present,
129129
member: shard['host'],
130130
keys: shard_collection_details(output['databases'], shard['_id']),
131-
provider: :mongo
131+
provider: :mongo,
132132
}
133133
end
134134
end

lib/puppet/provider/mongodb_user/mongodb.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def create
4848
command = {
4949
createUser: @resource[:username],
5050
customData: {
51-
createdBy: "Puppet Mongodb_user['#{@resource[:name]}']"
51+
createdBy: "Puppet Mongodb_user['#{@resource[:name]}']",
5252
},
5353
roles: role_hashes(@resource[:roles], @resource[:database]),
5454
}
@@ -90,7 +90,7 @@ def password_hash=(_value)
9090
command = {
9191
updateUser: @resource[:username],
9292
pwd: @resource[:password_hash],
93-
digestPassword: false
93+
digestPassword: false,
9494
}
9595

9696
mongo_eval("db.runCommand(#{command.to_json})", @resource[:database])
@@ -104,7 +104,7 @@ def password=(_value)
104104
updateUser: @resource[:username],
105105
pwd: @resource[:password],
106106
digestPassword: true,
107-
mechanisms: @resource[:auth_mechanism] == :scram_sha_256 ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1']
107+
mechanisms: (@resource[:auth_mechanism] == :scram_sha_256) ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1'],
108108
}
109109

110110
mongo_eval("db.runCommand(#{command.to_json})", @resource[:database])
@@ -149,12 +149,12 @@ def role_hashes(roles, db)
149149
if entry.include? '@'
150150
{
151151
'role' => entry.gsub(%r{^(.*)@.*$}, '\1'),
152-
'db' => entry.gsub(%r{^.*@(.*)$}, '\1')
152+
'db' => entry.gsub(%r{^.*@(.*)$}, '\1'),
153153
}
154154
else
155155
{
156156
'role' => entry,
157-
'db' => db
157+
'db' => db,
158158
}
159159
end
160160
end

lib/puppet/util/mongodb_scram.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def salted_password
3434
@password_hash,
3535
Base64.strict_decode64(@salt),
3636
@iterations,
37-
digest.size
37+
digest.size,
3838
)
3939
end
4040

spec/classes/mongos_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
describe 'with specific bind_ip values' do
3939
let :params do
4040
{
41-
bind_ip: ['127.0.0.1', '10.1.1.13']
41+
bind_ip: ['127.0.0.1', '10.1.1.13'],
4242
}
4343
end
4444

@@ -48,7 +48,7 @@
4848
context 'package_name => mongo-foo' do
4949
let(:params) do
5050
{
51-
package_name: 'mongo-foo'
51+
package_name: 'mongo-foo',
5252
}
5353
end
5454

@@ -59,7 +59,7 @@
5959
context 'service_manage => false' do
6060
let(:params) do
6161
{
62-
service_manage: false
62+
service_manage: false,
6363
}
6464
end
6565

@@ -70,7 +70,7 @@
7070
context 'package_ensure => purged' do
7171
let(:params) do
7272
{
73-
package_ensure: 'purged'
73+
package_ensure: 'purged',
7474
}
7575
end
7676

spec/classes/repo_spec.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
describe 'with version set' do
1717
let :params do
1818
{
19-
version: '5.0'
19+
version: '5.0',
2020
}
2121
end
2222

@@ -25,31 +25,31 @@
2525
it { is_expected.to contain_class('mongodb::repo::yum') }
2626

2727
it do
28-
is_expected.to contain_yumrepo('mongodb').
29-
with_baseurl('https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/5.0/$basearch/')
28+
is_expected.to contain_yumrepo('mongodb')
29+
.with_baseurl('https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/5.0/$basearch/')
3030
end
3131
when 'Suse'
3232
it { is_expected.to contain_class('mongodb::repo::zypper') }
3333

3434
it do
35-
is_expected.to contain_zypprepo('mongodb').
36-
with_baseurl('https://repo.mongodb.org/zypper/suse/$releasever_major/mongodb-org/5.0/$basearch/')
35+
is_expected.to contain_zypprepo('mongodb')
36+
.with_baseurl('https://repo.mongodb.org/zypper/suse/$releasever_major/mongodb-org/5.0/$basearch/')
3737
end
3838
when 'Debian'
3939
it { is_expected.to contain_class('mongodb::repo::apt') }
4040

4141
case facts[:os]['name']
4242
when 'Debian'
4343
it do
44-
is_expected.to contain_apt__source('mongodb').
45-
with_location('https://repo.mongodb.org/apt/debian').
46-
with_release("#{facts[:os]['distro']['codename']}/mongodb-org/5.0")
44+
is_expected.to contain_apt__source('mongodb')
45+
.with_location('https://repo.mongodb.org/apt/debian')
46+
.with_release("#{facts[:os]['distro']['codename']}/mongodb-org/5.0")
4747
end
4848
when 'Ubuntu'
4949
it do
50-
is_expected.to contain_apt__source('mongodb').
51-
with_location('https://repo.mongodb.org/apt/ubuntu').
52-
with_release("#{facts[:os]['distro']['codename']}/mongodb-org/5.0")
50+
is_expected.to contain_apt__source('mongodb')
51+
.with_location('https://repo.mongodb.org/apt/ubuntu')
52+
.with_release("#{facts[:os]['distro']['codename']}/mongodb-org/5.0")
5353
end
5454
end
5555
else
@@ -63,7 +63,7 @@
6363
version: '5.0',
6464
proxy: 'http://proxy-server:8080',
6565
proxy_username: 'proxyuser1',
66-
proxy_password: 'proxypassword1'
66+
proxy_password: 'proxypassword1',
6767
}
6868
end
6969

@@ -72,11 +72,11 @@
7272
it { is_expected.to contain_class('mongodb::repo::yum') }
7373

7474
it do
75-
is_expected.to contain_yumrepo('mongodb').
76-
with_enabled('1').
77-
with_proxy('http://proxy-server:8080').
78-
with_proxy_username('proxyuser1').
79-
with_proxy_password('proxypassword1')
75+
is_expected.to contain_yumrepo('mongodb')
76+
.with_enabled('1')
77+
.with_proxy('http://proxy-server:8080')
78+
.with_proxy_username('proxyuser1')
79+
.with_proxy_password('proxypassword1')
8080
end
8181
when 'Suse'
8282
it { is_expected.to contain_class('mongodb::repo::zypper') }

0 commit comments

Comments
 (0)