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' 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][]) 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 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 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' diff --git a/test/fakefs_helper.rb b/test/fakefs_helper.rb index a63f7abc..29d05131 100644 --- a/test/fakefs_helper.rb +++ b/test/fakefs_helper.rb @@ -24,3 +24,16 @@ 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 + undef :path + + def path + to_s + end + end +end