Published 2023-08-28.
            
Time to read: 1 minutes.
 
ruby collection.
Rubocop Visual Studio Plugin
RuboCop is a Ruby code style checker (linter) and formatter based on the community-driven Ruby Style Guide. There is a Rubocop Visual Studio Code plugin that works well.
Rubocop Project Configuration
  Copying the following lines into .vscode/settings.json makes Rubocop work in Visual Studio Code.
"ruby.rubocop.useBundler": true, "ruby.rubocop.configFilePath": "./.rubocop.yml"
Rubocop Workspace Configuration
  The above settings could also be located in a
  .code-workspace file:
{
  "folders": [
    {
      "path": "~/work/myProject"
    },
  ],
  "settings": {
    "ruby.rubocop.useBundler": true,
    "ruby.rubocop.configFilePath": "./.rubocop.yml"
  }
}
Rubocop Settings
  The following is the Rubocop configuration file (.rubocop.yml) that I use for this Jekyll website.
  It should be located within the top-level directory of a Ruby or Jekyll project.
require:
  - rubocop-jekyll
  - rubocop-md
  - rubocop-performance
  - rubocop-rake
  - rubocop-rspec
inherit_gem:
  rubocop-jekyll: .rubocop.yml
AllCops:
  Exclude:
    - _site/**/*
    - binstub/**/*
    - Gemfile*
    - exe/**/*
    - jekyll/**/*
    - vendor/**/*
  NewCops: enable
  TargetRubyVersion: 2.6
Gemspec/RequireMFA:
  Enabled: false
Jekyll/NoPutsAllowed:
  Enabled: false # Some of my Ruby code is plugins, other Ruby code is not, so this rule is a PITA
Naming/FileName:
  Exclude:
    - _bin/**/*
Layout/HashAlignment:
  EnforcedColonStyle: table
  EnforcedHashRocketStyle: table
Layout/LeadingCommentSpace:
  Exclude:
    - _bin/**/*
Layout/LineLength:
  Max: 150
Layout/FirstHashElementIndentation:
  Enabled: false
Layout/MultilineMethodCallIndentation:
  Enabled: false
Metrics/AbcSize:
  Max: 40
Metrics/BlockLength:
  Max: 50
Metrics/CyclomaticComplexity:
  Max: 15
Metrics/MethodLength:
  Max: 30
Metrics/PerceivedComplexity:
  Max: 20
Style/Alias:
  Exclude:
    - _plugins/symlink_watcher.rb
    - blog/bin/avImport
Style/Documentation:
  Enabled: false
Style/FrozenStringLiteralComment:
  Enabled: false
Style/HashSyntax:
  EnforcedStyle: ruby19
  EnforcedShorthandSyntax: consistent
Style/PercentLiteralDelimiters:
  Enabled: false
Style/RegexpLiteral:
  Enabled: false
Style/StringLiterals:
  Enabled: false
Style/StringLiteralsInInterpolation:
  Enabled: false
Style/TrailingCommaInArrayLiteral:
  Enabled: false
Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: comma
About the Author
I, Mike Slinn, have been working with Ruby for a long time now. Back in 2005, I was the product marketing manager at CodeGear (the company was formerly known as Borland) for their 3rd Rail IDE. 3rd Rail supported Ruby and Ruby on Rails at launch.
In 2006, I co-chaired the Silicon Valley Ruby Conference on behalf of the SD Forum in Silicon Valley. As you can see, I have the t-shirt. I was the sole chairman of the 2007 Silicon Valley Ruby Conference.
Several court cases have come my way over the years in my capacity as a software expert witness. The court cases featured questions about IP misappropriation for Ruby on Rails programs. You can read about my experience as a software expert if that interests you.
I currently enjoy writing Jekyll plugins in Ruby for this website and others, as well as Ruby utilities.