Class: RuboCop::Cop::SketchupPerformance::OperationDisableUI

Inherits:
SketchUp::Cop
  • Object
show all
Defined in:
lib/rubocop/sketchup/cop/performance/operation_disable_ui.rb

Overview

Weak warning. (Question?)

Constant Summary collapse

MSG =
'Operations should disable the UI for performance gain.'.freeze

Constants included from SketchUp::Config

SketchUp::Config::DEFAULT_CONFIGURATION

Instance Method Summary collapse

Methods inherited from SketchUp::Cop

inherited, #relevant_file?

Instance Method Details

#on_send(node) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rubocop/sketchup/cop/performance/operation_disable_ui.rb', line 10

def on_send(node)
  _, method_name, *args = *node
  return unless method_name == :start_operation
  if args.size < 2
    add_offense(node, location: :expression)
    return
  end
  argument = args[1]
  disable_ui = argument.truthy_literal?
  return if disable_ui
  add_offense(argument, location: :expression)
end