diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7f3e444..8c9e23c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --no-auto-gen-timestamp` -# using RuboCop version 1.75.8. +# using RuboCop version 1.79.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -39,7 +39,7 @@ Layout/HeredocIndentation: # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. +# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. # URISchemes: http, https Layout/LineLength: Exclude: @@ -93,29 +93,11 @@ Lint/NonAtomicFileOperation: Exclude: - 'lib/packaging/ship/artifactory.rb' -# Offense count: 10 +# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Lint/RedundantCopDisableDirective: Exclude: - - 'lib/packaging/paths.rb' - - 'lib/packaging/util/net.rb' - - 'lib/packaging/util/ship.rb' - 'lib/packaging/util/version.rb' - - 'spec/lib/packaging/util/git_spec.rb' - - 'spec/lib/packaging/util/version_spec.rb' - -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -Lint/RedundantStringCoercion: - Exclude: - - 'lib/packaging/util/rake_utils.rb' - - 'spec/lib/packaging/config_spec.rb' - -# Offense count: 2 -Lint/ShadowingOuterLocalVariable: - Exclude: - - 'tasks/jenkins_dynamic.rake' - - 'tasks/pe_ship.rake' # Offense count: 1 # Configuration parameters: AllowComments, AllowNil. @@ -236,13 +218,22 @@ Naming/MethodParameterName: - 'lib/packaging/util/ship.rb' - 'tasks/vendor_gems.rake' +# Offense count: 3 +# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates. +# AllowedMethods: call +# WaywardPredicates: nonzero? +Naming/PredicateMethod: + Exclude: + - 'lib/packaging/util.rb' + - 'lib/packaging/util/misc.rb' + # Offense count: 6 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs. # NamePrefix: is_, has_, have_, does_ # ForbiddenPrefixes: is_, has_, have_, does_ # AllowedMethods: is_a? # MethodDefinitionMacros: define_method, define_singleton_method -Naming/PredicateName: +Naming/PredicatePrefix: Exclude: - 'spec/**/*' - 'lib/packaging/sign/rpm.rb' @@ -456,10 +447,6 @@ RSpec/MatchArray: RSpec/MessageSpies: EnforcedStyle: receive -# Offense count: 46 -RSpec/MultipleExpectations: - Max: 7 - # Offense count: 42 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: @@ -810,7 +797,7 @@ Style/EvalWithLocation: # Offense count: 47 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowedVars. +# Configuration parameters: AllowedVars, DefaultToNil. Style/FetchEnvVar: Enabled: false diff --git a/lib/packaging/paths.rb b/lib/packaging/paths.rb index fb5e93a..2fd69ac 100644 --- a/lib/packaging/paths.rb +++ b/lib/packaging/paths.rb @@ -2,7 +2,6 @@ # This includes both reporting the correct path and divining the platform # tag associated with a variety of paths # -# rubocop:disable Metrics/ModuleLength module Pkg::Paths include Pkg::Platforms diff --git a/lib/packaging/util/net.rb b/lib/packaging/util/net.rb index 5df78e8..542aef8 100644 --- a/lib/packaging/util/net.rb +++ b/lib/packaging/util/net.rb @@ -111,7 +111,7 @@ def remote_execute(target_host, command, user_options = {}) ### ### Deprecated method implemented as a shim to the new `remote_execute` method ### - def remote_ssh_cmd(target, command, capture_output = false, extra_options = '', fail_fast = true, trace = false) # rubocop:disable Metrics/ParameterLists + def remote_ssh_cmd(target, command, capture_output = false, extra_options = '', fail_fast = true, trace = false) puts "Warn: \"remote_ssh_cmd\" call in packaging is deprecated. Use \"remote_execute\" instead." remote_execute(target, command, { capture_output: capture_output, diff --git a/lib/packaging/util/rake_utils.rb b/lib/packaging/util/rake_utils.rb index e742091..4bde15f 100644 --- a/lib/packaging/util/rake_utils.rb +++ b/lib/packaging/util/rake_utils.rb @@ -36,9 +36,9 @@ def invoke_task(task, *) def add_dependency(depender, dependency) if using_rake? if !task_defined?(depender) - fail "Could not locate a Rake task named '#{depender.to_s}' to add a dependency of '#{dependency.to_s}' to" + fail "Could not locate a Rake task named '#{depender}' to add a dependency of '#{dependency}' to" elsif !task_defined?(dependency) - fail "Could not locate a Rake task named '#{dependency.to_s}' to add as a dependency of '#{depender.to_s}'" + fail "Could not locate a Rake task named '#{dependency}' to add as a dependency of '#{depender}'" else depender_task = Rake::Task[depender] depender_task.enhance([dependency]) diff --git a/lib/packaging/util/ship.rb b/lib/packaging/util/ship.rb index 410ce73..bf09985 100644 --- a/lib/packaging/util/ship.rb +++ b/lib/packaging/util/ship.rb @@ -3,7 +3,7 @@ module Pkg::Util::Ship module_function - def collect_packages(pkg_exts, excludes = []) # rubocop:disable Metrics/MethodLength + def collect_packages(pkg_exts, excludes = []) pkgs = pkg_exts.map { |ext| Dir.glob(ext) }.flatten return [] if pkgs.empty? @@ -57,7 +57,6 @@ def reorganize_packages(pkgs, tmp, platform_independent = false, nonfinal = fals # false (most paths will be platform dependent), but set to true for gems # and tarballs since those just land directly under /opt/downloads/ # - # rubocop:disable Metrics/MethodLength, Metrics/AbcSize def ship_pkgs(pkg_exts, staging_server, remote_path, opts = {}) options = { excludes: [], diff --git a/lib/packaging/util/version.rb b/lib/packaging/util/version.rb index cd725bb..1edb3eb 100644 --- a/lib/packaging/util/version.rb +++ b/lib/packaging/util/version.rb @@ -80,7 +80,6 @@ def extended_dot_version # 5.3.0.rc4-1 # 3.0.5.rc6.24.g431768c-1 # - # rubocop:disable Metrics/AbcSize, Metrics/MethodLength def base_pkg_version(version = Pkg::Config.version) return "#{dot_version(version)}-#{Pkg::Config.release}".split('-') if final?(version) || Pkg::Config.vanagon_project @@ -143,13 +142,11 @@ def final?(version = Pkg::Config.version) # with the intent that it never change the official source tree. # # rubocop:disable Metrics/AbcSize - # rubocop:disable Metrics/CyclomaticComplexity - # rubocop:disable Metrics/PerceivedComplexity def versionbump(workdir = nil) version = ENV['VERSION'] || Pkg::Config.version.to_s.strip new_version = '"' + version + '"' - version_file = "#{workdir ? workdir + '/' : ''}#{Pkg::Config.version_file}" + version_file = "#{workdir + '/' if workdir}#{Pkg::Config.version_file}" # Read the previous version file in... contents = IO.read(version_file) @@ -182,7 +179,7 @@ def versionbump(workdir = nil) # input json file and output if it "looks tagged" or not # # @param json_data [hash] json data hash containing the ref to check - def report_json_tags(json_data) # rubocop:disable Metrics/AbcSize + def report_json_tags(json_data) puts 'component: ' + File.basename(json_data['url']) puts 'ref: ' + json_data['ref'].to_s if Pkg::Util::Git.remote_tagged?(json_data['url'], json_data['ref'].to_s) diff --git a/packaging.gemspec b/packaging.gemspec index 3f0367f..7735ab4 100644 --- a/packaging.gemspec +++ b/packaging.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 3.2.0' gem.add_development_dependency('rspec', ['>= 2.14.1', '< 4']) - gem.add_development_dependency('voxpupuli-rubocop', ['~> 4.1.0']) + gem.add_development_dependency('voxpupuli-rubocop', '~> 4.2.0') gem.add_dependency('artifactory', ['~> 3']) gem.add_dependency('base64', ['< 0.4']) gem.add_dependency('benchmark', ['< 0.5']) diff --git a/spec/lib/packaging/config_spec.rb b/spec/lib/packaging/config_spec.rb index 4b94077..232b5d5 100644 --- a/spec/lib/packaging/config_spec.rb +++ b/spec/lib/packaging/config_spec.rb @@ -143,7 +143,7 @@ Build_Params.each do |param| it "should have r/w accessors for #{param}" do Pkg::Config.should respond_to(param) - Pkg::Config.should respond_to("#{param.to_s}=") + Pkg::Config.should respond_to("#{param}=") end end end @@ -563,7 +563,7 @@ Pkg::Config.load_envvars end else - it "should set Pkg::Config##{v[:var]} to ENV[#{v[:envvar].to_s}]" do + it "should set Pkg::Config##{v[:var]} to ENV[#{v[:envvar]}]" do ENV[v[:envvar].to_s] = "FOO" Pkg::Util.stub(:boolean_value) { "FOO" } allow(Pkg::Config).to receive(:instance_variable_set) diff --git a/spec/lib/packaging/util/git_spec.rb b/spec/lib/packaging/util/git_spec.rb index 97a6f0a..016356a 100644 --- a/spec/lib/packaging/util/git_spec.rb +++ b/spec/lib/packaging/util/git_spec.rb @@ -2,7 +2,6 @@ require 'spec_helper' require 'packaging/util/git' -# rubocop:disable Metrics/BlockLength describe 'Pkg::Util::Git' do context '#commit_file' do let(:file) { 'thing.txt' } diff --git a/spec/lib/packaging/util/version_spec.rb b/spec/lib/packaging/util/version_spec.rb index f650fcf..adc16ea 100644 --- a/spec/lib/packaging/util/version_spec.rb +++ b/spec/lib/packaging/util/version_spec.rb @@ -3,7 +3,6 @@ # Spec tests for Pkg::Util::Version # -# rubocop:disable Metrics/BlockLength describe 'Pkg::Util::Version' do context '#versionbump' do let(:version_file) { 'thing.txt' }