Search code examples
rubyvisual-studio-coderubygemslintrubocop

How do I let VScode use the newest Ruby Parser for RuboCop


The problem looks like this: lint

I am using a MacBook Air (M2). The Ruby version is ruby 3.1.2p20, and the parser version is 3.3.7. These are the related extensions I have, all the settings are default. I looked all over the web and couldn't find a solution. I want VSCode to use the newest Ruby parser so it won't throw an error when I try to use pattern matching in Ruby, which is introduced in Ruby 2.7. extensions


Solution

  • install ruby-rubocop VS code extension

    and

    in project folder

    in .rubocop.yml add/update line

    AllCops:

    TargetRubyVersion: 3.3.7