Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why is Rubocop raising “parser/current recognizes 2.5.5-compliant syntax, but you are running 2.5.3”?

In a Rails app I have started seeing the following in logs and test outputs.

warning: parser/current is loading parser/ruby25, which recognizes
warning: 2.5.5-compliant syntax, but you are running 2.5.3.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

This is coming from Rubocop.

I had understood that Rubocop checks whether a .ruby-version file exists in the app root and uses the Ruby version it specifies. https://rubocop.readthedocs.io/en/latest/configuration/#setting-the-target-ruby-version

The Rails app contains such a file

/.ruby-version
ruby-2.5.3

Why is Rubocop running checks against the wrong version of Ruby?

like image 640
Andy Harvey Avatar asked Jun 11 '19 07:06

Andy Harvey


1 Answers

It's coming from parser, a dependency of rubocop.

https://github.com/whitequark/parser/blob/master/lib/parser/current.rb

Looking at this code it seems that if you are not using the last minor version of Ruby you're getting this warning.

like image 51
Jean Avatar answered Oct 04 '22 13:10

Jean