diff --git a/lib/facter/facter_dot_d.rb b/lib/facter/facter_dot_d.rb index c4ac142e5..5025ed9e2 100644 --- a/lib/facter/facter_dot_d.rb +++ b/lib/facter/facter_dot_d.rb @@ -23,7 +23,7 @@ def initialize(dir = '/etc/facts.d', cache_file = File.join(Puppet[:libdir], 'fa def entries Dir.entries(@dir).reject { |f| f =~ %r{^\.|\.ttl$} }.sort.map { |f| File.join(@dir, f) } - rescue # rubocop:disable Lint/RescueWithoutErrorClass + rescue [] end @@ -113,14 +113,14 @@ def script_parser(file) def cache_save! cache = load_cache File.open(@cache_file, 'w', 0o600) { |f| f.write(YAML.dump(cache)) } - rescue # rubocop:disable Lint/HandleExceptions, Lint/RescueWithoutErrorClass + rescue # rubocop:disable Lint/HandleExceptions end def cache_store(file, data) load_cache @cache[file] = { :data => data, :stored => Time.now.to_i } - rescue # rubocop:disable Lint/HandleExceptions, Lint/RescueWithoutErrorClass + rescue # rubocop:disable Lint/HandleExceptions end def cache_lookup(file) @@ -136,7 +136,7 @@ def cache_lookup(file) return cache[file][:data] if ttl == -1 return cache[file][:data] if (now - cache[file][:stored]) <= ttl return nil - rescue # rubocop:disable Lint/RescueWithoutErrorClass + rescue return nil end @@ -144,7 +144,7 @@ def cache_time(file) meta = file + '.ttl' return File.read(meta).chomp.to_i - rescue # rubocop:disable Lint/RescueWithoutErrorClass + rescue return 0 end @@ -156,7 +156,7 @@ def load_cache end return @cache - rescue # rubocop:disable Lint/RescueWithoutErrorClass + rescue @cache = {} return @cache end diff --git a/lib/puppet/parser/functions/any2bool.rb b/lib/puppet/parser/functions/any2bool.rb index c59924a17..9eb634d7f 100644 --- a/lib/puppet/parser/functions/any2bool.rb +++ b/lib/puppet/parser/functions/any2bool.rb @@ -33,7 +33,7 @@ module Puppet::Parser::Functions valid_float = begin !!Float(arg) # rubocop:disable Style/DoubleNegation : Could not find a better way to check if a boolean - rescue # rubocop:disable Lint/RescueWithoutErrorClass + rescue false end diff --git a/lib/puppet/parser/functions/dig44.rb b/lib/puppet/parser/functions/dig44.rb index e3fb8a39f..e7e78bfa2 100644 --- a/lib/puppet/parser/functions/dig44.rb +++ b/lib/puppet/parser/functions/dig44.rb @@ -53,7 +53,7 @@ module Puppet::Parser::Functions if structure.is_a? Array begin key = Integer key - rescue # rubocop:disable Lint/RescueWithoutErrorClass + rescue break end end diff --git a/lib/puppet/parser/functions/uriescape.rb b/lib/puppet/parser/functions/uriescape.rb index 2c9ab32e4..8bcd586cf 100644 --- a/lib/puppet/parser/functions/uriescape.rb +++ b/lib/puppet/parser/functions/uriescape.rb @@ -20,9 +20,9 @@ module Puppet::Parser::Functions result = if value.is_a?(Array) # Numbers in Puppet are often string-encoded which is troublesome ... - value.map { |i| i.is_a?(String) ? URI.escape(i) : i } # rubocop:disable Lint/UriEscapeUnescape + value.map { |i| i.is_a?(String) ? URI.escape(i) : i } else - URI.escape(value) # rubocop:disable Lint/UriEscapeUnescape + URI.escape(value) end return result diff --git a/spec/acceptance/member_spec.rb b/spec/acceptance/member_spec.rb index 6effbde0c..5e5809d67 100755 --- a/spec/acceptance/member_spec.rb +++ b/spec/acceptance/member_spec.rb @@ -26,25 +26,27 @@ end describe 'members array of integers' do - it_behaves_like 'item found' do - let(:pp) do - <<-DOC + let(:pp) do + <<-DOC if member( [1,2,3,4], 4 ){ notify { 'output correct': } } - DOC - end + DOC + end + + it_behaves_like 'item found' do end end describe 'members of mixed array' do - it_behaves_like 'item found' do - let(:pp) do - <<-DOC + let(:pp) do + <<-DOC if member( ['a','4',3], 'a' ){ notify { 'output correct': } } - DOC - end + DOC + end + + it_behaves_like 'item found' do end end it 'members arrays without members' diff --git a/spec/functions/private_spec.rb b/spec/functions/private_spec.rb index 32bb2fd1b..1efc04512 100644 --- a/spec/functions/private_spec.rb +++ b/spec/functions/private_spec.rb @@ -5,7 +5,7 @@ scope.expects(:warning).with("private() DEPRECATED: This function will cease to function on Puppet 4; please use assert_private() before upgrading to puppet 4 for backwards-compatibility, or migrate to the new parser's typing system.") # rubocop:disable Metrics/LineLength : unable to cut line to required length begin subject.call [] - rescue # rubocop:disable Lint/HandleExceptions, Lint/RescueWithoutErrorClass + rescue # rubocop:disable Lint/HandleExceptions # ignore this end end diff --git a/spec/unit/puppet/type/file_line_spec.rb b/spec/unit/puppet/type/file_line_spec.rb index 0fc10fea6..959bf69c6 100755 --- a/spec/unit/puppet/type/file_line_spec.rb +++ b/spec/unit/puppet/type/file_line_spec.rb @@ -72,10 +72,10 @@ expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path) }.to raise_error(Puppet::Error, %r{line is a required attribute}) end it 'does not require that a line is specified when matching for absence' do - expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error # rubocop:disable Lint/BooleanSymbol, Metrics/LineLength + expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error # rubocop:disable Metrics/LineLength end it 'although if a line is specified anyway when matching for absence it still works and the line is silently ignored' do - expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :line => 'i_am_irrelevant', :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error # rubocop:disable Lint/BooleanSymbol, Metrics/LineLength + expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :line => 'i_am_irrelevant', :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error # rubocop:disable Metrics/LineLength end it 'requires that a file is specified' do expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, %r{path is a required attribute}) @@ -84,7 +84,7 @@ expect(file_line[:ensure]).to eq :present end it 'defaults to replace => true' do - expect(file_line[:replace]).to eq :true # rubocop:disable Lint/BooleanSymbol + expect(file_line[:replace]).to eq :true end it 'defaults to encoding => UTF-8' do expect(file_line[:encoding]).to eq 'UTF-8'