Defect #42606
closedRuboCop warning about deprecated `EnsureNode#body` with rubocop-ast >= 1.41
0%
Description
When running RuboCop on Redmine 6.0-stable and 5.1-stable with `rubocop-ast` 1.41.0 or later, the following warning appears:
`EnsureNode#body` is deprecated and will be changed in the next major version of rubocop-ast. Use `EnsureNode#branch` instead to get the body of the `ensure` branch.
The warning does not appear if `rubocop-ast` is pinned to version 1.40.x.
Index: Gemfile
===================================================================
--- Gemfile (revision 23680)
+++ Gemfile (working copy)
@@ -111,6 +111,7 @@
gem 'selenium-webdriver', '>= 4.11.0'
# RuboCop
gem 'rubocop', '~> 1.68.0', require: false
+ gem 'rubocop-ast', '~> 1.40.0'
gem 'rubocop-performance', '~> 1.22.0', require: false
gem 'rubocop-rails', '~> 2.27.0', require: false
gem 'bundle-audit', require: false
Updated by Alexander Meindl 8 days ago
Hi,
with this change I got the following error with bundle update
:
╰─ bundle update
Your Gemfile lists the gem puma (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Fetching gem metadata from https://rubygems.org/.........
Could not find gem 'rubocop-ast (~> 1.40.0)' with platform 'x86_64-linux' in rubygems repository https://rubygems.org/ or installed locally.
The source contains the following gems matching 'rubocop-ast (~> 1.40.0)':
* rubocop-ast-1.40.0
ruby 3.1.2 was used, no plugin is installed.
Updated by Alexander Meindl 8 days ago
Hi, I forgot to mention the used branch: I used branch 6.0-stable
Updated by Alexander Meindl 8 days ago
Hi again,
I just want to mention, that the problem exists with RAILS_ENV=production.
Updated by Go MAEDA 7 days ago
Alexander Meindl wrote in #note-2:
with this change I got the following error with
bundle update
:
I was unable to eproduce the problem using Ruby 3.1.6 on the 6.0-stable branch.
Does changing the Gemfile as follows resolve the issue?
Index: Gemfile
===================================================================
--- Gemfile (revision 23705)
+++ Gemfile (working copy)
@@ -111,7 +111,7 @@
gem 'selenium-webdriver', '>= 4.11.0'
# RuboCop
gem 'rubocop', '~> 1.68.0', require: false
- gem 'rubocop-ast', '~> 1.40.0'
+ gem 'rubocop-ast', '< 1.41.0'
gem 'rubocop-performance', '~> 1.22.0', require: false
gem 'rubocop-rails', '~> 2.27.0', require: false
gem 'bundle-audit', require: false
Updated by Alexander Meindl 7 days ago
Hi Go MAEDA,
thanks for your response.
No, now I get the following error:
bundle config set --local without 'development test'
bundle update
#Fetching gem metadata from https://rubygems.org/.........
Could not find gem 'rubocop-ast (< 1.41.0)' with platform 'x86_64-linux' in rubygems repository https://rubygems.org/ or installed locally.
The source contains the following gems matching 'rubocop-ast (< 1.41.0)':
* rubocop-ast-0.0.1
* rubocop-ast-0.0.2
* rubocop-ast-0.0.3
* [..]
* rubocop-ast-1.39.0
* rubocop-ast-1.40.0
More information to my system:
- ruby package from debian 12 (no rbenv or rvm)
- Bundler version 2.5.5
Solution¶
But than, I found a solution: the old bundler version was the problem. With bundle update --bundler
I got version 2.6.8
. And with the version, there are no problems with your first commited change.
For me the issue is solved. Your commit already commited version works with a newer bundler version. I am not sure, if this is ok for the stable release, if there are problems with the old bundler version. Other guys will get the same problem, if an old bundler version is used.
Updated by Go MAEDA 7 days ago
Thank you for providing more detailed information.
Alexander Meindl wrote in #note-6:
For me the issue is solved. Your commit already commited version works with a newer bundler version. I am not sure, if this is ok for the stable release, if there are problems with the old bundler version.
It is possible that the Bundler version is not the cause. I tested with Bundler 2.3.26, which is older than your 2.5.5, but I was not able to reproduce the error.
Updated by Alexander Meindl 7 days ago
Hi Go MAEDA,
I am not sure, maybe bundle update --bundler
also do some magic with Gemfile.lock. I made another test with a redmine instance with bundler 2.5.5 installed. In this test, I only deleted the Gemfile.lock file and run bundle update
after this. This worked for me with bundler 2.5.5, too.
Maybe the root cause was in Gemfile.lock and this was fixed with bundle update --bundler
or the newer version of bundle had no problem with the Gemfile.lock file.