Class: RuboCop::Cop::SketchupRequirements::GetExtensionLicense
- Inherits:
-
SketchUp::Cop
- Object
- SketchUp::WorkaroundCop
- SketchUp::Cop
- RuboCop::Cop::SketchupRequirements::GetExtensionLicense
- Includes:
- RangeHelp, SketchUp::NoCommentDisable
- Defined in:
- lib/rubocop/sketchup/cop/requirements/get_extension_license.rb
Overview
Don’t attempt to kill the Ruby interpreter by calling ‘exit` or `exit!`. SketchUp will trap `exit` and prevent that, with a message in the console. But `exit!` is not trapped and with terminate SketchUp without shutting down cleanly.
Use ‘return`, `next`, `break` or `raise` instead.
Constant Summary collapse
- MSG_INVALID =
'Invalid extension GUID'
- MSG_WRONG_TYPE =
'Only pass in extension GUID from local string '\ 'literals.'
- MSG_TRAILING_SPACE =
'Extra space in extension GUID'
- EXTENSION_ID_PATTERN =
rubocop:disable Metrics/LineLength
/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.freeze
Constants included from SketchUp::Config
SketchUp::Config::DEFAULT_CONFIGURATION
Instance Method Summary collapse
-
#on_send(node) ⇒ Object
rubocop:enable Metrics/LineLength.
Methods inherited from SketchUp::Cop
Instance Method Details
#on_send(node) ⇒ Object
rubocop:enable Metrics/LineLength
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rubocop/sketchup/cop/requirements/get_extension_license.rb', line 35 def on_send(node) argument = get_extension_license(node) return unless argument if argument.lvar_type? variable_name = argument.children.first assignment_node = find_assignment(node, variable_name) argument = assignment_node.children.last if assignment_node end if argument.str_type? validate_extension_id(argument) else location = argument.loc.expression add_offense(node, location: location, message: MSG_WRONG_TYPE) end end |