Integration
See RuboCop's own documentation for more information.
Editor integration
VSCode
VSCode Extensions
Gems
Project Configuration
This setup uses Bundler to manage the gem dependencies for your project. It ensures you can use different version of rubocop
and rubocop-sketchup
for each of your projects.
Start by installing the VSCode extensions listed above.
Then add these configuration files relative to your project root:
Gemfile
# frozen_string_literal: true
source 'https://rubygems.org'
gemspec
group :development do
gem 'rubocop', '>= 0.82', '< 2.0'
gem 'rubocop-sketchup', '~> 1.4.0'
gem 'sketchup-api-stubs' # Not required for rubocop-sketchup, but nice to have
gem 'solargraph'
end
.vscode/settings.json
{
"solargraph.diagnostics": true
}
.solargraph.yml
require_paths:
- "C:/Program Files/SketchUp/SketchUp 2020/Tools" # Modify as needed
- src # Match with AllCops/SketchUp/SourcePath in .rubocop.yml.
reporters:
- rubocop
.rubocop.yml
require: rubocop-sketchup
AllCops:
DisabledByDefault: true
SketchUp:
SourcePath: src # Modify as needed - refer to rubocop-sketchup's configuration
TargetSketchUpVersion: 2014
SketchupDeprecations:
Enabled: true
SketchupPerformance:
Enabled: true
SketchupRequirements:
Enabled: true
SketchupSuggestions:
Enabled: true
SketchupBugs:
Enabled: true
Once that is done, run bundle install
to allow Bundler to install the required gems for your projects.
Now you should be ready to use VSCode with inline feedback from rubocop-sketchup.
Rake integration
RuboCop::RakeTask.new do |task|
task.requires << 'rubocop-sketchup'
end