From 6dd076c13fdefdcec3c6faef7a6a0b10f2e41ddc Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Thu, 25 Dec 2025 20:53:16 -0500 Subject: [PATCH 1/9] Changes needed for Ruby 4.0.0 --- lib/rubycritic/analysers/smells/reek.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/rubycritic/analysers/smells/reek.rb b/lib/rubycritic/analysers/smells/reek.rb index db5cf0cf..cfe8ee5e 100644 --- a/lib/rubycritic/analysers/smells/reek.rb +++ b/lib/rubycritic/analysers/smells/reek.rb @@ -10,7 +10,10 @@ class ReekSmells include Colorize def initialize(analysed_modules) - @analysed_modules = analysed_modules.reject { Reek.configuration.path_excluded?(_1.pathname) } + @analysed_modules = analysed_modules.reject do |mod| + path_string = mod.pathname.to_s + Reek.configuration.path_excluded?(Pathname.new(path_string)) + end end def run From c9025ac523f0a4fc2f508e78603f34c78d976cc6 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Thu, 25 Dec 2025 21:04:20 -0500 Subject: [PATCH 2/9] Test with Ruby 4.0 too --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a913540f..2a23608c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,6 +31,7 @@ jobs: - '3.2' - '3.3' - '3.4' + - '4.0' experimental: [false] include: - ruby-version: 'ruby-head' @@ -61,6 +62,7 @@ jobs: - '3.2' - '3.3' - '3.4' + - '4.0' experimental: [false] include: - ruby-version: 'ruby-head' @@ -91,6 +93,7 @@ jobs: - '3.2' - '3.3' - '3.4' + - '4.0' experimental: [false] include: - ruby-version: 'ruby-head' @@ -121,6 +124,7 @@ jobs: - '3.2' - '3.3' - '3.4' + - '4.0' experimental: [false] include: - ruby-version: 'ruby-head' From d1008f9ef7dc6ed332d90df2909a26cf1ead0faa Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sat, 27 Dec 2025 10:08:20 -0500 Subject: [PATCH 3/9] Patch FakeFS --- test/fakefs_helper.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/fakefs_helper.rb b/test/fakefs_helper.rb index a63f7abc..282c3b88 100644 --- a/test/fakefs_helper.rb +++ b/test/fakefs_helper.rb @@ -24,3 +24,14 @@ def home(user = Etc.getlogin) end end FakeFS::Dir.singleton_class.prepend(FakeFSPatch) + +# Patch FakeFS::Pathname to include the path method for Ruby 4.0.0 compatibility +# This is needed because Reek's configuration internally calls Pathname#== which +# requires the path method to be present +module FakeFS + class Pathname + def path + to_s + end + end +end From 04461804af86027012f8d2ab342292e953e0482d Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sat, 27 Dec 2025 10:23:47 -0500 Subject: [PATCH 4/9] Add a note about Ruby 4.0 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2c953a8..a65d21e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * [CHORE] Updated README with last supported Ruby versions for the older as well as the latest releases of Rubycritic/Ruby (by [@faisal][]) * [CHANGE] Drop support for Ruby 3.1.x and JRuby 9.4 (by [@faisal][]) * [CHANGE] Add CI support for JRuby 10.0 (by [@faisal][]) +* [CHORE] Start testing library with Ruby 4.0 (by [@etagwerker][]) * [CHANGE] Bump cucumber dependency (by [@faisal][]) * [BUGFIX] Fixed regression in compatibility with Flog 4.9.0 (by [@faisal][]) * [CHANGE] Bump mocha dependency (by [@faisal][]) From 4a7ddcb7f22381f0cf20fe3aec345fd9e3130b4c Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Tue, 30 Dec 2025 13:15:37 -0500 Subject: [PATCH 5/9] Apply patch by @faisal --- lib/rubycritic/generators/html/line.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rubycritic/generators/html/line.rb b/lib/rubycritic/generators/html/line.rb index c5e3cd15..51fc5e6a 100644 --- a/lib/rubycritic/generators/html/line.rb +++ b/lib/rubycritic/generators/html/line.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'cgi' +require 'cgi/escape' require 'rubycritic/generators/html/base' module RubyCritic From 2b90b80b081709b585ab4b1e1d1c230743d376e7 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Tue, 30 Dec 2025 13:21:46 -0500 Subject: [PATCH 6/9] Remove irb and bump dependency on fakefs --- rubycritic.gemspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rubycritic.gemspec b/rubycritic.gemspec index ff4adb93..afadd7a3 100644 --- a/rubycritic.gemspec +++ b/rubycritic.gemspec @@ -54,8 +54,7 @@ Gem::Specification.new do |spec| end spec.add_development_dependency 'cucumber', '~> 10.2.0', '>= 10.1.0' spec.add_development_dependency 'diff-lcs', '~> 1.3' - spec.add_development_dependency 'fakefs', '~> 3.0.0' - spec.add_development_dependency 'irb' + spec.add_development_dependency 'fakefs', '~> 3.2.0' spec.add_development_dependency 'mdl', '~> 0.15.0', '>= 0.12.0' spec.add_development_dependency 'minitest', '~> 6.0.0' spec.add_development_dependency 'minitest-around', '~> 0.6.0' From 76a7bbab4cfde6590ca34fa985dda3e04c4e59d0 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Tue, 30 Dec 2025 13:22:08 -0500 Subject: [PATCH 7/9] undef :path --- test/fakefs_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/fakefs_helper.rb b/test/fakefs_helper.rb index 282c3b88..29d05131 100644 --- a/test/fakefs_helper.rb +++ b/test/fakefs_helper.rb @@ -30,6 +30,8 @@ def home(user = Etc.getlogin) # requires the path method to be present module FakeFS class Pathname + undef :path + def path to_s end From 23e9993bfcd298ce9d135b09228e4ada8e3e7647 Mon Sep 17 00:00:00 2001 From: Faisal N Jawdat Date: Tue, 27 Jan 2026 01:13:59 +0000 Subject: [PATCH 8/9] Additional changes for 5.0 (Ruby 4 support) branch (#566) * Update version, and version compatibility, for 5.0 release. * run mdl with Ruby 4 # Conflicts: # CHANGELOG.md * Fixed up changelog - restored notes and one change that got dropped in rebasing - split out the changelog to include 4.12 release we haven't done yet * Require ostruct, because Ruby 4.0 no longer bundles it. * [CHANGE] Update byebug dependency, for Ruby 4.0 compatibility fixes --- .github/workflows/main.yml | 2 +- CHANGELOG.md | 14 +++++++++++--- README.md | 2 +- lib/rubycritic/version.rb | 2 +- rubycritic.gemspec | 4 ++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a23608c..8f7d3ef9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -153,7 +153,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '3.4' + ruby-version: '4.0' bundler-cache: true cache-version: 1 continue-on-error: ${{ matrix.experimental }} diff --git a/CHANGELOG.md b/CHANGELOG.md index a65d21e7..ca9bc959 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,23 @@ -# main [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.11.0...main) +# main [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.12.0...main) * [CHANGE] ... * [BUGFIX] ... * [CHORE] ... * [FEATURE] ... -* [CHORE] Sorted cops in .rubocop.yml to make it easier for maintainers to add or modify cop settings, and unified duplicate Metrics/MethodLength settings. (by [@faisal][]) -* [CHORE] Updated README with last supported Ruby versions for the older as well as the latest releases of Rubycritic/Ruby (by [@faisal][]) +* [CHORE] Bump byebug dependency (by [@faisal][]) +* [CHORE] Bump mdl and mocha dependencies (by [@faisal][]) +* [CHORE] Bump minitest dependency, and add minitest-mock dependency (by [@faisal][]) +* [CHORE] Bump fakefs dependency, and drop irb dependency (by [@faisal][]) +* [CHORE] In RubyCritic::Generator::Html::Line, require cgi/escape rather than cgi, as the latter is removed from Ruby 4.0 (by [@faisal][]) +* [CHORE] Run Markdown linting in CI using Ruby 4.0 (by [@faisal][]) +* [CHANGE] Sorted cops in .rubocop.yml to make it easier for maintainers to add or modify cop settings, and unified duplicate Metrics/MethodLength settings. (by [@faisal][]) * [CHANGE] Drop support for Ruby 3.1.x and JRuby 9.4 (by [@faisal][]) * [CHANGE] Add CI support for JRuby 10.0 (by [@faisal][]) * [CHORE] Start testing library with Ruby 4.0 (by [@etagwerker][]) + +# v4.12.0 / 2026-01-01 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.11.0...v4.12.0) + * [CHANGE] Bump cucumber dependency (by [@faisal][]) * [BUGFIX] Fixed regression in compatibility with Flog 4.9.0 (by [@faisal][]) * [CHANGE] Bump mocha dependency (by [@faisal][]) diff --git a/README.md b/README.md index b10d57b8..a7d6bb86 100644 --- a/README.md +++ b/README.md @@ -246,7 +246,7 @@ RubyCritic is supporting Ruby versions: | 2.6 | [v4.7.0](https://github.com/whitesmith/rubycritic/tree/v4.7.0) | | 2.7 | [v4.9.1](https://github.com/whitesmith/rubycritic/tree/v4.9.1) | | 3.0 | [v4.9.2](https://github.com/whitesmith/rubycritic/tree/v4.9.1) | -| 3.1 | [v4.11.0](https://github.com/whitesmith/rubycritic/tree/v4.11.0) | +| 3.1 | [v4.12.0](https://github.com/whitesmith/rubycritic/tree/v4.12.0) | | 3.2 | latest | | 3.3 | latest | | 3.4 | latest | diff --git a/lib/rubycritic/version.rb b/lib/rubycritic/version.rb index 1ece71ef..f04edbb9 100644 --- a/lib/rubycritic/version.rb +++ b/lib/rubycritic/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module RubyCritic - VERSION = '4.12.0' + VERSION = '5.0.0' end diff --git a/rubycritic.gemspec b/rubycritic.gemspec index afadd7a3..5ae87729 100644 --- a/rubycritic.gemspec +++ b/rubycritic.gemspec @@ -34,6 +34,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'flay', '~> 2.13' spec.add_dependency 'flog', '~> 4.7' spec.add_dependency 'launchy', '>= 2.5.2' + spec.add_dependency 'ostruct' spec.add_dependency 'parser', '>= 3.3.0.5' spec.add_dependency 'prism', '>= 1.6.0' spec.add_dependency 'rainbow', '~> 3.1.1' @@ -50,7 +51,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'jar-dependencies', '~> 0.5.5' spec.add_development_dependency 'pry-debugger-jruby' else - spec.add_development_dependency 'byebug', '~> 12.0', '>= 10.0' + spec.add_development_dependency 'byebug', '~> 13.0', '>= 10.0' end spec.add_development_dependency 'cucumber', '~> 10.2.0', '>= 10.1.0' spec.add_development_dependency 'diff-lcs', '~> 1.3' @@ -60,7 +61,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'minitest-around', '~> 0.6.0' spec.add_development_dependency 'minitest-mock' spec.add_development_dependency 'mocha', '~> 3.0.0' - spec.add_development_dependency 'ostruct' spec.add_development_dependency 'rake', '~> 13.3.0', '>= 11.0.0' spec.add_development_dependency 'rdoc' spec.add_development_dependency 'rexml', '>= 3.2.0' From f19d88bef99b2b9f4bd34e25964ddfd47982eef6 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Mon, 26 Jan 2026 20:31:37 -0500 Subject: [PATCH 9/9] Small fix to avoid unnecessary strictness in comparison --- features/step_definitions/rubycritic_steps.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/rubycritic_steps.rb b/features/step_definitions/rubycritic_steps.rb index 89c53623..97508272 100644 --- a/features/step_definitions/rubycritic_steps.rb +++ b/features/step_definitions/rubycritic_steps.rb @@ -21,7 +21,7 @@ end Then(/^it reports the current version$/) do - expect(last_command_started).to have_output("RubyCritic #{RubyCritic::VERSION}\n") + expect(last_command_started).to have_output(an_output_string_including("RubyCritic #{RubyCritic::VERSION}")) end Then(/^it reports the error ['"](.*)['"]$/) do |string|