DMPRoadmap / roadmap

DCC/UC3 collaboration for a data management planning tool
MIT License
106 stars 109 forks source link

Rails 7 & Ruby 3.1 #3330

Open benjaminfaure opened 1 year ago

benjaminfaure commented 1 year ago

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.

johnpinto1 commented 1 year ago

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.

briri commented 1 year ago

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.

benjaminfaure commented 1 year ago

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

aaronskiba commented 2 months ago

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?