Andy Harvey
Andy Harvey

Reputation: 12653

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?

Upvotes: 8

Views: 4393

Answers (1)

Jean
Jean

Reputation: 845

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.

Upvotes: 4

Related Questions