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
3 changes: 2 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ name: Ruby
on:
pull_request: {}
push:
branches: main
branches:
- main

jobs:
rubocop_and_matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.4
# setup a package lock if one doesn't exist, otherwise do nothing
- name: check lock
run: '[ -f "Gemfile.lock" ] && echo "package lock file exists, skipping" || bundle lock'
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require:
- rubocop-rspec

AllCops:
TargetRubyVersion: 2.7
TargetRubyVersion: 3.2
NewCops: enable
Exclude:
- "**/*.erb"
Expand Down
4 changes: 2 additions & 2 deletions lib/git/basic_submodules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ module BasicSubmodules
# @option options [Boolean] :rebase rebase current branch of submodule onto the commit recorded in the superproject
# @option options [Boolean] :recursive recurse into nested submodules
# @return options [String] any output produced by `git` when submodules are initialized
def update_submodules(**options)
self.lib.update_submodules(**options)
def update_submodules(**)
self.lib.update_submodules(**)
end
end

Expand Down
10 changes: 5 additions & 5 deletions lib/vanagon/component/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def initialize(name, settings, platform)
#
# @param name [String] name of the componennt
# @param block [Proc] DSL definition of the component to call
def component(name, &block)
def component(name, &)
yield(self, @component.settings, @component.platform)
end

Expand Down Expand Up @@ -59,28 +59,28 @@ def respond_to_missing?(method_name, include_private = false)
# Set or add to the configure call for the component. The commands required to configure the component before building it.
#
# @param block [Proc] the command(s) required to configure the component
def configure(&block)
def configure(&)
@component.configure << yield
end

# Set or add to the build call for the component. The commands required to build the component before testing/installing it.
#
# @param block [Proc] the command(s) required to build the component
def build(&block)
def build(&)
@component.build << yield
end

# Set or add to the check call for the component. The commands required to test the component before installing it.
#
# @param block [Proc] the command(s) required to test the component
def check(&block)
def check(&)
@component.check << yield
end

# Set or add to the install call for the component. The commands required to install the component.
#
# @param block [Proc] the command(s) required to install the component
def install(&block)
def install(&)
@component.install << yield
end

Expand Down
4 changes: 2 additions & 2 deletions lib/vanagon/component/rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class Rules
#
# @!macro [attach] rule
# @return [Makefile::Rule] The $1 rule
def self.rule(target, &block)
def self.rule(target, &)
define_method("#{target}_rule") do
Makefile::Rule.new("#{component.name}-#{target}") do |rule|
instance_exec(rule, &block)
instance_exec(rule, &)
end
end
end
Expand Down
1 change: 0 additions & 1 deletion lib/vanagon/extensions/set/json.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'set'
require 'json'

module SetJson
Expand Down
8 changes: 4 additions & 4 deletions lib/vanagon/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@
# Platform names currently contain some information about the platform. Fields
# within the name are delimited by the '-' character, and this regex can be used to
# extract those fields.
PLATFORM_REGEX = /^(.*)-(.*)-(.*)$/.freeze
PLATFORM_REGEX = /^(.*)-(.*)-(.*)$/

VERSION_REGEX = /^([=<>]+)\s*([^<>=]*)$/.freeze
VERSION_REGEX = /^([=<>]+)\s*([^<>=]*)$/

# Loads a platform from the config/platforms directory
#
Expand Down Expand Up @@ -314,7 +314,7 @@
#
# @return [String] the operating system name as specified in the platform
def os_name # rubocop:disable Lint/DuplicateMethods
@os_name ||= @name.match(PLATFORM_REGEX)[1]

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
end

# Sets and gets the version of the operating system for the platform.
Expand All @@ -322,7 +322,7 @@
#
# @return [String] the operating system version as specified in the platform
def os_version # rubocop:disable Lint/DuplicateMethods
@os_version ||= @name.match(PLATFORM_REGEX)[2]

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
end

# Sets and gets the architecture of the platform.
Expand All @@ -330,7 +330,7 @@
#
# @return [String] the architecture of the platform
def architecture # rubocop:disable Lint/DuplicateMethods
@architecture ||= @name.match(PLATFORM_REGEX)[3]

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '-' and with many repetitions of '-a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with '--' and with many repetitions of '-a'.
end

# Utility matcher to determine is the platform is a debian variety
Expand Down Expand Up @@ -510,9 +510,9 @@
#
# @param *args [Array<String>] List of arguments to pass on to the platform specific method
# @raise [Vanagon::Error] an arror is raised if the current platform does not define add_repository
def add_build_repository(*args)
def add_build_repository(*)
if self.respond_to?(:add_repository)
self.provision_with self.send(:add_repository, *args)
self.provision_with self.send(:add_repository, *)
else
raise Vanagon::Error, "Adding a build repository not defined for #{name}"
end
Expand Down Expand Up @@ -575,7 +575,7 @@
# @param default [deprecated] default operator to use if version string doesn't
# contain an operator
def version_munger(version_string, default: '=')
match = version_string.match(VERSION_REGEX)

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings starting with '<' and with many repetitions of ' '.
This
regular expression
that depends on a
library input
may run slow on strings starting with '<' and with many repetitions of ' '.
This
regular expression
that depends on a
library input
may run slow on strings starting with '<' and with many repetitions of ' '.

if match.nil?
VanagonLogger.info "Passing a version without an operator is deprecated!"
Expand Down
4 changes: 2 additions & 2 deletions lib/vanagon/platform/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ def zypper_repo(definition)
#
# @param *args [Array<String>] List of arguments to pass on to the platform specific method
# @raise [Vanagon::Error] an arror is raised if the current platform does not define add_repository
def add_build_repository(*args)
@platform.add_build_repository(*args)
def add_build_repository(*)
@platform.add_build_repository(*)
end

def setting(name, value)
Expand Down
4 changes: 2 additions & 2 deletions lib/vanagon/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
require 'time'

# Used to parse the vendor field into name and email
VENDOR_REGEX = /^(.*) <(.*)>$/.freeze
VENDOR_REGEX = /^(.*) <(.*)>$/

class Vanagon
class Project
Expand Down Expand Up @@ -204,7 +204,7 @@
# @param vend [String] name and email address of vendor
# @raise [Vanagon::Error] when `vend` does not include email address
def vendor=(vend)
raise Vanagon::Error, 'Project vendor field must include email address in angle brackets, e.g. "Puppet Inc. <release@puppet.com>"' unless vend.match(VENDOR_REGEX)

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings starting with ' <' and with many repetitions of ' <a'.
This
regular expression
that depends on a
library input
may run slow on strings starting with ' <' and with many repetitions of ' <a'.

Check failure

Code scanning / CodeQL

Badly anchored regular expression High

This value depends on
library input
, and is
checked
against a
badly anchored regular expression
.
This value depends on
library input
, and is
checked
against a
badly anchored regular expression
.
@vendor = vend
end

Expand All @@ -213,7 +213,7 @@
#
# @return [String] Vendor name without email address
def vendor_name_only
return @vendor.match(VENDOR_REGEX)[1]

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings starting with ' <' and with many repetitions of ' <a'.
end

# Parses the vendor for the project by taking only the email address field
Expand All @@ -221,7 +221,7 @@
#
# @return [String] Vendor email address
def vendor_email_only
return @vendor.match(VENDOR_REGEX)[2]

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings starting with ' <' and with many repetitions of ' <a'.
end

# Collects all sources and patches into the provided workdir
Expand Down Expand Up @@ -862,7 +862,7 @@
source.file
end

@settings.merge!(YAML.safe_load(File.read(yaml_path), permitted_classes: [Symbol]))
@settings.merge!(YAML.safe_load_file(yaml_path, permitted_classes: [Symbol]))
end
end

Expand Down
3 changes: 1 addition & 2 deletions lib/vanagon/project/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require 'vanagon/utilities'
require 'vanagon/component/source'
require 'git/rev_list'
require 'set'
require 'yaml'

class Vanagon
Expand All @@ -28,7 +27,7 @@ def initialize(name, configdir, platform, include_components = [])
#
# @param name [String] name of the project
# @param block [Proc] DSL definition of the project to call
def project(name, &block)
def project(name, &)
yield(self)
end

Expand Down
6 changes: 3 additions & 3 deletions lib/vanagon/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def find_program_on_path(command, required = true)
# @param timeout [Integer] number of seconds to run the block before timing out
# @return [true] If the block succeeds, true is returned
# @raise [Vanagon::Error] if the block fails after the retries are exhausted, an error is raised
def retry_with_timeout(tries = 5, timeout = 1, &blk)
def retry_with_timeout(tries = 5, timeout = 1, &)
error = nil
tries.to_i.times do
Timeout::timeout(timeout.to_i) do
Expand Down Expand Up @@ -276,8 +276,8 @@ def local_command(command, return_command_output: false, log: true)
end
end

def clean_environment(&block)
return Bundler.with_unbundled_env(&block) if defined?(Bundler)
def clean_environment(&)
return Bundler.with_unbundled_env(&) if defined?(Bundler)
yield
end
private :clean_environment
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/vanagon/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class Project

allow(Vanagon::Component::Source).to receive(:determine_source_type).and_return(:local)
allow(Vanagon::Component::Source).to receive(:source).and_return(local_source)
allow(File).to receive(:read).with(yaml_path).and_return(yaml_content)
allow(YAML).to receive(:safe_load_file).with(yaml_path, permitted_classes: [Symbol]).and_return({ other: 'other', merged: 'yup' })

expect { project.load_yaml_settings(local_yaml_uri) }.not_to raise_exception
end
Expand Down
2 changes: 1 addition & 1 deletion vanagon.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
gem.authors = ['Puppet By Perforce', 'OpenVoxProjec']
gem.email = 'voxpupuli@groups.io'
gem.homepage = 'http://github.com/OpenVoxProject/vanagon'
gem.required_ruby_version = ['>= 2.7', '< 4']
gem.required_ruby_version = ['>= 3.2', '< 4']
Comment thread
bastelfreak marked this conversation as resolved.

gem.add_dependency('docopt', '~> 0.6.1')
# Handle git repos responsibly
Expand Down