Skip to content

Conversation

@etagwerker
Copy link
Collaborator

@etagwerker etagwerker commented Dec 26, 2025

Hi there,

This is the start of a branch to add support for Ruby 4.0. It fixes #555 (reported by @faisal)

The only failure I'm getting locally is this one:

Fabulous run in 4.031929s, 40.6753 runs/s, 70.9338 assertions/s.

  1) Error:
RubyCritic::Generator::JsonReport::#generate_report#test_0001_creates a report file with JSON data inside:
NoMethodError: undefined method 'path' for an instance of FakeFS::Pathname
    /Users/etagwerker/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/reek-6.5.0/lib/reek/configuration/app_configuration.rb:70:in 'Pathname#=='
    /Users/etagwerker/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/reek-6.5.0/lib/reek/configuration/app_configuration.rb:70:in 'Array#include?'
    /Users/etagwerker/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/reek-6.5.0/lib/reek/configuration/app_configuration.rb:70:in 'Reek::Configuration::AppConfiguration#path_excluded?'
    lib/rubycritic/analysers/smells/reek.rb:15:in 'block in RubyCritic::Analyser::ReekSmells#initialize'
    lib/rubycritic/core/analysed_modules_collection.rb:32:in 'Array#each'
    lib/rubycritic/core/analysed_modules_collection.rb:32:in 'RubyCritic::AnalysedModulesCollection#each'
    lib/rubycritic/analysers/smells/reek.rb:13:in 'Enumerable#reject'
    lib/rubycritic/analysers/smells/reek.rb:13:in 'RubyCritic::Analyser::ReekSmells#initialize'
    lib/rubycritic/analysers_runner.rb:30:in 'block in RubyCritic::AnalysersRunner#run'
    lib/rubycritic/analysers_runner.rb:29:in 'Array#each'
    lib/rubycritic/analysers_runner.rb:29:in 'RubyCritic::AnalysersRunner#run'
    test/lib/rubycritic/generators/json_report_test.rb:32:in 'create_analysed_modules_collection'
    test/lib/rubycritic/generators/json_report_test.rb:19:in 'block (3 levels) in <top (required)>'

164 runs, 286 assertions, 0 failures, 1 errors, 0 skips
rake aborted!

Check list:

@faisal
Copy link
Contributor

faisal commented Dec 28, 2025

One more fix, this time to get rid of the warnings about requiring CGI: #559

@faisal
Copy link
Contributor

faisal commented Dec 30, 2025

Starting over(ish)?

@faisal
Copy link
Contributor

faisal commented Dec 30, 2025

Starting over(ish)?

FWIW this branch has all the prior fixes, plus a fix to suppress the path override warning: https://github.com/faisal/rubycritic/tree/restore_4_fixes

It passes all the test and feature tasks, and only shows these warnings when testing:

$ bundle exec rake test
/Users/faisal/Documents/Versioned/rubycritic/.bundle/ruby/3.2.0/gems/flay-2.14.1/lib/flay.rb:11: warning: already initialized constant NotRubyParser
/Users/faisal/Documents/Versioned/rubycritic/.bundle/ruby/3.2.0/gems/flog-4.9.1/lib/flog.rb:7: warning: previous definition of NotRubyParser was here

@etagwerker
Copy link
Collaborator Author

Starting over(ish)?

@faisal Pretty sure I messed up a git merge/rebase and that's why it looked like I was starting over.

https://github.com/faisal/rubycritic/tree/restore_4_fixes

Thanks for pointing me to this branch. I believe it should be good to go now.

Please check it out and let me know if I missed anything. 🙏🏻

@faisal
Copy link
Contributor

faisal commented Dec 30, 2025

Starting over(ish)?

@faisal Pretty sure I messed up a git merge/rebase and that's why it looked like I was starting over.

I had that feeling.

https://github.com/faisal/rubycritic/tree/restore_4_fixes

Thanks for pointing me to this branch. I believe it should be good to go now.

Great -- I'm glad it helped!

Please check it out and let me know if I missed anything. 🙏🏻

It passed all my tests locally, and diffs with results from prior versions showed the output to be substantially the same. I think this is good to go.

@etagwerker etagwerker changed the title Support for Ruby 4.0 RubyCritic v5.0 (Support for Ruby 4.0) Jan 25, 2026
@JuanVqz
Copy link
Contributor

JuanVqz commented Jan 26, 2026

Just sharing some thoughts about releasing v5.

@faisal
Copy link
Contributor

faisal commented Jan 26, 2026

Just sharing some thoughts about releasing v5.

Reading through the upgrade guide and looking at the other js that has to play nice with jQuery, I fear this will be an involved update. jQuery 3.1.1 is almost ten years old, jQuery 4 removes a fair amount of deprecated API surface, and each other script we use (some of which haven't been updated in years) will need to be considered as well.

It's worth doing but is this the release for it?

  • Move out of jQuery?

What could we use instead?

  • Any performance improvement we are willing to do in the reports?

@JuanVqz
Copy link
Contributor

JuanVqz commented Jan 26, 2026

It's worth doing but is this the release for it?

I'm just trying to brainstorm what else we can do in this v5.0 release.

What could we use instead?

I'll have a closer look at the JS used in the frontend to know what we can use instead.

faisal and others added 2 commits January 26, 2026 20:13
* 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
@etagwerker
Copy link
Collaborator Author

Could we upgrade jQuery in this v5 release?

@JuanVqz That's a good idea, but I think it would be best for a 5.1 release. Also, I wouldn't stop at jQuery. I think there may be an opportunity to upgrade most JS dependencies:

  • jQuery
  • bootstrap
  • highchart

We're doing pretty well in terms of dependency freshness for our core dependencies:

➜  rubycritic git:(fixes/555) ✗ libyear-bundler --all
       cucumber-ci-environment         11.0.0     2025-10-07         13.0.0     2026-01-26         2      [2, 0, 0]       0.3
       cucumber-html-formatter         22.3.0     2025-12-22         23.0.0     2026-01-25         1      [1, 0, 0]       0.1
      cucumber-tag-expressions          8.1.0     2025-11-26          9.0.0     2026-01-25         1      [1, 0, 0]       0.2
                          ruby          4.0.0     2025-12-25          4.0.1     2026-01-13         1      [0, 0, 1]       0.1
System is 0.6 libyears behind
Total releases behind: 5
Major, minor, patch versions behind: 4, 0, 1

@etagwerker etagwerker merged commit 587d704 into main Jan 27, 2026
32 checks passed
@etagwerker etagwerker deleted the fixes/555 branch January 27, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ruby 4 support

4 participants