rubocop-sketchup 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/lib/rubocop-sketchup.rb +2 -0
  4. data/lib/rubocop/sketchup.rb +2 -0
  5. data/lib/rubocop/sketchup/cop/bugs/material_name.rb +1 -1
  6. data/lib/rubocop/sketchup/cop/bugs/render_mode.rb +2 -2
  7. data/lib/rubocop/sketchup/cop/bugs/uniform_scaling.rb +1 -1
  8. data/lib/rubocop/sketchup/cop/deprecations/add_separator_to_menu.rb +1 -1
  9. data/lib/rubocop/sketchup/cop/deprecations/operation_next_transparent.rb +1 -1
  10. data/lib/rubocop/sketchup/cop/deprecations/require_all.rb +1 -1
  11. data/lib/rubocop/sketchup/cop/deprecations/set_texture_projection.rb +1 -1
  12. data/lib/rubocop/sketchup/cop/deprecations/show_ruby_panel.rb +1 -1
  13. data/lib/rubocop/sketchup/cop/deprecations/sketchup_set.rb +1 -1
  14. data/lib/rubocop/sketchup/cop/performance/openssl.rb +1 -1
  15. data/lib/rubocop/sketchup/cop/performance/operation_disable_ui.rb +1 -1
  16. data/lib/rubocop/sketchup/cop/performance/selection_bulk.rb +1 -1
  17. data/lib/rubocop/sketchup/cop/performance/type_check.rb +1 -1
  18. data/lib/rubocop/sketchup/cop/performance/typename.rb +1 -1
  19. data/lib/rubocop/sketchup/cop/requirements/api_namespace.rb +1 -1
  20. data/lib/rubocop/sketchup/cop/requirements/exit.rb +1 -1
  21. data/lib/rubocop/sketchup/cop/requirements/extension_namespace.rb +1 -1
  22. data/lib/rubocop/sketchup/cop/requirements/file_structure.rb +6 -6
  23. data/lib/rubocop/sketchup/cop/requirements/gem_install.rb +1 -1
  24. data/lib/rubocop/sketchup/cop/requirements/get_extension_license.rb +3 -3
  25. data/lib/rubocop/sketchup/cop/requirements/global_constants.rb +1 -1
  26. data/lib/rubocop/sketchup/cop/requirements/global_include.rb +1 -1
  27. data/lib/rubocop/sketchup/cop/requirements/global_methods.rb +1 -1
  28. data/lib/rubocop/sketchup/cop/requirements/global_variables.rb +1 -1
  29. data/lib/rubocop/sketchup/cop/requirements/language_handler_globals.rb +1 -1
  30. data/lib/rubocop/sketchup/cop/requirements/load_path.rb +1 -1
  31. data/lib/rubocop/sketchup/cop/requirements/minimal_registration.rb +1 -1
  32. data/lib/rubocop/sketchup/cop/requirements/observers_start_operation.rb +1 -1
  33. data/lib/rubocop/sketchup/cop/requirements/register_extension.rb +1 -1
  34. data/lib/rubocop/sketchup/cop/requirements/ruby_core_namespace.rb +1 -1
  35. data/lib/rubocop/sketchup/cop/requirements/ruby_stdlib_namespace.rb +1 -1
  36. data/lib/rubocop/sketchup/cop/requirements/shipped_extensions_namespace.rb +1 -1
  37. data/lib/rubocop/sketchup/cop/requirements/sketchup_extension.rb +14 -14
  38. data/lib/rubocop/sketchup/cop/requirements/sketchup_require.rb +5 -5
  39. data/lib/rubocop/sketchup/cop/suggestions/add_group.rb +1 -1
  40. data/lib/rubocop/sketchup/cop/suggestions/compatibility.rb +3 -3
  41. data/lib/rubocop/sketchup/cop/suggestions/dc_internals.rb +1 -1
  42. data/lib/rubocop/sketchup/cop/suggestions/file_encoding.rb +1 -1
  43. data/lib/rubocop/sketchup/cop/suggestions/model_entities.rb +1 -1
  44. data/lib/rubocop/sketchup/cop/suggestions/monkey_patched_api.rb +5 -5
  45. data/lib/rubocop/sketchup/cop/suggestions/operation_name.rb +4 -4
  46. data/lib/rubocop/sketchup/cop/suggestions/sketchup_find_support_file.rb +1 -1
  47. data/lib/rubocop/sketchup/cop/suggestions/tool_drawing_bounds.rb +1 -1
  48. data/lib/rubocop/sketchup/cop/suggestions/tool_invalidate.rb +2 -2
  49. data/lib/rubocop/sketchup/cop/suggestions/tool_user_input.rb +1 -1
  50. data/lib/rubocop/sketchup/cop/suggestions/toolbar_timer.rb +2 -2
  51. data/lib/rubocop/sketchup/formatter/extension_review.rb +1 -1
  52. data/lib/rubocop/sketchup/namespace.rb +1 -1
  53. data/lib/rubocop/sketchup/range_help.rb +1 -1
  54. data/lib/rubocop/sketchup/version.rb +3 -1
  55. data/rubocop-sketchup.gemspec +4 -2
  56. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f41cde091e8436d91f8401f489bda6daed828f7dbef89f645620f325b6a188d
4
- data.tar.gz: 8f13f01611e868c0b4bb3ad904d5679de3c4aa7c38869d42e38cddab05971b8f
3
+ metadata.gz: f191f3c6933aecafd8276d46cf582094e4562b7d1a9d7e2c62031351d83c7318
4
+ data.tar.gz: '0854e6c51bfec535cf5c626fdf5f44d335ef392daa979e56bfdff9fc0deb2a8e'
5
5
  SHA512:
6
- metadata.gz: c7dd283a2ff010bafbea36e15c57c58f3ce72e17787da27e5b4e80e7dc0b545e81ae55edecad18d91be0e50d54130c90bf8bdeef03834168627608ff96368a53
7
- data.tar.gz: 5007bf166f68996827c4f9c0782ca0214cfc36a669e03c3573a8c15912a331ed088e759e434b89a0223897c0134d0e042923395e7dcfa51cd39cb142d329fba4
6
+ metadata.gz: 4f2755cbefe2667ef8d2888c269f16561109b6c848bb7ce089cbe0d03273e801bc68862f773e5e95be170734bc5c28b71b9848d602a9ce89fe6bd0cc98b74abf
7
+ data.tar.gz: 62f91f9d6adf7da13fdd3da9ab0f1f75145c7d8172d6c5cc21217352df3d3a875e6e450a825ac46632a594a4cdaa200771475f5c968a25f08df58c21dec1462d
data/Gemfile CHANGED
@@ -12,9 +12,9 @@ end
12
12
 
13
13
  group :development do
14
14
  gem 'bump', '~> 0.5', require: false
15
- gem 'nokogiri', '>= 1.8', '< 1.10', require: false # 1.10 require Ruby 2.3
15
+ gem 'rubocop-performance', require: false
16
16
  gem 'simplecov', '~> 0.10', require: false
17
- gem 'solargraph', '~> 0.31', require: false
17
+ gem 'solargraph', '~> 0.34', require: false
18
18
  gem 'thor', '~> 0.20', require: false
19
19
  gem 'yard', '~> 0.9', require: false
20
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubocop'
2
4
  require 'rubocop/sketchup'
3
5
  require 'rubocop/sketchup/version'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
 
3
5
  module RuboCop
@@ -79,7 +79,7 @@ module RuboCop
79
79
  PATTERN
80
80
 
81
81
  MSG_SET_NAME = '`material.name=` might add duplicate materials in '\
82
- 'SU2017 and older versions.'.freeze
82
+ 'SU2017 and older versions.'
83
83
 
84
84
  def on_send(node)
85
85
  return unless valid_for_target_sketchup_version?
@@ -43,10 +43,10 @@ module RuboCop
43
43
  PATTERN
44
44
 
45
45
  MSG_OBSOLETE = 'Obsolete render mode will crash in SU2017 and '\
46
- 'newer versions.'.freeze
46
+ 'newer versions.'
47
47
 
48
48
  MSG_INVALID = 'Invalid render mode will crash in SU2017 and '\
49
- 'newer versions.'.freeze
49
+ 'newer versions.'
50
50
 
51
51
  def on_send(node)
52
52
  return unless valid_for_target_sketchup_version?
@@ -21,7 +21,7 @@ module RuboCop
21
21
  PATTERN
22
22
 
23
23
  MSG = 'Resulting transformation matrix might yield unexpected '\
24
- 'results.'.freeze
24
+ 'results.'
25
25
 
26
26
  def on_send(node)
27
27
  return unless valid_for_target_sketchup_version?
@@ -7,7 +7,7 @@ module RuboCop
7
7
  # a sub-menu instead.
8
8
  class AddSeparatorToMenu < SketchUp::Cop
9
9
 
10
- MSG = 'Method is deprecated.'.freeze
10
+ MSG = 'Method is deprecated.'
11
11
 
12
12
  def_node_matcher :add_separator_to_menu?, <<-PATTERN
13
13
  (send nil? :add_separator_to_menu _)
@@ -13,7 +13,7 @@ module RuboCop
13
13
  # Only use this flag if you have no other option, for instance to work
14
14
  # around bug in how `Sketchup::Model#place_component` starts operations.
15
15
  class OperationNextTransparent < SketchUp::Cop
16
- MSG = 'Third argument is deprecated.'.freeze
16
+ MSG = 'Third argument is deprecated.'
17
17
 
18
18
  def on_send(node)
19
19
  _, method_name, *args = *node
@@ -9,7 +9,7 @@ module RuboCop
9
9
  class RequireAll < SketchUp::Cop
10
10
 
11
11
  MSG = 'Method is deprecated because it adds the given path '\
12
- 'to $LOAD_PATH.'.freeze
12
+ 'to $LOAD_PATH.'
13
13
 
14
14
  def_node_matcher :require_all?, <<-PATTERN
15
15
  (send nil? :require_all _)
@@ -8,7 +8,7 @@ module RuboCop
8
8
  # repaired. Once repaired the UV mapping will visually change.
9
9
  class SetTextureProjection < SketchUp::Cop
10
10
 
11
- MSG = 'Method is deprecated. It can create invalid UV mapping.'.freeze
11
+ MSG = 'Method is deprecated. It can create invalid UV mapping.'
12
12
 
13
13
  def_node_matcher :set_texture_projection?, <<-PATTERN
14
14
  (send _ :set_texture_projection ...)
@@ -7,7 +7,7 @@ module RuboCop
7
7
  class ShowRubyPanel < SketchUp::Cop
8
8
 
9
9
  MSG = 'Method is deprecated. Use `SKETCHUP_CONSOLE.show` '\
10
- 'instead.'.freeze
10
+ 'instead.'
11
11
 
12
12
  def_node_matcher :show_ruby_panel?, <<-PATTERN
13
13
  (send nil? :show_ruby_panel)
@@ -12,7 +12,7 @@ module RuboCop
12
12
  # and less versatile.
13
13
  class SketchupSet < SketchUp::Cop
14
14
 
15
- MSG = 'Class is deprecated.'.freeze
15
+ MSG = 'Class is deprecated.'
16
16
 
17
17
  def_node_matcher :sketchup_set?, <<-PATTERN
18
18
  (const (const nil? :Sketchup) :Set)
@@ -16,7 +16,7 @@ module RuboCop
16
16
  class OpenSSL < SketchUp::Cop
17
17
 
18
18
  MSG = 'Avoid use of OpenSSL within SketchUp due to severe performance '\
19
- 'issues.'.freeze
19
+ 'issues.'
20
20
 
21
21
  # http://www.rubydoc.info/gems/rubocop/RuboCop/NodePattern
22
22
  # https://rubocop.readthedocs.io/en/latest/node_pattern/
@@ -11,7 +11,7 @@ module RuboCop
11
11
  # # <model changes>
12
12
  # model.commit_operation
13
13
  class OperationDisableUI < SketchUp::Cop
14
- MSG = 'Operations should disable the UI for performance gain.'.freeze
14
+ MSG = 'Operations should disable the UI for performance gain.'
15
15
 
16
16
  def on_send(node)
17
17
  _, method_name, *args = *node
@@ -29,7 +29,7 @@ module RuboCop
29
29
  include RangeHelp
30
30
 
31
31
  MSG = 'Prefer changing selection in bulk instead of modifying '\
32
- 'selection within loops.'.freeze
32
+ 'selection within loops.'
33
33
 
34
34
  # http://www.rubydoc.info/gems/rubocop/RuboCop/NodePattern
35
35
  # https://rubocop.readthedocs.io/en/latest/node_pattern/
@@ -31,7 +31,7 @@ module RuboCop
31
31
  include RangeHelp
32
32
 
33
33
  MSG = 'String comparisons are very slow, prefer `.is_a?` '\
34
- 'instead.'.freeze
34
+ 'instead.'
35
35
 
36
36
  def_node_matcher :string_class_compare?, <<-PATTERN
37
37
  (send
@@ -8,7 +8,7 @@ module RuboCop
8
8
  # `entity.typename == 'Face'` is slow because it performs a string
9
9
  # comparison. `is_a?` is much faster because it's a simple type check.
10
10
  class Typename < SketchUp::Cop
11
- MSG = '`.typename` is very slow, prefer `.is_a?` instead.'.freeze
11
+ MSG = '`.typename` is very slow, prefer `.is_a?` instead.'
12
12
 
13
13
  def on_send(node)
14
14
  _, method_name = *node
@@ -14,7 +14,7 @@ module RuboCop
14
14
  include SketchUp::NoCommentDisable
15
15
  include SketchUp::NamespaceChecker
16
16
 
17
- MSG = 'Do not modify the SketchUp API.'.freeze
17
+ MSG = 'Do not modify the SketchUp API.'
18
18
 
19
19
  NAMESPACES = %w[
20
20
  Geom Layout Sketchup SketchupExtension UI
@@ -14,7 +14,7 @@ module RuboCop
14
14
  include SketchUp::NoCommentDisable
15
15
 
16
16
  MSG = '`exit` attempts to kill the Ruby interpreter. Use `return`, '\
17
- '`next`, `break` or `raise` instead.'.freeze
17
+ '`next`, `break` or `raise` instead.'
18
18
 
19
19
  # Reference: http://rubocop.readthedocs.io/en/latest/development/
20
20
  def_node_matcher :exit?, <<-PATTERN
@@ -88,7 +88,7 @@ module RuboCop
88
88
  namespace = Namespace.new(node.defined_module_name).from_root
89
89
  format('Use a single root namespace. '\
90
90
  '(Found `%<found>s`; Previously found `%<expected>s`)',
91
- found: namespace, expected: @@namespace)
91
+ found: namespace, expected: @@namespace)
92
92
  end
93
93
 
94
94
  def exempted?(namespace)
@@ -40,8 +40,8 @@ module RuboCop
40
40
  msg = 'Extensions must have exactly one root Ruby (.rb) file. '\
41
41
  'Found: %d'
42
42
  add_offense(nil,
43
- location: range,
44
- message: format(msg, root_ruby_files.size))
43
+ location: range,
44
+ message: format(msg, root_ruby_files.size))
45
45
  return
46
46
  end
47
47
 
@@ -57,8 +57,8 @@ module RuboCop
57
57
  if sub_folders.size != 1
58
58
  msg = 'Extensions must have exactly one support directory. Found %d'
59
59
  add_offense(nil,
60
- location: range,
61
- message: format(msg, sub_folders.size))
60
+ location: range,
61
+ message: format(msg, sub_folders.size))
62
62
  return
63
63
  end
64
64
 
@@ -69,8 +69,8 @@ module RuboCop
69
69
  'of the root Ruby file. Expected %s, found %s'
70
70
  msg = format(msg, extension_basename, support_directory.basename)
71
71
  add_offense(nil,
72
- location: range,
73
- message: msg)
72
+ location: range,
73
+ message: msg)
74
74
  end
75
75
  end
76
76
 
@@ -26,7 +26,7 @@ module RuboCop
26
26
  include SketchUp::NoCommentDisable
27
27
 
28
28
  MSG = '`Gem.install` is unreliable in SketchUp, and can cause '\
29
- 'extensions to clash.'.freeze
29
+ 'extensions to clash.'
30
30
 
31
31
  # Reference: http://rubocop.readthedocs.io/en/latest/development/
32
32
  def_node_matcher :gem_install?, <<-PATTERN
@@ -14,12 +14,12 @@ module RuboCop
14
14
  include RangeHelp
15
15
  include SketchUp::NoCommentDisable
16
16
 
17
- MSG_INVALID = 'Invalid extension GUID'.freeze
17
+ MSG_INVALID = 'Invalid extension GUID'
18
18
 
19
19
  MSG_WRONG_TYPE = 'Only pass in extension GUID from local string '\
20
- 'literals.'.freeze
20
+ 'literals.'
21
21
 
22
- MSG_TRAILING_SPACE = 'Extra space in extension GUID'.freeze
22
+ MSG_TRAILING_SPACE = 'Extra space in extension GUID'
23
23
 
24
24
  def_node_matcher :get_extension_license, <<-PATTERN
25
25
  (send
@@ -14,7 +14,7 @@ module RuboCop
14
14
  include SketchUp::NoCommentDisable
15
15
  include SketchUp
16
16
 
17
- MSG = 'Do not introduce global constants.'.freeze
17
+ MSG = 'Do not introduce global constants.'
18
18
 
19
19
  def_node_matcher :namespaced_constant?, <<-PATTERN
20
20
  (casgn
@@ -14,7 +14,7 @@ module RuboCop
14
14
  include SketchUp::NoCommentDisable
15
15
  include SketchUp
16
16
 
17
- MSG = 'Do not include into global namespace.'.freeze
17
+ MSG = 'Do not include into global namespace.'
18
18
 
19
19
  def_node_matcher :is_include?, <<-PATTERN
20
20
  (send nil? :include ...)
@@ -14,7 +14,7 @@ module RuboCop
14
14
  include SketchUp::NoCommentDisable
15
15
  include SketchUp
16
16
 
17
- MSG = 'Do not introduce global methods.'.freeze
17
+ MSG = 'Do not introduce global methods.'
18
18
 
19
19
  # Reference: http://www.rubydoc.info/gems/rubocop/RuboCop/NodePattern
20
20
  #
@@ -21,7 +21,7 @@ module RuboCop
21
21
  include SketchUp::NoCommentDisable
22
22
  include SketchUp::DynamicComponentGlobals
23
23
 
24
- MSG = 'Do not introduce global variables.'.freeze
24
+ MSG = 'Do not introduce global variables.'
25
25
 
26
26
  # predefined global variables their English aliases
27
27
  # http://www.zenspider.com/Languages/Ruby/QuickRef.html
@@ -11,7 +11,7 @@ module RuboCop
11
11
  include SketchUp::NoCommentDisable
12
12
 
13
13
  MSG = 'Avoid globals in general, but especially these which are known '\
14
- 'to be in use.'.freeze
14
+ 'to be in use.'
15
15
 
16
16
  LH_GLOBALS = %i[
17
17
  $dc_strings
@@ -9,7 +9,7 @@ module RuboCop
9
9
 
10
10
  include SketchUp::NoCommentDisable
11
11
 
12
- MSG = 'Do not modify the load path.'.freeze
12
+ MSG = 'Do not modify the load path.'
13
13
 
14
14
  def_node_matcher :load_path_mutator?, <<-PATTERN
15
15
  (send
@@ -33,7 +33,7 @@ module RuboCop
33
33
  include SketchUp::ExtensionProject
34
34
 
35
35
  MSG = "Don't load extension files in the root file registering the "\
36
- 'extension.'.freeze
36
+ 'extension.'
37
37
 
38
38
  # Reference: http://rubocop.readthedocs.io/en/latest/node_pattern/
39
39
  def_node_matcher :require_filename, <<-PATTERN
@@ -32,7 +32,7 @@ module RuboCop
32
32
  include SketchUp::NoCommentDisable
33
33
  include RangeHelp
34
34
 
35
- MSG = 'Observers should create transparent operations.'.freeze
35
+ MSG = 'Observers should create transparent operations.'
36
36
 
37
37
  def_node_search :start_operation, <<-PATTERN
38
38
  (send
@@ -18,7 +18,7 @@ module RuboCop
18
18
 
19
19
  include SketchUp::NoCommentDisable
20
20
 
21
- MSG = 'Always register extensions to load by default.'.freeze
21
+ MSG = 'Always register extensions to load by default.'
22
22
 
23
23
  def_node_search :sketchup_register_extension, <<-PATTERN
24
24
  (send
@@ -14,7 +14,7 @@ module RuboCop
14
14
  include SketchUp::NoCommentDisable
15
15
  include SketchUp::NamespaceChecker
16
16
 
17
- MSG = 'Do not modify Ruby core functionality.'.freeze
17
+ MSG = 'Do not modify Ruby core functionality.'
18
18
 
19
19
  # We check only against the top level namespaces. The core define more
20
20
  # objects, but they are under one of the top level namespaces listed.
@@ -14,7 +14,7 @@ module RuboCop
14
14
  include SketchUp::NoCommentDisable
15
15
  include SketchUp::NamespaceChecker
16
16
 
17
- MSG = 'Do not modify Ruby stdlib functionality.'.freeze
17
+ MSG = 'Do not modify Ruby stdlib functionality.'
18
18
 
19
19
  # We check only against the top level namespaces. The stdlib define more
20
20
  # objects, but they are under one of the top level namespaces listed.
@@ -9,7 +9,7 @@ module RuboCop
9
9
  include SketchUp::NoCommentDisable
10
10
  include SketchUp::NamespaceChecker
11
11
 
12
- MSG = 'Do not modify shipped extensions.'.freeze
12
+ MSG = 'Do not modify shipped extensions.'
13
13
 
14
14
  # We check only against the top level namespaces. The core define more
15
15
  # objects, but they are under one of the top level namespaces listed.
@@ -21,11 +21,11 @@ module RuboCop
21
21
  include RangeHelp
22
22
 
23
23
  # rubocop:disable Metrics/LineLength
24
- MSG = 'Create and register one SketchupExtension instance per extension.'.freeze
25
- MSG_CREATE_ONE = 'Create only SketchupExtension instance per extension.'.freeze
26
- MSG_CREATE_MISSING = 'SketchupExtension.new not found.'.freeze
27
- MSG_REGISTER_ONE = 'Only register one SketchupExtension instance per extension.'.freeze
28
- MSG_REGISTER_MISSING = 'Registration of SketchupExtension not found. Expected %s'.freeze
24
+ MSG = 'Create and register one SketchupExtension instance per extension.'
25
+ MSG_CREATE_ONE = 'Create only SketchupExtension instance per extension.'
26
+ MSG_CREATE_MISSING = 'SketchupExtension.new not found.'
27
+ MSG_REGISTER_ONE = 'Only register one SketchupExtension instance per extension.'
28
+ MSG_REGISTER_MISSING = 'Registration of SketchupExtension not found. Expected %s'
29
29
  # rubocop:enable Metrics/LineLength
30
30
 
31
31
  # Reference: http://rubocop.readthedocs.io/en/latest/node_pattern/
@@ -53,14 +53,14 @@ module RuboCop
53
53
 
54
54
  # Threat instances not assigned to anything as non-existing.
55
55
  extension_nodes.select! { |node|
56
- node.parent && node.parent.assignment?
56
+ node.parent&.assignment?
57
57
  }
58
58
 
59
59
  # There should not be multiple instances.
60
60
  if extension_nodes.size > 1
61
61
  add_offense(nil,
62
- location: range,
63
- message: MSG_CREATE_ONE)
62
+ location: range,
63
+ message: MSG_CREATE_ONE)
64
64
  return
65
65
  end
66
66
 
@@ -68,8 +68,8 @@ module RuboCop
68
68
  extension_node = extension_nodes.first
69
69
  if extension_node.nil?
70
70
  add_offense(nil,
71
- location: range,
72
- message: MSG_CREATE_MISSING)
71
+ location: range,
72
+ message: MSG_CREATE_MISSING)
73
73
  return
74
74
  end
75
75
 
@@ -81,7 +81,7 @@ module RuboCop
81
81
  'Missing required name arguments'
82
82
  end
83
83
  add_offense(extension_node,
84
- message: message)
84
+ message: message)
85
85
  return
86
86
  end
87
87
 
@@ -100,7 +100,7 @@ module RuboCop
100
100
  # Make sure there is only one call to `register_extension`.
101
101
  if registered_vars.size > 1
102
102
  add_offense(registered_vars[1],
103
- message: MSG_REGISTER_ONE)
103
+ message: MSG_REGISTER_ONE)
104
104
  return
105
105
  end
106
106
 
@@ -108,8 +108,8 @@ module RuboCop
108
108
  unless registered_var == extension_var
109
109
  msg = MSG_REGISTER_MISSING % extension_var.to_s
110
110
  add_offense(nil,
111
- location: range,
112
- message: msg)
111
+ location: range,
112
+ message: msg)
113
113
  end
114
114
  end
115
115
 
@@ -28,19 +28,19 @@ module RuboCop
28
28
  include RangeHelp
29
29
 
30
30
  MSG_SKETCHUP_REQUIRE_EXT_NAME = 'Do not hard code file extensions '\
31
- 'with `Sketchup.require`.'.freeze
31
+ 'with `Sketchup.require`.'
32
32
 
33
33
  MSG_EXTENSION_NEW_EXT_NAME = 'Do not hard code file extensions '\
34
- 'with `SketchupExtension.new`.'.freeze
34
+ 'with `SketchupExtension.new`.'
35
35
 
36
36
  MSG_REQUIRE_FOR_BINARY = 'Use `require` instead of `Sketchup.require` '\
37
- 'to load binary Ruby libraries.'.freeze
37
+ 'to load binary Ruby libraries.'
38
38
 
39
39
  MSG_OMIT_BINARY_EXT = 'Do not hard code .so/.bundle file '\
40
- 'extensions'.freeze
40
+ 'extensions'
41
41
 
42
42
  MSG_REQUIRE_ENCRYPTED = 'Use `Sketchup.require` when loading Ruby '\
43
- 'files for encrypted extensions.'.freeze
43
+ 'files for encrypted extensions.'
44
44
 
45
45
  def_node_matcher :ruby_require, <<-PATTERN
46
46
  (send nil? :require (str $_))
@@ -30,7 +30,7 @@ module RuboCop
30
30
 
31
31
  include RangeHelp
32
32
 
33
- MSG = 'Avoid creating groups out of existing entities.'.freeze
33
+ MSG = 'Avoid creating groups out of existing entities.'
34
34
 
35
35
  def_node_matcher :add_group?, <<-PATTERN
36
36
  (send _ :add_group ...)
@@ -16,7 +16,7 @@ module RuboCop
16
16
  include SketchUp::Features
17
17
  include SketchUp
18
18
 
19
- MSG = 'Incompatible feature with target SketchUp version'.freeze
19
+ MSG = 'Incompatible feature with target SketchUp version'
20
20
 
21
21
  def on_def(node)
22
22
  return unless observer_method?(node)
@@ -43,7 +43,7 @@ module RuboCop
43
43
  end
44
44
 
45
45
  def on_const(node)
46
- if node.parent && node.parent.module_definition?
46
+ if node.parent&.module_definition?
47
47
  # This catches definition of classes and modules.
48
48
  namespace = Namespace.new(node.parent_module_name)
49
49
  return unless namespace.top_level?
@@ -103,7 +103,7 @@ module RuboCop
103
103
  end
104
104
 
105
105
  def module_method?(node)
106
- node.receiver && node.receiver.const_type?
106
+ node.receiver&.const_type?
107
107
  end
108
108
 
109
109
  def instance_method?(feature_name)
@@ -11,7 +11,7 @@ module RuboCop
11
11
 
12
12
  include SketchUp::DynamicComponentGlobals
13
13
 
14
- MSG = 'Avoid relying on internal logic of Dynamic Components.'.freeze
14
+ MSG = 'Avoid relying on internal logic of Dynamic Components.'
15
15
 
16
16
  def on_gvar(node)
17
17
  check_global(node)
@@ -17,7 +17,7 @@ module RuboCop
17
17
  # basename = File.basename(file, '.*')
18
18
  class FileEncoding < SketchUp::Cop
19
19
 
20
- MSG = 'Beware encoding bug with `__FILE__` and `__dir__`.'.freeze
20
+ MSG = 'Beware encoding bug with `__FILE__` and `__dir__`.'
21
21
 
22
22
  def_node_matcher :file_loaded?, <<-PATTERN
23
23
  (send nil? {:file_loaded? :file_loaded} ...)
@@ -11,7 +11,7 @@ module RuboCop
11
11
  # have an explicit reason to work in the root model context.
12
12
  class ModelEntities < SketchUp::Cop
13
13
 
14
- MSG = 'Prefer `model.active_entities` over `model.entities`.'.freeze
14
+ MSG = 'Prefer `model.active_entities` over `model.entities`.'
15
15
 
16
16
  # Reference: http://www.rubydoc.info/gems/rubocop/RuboCop/NodePattern
17
17
  def_node_matcher :active_model_entities?, <<-PATTERN
@@ -14,7 +14,7 @@ module RuboCop
14
14
 
15
15
  def on_send(node)
16
16
  # Only check instance methods.
17
- return if node.receiver && node.receiver.const_type?
17
+ return if node.receiver&.const_type?
18
18
 
19
19
  name = node.method_name
20
20
 
@@ -22,7 +22,7 @@ module RuboCop
22
22
  return unless dc_method
23
23
 
24
24
  if dc_method.key?(:variables)
25
- return unless node.receiver && node.receiver.variable?
25
+ return unless node.receiver&.variable?
26
26
 
27
27
  receiver_name = node.receiver.children.first
28
28
  # Account for instance and class variables.
@@ -34,9 +34,9 @@ module RuboCop
34
34
  message = "#{path}##{name} is not part of the official API. "\
35
35
  "It's a monkey-patched addition by Dynamic Components."
36
36
  add_offense(node,
37
- location: :selector,
38
- severity: :warning,
39
- message: message)
37
+ location: :selector,
38
+ severity: :warning,
39
+ message: message)
40
40
  end
41
41
 
42
42
  end
@@ -48,8 +48,8 @@ module RuboCop
48
48
 
49
49
  include RangeHelp
50
50
 
51
- MSG = 'Operation name should be a short capitalized description.'.freeze
52
- MSG_MAX = 'Operation names should not be short and concise. [%d/%d]'.freeze
51
+ MSG = 'Operation name should be a short capitalized description.'
52
+ MSG_MAX = 'Operation names should not be short and concise. [%d/%d]'
53
53
 
54
54
  def on_send(node)
55
55
  _, method_name, *args = *node
@@ -72,8 +72,8 @@ module RuboCop
72
72
  unless operation_name.size <= max_operation_name_length
73
73
  message = format(MSG_MAX, operation_name.size, max_operation_name_length)
74
74
  add_offense(args.first,
75
- location: excess_range(args.first, operation_name),
76
- message: message)
75
+ location: excess_range(args.first, operation_name),
76
+ message: message)
77
77
  end
78
78
  # Ensure operation name is not empty.
79
79
  if operation_name.empty?
@@ -16,7 +16,7 @@ module RuboCop
16
16
  class SketchupFindSupportFile < SketchUp::Cop
17
17
 
18
18
  MSG = 'Avoid `Sketchup.find_support_file` to find your '\
19
- "extension's files.".freeze
19
+ "extension's files."
20
20
 
21
21
  # http://www.rubydoc.info/gems/rubocop/RuboCop/NodePattern
22
22
  # https://rubocop.readthedocs.io/en/latest/node_pattern/
@@ -29,7 +29,7 @@ module RuboCop
29
29
  include SketchUp::ToolChecker
30
30
 
31
31
  MSG_MISSING_GET_EXTENTS = 'When drawing to the viewport implement '\
32
- '`getExtents` so drawn geometry is not clipped.'.freeze
32
+ '`getExtents` so drawn geometry is not clipped.'
33
33
 
34
34
  def on_tool_class(class_node, body_methods)
35
35
  return unless find_method(body_methods, :draw)
@@ -31,10 +31,10 @@ module RuboCop
31
31
  include SketchUp::ToolChecker
32
32
 
33
33
  MSG_MISSING_INVALIDATE_METHOD = 'When drawing to the viewport, make '\
34
- 'sure to `suspend` and `deactivate` calls `view.invalidate`.'.freeze
34
+ 'sure to `suspend` and `deactivate` calls `view.invalidate`.'
35
35
 
36
36
  MSG_MISSING_INVALIDATE = 'When drawing to the viewport, make sure to '\
37
- 'call `view.invalidate` when the tool becomes inactive.'.freeze
37
+ 'call `view.invalidate` when the tool becomes inactive.'
38
38
 
39
39
  def_node_search :view_invalidate?, <<-PATTERN
40
40
  (send (lvar :view) :invalidate ...)
@@ -24,7 +24,7 @@ module RuboCop
24
24
  include SketchUp::ToolChecker
25
25
 
26
26
  MSG_MISSING_ENABLE_VCB = 'When accepting user input, make sure to '\
27
- 'define `enableVCB?`.'.freeze
27
+ 'define `enableVCB?`.'
28
28
 
29
29
  def on_tool_class(class_node, body_methods)
30
30
  return unless find_method(body_methods, :onUserText)
@@ -25,7 +25,7 @@ module RuboCop
25
25
  include RangeHelp
26
26
 
27
27
  MSG = 'Wrapping `toolbar.restore` in `UI.start_timer` is '\
28
- 'redundant.'.freeze
28
+ 'redundant.'
29
29
 
30
30
  def_node_matcher :toolbar_new?, <<-PATTERN
31
31
  (send (const (const nil? :UI) :Toolbar) :new _)
@@ -50,7 +50,7 @@ module RuboCop
50
50
  toolbar_variable_name = assignment_node.children.first
51
51
 
52
52
  receiver = ui_start_timer_restore(assignment_node.parent).first
53
- return unless receiver && receiver.variable?
53
+ return unless receiver&.variable?
54
54
 
55
55
  receiver_variable_name = receiver.children.first
56
56
 
@@ -10,7 +10,7 @@ module RuboCop
10
10
  module Formatter
11
11
  # This formatter saves the output as an html file.
12
12
  class ExtensionReviewFormatter < BaseFormatter
13
- ELLIPSES = '<span class="extra-code">...</span>'.freeze
13
+ ELLIPSES = '<span class="extra-code">...</span>'
14
14
  TEMPLATE_PATH =
15
15
  File.expand_path('../../../../assets/output.html.erb', __dir__)
16
16
 
@@ -6,7 +6,7 @@ module RuboCop
6
6
 
7
7
  attr_reader :namespace
8
8
 
9
- SEPARATOR = '::'.freeze
9
+ SEPARATOR = '::'
10
10
 
11
11
  # @param [String] namespace
12
12
  def initialize(namespace)
@@ -33,7 +33,7 @@ module RuboCop
33
33
  def conditional_range(node)
34
34
  if node.modifier_form?
35
35
  range_between(node.loc.keyword.begin_pos,
36
- node.loc.expression.end_pos)
36
+ node.loc.expression.end_pos)
37
37
  else
38
38
  :expression
39
39
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  module SketchUp
3
- VERSION = '0.9.0'.freeze
5
+ VERSION = '0.10.0'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $LOAD_PATH.unshift File.expand_path('lib', __dir__)
2
4
  require 'rubocop/sketchup/version'
3
5
 
@@ -11,7 +13,7 @@ Gem::Specification.new do |spec|
11
13
 
12
14
  spec.version = RuboCop::SketchUp::VERSION
13
15
  spec.platform = Gem::Platform::RUBY
14
- spec.required_ruby_version = '>= 2.2.0'
16
+ spec.required_ruby_version = '>= 2.3.0'
15
17
 
16
18
  spec.require_paths = ['lib']
17
19
  spec.files = Dir[
@@ -22,6 +24,6 @@ Gem::Specification.new do |spec|
22
24
  'Gemfile'
23
25
  ]
24
26
 
25
- spec.add_dependency 'rubocop', '~> 0.63.0'
27
+ spec.add_dependency 'rubocop', '~> 0.69.0'
26
28
  spec.add_development_dependency 'bundler', '>= 1.13', '< 3.0'
27
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-sketchup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trimble Inc, SketchUp Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-15 00:00:00.000000000 Z
11
+ date: 2019-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.63.0
19
+ version: 0.69.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.63.0
26
+ version: 0.69.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -131,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
131
  requirements:
132
132
  - - ">="
133
133
  - !ruby/object:Gem::Version
134
- version: 2.2.0
134
+ version: 2.3.0
135
135
  required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="