Skip to content

Commit 7cd4c06

Browse files
committed
rubocop corrections
1 parent d2f95fe commit 7cd4c06

9 files changed

Lines changed: 18 additions & 18 deletions

File tree

lib/puppet/provider/mongodb.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def self.conn_string
112112
ip_real = case first_ip_in_list
113113
when '0.0.0.0'
114114
Facter.value(:fqdn)
115-
when %r{\[?::0\]?} # rubocop:disable Lint/DuplicateBranch
115+
when %r{\[?::0\]?}
116116
Facter.value(:fqdn)
117117
else
118118
first_ip_in_list

lib/puppet/provider/mongodb_replset/mongo.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def master_host(members)
130130
end
131131

132132
def self.replset_properties
133-
conn_string = conn_string # rubocop:disable Lint/SelfAssignment
133+
conn_string = conn_string
134134
begin
135135
output = mongo_command('rs.conf()', conn_string)
136136
rescue Puppet::ExecutionFailure

lib/puppet/provider/mongodb_user/mongodb.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def create
6060
}
6161

6262
if mongo_4? || mongo_5?
63-
if @resource[:auth_mechanism] == :scram_sha_256 # rubocop:disable Naming/VariableNumber
63+
if @resource[:auth_mechanism] == :scram_sha_256
6464
command[:mechanisms] = ['SCRAM-SHA-256']
6565
command[:pwd] = @resource[:password]
6666
command[:digestPassword] = true
@@ -121,7 +121,7 @@ def password=(value)
121121
}
122122

123123
if mongo_4? || mongo_5?
124-
command[:mechanisms] = @resource[:auth_mechanism] == :scram_sha_256 ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1'] # rubocop:disable Naming/VariableNumber
124+
command[:mechanisms] = @resource[:auth_mechanism] == :scram_sha_256 ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1']
125125
end
126126

127127
mongo_eval("db.runCommand(#{command.to_json})", @resource[:database])

lib/puppet/type/mongodb_user.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,16 @@ def to_s?(_value = @is)
8888
end
8989

9090
def insync?(_is)
91-
return !@resource[:update_password] if @resource[:auth_mechanism] == :scram_sha_256 # rubocop:disable Naming/VariableNumber
91+
return !@resource[:update_password] if @resource[:auth_mechanism] == :scram_sha_256
9292

9393
should_to_s == to_s?
9494
end
9595
end
9696

9797
newparam(:auth_mechanism) do
9898
desc 'Authentication mechanism. Password verification is not supported with SCRAM-SHA-256.'
99-
defaultto :scram_sha_1 # rubocop:disable Naming/VariableNumber
100-
newvalues(:scram_sha_256, :scram_sha_1) # rubocop:disable Naming/VariableNumber
99+
defaultto :scram_sha_1
100+
newvalues(:scram_sha_256, :scram_sha_1)
101101
end
102102

103103
newparam(:update_password, boolean: true) do
@@ -126,7 +126,7 @@ def insync?(_is)
126126
err("Either 'password_hash' or 'password' should be provided")
127127
elsif !self[:password_hash].nil? && !self[:password].nil?
128128
err("Only one of 'password_hash' or 'password' should be provided")
129-
elsif !self[:password_hash].nil? && self[:auth_mechanism] == :scram_sha_256 # rubocop:disable Naming/VariableNumber
129+
elsif !self[:password_hash].nil? && self[:auth_mechanism] == :scram_sha_256
130130
err("'password_hash' is not supported with SCRAM-SHA-256 authentication mechanism")
131131
end
132132
raise("The parameter 'scram_credentials' is read-only and cannot be changed") if should(:scram_credentials)

spec/acceptance/mongos_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ class { 'mongodb::server':
4848
it { is_expected.to be_running }
4949
end
5050

51-
describe port(27_017) do # rubocop:disable RSpec/RepeatedExampleGroupBody
51+
describe port(27_017) do
5252
it { is_expected.to be_listening }
5353
end
5454

55-
describe port(27_019) do # rubocop:disable RSpec/RepeatedExampleGroupBody
55+
describe port(27_019) do
5656
it { is_expected.to be_listening }
5757
end
5858

@@ -90,11 +90,11 @@ class { 'mongodb::mongos':
9090
it { is_expected.not_to be_running }
9191
end
9292

93-
describe port(27_017) do # rubocop:disable RSpec/RepeatedExampleGroupBody
93+
describe port(27_017) do
9494
it { is_expected.not_to be_listening }
9595
end
9696

97-
describe port(27_019) do # rubocop:disable RSpec/RepeatedExampleGroupBody
97+
describe port(27_019) do
9898
it { is_expected.not_to be_listening }
9999
end
100100
end

spec/acceptance/server_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ class { 'mongodb::server':
185185
it { is_expected.not_to be_running }
186186
end
187187

188-
describe port(27_017) do # rubocop:disable RSpec/RepeatedExampleGroupBody
188+
describe port(27_017) do
189189
it { is_expected.not_to be_listening }
190190
end
191191

192-
describe port(27_018) do # rubocop:disable RSpec/RepeatedExampleGroupBody
192+
describe port(27_018) do
193193
it { is_expected.not_to be_listening }
194194
end
195195
end

spec/classes/server_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@
540540

541541
context 'when setting up replicasets' do
542542
describe 'should setup using replset_config' do
543-
let(:rsConf) do # rubocop:disable RSpec/VariableName
543+
let(:rsConf) do
544544
{
545545
'rsTest' => {
546546
'members' => [
@@ -564,7 +564,7 @@
564564
end
565565

566566
describe 'should setup using replset_members' do
567-
let(:rsConf) do # rubocop:disable RSpec/VariableName
567+
let(:rsConf) do
568568
{
569569
'rsTest' => {
570570
'ensure' => 'present',

spec/unit/puppet/provider/mongodb_shard/mongodb_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
end
6868

6969
describe 'destroy' do
70-
it 'removes a shard' do # rubocop:disable Lint/EmptyBlock
70+
it 'removes a shard' do
7171
end
7272
end
7373

spec/unit/puppet/util/mongodb_output_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'spec_helper' # rubocop:todo Style/FrozenStringLiteralComment Frozen strings break the regex below
1+
require 'spec_helper' # Frozen strings break the regex below
22
require 'puppet/util/mongodb_output'
33
require 'json'
44

0 commit comments

Comments
 (0)