Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 14 additions & 27 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion lib/packaging/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/packaging/util/net.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
shell_flags += 'set -x;' if options[:trace]
shell_commands = "#{shell_flags}#{command}"

remote_command = "#{ssh} #{options[:extra_options]} -t #{target_host} " +
"'#{shell_commands.gsub("'", "'\\\\''")}'"

Check warning

Code scanning / CodeQL

Unsafe shell command constructed from library input Medium

This string concatenation which depends on
library input
is later used in a
shell command
.
This string concatenation which depends on
library input
is later used in a
shell command
.
This string concatenation which depends on library input is later used in a
shell command
.
This string concatenation which depends on library input is later used in a
shell command
.
This string concatenation which depends on library input is later used in a
shell command
.
This string concatenation which depends on library input is later used in a
shell command
.
This string concatenation which depends on library input is later used in a
shell command
.
This string concatenation which depends on library input is later used in a
shell command
.
This string concatenation which depends on library input is later used in a
shell command
.
This string concatenation which depends on library input is later used in a
shell command
.
This string concatenation which depends on library input is later used in a
shell command
.

# This is NOT a good way to support this functionality.
if ENV['DRYRUN']
Expand Down Expand Up @@ -111,7 +111,7 @@
###
### 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,
Expand Down
4 changes: 2 additions & 2 deletions lib/packaging/util/rake_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
3 changes: 1 addition & 2 deletions lib/packaging/util/ship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down Expand Up @@ -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/<project>
#
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def ship_pkgs(pkg_exts, staging_server, remote_path, opts = {})
options = {
excludes: [],
Expand Down
7 changes: 2 additions & 5 deletions lib/packaging/util/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packaging.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/packaging/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion spec/lib/packaging/util/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
1 change: 0 additions & 1 deletion spec/lib/packaging/util/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down