Where is "all cops" that I'm supposed to set "TargetRubyVersion" in?
Just installed 2017.1 and I'm getting syntax warnings from RuboCop because it's using a different Ruby version than the project. On hovering it says to set the TargetRubyVersion in AllCops.
I have looked and looked and cannot find this option.
Where do I set this?
UPDATE: it's added to the .rubocop.yml file as in:
AllCops:
TargetRubyVersion: 2.3.3
LATER UPDATE: I had to disable the RuboCop inspection as unusable.
"2.3.3" is not recognized as a valid Ruby version (want's "2.3" or other major.minor versions only) however RubyMine still shows me invalid syntax in every case where I've used the safe navigation operator that was introduced in 2.3.0.
请先登录再写评论。
Hello Jerry,
it appears to be a known problem, please vote for it:
https://youtrack.jetbrains.com/issue/RUBY-19379
Edit: Forget my comment, all I said is already mentioned in the ticket.
Leaving the patch version number out of the config is actually the normal RuboCop config behavior. However, RuboCop should also respect the ruby version set in a .ruby-version file. My native RuboCop installation respects this, for some reason though, the one that's integrated in RubyMine does not.
I agree RM could be smarter with its Rubocop default settings,
but you should store the Rubocop config in the repository by adding a `.rubocop.yml` to your project.
Example: