diff --git a/lib/puppet/provider/mongodb.rb b/lib/puppet/provider/mongodb.rb index 2921514a9..4e9554426 100644 --- a/lib/puppet/provider/mongodb.rb +++ b/lib/puppet/provider/mongodb.rb @@ -112,7 +112,7 @@ def self.conn_string ip_real = case first_ip_in_list when '0.0.0.0' Facter.value(:fqdn) - when %r{\[?::0\]?} # rubocop:disable Lint/DuplicateBranch + when %r{\[?::0\]?} Facter.value(:fqdn) else first_ip_in_list diff --git a/lib/puppet/provider/mongodb_replset/mongo.rb b/lib/puppet/provider/mongodb_replset/mongo.rb index a12484bc5..57f01511a 100644 --- a/lib/puppet/provider/mongodb_replset/mongo.rb +++ b/lib/puppet/provider/mongodb_replset/mongo.rb @@ -130,7 +130,7 @@ def master_host(members) end def self.replset_properties - conn_string = conn_string # rubocop:disable Lint/SelfAssignment + conn_string = conn_string begin output = mongo_command('rs.conf()', conn_string) rescue Puppet::ExecutionFailure diff --git a/lib/puppet/provider/mongodb_user/mongodb.rb b/lib/puppet/provider/mongodb_user/mongodb.rb index 27d3a5841..3b21a2ee0 100644 --- a/lib/puppet/provider/mongodb_user/mongodb.rb +++ b/lib/puppet/provider/mongodb_user/mongodb.rb @@ -60,7 +60,7 @@ def create } if mongo_4? || mongo_5? - if @resource[:auth_mechanism] == :scram_sha_256 # rubocop:disable Naming/VariableNumber + if @resource[:auth_mechanism] == :scram_sha_256 command[:mechanisms] = ['SCRAM-SHA-256'] command[:pwd] = @resource[:password] command[:digestPassword] = true @@ -121,7 +121,7 @@ def password=(value) } if mongo_4? || mongo_5? - command[:mechanisms] = @resource[:auth_mechanism] == :scram_sha_256 ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1'] # rubocop:disable Naming/VariableNumber + command[:mechanisms] = @resource[:auth_mechanism] == :scram_sha_256 ? ['SCRAM-SHA-256'] : ['SCRAM-SHA-1'] end mongo_eval("db.runCommand(#{command.to_json})", @resource[:database]) diff --git a/lib/puppet/type/mongodb_user.rb b/lib/puppet/type/mongodb_user.rb index c585e7002..592075407 100644 --- a/lib/puppet/type/mongodb_user.rb +++ b/lib/puppet/type/mongodb_user.rb @@ -88,7 +88,7 @@ def to_s?(_value = @is) end def insync?(_is) - return !@resource[:update_password] if @resource[:auth_mechanism] == :scram_sha_256 # rubocop:disable Naming/VariableNumber + return !@resource[:update_password] if @resource[:auth_mechanism] == :scram_sha_256 should_to_s == to_s? end @@ -96,8 +96,8 @@ def insync?(_is) newparam(:auth_mechanism) do desc 'Authentication mechanism. Password verification is not supported with SCRAM-SHA-256.' - defaultto :scram_sha_1 # rubocop:disable Naming/VariableNumber - newvalues(:scram_sha_256, :scram_sha_1) # rubocop:disable Naming/VariableNumber + defaultto :scram_sha_1 + newvalues(:scram_sha_256, :scram_sha_1) end newparam(:update_password, boolean: true) do @@ -126,7 +126,7 @@ def insync?(_is) err("Either 'password_hash' or 'password' should be provided") elsif !self[:password_hash].nil? && !self[:password].nil? err("Only one of 'password_hash' or 'password' should be provided") - elsif !self[:password_hash].nil? && self[:auth_mechanism] == :scram_sha_256 # rubocop:disable Naming/VariableNumber + elsif !self[:password_hash].nil? && self[:auth_mechanism] == :scram_sha_256 err("'password_hash' is not supported with SCRAM-SHA-256 authentication mechanism") end raise("The parameter 'scram_credentials' is read-only and cannot be changed") if should(:scram_credentials) diff --git a/spec/acceptance/mongos_spec.rb b/spec/acceptance/mongos_spec.rb index e136155bf..eefcafd83 100644 --- a/spec/acceptance/mongos_spec.rb +++ b/spec/acceptance/mongos_spec.rb @@ -48,11 +48,11 @@ class { 'mongodb::server': it { is_expected.to be_running } end - describe port(27_017) do # rubocop:disable RSpec/RepeatedExampleGroupBody + describe port(27_017) do it { is_expected.to be_listening } end - describe port(27_019) do # rubocop:disable RSpec/RepeatedExampleGroupBody + describe port(27_019) do it { is_expected.to be_listening } end @@ -90,11 +90,11 @@ class { 'mongodb::mongos': it { is_expected.not_to be_running } end - describe port(27_017) do # rubocop:disable RSpec/RepeatedExampleGroupBody + describe port(27_017) do it { is_expected.not_to be_listening } end - describe port(27_019) do # rubocop:disable RSpec/RepeatedExampleGroupBody + describe port(27_019) do it { is_expected.not_to be_listening } end end diff --git a/spec/acceptance/server_spec.rb b/spec/acceptance/server_spec.rb index e889254d2..560282853 100644 --- a/spec/acceptance/server_spec.rb +++ b/spec/acceptance/server_spec.rb @@ -185,11 +185,11 @@ class { 'mongodb::server': it { is_expected.not_to be_running } end - describe port(27_017) do # rubocop:disable RSpec/RepeatedExampleGroupBody + describe port(27_017) do it { is_expected.not_to be_listening } end - describe port(27_018) do # rubocop:disable RSpec/RepeatedExampleGroupBody + describe port(27_018) do it { is_expected.not_to be_listening } end end diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index e71e86eda..61cced4c1 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -540,7 +540,7 @@ context 'when setting up replicasets' do describe 'should setup using replset_config' do - let(:rsConf) do # rubocop:disable RSpec/VariableName + let(:rsConf) do { 'rsTest' => { 'members' => [ @@ -564,7 +564,7 @@ end describe 'should setup using replset_members' do - let(:rsConf) do # rubocop:disable RSpec/VariableName + let(:rsConf) do { 'rsTest' => { 'ensure' => 'present', diff --git a/spec/unit/puppet/provider/mongodb_shard/mongodb_spec.rb b/spec/unit/puppet/provider/mongodb_shard/mongodb_spec.rb index 5d4a50313..865ed8d87 100644 --- a/spec/unit/puppet/provider/mongodb_shard/mongodb_spec.rb +++ b/spec/unit/puppet/provider/mongodb_shard/mongodb_spec.rb @@ -67,7 +67,7 @@ end describe 'destroy' do - it 'removes a shard' do # rubocop:disable Lint/EmptyBlock + it 'removes a shard' do end end diff --git a/spec/unit/puppet/util/mongodb_output_spec.rb b/spec/unit/puppet/util/mongodb_output_spec.rb index fb3a1219d..9e53ea715 100644 --- a/spec/unit/puppet/util/mongodb_output_spec.rb +++ b/spec/unit/puppet/util/mongodb_output_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' # rubocop:todo Style/FrozenStringLiteralComment Frozen strings break the regex below +require 'spec_helper' # Frozen strings break the regex below require 'puppet/util/mongodb_output' require 'json'