Class: RuboCop::Cop::SketchupSuggestions::AddGroup
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::SketchupSuggestions::AddGroup
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/sketchup/cop/suggestions/add_group.rb
Overview
The idiomatic way to create groups via the Ruby API differ from the way you’d do it from the UI.
Using the API you should prefer to create the group first, then add your geometry into the group. This is more performant and predictable.
Grouping existing geometry via the API have historically been affected by bugs and issues.
If you do have to group existing geometry via the API, make sure you group geometry from the active context; ‘model.active_entities`. Otherwise you might run into unexpected issues, even crashes.
Constant Summary collapse
- MSG =
'Avoid creating groups out of existing entities.'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/rubocop/sketchup/cop/suggestions/add_group.rb', line 39 def on_send(node) return unless add_group?(node) return if node.arguments.empty? add_offense(node, location: arguments_range(node)) end |