diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index cffcc304..67899942 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -156,15 +156,6 @@ Style/MixinUsage: Exclude: - 'spec/spec_helper.rb' -# Offense count: 2 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns. -# SupportedStyles: predicate, comparison -Style/NumericPredicate: - Exclude: - - 'spec/**/*' - - 'lib/puppet/provider/vcsrepo/git.rb' - # Offense count: 1 # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? @@ -172,13 +163,6 @@ Style/OptionalBooleanParameter: Exclude: - 'spec/support/filesystem_helpers.rb' -# Offense count: 3 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/SlicingWithRange: - Exclude: - - 'lib/puppet/provider/vcsrepo/cvs.rb' - - 'lib/puppet/provider/vcsrepo/svn.rb' - # Offense count: 14 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Mode. diff --git a/lib/puppet/provider/vcsrepo/cvs.rb b/lib/puppet/provider/vcsrepo/cvs.rb index bc434515..f3fa2dbb 100644 --- a/lib/puppet/provider/vcsrepo/cvs.rb +++ b/lib/puppet/provider/vcsrepo/cvs.rb @@ -74,7 +74,7 @@ def revision if File.exist?(tag_file) contents = File.read(tag_file).strip # NOTE: Doesn't differentiate between N and T entries - @rev = contents[1..-1] + @rev = contents[1..] else @rev = 'HEAD' end diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index afee077a..640b6d16 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -367,7 +367,7 @@ def bare_git_config_exists? # @!visibility private def clone_repository(source, path) args = ['clone'] - if @resource.value(:depth) && @resource.value(:depth).to_i > 0 + if @resource.value(:depth)&.to_i&.positive? args.push('--depth', @resource.value(:depth).to_s) args.push('--branch', @resource.value(:revision).to_s) if @resource.value(:revision) && !@resource.value(:branch) end @@ -415,7 +415,7 @@ def commits? rescue Puppet::ExecutionFailure commits = 0 end - return commits > 0 + return commits.positive? end end diff --git a/lib/puppet/provider/vcsrepo/svn.rb b/lib/puppet/provider/vcsrepo/svn.rb index c6ad1a50..aeda56dd 100644 --- a/lib/puppet/provider/vcsrepo/svn.rb +++ b/lib/puppet/provider/vcsrepo/svn.rb @@ -172,7 +172,7 @@ def sensitive? def get_includes(directory) at_path do args = buildargs.push('info', directory) - return directory[2..-1].gsub(File::SEPARATOR, '/') if svn_wrapper(*args)[%r{^Depth:\s+(\w+)}m, 1] != 'empty' + return directory[2..].gsub(File::SEPARATOR, '/') if svn_wrapper(*args)[%r{^Depth:\s+(\w+)}m, 1] != 'empty' Dir.entries(directory).map { |entry| next if SKIP_DIRS.include?(entry) @@ -181,7 +181,7 @@ def get_includes(directory) if File.directory?(entry) get_includes(entry) elsif File.file?(entry) - entry[2..-1].gsub(File::SEPARATOR, '/') + entry[2..].gsub(File::SEPARATOR, '/') end }.flatten.compact! end