` warning: parser/current is loading parser/ruby2x, which recognizes warning: 2.a-compliant syntax, but you are running 2.b. `
Detail
https://github.com/whitequark/parser#compatibility-with-ruby-mri
Unfortunately, Ruby MRI often changes syntax in patchlevel versions. This has happened, at least, for every release since 1.9; for example, commits c5013452 and 04bb9d6b were backported all the way from HEAD to 1.9. Moreover, there is no simple way to track these changes.
This policy makes it all but impossible to make Parser precisely compatible with the Ruby MRI parser. Indeed, at September 2014, it would be necessary to maintain and update ten different parsers together with their lexer quirks in order to be able to emulate any given released Ruby MRI version.
As a result, Parser chooses a different path: the
parser/rubyXY
parsers recognize the syntax of the latest minor version of Ruby MRI X.Y at the time of the gem release.
Solution
Run Rubocop as
ruby -W0 -S rubocop filename
- Install gem warning and config as:
1 2 3
# config/initializers/warning_ignores.rb ### https://github.com/jeremyevans/ruby-warning Warning.ignore(/warning: parser/)
- If you use VS Code as code editor and install
ruby-rubocop
extension. Go to its extension settings and check the checkbox1
Ruby > Rubocop:Suppress Rubocop Warnings