diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b93467dc6..d950a6e5b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -141,7 +141,6 @@ jobs: cfg: - {os: ubuntu-latest, ruby: '2.7'} - {os: ubuntu-22.04, ruby: '3.2'} # with openssl 3 - - {os: ubuntu-22.04, ruby: 'jruby-9.3.14.0'} - {os: ubuntu-latest, ruby: 'jruby-9.4.8.0'} - {os: ubuntu-latest, ruby: 'jruby-9.4.12.1'} - {os: windows-2022, ruby: '2.7'} diff --git a/.rubocop.yml b/.rubocop.yml index 8736c5679..7e0d2e15d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,7 +2,7 @@ inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 2.5 + TargetRubyVersion: 2.7 Exclude: - acceptance/**/* - vendor/**/* diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5604e22e6..86a9fb54e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,16 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 -# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns. -# SupportedStyles: snake_case, camelCase -# ForbiddenIdentifiers: __id__, __send__ -Naming/MethodName: - Exclude: - - 'spec/mocks/win32ole.rb' - - 'spec/mocks/ffi.rb' - - 'spec/facter/util/windows/network_utils_spec.rb' - # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). Performance/RegexpMatch: @@ -35,7 +25,7 @@ Style/ClassVars: - 'spec/custom_facts/puppetlabs_spec/files.rb' - 'spec/framework/logging/logger_spec.rb' -# Offense count: 981 +# Offense count: 982 # Configuration parameters: AllowedConstants. Style/Documentation: Enabled: false @@ -46,3 +36,16 @@ Style/Documentation: Style/OptionalBooleanParameter: Exclude: - 'lib/facter/util/resolvers/http.rb' + +# Offense count: 13 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SlicingWithRange: + Exclude: + - 'install.rb' + - 'lib/facter/facts/solaris/ldom.rb' + - 'lib/facter/framework/cli/cli.rb' + - 'lib/facter/resolvers/aix/serialnumber.rb' + - 'lib/facter/resolvers/freebsd/swap_memory.rb' + - 'lib/facter/resolvers/networking.rb' + - 'lib/facter/resolvers/partitions.rb' + - 'lib/facter/util/api_debugger.rb' diff --git a/lib/docs/generate.rb b/lib/docs/generate.rb index 9ed92a011..4ea43d8e7 100755 --- a/lib/docs/generate.rb +++ b/lib/docs/generate.rb @@ -18,11 +18,7 @@ def format_facts(fact_hash) facts: fact_hash }) - erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ - ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-') - else - ERB.new(File.read(PATH_TO_TEMPLATE), nil, '-') - end + erb = ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-') erb.result(scope.instance_eval { binding }) end diff --git a/lib/facter/framework/cli/cli.rb b/lib/facter/framework/cli/cli.rb index 55d9c13c1..7f430f91f 100755 --- a/lib/facter/framework/cli/cli.rb +++ b/lib/facter/framework/cli/cli.rb @@ -113,7 +113,7 @@ def man(*args) negate_options = %w[block cache custom_facts external_facts] template = File.join(File.dirname(__FILE__), '..', '..', 'templates', 'man.erb') - erb = ERB.new(File.read(template), nil, '-') + erb = ERB.new(File.read(template), trim_mode: '-') erb.filename = template puts erb.result(binding) end diff --git a/openfact.gemspec b/openfact.gemspec index 17d4e7ab2..bbb589dd8 100644 --- a/openfact.gemspec +++ b/openfact.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |spec| base = "#{__dir__}#{File::SEPARATOR}" spec.files = dirs.map { |path| path.sub(base, '') } - spec.required_ruby_version = '>= 2.5', '< 5.0' + spec.required_ruby_version = '>= 2.7', '< 5.0' spec.bindir = 'bin' spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ['lib']