This is for @tt_su and @ene_su or others who are familiar with rubocop
.
In our September Developer MeetUp, I brought up having some issues integrating rubocop-sketchup
with standard rubocop
. Created this topic to discuss some of the issues I’ve encountered when trying to use rubocop-sketchup
.
First, I have version 1.2.0 of RuboCop…
rubocop -v
1.2.0
And, in the Github page for rubocop-sketchup
the installation specify to use rubocop
version 0.93
. Does this means I have to uninstall version 1.2.0
for rubocop?
gem install rubocop -v 0.93
gem install rubocop-sketchup
The last time I installed gem
files was when developing ruby on rails
apps using a gem file
and running bundle install
after. But, not sure how to make this work outside of rails
app. However, I ran the commands on the terminal and they seem to have been installed.
Ok so here is the error I get when running rubocop
from the terminal while having require: rubocop-sketchup
on my .rubocop.yml
file.
◯ src % rubocop
/Users/rafaelrivera/Dropbox/GIT/compo-guides/.rubocop.yml:5: `Metrics/MethodLength` is concealed by line 134
Unable to activate rubocop-sketchup-0.19.0, because rubocop-1.2.0 conflicts with rubocop (>= 0.82, <= 0.93)
/Users/rafaelrivera/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/specification.rb:2243:in `raise_if_conflicts'
/Users/rafaelrivera/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/specification.rb:1371:in `activate'
/Users/rafaelrivera/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:215:in `rescue in try_activate'
/Users/rafaelrivera/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:208:in `try_activate'
/Users/rafaelrivera/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:161:in `rescue in require'
/Users/rafaelrivera/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:156:in `require'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/config_loader_resolver.rb:17:in `block (2 levels) in resolve_requires'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/config_loader_resolver.rb:13:in `each'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/config_loader_resolver.rb:12:in `tap'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/config_loader.rb:43:in `load_file'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/config_loader.rb:104:in `configuration_from_file'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/config_store.rb:58:in `for_dir'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/config_store.rb:37:in `for_pwd'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/cli.rb:124:in `apply_default_formatter'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/lib/rubocop/cli.rb:40:in `run'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/exe/rubocop:13:in `block in <top (required)>'
/Users/rafaelrivera/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/gems/rubocop-1.2.0/exe/rubocop:12:in `<top (required)>'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/bin/rubocop:23:in `load'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/bin/rubocop:23:in `<main>'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
/Users/rafaelrivera/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
I personally use rubocop
with Sublime
by installing rubocop
Package Control.
https://packagecontrol.io/packages/RuboCop
Everything works without rubocop-sketchup
being required.
Here is my .rubocop.yml
file just in case (most was copied from eneroth y thomthom).
# The line below if uncommented makes rubocop not work.
#require: rubocop-sketchup
# Aim for 10 lines or less but accept longer ones when things can't be extracted
# to sensible methods.
Metrics/MethodLength:
Max: 20
Naming/MethodName:
IgnoredPatterns:
# Tool
- '^\s*enableVCB\?(\(.*\))?$'
- '^\s*getExtents(\(.*\))?$'
- '^\s*getInstructorContentDirectory(\(.*\))?$'
- '^\s*getMenu(\(.*\))?$'
- '^\s*onCancel(\(.*\))?$'
- '^\s*onKeyDown(\(.*\))?$'
- '^\s*onKeyUp(\(.*\))?$'
- '^\s*onLButtonDoubleClick(\(.*\))?$'
- '^\s*onLButtonDown(\(.*\))?$'
- '^\s*onLButtonUp(\(.*\))?$'
- '^\s*onMButtonDoubleClick(\(.*\))?$'
- '^\s*onMButtonDown(\(.*\))?$'
- '^\s*onMButtonUp(\(.*\))?$'
- '^\s*onMouseEnter(\(.*\))?$'
- '^\s*onMouseLeave(\(.*\))?$'
- '^\s*onMouseMove(\(.*\))?$'
- '^\s*onMouseWheel(\(.*\))?$'
- '^\s*onRButtonDown(\(.*\))?$'
- '^\s*onRButtonUp(\(.*\))?$'
- '^\s*onReturn(\(.*\))?$'
- '^\s*onSetCursor(\(.*\))?$'
- '^\s*onUserText(\(.*\))?$'
# AppObserver
- '^\s*expectsStartupModelNotifications(\(.*\))?$'
- '^\s*onActivateModel(\(.*\))?$'
- '^\s*onNewModel(\(.*\))?$'
- '^\s*onOpenModel(\(.*\))?$'
- '^\s*onQuit(\(.*\))?$'
- '^\s*onUnloadExtension(\(.*\))?$'
# DefinitionObserver
- '^\s*onComponentInstanceAdded(\(.*\))?$'
- '^\s*onComponentInstanceRemoved(\(.*\))?$'
# DefinitionsObserver
- '^\s*onComponentAdded(\(.*\))?$'
- '^\s*onComponentPropertiesChanged(\(.*\))?$'
- '^\s*onComponentRemoved(\(.*\))?$'
- '^\s*onComponentTypeChanged(\(.*\))?$'
# DimensionsObserver
- '^\s*onTextChanged(\(.*\))?$'
# EntitiesObserver
- '^\s*onActiveSectionPlaneChanged(\(.*\))?$'
- '^\s*onElementAdded(\(.*\))?$'
- '^\s*onElementModified(\(.*\))?$'
- '^\s*onElementRemoved(\(.*\))?$'
- '^\s*onEraseEntities(\(.*\))?$'
# EntityObserver
- '^\s*onChangeEntity(\(.*\))?$'
- '^\s*onEraseEntity(\(.*\))?$'
# FrameChangeObserver
- '^\s*frameChange(\(.*\))?$'
# InstanceObserver
- '^\s*onClose(\(.*\))?$'
- '^\s*onOpen(\(.*\))?$'
# LayersObserver
- '^\s*onCurrentLayerChangedS(\(.*\))?$'
- '^\s*onLayerAdded(\(.*\))?$'
- '^\s*onLayerChanged(\(.*\))?$'
- '^\s*onLayerRemoved(\(.*\))?$'
- '^\s*onRemoveAllLayers(\(.*\))?$'
# MaterialsObserver
- '^\s*onMaterialAdd(\(.*\))?$'
- '^\s*onMaterialChange(\(.*\))?$'
- '^\s*onMaterialRefChange(\(.*\))?$'
- '^\s*onMaterialRemove(\(.*\))?$'
- '^\s*onMaterialSetCurrent(\(.*\))?$'
- '^\s*onMaterialUndoRedo(\(.*\))?$'
# ModelObserver
- '^\s*onActivePathChanged(\(.*\))?$'
- '^\s*onAfterComponentSaveAs(\(.*\))?$'
- '^\s*onBeforeComponentSaveAs(\(.*\))?$'
- '^\s*onDeleteModel(\(.*\))?$'
- '^\s*onEraseAll(\(.*\))?$'
- '^\s*onExplode(\(.*\))?$'
- '^\s*onPidChanged(\(.*\))?$'
- '^\s*onPlaceComponent(\(.*\))?$'
- '^\s*onPostSaveModel(\(.*\))?$'
- '^\s*onPreSaveModel(\(.*\))?$'
- '^\s*onSaveModel(\(.*\))?$'
- '^\s*onTransactionAbort(\(.*\))?$'
- '^\s*onTransactionCommit(\(.*\))?$'
- '^\s*onTransactionEmpty(\(.*\))?$'
- '^\s*onTransactionRedo(\(.*\))?$'
- '^\s*onTransactionStart(\(.*\))?$'
- '^\s*onTransactionUndo(\(.*\))?$'
# OptionsproviderObserver
- '^\s*onOptionsProviderChanged(\(.*\))?$'
# PagesObserver
- '^\s*onContentsModified(\(.*\))?$'
- '^\s*onElementAdded(\(.*\))?$'
- '^\s*onElementRemoved(\(.*\))?$'
# RenderingOptionsObserver
- '^\s*onRenderingOptionsChanged(\(.*\))?$'
# SelectionObserver
- '^\s*onSelectionAdded(\(.*\))?$'
- '^\s*onSelectionBulkChange(\(.*\))?$'
- '^\s*onSelectionCleared(\(.*\))?$'
- '^\s*onSelectionRemoved(\(.*\))?$'
- '^\s*onSelectedRemoved(\(.*\))?$'
# ShadowInfoObserver
- '^\s*onShadowInfoChanged(\(.*\))?$'
# ToolsObserver
- '^\s*onActiveToolChanged(\(.*\))?$'
- '^\s*onToolStateChanged(\(.*\))?$'
# ViewObserver
- '^\s*onViewChanged(\(.*\))?$'
# Allow common names in SketchUp 3d modeling.
Naming/MethodParameterName:
AllowedNames:
- 'x'
- 'y'
- 'z'
- 'u'
- 'v'
- 'uv'
- 'ip'
# Ideal length should be 80. But some times it reads better to let the line
# bleed over by a little. In this project there are enough of these cases that
# the RuboCop max is set to 100.
Metrics/LineLength:
Max: 100
Metrics/MethodLength:
Max: 30
Ok, I’ll stop here for now.
Hopefully, I was able to express what is going on.