From 88439e6828be95f02ba1e914eb6e8c0793115f81 Mon Sep 17 00:00:00 2001 From: Faisal N Jawdat Date: Mon, 2 Dec 2024 20:30:56 +0000 Subject: [PATCH] Drop support for Ruby 3.0, and adopt Rubycritic changes for Ruby 3.1. (#492) - Drop support for Ruby 3.0. - Update Rubycritic config to target Ruby 3.1. Apply all safe autocorrections except for Style/HashSyntax. - Set Rubycritic's Style/HashSyntax EnforcedShorthandSyntax to 'never', which keeps the old style in place (and consistent) until we decide to convert. - Add Ruby 3.3 to the test matrix and Drop Ruby 3.0 (which largely includes the changes in https://github.com/whitesmith/rubycritic/pull/488, so we'll need to rebase if that's landed when we do something with this) - Bump minitest, mocha, rubocop dependencies --- .github/workflows/main.yml | 4 --- .rubocop.yml | 5 +++- CHANGELOG.md | 2 ++ lib/rubycritic/analysers/coverage.rb | 4 +-- .../core/analysed_modules_collection.rb | 4 +-- rubycritic.gemspec | 30 +++++++++---------- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 106cf67a..d3abeba6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,6 @@ jobs: fail-fast: false matrix: ruby-version: - - '3.0' - '3.1' - '3.2' - '3.3' @@ -59,7 +58,6 @@ jobs: fail-fast: false matrix: ruby-version: - - '3.0' - '3.1' - '3.2' - '3.3' @@ -89,7 +87,6 @@ jobs: fail-fast: false matrix: ruby-version: - - '3.0' - '3.1' - '3.2' - '3.3' @@ -119,7 +116,6 @@ jobs: fail-fast: false matrix: ruby-version: - - '3.0' - '3.1' - '3.2' - '3.3' diff --git a/.rubocop.yml b/.rubocop.yml index fa3972ef..97393f47 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,7 +11,7 @@ AllCops: - 'tmp/**/*' - 'vendor/**/*' - 'gemfiles/*' - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.1 Metrics/BlockLength: Enabled: false @@ -26,6 +26,9 @@ Layout/LineLength: Style/Documentation: Enabled: false +Style/HashSyntax: + EnforcedShorthandSyntax: either + Security/MarshalLoad: Enabled: false Include: diff --git a/CHANGELOG.md b/CHANGELOG.md index 975d8ffc..ea1f1b5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # main [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.9.1...main) +* [CHANGE] Drop support for Ruby 3.0.x (by [@faisal][]) +* [CHANGE] Bump minitest, mocha, rubocop dependencies (by [@faisal][]) * [CHANGE] Drop support for Ruby 2.7.x (by [@faisal][]) # v4.9.1 / 2024-04-14 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.9.0...v4.9.1) diff --git a/lib/rubycritic/analysers/coverage.rb b/lib/rubycritic/analysers/coverage.rb index 259ed183..96fbdea0 100644 --- a/lib/rubycritic/analysers/coverage.rb +++ b/lib/rubycritic/analysers/coverage.rb @@ -88,13 +88,13 @@ def stored_data # Ensure only one process is reading or writing the resultset at any # given time - def synchronize_resultset(&proc) + def synchronize_resultset(&) # make it reentrant return yield if defined?(@resultset_locked) && @resultset_locked == true return yield unless File.exist?(resultset_writelock) - with_lock(&proc) + with_lock(&) end def with_lock diff --git a/lib/rubycritic/core/analysed_modules_collection.rb b/lib/rubycritic/core/analysed_modules_collection.rb index 9f7064b0..ee33871c 100644 --- a/lib/rubycritic/core/analysed_modules_collection.rb +++ b/lib/rubycritic/core/analysed_modules_collection.rb @@ -28,8 +28,8 @@ def initialize(paths, modules = nil) end end - def each(&block) - @modules.each(&block) + def each(&) + @modules.each(&) end def where(module_paths) diff --git a/rubycritic.gemspec b/rubycritic.gemspec index fe9ca4ba..ca118b9b 100644 --- a/rubycritic.gemspec +++ b/rubycritic.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |spec| spec.summary = 'RubyCritic is a Ruby code quality reporter' spec.homepage = 'https://github.com/whitesmith/rubycritic' spec.license = 'MIT' - spec.required_ruby_version = '>= 3.0.0' + spec.required_ruby_version = '>= 3.1.0' spec.files = [ 'CHANGELOG.md', @@ -30,17 +30,17 @@ Gem::Specification.new do |spec| spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } spec.require_path = 'lib' - spec.add_runtime_dependency 'flay', '~> 2.13' - spec.add_runtime_dependency 'flog', '~> 4.7' - spec.add_runtime_dependency 'launchy', '>= 2.5.2' - spec.add_runtime_dependency 'parser', '>= 3.3.0.5' - spec.add_runtime_dependency 'rainbow', '~> 3.1.1' - spec.add_runtime_dependency 'reek', '~> 6.3.0', '< 7.0' - spec.add_runtime_dependency 'rexml' - spec.add_runtime_dependency 'ruby_parser', '~> 3.21' - spec.add_runtime_dependency 'simplecov', '>= 0.22.0' - spec.add_runtime_dependency 'tty-which', '~> 0.5.0' - spec.add_runtime_dependency 'virtus', '~> 2.0' + spec.add_dependency 'flay', '~> 2.13' + spec.add_dependency 'flog', '~> 4.7' + spec.add_dependency 'launchy', '>= 2.5.2' + spec.add_dependency 'parser', '>= 3.3.0.5' + spec.add_dependency 'rainbow', '~> 3.1.1' + spec.add_dependency 'reek', '~> 6.3.0', '< 7.0' + spec.add_dependency 'rexml' + spec.add_dependency 'ruby_parser', '~> 3.21' + spec.add_dependency 'simplecov', '>= 0.22.0' + spec.add_dependency 'tty-which', '~> 0.5.0' + spec.add_dependency 'virtus', '~> 2.0' spec.add_development_dependency 'aruba', '~> 2.2.0' spec.add_development_dependency 'bundler', '>= 2.0.0' @@ -53,12 +53,12 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'diff-lcs', '~> 1.3' spec.add_development_dependency 'fakefs', '~> 2.5.0' spec.add_development_dependency 'mdl', '~> 0.13.0', '>= 0.12.0' - spec.add_development_dependency 'minitest', '~> 5.22.2', '>= 5.3.0' + spec.add_development_dependency 'minitest', '~> 5.25.2', '>= 5.3.0' spec.add_development_dependency 'minitest-around', '~> 0.5.0', '>= 0.4.0' - spec.add_development_dependency 'mocha', '~> 2.2.0' + spec.add_development_dependency 'mocha', '~> 2.6.1' spec.add_development_dependency 'rake', '~> 13.2.0', '>= 11.0.0' spec.add_development_dependency 'rexml', '>= 3.2.0' - spec.add_development_dependency 'rubocop', '~> 1.63.0', '>= 1.54.0' + spec.add_development_dependency 'rubocop', '~> 1.69.0', '>= 1.54.0' spec.add_development_dependency 'rubocop-minitest' spec.add_development_dependency 'rubocop-performance' spec.add_development_dependency 'rubocop-rake'