Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TargetRubyVersion parameter, under AllCops Not Working

When I run rubocop on a file, I get the following warning:

(Using Ruby 2.5 parser; configure using TargetRubyVersion parameter, under AllCops)

I added the following on .rubocop.yml file:

AllCops:
  TargetRubyVersion: 2.5.8

Still the warning is not going away. What am I doing wrong?

like image 281
farha Avatar asked Jul 24 '26 03:07

farha


2 Answers

Had same issue, added the

AllCops:
  TargetRubyVersion: 2.X

to my .rubocop.yml file and it did nothing, error was still showing up.

Turns out I had a syntax error, I was missing a } , once I added it rubocop was able to properly go through my file and find/fix the usual offenses. Have a great day guys!

like image 196
Jose Paez Avatar answered Jul 26 '26 16:07

Jose Paez


you can fix it by adding the following to your .rubocop.yml

AllCops:
  TargetRubyVersion: 3.1.x
like image 42
MOHAMED GAMIL ELDIMARDASH Avatar answered Jul 26 '26 17:07

MOHAMED GAMIL ELDIMARDASH