From a0687bd945f324bacf63faa6ecfcc2e3d349a32c Mon Sep 17 00:00:00 2001 From: Faisal N Jawdat Date: Sun, 9 Nov 2025 20:33:06 +0000 Subject: [PATCH 1/9] alphabetize and uniquify cop config in .rubocopy.yml --- .rubocop.yml | 90 +++++++++++++++++++++++++--------------------------- CHANGELOG.md | 1 + 2 files changed, 44 insertions(+), 47 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b169f1c8..0bb16826 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -13,62 +13,25 @@ AllCops: - 'gemfiles/*' TargetRubyVersion: 3.2 -Metrics/BlockLength: - Enabled: false - -Metrics/MethodLength: +Gemspec/DevelopmentDependencies: Exclude: - - "lib/rubycritic/configuration.rb" - -Layout/LineLength: - Max: 120 - -Style/Documentation: - Enabled: false - -Style/HashSyntax: - EnforcedShorthandSyntax: either - -Security/MarshalLoad: - Enabled: false - Include: - - 'lib/rubycritic/serializer.rb' - -Style/RedundantFreeze: - Enabled: false - Include: - - 'lib/rubycritic/core/smell.rb' - - 'lib/rubycritic/generators/json/simple.rb' - - 'lib/rubycritic/revision_comparator.rb' - - 'lib/rubycritic/source_control_systems/perforce.rb' - - 'lib/rubycritic/source_locator.rb' - - 'lib/rubycritic/version.rb' + - 'rubycritic.gemspec' Layout/BlockAlignment: Enabled: false Exclude: - 'features/step_definitions/rake_task_steps.rb' -Naming/RescuedExceptionsVariableName: - Exclude: - - 'lib/rubycritic/analysers/coverage.rb' - - 'lib/rubycritic/cli/application.rb' - - 'lib/rubycritic/reporter.rb' - -Lint/EmptyClass: - Exclude: - - 'test/lib/rubycritic/reporter_test.rb' +Layout/LineLength: + Max: 120 Lint/ConstantDefinitionInBlock: Exclude: - 'test/lib/rubycritic/reporter_test.rb' -Style/OpenStructUse: +Lint/EmptyClass: Exclude: - - 'test/lib/rubycritic/generators/turbulence_test.rb' - - 'test/lib/rubycritic/generators/console_report_test.rb' - - 'test/lib/rubycritic/core/analysed_module_test.rb' - - 'test/analysers_test_helper.rb' + - 'test/lib/rubycritic/reporter_test.rb' Lint/MissingSuper: Exclude: @@ -81,10 +44,6 @@ Lint/MissingSuper: - 'lib/rubycritic/generators/html/code_index.rb' - 'lib/rubycritic/generators/html/line.rb' -Gemspec/DevelopmentDependencies: - Exclude: - - 'rubycritic.gemspec' - Lint/StructNewOverride: Exclude: - 'lib/rubycritic/source_control_systems/git/churn.rb' @@ -93,10 +52,47 @@ Metrics/AbcSize: Exclude: - 'lib/rubycritic/configuration.rb' +Metrics/BlockLength: + Enabled: false + Metrics/MethodLength: Exclude: - 'lib/rubycritic/configuration.rb' +Naming/RescuedExceptionsVariableName: + Exclude: + - 'lib/rubycritic/analysers/coverage.rb' + - 'lib/rubycritic/cli/application.rb' + - 'lib/rubycritic/reporter.rb' + +Security/MarshalLoad: + Enabled: false + Include: + - 'lib/rubycritic/serializer.rb' + +Style/Documentation: + Enabled: false + +Style/HashSyntax: + EnforcedShorthandSyntax: either + +Style/OpenStructUse: + Exclude: + - 'test/lib/rubycritic/generators/turbulence_test.rb' + - 'test/lib/rubycritic/generators/console_report_test.rb' + - 'test/lib/rubycritic/core/analysed_module_test.rb' + - 'test/analysers_test_helper.rb' + Style/RedundantAssignment: Exclude: - 'lib/rubycritic/configuration.rb' + +Style/RedundantFreeze: + Enabled: false + Include: + - 'lib/rubycritic/core/smell.rb' + - 'lib/rubycritic/generators/json/simple.rb' + - 'lib/rubycritic/revision_comparator.rb' + - 'lib/rubycritic/source_control_systems/perforce.rb' + - 'lib/rubycritic/source_locator.rb' + - 'lib/rubycritic/version.rb' diff --git a/CHANGELOG.md b/CHANGELOG.md index efd38d62..d038d1c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * [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][]) * [CHANGE] Drop support for Ruby 3.1.x and JRuby 9.4 (by [@faisal][]) * [CHANGE] Add CI support for JRuby 10.0 (by [@faisal][]) * [CHANGE] Bump cucumber dependency (by [@faisal][]) From b9c95bd6589bab3df7d0a22bd63b46cf262db4d5 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Thu, 25 Dec 2025 20:53:16 -0500 Subject: [PATCH 2/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 e48dc6222bc33dcf8deb696c11960c271d56407a Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Thu, 25 Dec 2025 21:04:20 -0500 Subject: [PATCH 3/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 0578c2dc4f3faf6112cedc1d87fbe6df58b315f9 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sat, 27 Dec 2025 10:08:20 -0500 Subject: [PATCH 4/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 491688333fbb3d0526b1cfd0a332dc532c2b3657 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sat, 27 Dec 2025 10:23:47 -0500 Subject: [PATCH 5/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 d038d1c2..1ca65c17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * [CHORE] ... * [FEATURE] ... +* [CHORE] Start testing library with Ruby 4.0 (by [@etagwerker][]) * [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][]) * [CHANGE] Drop support for Ruby 3.1.x and JRuby 9.4 (by [@faisal][]) * [CHANGE] Add CI support for JRuby 10.0 (by [@faisal][]) From 106b64abbcbd1ad832ded7df9a4b681b1a126674 Mon Sep 17 00:00:00 2001 From: Faisal N Jawdat Date: Fri, 26 Dec 2025 14:22:02 +0000 Subject: [PATCH 6/9] run mdl with Ruby 4 --- .github/workflows/main.yml | 2 +- CHANGELOG.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 1ca65c17..16032bc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * [CHORE] ... * [FEATURE] ... +* [CHORE] Run Markdown linting in CI using Ruby 4.0 (by [@faisal][]) * [CHORE] Start testing library with Ruby 4.0 (by [@etagwerker][]) * [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][]) * [CHANGE] Drop support for Ruby 3.1.x and JRuby 9.4 (by [@faisal][]) From 3e8644e6640245eb945e1532dde97d3910b67394 Mon Sep 17 00:00:00 2001 From: Faisal N Jawdat Date: Sun, 28 Dec 2025 12:04:54 +0000 Subject: [PATCH 7/9] Silence warnings about using cgi since most of it has been extracted in Ruby 4.0. --- CHANGELOG.md | 1 + lib/rubycritic/generators/html/line.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16032bc9..6d364ef0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * [CHORE] ... * [FEATURE] ... +* [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][]) * [CHORE] Start testing library with Ruby 4.0 (by [@etagwerker][]) * [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][]) 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 a633212353fe21ed2b957542bae093a3ea81bb69 Mon Sep 17 00:00:00 2001 From: Faisal N Jawdat Date: Sun, 28 Dec 2025 13:41:37 +0000 Subject: [PATCH 8/9] Silence warnings about using cgi since most of it has been extracted in Ruby 4.0. (#559) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d364ef0..d426efc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * [CHORE] ... * [FEATURE] ... +* [CHORE] In RubyCritic::Generator::Html::Line, require cgi/escape rather than cgi, as the latter is removed from Ruby 4.0 (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][]) * [CHORE] Start testing library with Ruby 4.0 (by [@etagwerker][]) From 6aef077e120098ec6c811fdbea785bfbe3c7e354 Mon Sep 17 00:00:00 2001 From: Faisal N Jawdat Date: Sun, 28 Dec 2025 14:52:14 +0000 Subject: [PATCH 9/9] Bump fakefs dependency - Move to FakeFS 3.2, which fixes some underlying test issues - Drop the irb dependency since FakeFS no longer needs it --- CHANGELOG.md | 1 + rubycritic.gemspec | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d426efc0..165a8406 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * [CHORE] ... * [FEATURE] ... +* [CHORE] Bump fakefs (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] 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][]) 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'