roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Rails 7 & Ruby 3.1

Open benjaminfaure opened this issue 2 years ago • 4 comments

I recently updated DMP OPIDoR to Rails 7 & Ruby 3.1.

The upgrade has been fairly easy, the most notable changes coming from Ruby 3.1. I'll send a PR for this update.

https://www.ruby-lang.org/en/news/2021/12/25/ruby-3-1-0-released/ Ruby 3.1 brings an autocomplete feature in the Rails console. It can be usefull if you use it a lot. The main changes is a new syntax suger for hash literals, they tried to add something a bit similar to ES6 Javascript ;

Values in Hash literals and keyword arguments can be omitted.
    {x:, y:} is syntax sugar for {x: x, y: y}.
    foo(x:, y:) is syntax sugar for foo(x: x, y: y).

This change triggers a lot a rubocop warning, as it now expects apps to use this new syntax. It can be automatically fixed by Rubocop. We might have to discuss if we keep this change or if we deactivate the rule, as the syntax is not really clear.

benjaminfaure avatar Jul 18 '23 13:07 benjaminfaure

Bringing this change would be good. We need to keep up to date with developments. So @benjaminfaure can suggest a way of introducing the change gradually to the code? You said Rubocop autofixes code. So maybe just doing it as a PR as I think you suggested at the last meeting. We can ask others to contribute to discussion too.

johnpinto1 avatar Jul 24 '23 15:07 johnpinto1

Agree that this would be a good change. We should stay up to date with the latest trends. It will however require a lot of testing since our current code coverage isn't great.

briri avatar Jul 24 '23 16:07 briri

I think by using the rubocop -a/rubocop -A command, Rubocop can autofix most of the syntax issue, this one included.

I can do a commit on this branch with the rubocop fixes if you want

benjaminfaure avatar Jul 25 '23 13:07 benjaminfaure

In terms of the Roadmap 2024 Q4 Project Backlog, it is looking like only the Rails 7 upgrade will be included for now (Rails 7 PR: https://github.com/DMPRoadmap/roadmap/pull/3426).

A further Rails upgrade to 7.2 will probably occur in the near future to address the following issue: https://github.com/DMPRoadmap/roadmap/issues/3429. Perhaps the Ruby 3.1 upgrade will be done at that time as well?

aaronskiba avatar Sep 04 '24 18:09 aaronskiba