TargetRubyVersion parameter, under AllCops Not Working

Viewed 5118

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?

3 Answers

The config file should be named .rubocop.yml (dot in front).

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 thorugh my file and find/fix the usual offenses. Have a great day guys!

This error was resolved for me by fixing a syntax error in the file.

Related