rubocop-sketchup 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +20 -21
  3. data/assets/output.html.erb +301 -301
  4. data/config/default.yml +379 -379
  5. data/lib/rubocop/sketchup/config.rb +63 -63
  6. data/lib/rubocop/sketchup/cop/bugs/material_name.rb +108 -108
  7. data/lib/rubocop/sketchup/cop/bugs/render_mode.rb +72 -72
  8. data/lib/rubocop/sketchup/cop/bugs/uniform_scaling.rb +36 -36
  9. data/lib/rubocop/sketchup/cop/deprecations/add_separator_to_menu.rb +25 -25
  10. data/lib/rubocop/sketchup/cop/deprecations/operation_next_transparent.rb +30 -30
  11. data/lib/rubocop/sketchup/cop/deprecations/require_all.rb +27 -27
  12. data/lib/rubocop/sketchup/cop/deprecations/set_texture_projection.rb +26 -26
  13. data/lib/rubocop/sketchup/cop/deprecations/show_ruby_panel.rb +25 -25
  14. data/lib/rubocop/sketchup/cop/deprecations/sketchup_set.rb +30 -30
  15. data/lib/rubocop/sketchup/cop/performance/openssl.rb +41 -41
  16. data/lib/rubocop/sketchup/cop/performance/operation_disable_ui.rb +33 -33
  17. data/lib/rubocop/sketchup/cop/performance/selection_bulk.rb +79 -79
  18. data/lib/rubocop/sketchup/cop/performance/type_check.rb +63 -63
  19. data/lib/rubocop/sketchup/cop/performance/typename.rb +24 -24
  20. data/lib/rubocop/sketchup/cop/requirements/api_namespace.rb +30 -30
  21. data/lib/rubocop/sketchup/cop/requirements/exit.rb +33 -33
  22. data/lib/rubocop/sketchup/cop/requirements/extension_namespace.rb +125 -125
  23. data/lib/rubocop/sketchup/cop/requirements/file_structure.rb +97 -97
  24. data/lib/rubocop/sketchup/cop/requirements/gem_install.rb +45 -45
  25. data/lib/rubocop/sketchup/cop/requirements/get_extension_license.rb +95 -95
  26. data/lib/rubocop/sketchup/cop/requirements/global_constants.rb +38 -38
  27. data/lib/rubocop/sketchup/cop/requirements/global_include.rb +42 -42
  28. data/lib/rubocop/sketchup/cop/requirements/global_methods.rb +65 -65
  29. data/lib/rubocop/sketchup/cop/requirements/global_variables.rb +95 -95
  30. data/lib/rubocop/sketchup/cop/requirements/language_handler_globals.rb +46 -46
  31. data/lib/rubocop/sketchup/cop/requirements/load_path.rb +83 -83
  32. data/lib/rubocop/sketchup/cop/requirements/minimal_registration.rb +73 -73
  33. data/lib/rubocop/sketchup/cop/requirements/observers_start_operation.rb +161 -161
  34. data/lib/rubocop/sketchup/cop/requirements/register_extension.rb +45 -45
  35. data/lib/rubocop/sketchup/cop/requirements/ruby_core_namespace.rb +291 -291
  36. data/lib/rubocop/sketchup/cop/requirements/ruby_stdlib_namespace.rb +634 -634
  37. data/lib/rubocop/sketchup/cop/requirements/shipped_extensions_namespace.rb +61 -61
  38. data/lib/rubocop/sketchup/cop/requirements/sketchup_extension.rb +119 -119
  39. data/lib/rubocop/sketchup/cop/requirements/sketchup_require.rb +150 -149
  40. data/lib/rubocop/sketchup/cop/suggestions/add_group.rb +49 -49
  41. data/lib/rubocop/sketchup/cop/suggestions/compatibility.rb +128 -128
  42. data/lib/rubocop/sketchup/cop/suggestions/dc_internals.rb +34 -34
  43. data/lib/rubocop/sketchup/cop/suggestions/file_encoding.rb +78 -78
  44. data/lib/rubocop/sketchup/cop/suggestions/model_entities.rb +58 -58
  45. data/lib/rubocop/sketchup/cop/suggestions/monkey_patched_api.rb +45 -45
  46. data/lib/rubocop/sketchup/cop/suggestions/operation_name.rb +137 -137
  47. data/lib/rubocop/sketchup/cop/suggestions/sketchup_find_support_file.rb +39 -39
  48. data/lib/rubocop/sketchup/cop/suggestions/tool_drawing_bounds.rb +45 -45
  49. data/lib/rubocop/sketchup/cop/suggestions/tool_invalidate.rb +68 -68
  50. data/lib/rubocop/sketchup/cop/suggestions/tool_user_input.rb +41 -41
  51. data/lib/rubocop/sketchup/cop/suggestions/toolbar_timer.rb +65 -65
  52. data/lib/rubocop/sketchup/cop.rb +110 -110
  53. data/lib/rubocop/sketchup/dc_globals.rb +24 -24
  54. data/lib/rubocop/sketchup/dc_methods.rb +130 -130
  55. data/lib/rubocop/sketchup/extension_project.rb +65 -65
  56. data/lib/rubocop/sketchup/features.rb +1477 -1420
  57. data/lib/rubocop/sketchup/formatter/extension_review.rb +269 -269
  58. data/lib/rubocop/sketchup/inject.rb +19 -19
  59. data/lib/rubocop/sketchup/namespace.rb +49 -49
  60. data/lib/rubocop/sketchup/namespace_checker.rb +103 -103
  61. data/lib/rubocop/sketchup/no_comment_disable.rb +17 -17
  62. data/lib/rubocop/sketchup/range_help.rb +52 -52
  63. data/lib/rubocop/sketchup/sketchup_target_range.rb +75 -75
  64. data/lib/rubocop/sketchup/sketchup_version.rb +129 -128
  65. data/lib/rubocop/sketchup/tool_checker.rb +41 -43
  66. data/lib/rubocop/sketchup/version.rb +7 -7
  67. data/lib/rubocop/sketchup.rb +14 -14
  68. data/lib/rubocop-sketchup.rb +53 -53
  69. data/rubocop-sketchup.gemspec +29 -29
  70. metadata +8 -8
@@ -1,130 +1,130 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module SketchUp
5
- module DynamicComponentMethods
6
-
7
- DC_METHODS = [
8
- {
9
- name: :rotx,
10
- path: 'Geom::Transformation',
11
- },
12
- {
13
- name: :roty,
14
- path: 'Geom::Transformation',
15
- },
16
- {
17
- name: :rotz,
18
- path: 'Geom::Transformation',
19
- },
20
- {
21
- name: :xscale,
22
- path: 'Geom::Transformation',
23
- },
24
- {
25
- name: :yscale,
26
- path: 'Geom::Transformation',
27
- },
28
- {
29
- name: :zscale,
30
- path: 'Geom::Transformation',
31
- },
32
-
33
- {
34
- name: :copy,
35
- path: 'Sketchup::Camera',
36
- variables: [:camera, :cam],
37
- },
38
- {
39
- name: :update,
40
- path: 'Sketchup::Camera',
41
- variables: [:camera, :cam],
42
- },
43
- {
44
- name: :same_camera_params?,
45
- path: 'Sketchup::Camera',
46
- },
47
-
48
- {
49
- name: :copy,
50
- path: 'Sketchup::ComponentInstance',
51
- variables: [:instance, :inst],
52
- },
53
- {
54
- name: :description,
55
- path: 'Sketchup::ComponentInstance',
56
- variables: [:instance, :inst],
57
- },
58
-
59
- {
60
- name: :local_transformation,
61
- path: 'Sketchup::Drawingelement',
62
- },
63
- {
64
- name: :scaled_size,
65
- path: 'Sketchup::Drawingelement',
66
- },
67
- {
68
- name: :unscaled_size,
69
- path: 'Sketchup::Drawingelement',
70
- },
71
- {
72
- name: :set_last_size,
73
- path: 'Sketchup::Drawingelement',
74
- },
75
- {
76
- name: :last_scaling_factors,
77
- path: 'Sketchup::Drawingelement',
78
- },
79
-
80
- {
81
- name: :get_attributes,
82
- path: 'Sketchup::Entity',
83
- },
84
- {
85
- name: :has_attributes?,
86
- path: 'Sketchup::Entity',
87
- },
88
-
89
- {
90
- name: :typename,
91
- path: 'Sketchup::Model',
92
- variables: [:model, :mod],
93
- },
94
- {
95
- name: :entityID,
96
- path: 'Sketchup::Model',
97
- variables: [:model, :mod],
98
- },
99
- {
100
- name: :delete_attribute,
101
- path: 'Sketchup::Model',
102
- variables: [:model, :mod],
103
- },
104
- {
105
- name: :layer,
106
- path: 'Sketchup::Model',
107
- variables: [:model, :mod],
108
- },
109
-
110
- {
111
- name: :last_width=,
112
- path: 'UI::WebDialog',
113
- },
114
- {
115
- name: :last_height=,
116
- path: 'UI::WebDialog',
117
- },
118
- {
119
- name: :last_width,
120
- path: 'UI::WebDialog',
121
- },
122
- {
123
- name: :last_height,
124
- path: 'UI::WebDialog',
125
- },
126
- ].freeze
127
-
128
- end
129
- end
130
- end
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module SketchUp
5
+ module DynamicComponentMethods
6
+
7
+ DC_METHODS = [
8
+ {
9
+ name: :rotx,
10
+ path: 'Geom::Transformation',
11
+ },
12
+ {
13
+ name: :roty,
14
+ path: 'Geom::Transformation',
15
+ },
16
+ {
17
+ name: :rotz,
18
+ path: 'Geom::Transformation',
19
+ },
20
+ {
21
+ name: :xscale,
22
+ path: 'Geom::Transformation',
23
+ },
24
+ {
25
+ name: :yscale,
26
+ path: 'Geom::Transformation',
27
+ },
28
+ {
29
+ name: :zscale,
30
+ path: 'Geom::Transformation',
31
+ },
32
+
33
+ {
34
+ name: :copy,
35
+ path: 'Sketchup::Camera',
36
+ variables: [:camera, :cam],
37
+ },
38
+ {
39
+ name: :update,
40
+ path: 'Sketchup::Camera',
41
+ variables: [:camera, :cam],
42
+ },
43
+ {
44
+ name: :same_camera_params?,
45
+ path: 'Sketchup::Camera',
46
+ },
47
+
48
+ {
49
+ name: :copy,
50
+ path: 'Sketchup::ComponentInstance',
51
+ variables: [:instance, :inst],
52
+ },
53
+ {
54
+ name: :description,
55
+ path: 'Sketchup::ComponentInstance',
56
+ variables: [:instance, :inst],
57
+ },
58
+
59
+ {
60
+ name: :local_transformation,
61
+ path: 'Sketchup::Drawingelement',
62
+ },
63
+ {
64
+ name: :scaled_size,
65
+ path: 'Sketchup::Drawingelement',
66
+ },
67
+ {
68
+ name: :unscaled_size,
69
+ path: 'Sketchup::Drawingelement',
70
+ },
71
+ {
72
+ name: :set_last_size,
73
+ path: 'Sketchup::Drawingelement',
74
+ },
75
+ {
76
+ name: :last_scaling_factors,
77
+ path: 'Sketchup::Drawingelement',
78
+ },
79
+
80
+ {
81
+ name: :get_attributes,
82
+ path: 'Sketchup::Entity',
83
+ },
84
+ {
85
+ name: :has_attributes?,
86
+ path: 'Sketchup::Entity',
87
+ },
88
+
89
+ {
90
+ name: :typename,
91
+ path: 'Sketchup::Model',
92
+ variables: [:model, :mod],
93
+ },
94
+ {
95
+ name: :entityID,
96
+ path: 'Sketchup::Model',
97
+ variables: [:model, :mod],
98
+ },
99
+ {
100
+ name: :delete_attribute,
101
+ path: 'Sketchup::Model',
102
+ variables: [:model, :mod],
103
+ },
104
+ {
105
+ name: :layer,
106
+ path: 'Sketchup::Model',
107
+ variables: [:model, :mod],
108
+ },
109
+
110
+ {
111
+ name: :last_width=,
112
+ path: 'UI::WebDialog',
113
+ },
114
+ {
115
+ name: :last_height=,
116
+ path: 'UI::WebDialog',
117
+ },
118
+ {
119
+ name: :last_width,
120
+ path: 'UI::WebDialog',
121
+ },
122
+ {
123
+ name: :last_height,
124
+ path: 'UI::WebDialog',
125
+ },
126
+ ].freeze
127
+
128
+ end
129
+ end
130
+ end
@@ -1,65 +1,65 @@
1
- # frozen_string_literal: true
2
-
3
- require 'pathname'
4
-
5
- module RuboCop
6
- module SketchUp
7
- module ExtensionProject
8
-
9
- include SketchUp::Config
10
-
11
- # @return [Pathname]
12
- def config_path
13
- path = config.instance_variable_get(:@loaded_path)
14
- if path
15
- Pathname.new(path).expand_path.dirname
16
- else
17
- Pathname.new(Dir.pwd).expand_path
18
- end
19
- end
20
-
21
- # @return [Pathname]
22
- def relative_source_path
23
- Pathname.new(extension_source_path_config)
24
- end
25
-
26
- # @return [Pathname]
27
- def source_path
28
- config_path.join(relative_source_path)
29
- end
30
-
31
- # @param [RuboCop::ProcessedSource] processed_source
32
- def path_relative_to_source(processed_source)
33
- source_filename = processed_source.buffer.name
34
- rel_path = config.path_relative_to_config(source_filename)
35
- path = Pathname.new(rel_path).expand_path
36
- path.relative_path_from(source_path)
37
- end
38
-
39
- # @param [RuboCop::ProcessedSource] processed_source
40
- def root_file?(processed_source)
41
- filename = path_relative_to_source(processed_source)
42
- filename.extname.casecmp('.rb').zero? &&
43
- filename.parent.to_s == '.'
44
- end
45
-
46
- def extension_root_files
47
- Dir.glob("#{source_path}/*.rb").map { |path| Pathname.new(path) }
48
- end
49
-
50
- def extension_root_file
51
- unless extension_root_files.size == 1
52
- num_files = extension_root_files.size
53
- raise "More than one root extension file (#{num_files})"
54
- end
55
-
56
- extension_root_files.first
57
- end
58
-
59
- def extension_directory
60
- extension_root_file.dirname
61
- end
62
-
63
- end
64
- end
65
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ module RuboCop
6
+ module SketchUp
7
+ module ExtensionProject
8
+
9
+ include SketchUp::Config
10
+
11
+ # @return [Pathname]
12
+ def config_path
13
+ path = config.instance_variable_get(:@loaded_path)
14
+ if path
15
+ Pathname.new(path).expand_path.dirname
16
+ else
17
+ Pathname.new(Dir.pwd).expand_path
18
+ end
19
+ end
20
+
21
+ # @return [Pathname]
22
+ def relative_source_path
23
+ Pathname.new(extension_source_path_config)
24
+ end
25
+
26
+ # @return [Pathname]
27
+ def source_path
28
+ config_path.join(relative_source_path)
29
+ end
30
+
31
+ # @param [RuboCop::ProcessedSource] processed_source
32
+ def path_relative_to_source(processed_source)
33
+ source_filename = processed_source.buffer.name
34
+ rel_path = config.path_relative_to_config(source_filename)
35
+ path = Pathname.new(rel_path).expand_path
36
+ path.relative_path_from(source_path)
37
+ end
38
+
39
+ # @param [RuboCop::ProcessedSource] processed_source
40
+ def root_file?(processed_source)
41
+ filename = path_relative_to_source(processed_source)
42
+ filename.extname.casecmp('.rb').zero? &&
43
+ filename.parent.to_s == '.'
44
+ end
45
+
46
+ def extension_root_files
47
+ Dir.glob("#{source_path}/*.rb").map { |path| Pathname.new(path) }
48
+ end
49
+
50
+ def extension_root_file
51
+ unless extension_root_files.size == 1
52
+ num_files = extension_root_files.size
53
+ raise "More than one root extension file (#{num_files})"
54
+ end
55
+
56
+ extension_root_files.first
57
+ end
58
+
59
+ def extension_directory
60
+ extension_root_file.dirname
61
+ end
62
+
63
+ end
64
+ end
65
+ end