rubocop-sketchup 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +19 -19
- data/assets/output.html.erb +301 -301
- data/config/default.yml +355 -355
- data/lib/rubocop/sketchup/config.rb +63 -63
- data/lib/rubocop/sketchup/cop/deprecations/add_separator_to_menu.rb +25 -25
- data/lib/rubocop/sketchup/cop/deprecations/operation_next_transparent.rb +30 -30
- data/lib/rubocop/sketchup/cop/deprecations/require_all.rb +27 -27
- data/lib/rubocop/sketchup/cop/deprecations/set_texture_projection.rb +26 -26
- data/lib/rubocop/sketchup/cop/deprecations/show_ruby_panel.rb +25 -25
- data/lib/rubocop/sketchup/cop/deprecations/sketchup_set.rb +30 -30
- data/lib/rubocop/sketchup/cop/performance/openssl.rb +41 -41
- data/lib/rubocop/sketchup/cop/performance/operation_disable_ui.rb +33 -33
- data/lib/rubocop/sketchup/cop/performance/selection_bulk.rb +79 -79
- data/lib/rubocop/sketchup/cop/performance/type_check.rb +63 -63
- data/lib/rubocop/sketchup/cop/performance/typename.rb +24 -24
- data/lib/rubocop/sketchup/cop/requirements/api_namespace.rb +30 -30
- data/lib/rubocop/sketchup/cop/requirements/exit.rb +32 -32
- data/lib/rubocop/sketchup/cop/requirements/extension_namespace.rb +108 -108
- data/lib/rubocop/sketchup/cop/requirements/file_structure.rb +97 -97
- data/lib/rubocop/sketchup/cop/requirements/gem_install.rb +45 -45
- data/lib/rubocop/sketchup/cop/requirements/get_extension_license.rb +95 -95
- data/lib/rubocop/sketchup/cop/requirements/global_constants.rb +38 -38
- data/lib/rubocop/sketchup/cop/requirements/global_include.rb +42 -42
- data/lib/rubocop/sketchup/cop/requirements/global_methods.rb +65 -65
- data/lib/rubocop/sketchup/cop/requirements/global_variables.rb +95 -95
- data/lib/rubocop/sketchup/cop/requirements/language_handler_globals.rb +46 -46
- data/lib/rubocop/sketchup/cop/requirements/load_path.rb +83 -83
- data/lib/rubocop/sketchup/cop/requirements/minimal_registration.rb +73 -73
- data/lib/rubocop/sketchup/cop/requirements/observers_start_operation.rb +161 -161
- data/lib/rubocop/sketchup/cop/requirements/register_extension.rb +45 -45
- data/lib/rubocop/sketchup/cop/requirements/ruby_core_namespace.rb +291 -291
- data/lib/rubocop/sketchup/cop/requirements/ruby_stdlib_namespace.rb +634 -634
- data/lib/rubocop/sketchup/cop/requirements/shipped_extensions_namespace.rb +61 -61
- data/lib/rubocop/sketchup/cop/requirements/sketchup_extension.rb +119 -119
- data/lib/rubocop/sketchup/cop/requirements/sketchup_require.rb +163 -163
- data/lib/rubocop/sketchup/cop/suggestions/add_group.rb +49 -49
- data/lib/rubocop/sketchup/cop/suggestions/compatibility.rb +117 -117
- data/lib/rubocop/sketchup/cop/suggestions/dc_internals.rb +34 -34
- data/lib/rubocop/sketchup/cop/suggestions/file_encoding.rb +78 -78
- data/lib/rubocop/sketchup/cop/suggestions/model_entities.rb +58 -58
- data/lib/rubocop/sketchup/cop/suggestions/monkey_patched_api.rb +45 -45
- data/lib/rubocop/sketchup/cop/suggestions/operation_name.rb +103 -103
- data/lib/rubocop/sketchup/cop/suggestions/sketchup_find_support_file.rb +39 -39
- data/lib/rubocop/sketchup/cop/suggestions/tool_drawing_bounds.rb +44 -44
- data/lib/rubocop/sketchup/cop/suggestions/tool_invalidate.rb +66 -66
- data/lib/rubocop/sketchup/cop/suggestions/tool_user_input.rb +41 -41
- data/lib/rubocop/sketchup/cop/suggestions/toolbar_timer.rb +65 -65
- data/lib/rubocop/sketchup/cop.rb +111 -111
- data/lib/rubocop/sketchup/dc_globals.rb +24 -24
- data/lib/rubocop/sketchup/dc_methods.rb +130 -130
- data/lib/rubocop/sketchup/extension_project.rb +65 -65
- data/lib/rubocop/sketchup/features.rb +738 -738
- data/lib/rubocop/sketchup/formatter/extension_review.rb +259 -259
- data/lib/rubocop/sketchup/inject.rb +19 -19
- data/lib/rubocop/sketchup/namespace.rb +47 -47
- data/lib/rubocop/sketchup/namespace_checker.rb +46 -46
- data/lib/rubocop/sketchup/no_comment_disable.rb +17 -17
- data/lib/rubocop/sketchup/range_help.rb +52 -52
- data/lib/rubocop/sketchup/sketchup_version.rb +87 -87
- data/lib/rubocop/sketchup/tool_checker.rb +43 -43
- data/lib/rubocop/sketchup/version.rb +5 -5
- data/lib/rubocop/sketchup.rb +12 -12
- data/lib/rubocop-sketchup.rb +48 -48
- data/rubocop-sketchup.gemspec +27 -27
- metadata +4 -4
data/lib/rubocop/sketchup/cop.rb
CHANGED
@@ -1,111 +1,111 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module SketchUp
|
5
|
-
|
6
|
-
WorkaroundCop = RuboCop::Cop::Cop.dup
|
7
|
-
|
8
|
-
# Clone of the the normal RuboCop::Cop::Cop class so we can rewrite
|
9
|
-
# the inherited method without breaking functionality
|
10
|
-
class WorkaroundCop
|
11
|
-
# Remove the Cop.inherited method to be a noop. Our SketchUp::Cop
|
12
|
-
# class will invoke the inherited hook instead
|
13
|
-
class << self
|
14
|
-
undef inherited
|
15
|
-
def inherited(*) end
|
16
|
-
end
|
17
|
-
|
18
|
-
# Special case `Module#<` so that the rspec support rubocop exports
|
19
|
-
# is compatible with our subclass
|
20
|
-
def self.<(other)
|
21
|
-
other.equal?(RuboCop::Cop::Cop) || super
|
22
|
-
end
|
23
|
-
end
|
24
|
-
private_constant(:WorkaroundCop)
|
25
|
-
|
26
|
-
# @abstract parent class to SketchUp cops
|
27
|
-
#
|
28
|
-
# The criteria for whether rubocop-sketchup analyzes a certain ruby file
|
29
|
-
# is configured via `AllCops/SketchUp`. For example, if you want to
|
30
|
-
# customize your project to scan all files within a `test/` directory
|
31
|
-
# then you could add this to your configuration:
|
32
|
-
#
|
33
|
-
# @example configuring analyzed paths
|
34
|
-
#
|
35
|
-
# AllCops:
|
36
|
-
# SketchUp:
|
37
|
-
# SketchupDeprecations:
|
38
|
-
# Exclude:
|
39
|
-
# - '_test.rb$'
|
40
|
-
# - '(?:^|/)test/'
|
41
|
-
class Cop < WorkaroundCop
|
42
|
-
|
43
|
-
include SketchUp::Config
|
44
|
-
|
45
|
-
# Invoke the original inherited hook so our cops are recognized
|
46
|
-
def self.inherited(subclass)
|
47
|
-
RuboCop::Cop::Cop.inherited(subclass)
|
48
|
-
end
|
49
|
-
|
50
|
-
def relevant_file?(file)
|
51
|
-
relevant_rubocop_sketchup_file?(file) && super
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def default_severity
|
57
|
-
sketchup_severity || super
|
58
|
-
end
|
59
|
-
|
60
|
-
def sketchup_severity
|
61
|
-
case self.class.department
|
62
|
-
when :SketchupRequirements
|
63
|
-
:error
|
64
|
-
when :SketchupDeprecations
|
65
|
-
:warning
|
66
|
-
when :SketchupPerformance
|
67
|
-
:warning
|
68
|
-
when :SketchupSuggestions
|
69
|
-
:convention
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def department_name
|
74
|
-
self.class.department.to_s
|
75
|
-
end
|
76
|
-
|
77
|
-
def relevant_rubocop_sketchup_file?(file)
|
78
|
-
!sketchup_excluded?(file)
|
79
|
-
end
|
80
|
-
|
81
|
-
def sketchup_excluded?(file)
|
82
|
-
matches_file?(file, sketchup_exclude_pattern) ||
|
83
|
-
matches_file?(file, sketchup_department_exclude_pattern)
|
84
|
-
end
|
85
|
-
|
86
|
-
def matches_file?(file, patterns)
|
87
|
-
path = nil
|
88
|
-
patterns.any? do |pattern|
|
89
|
-
# Try to match the absolute path, as Exclude properties are absolute.
|
90
|
-
next true if match_path?(pattern, file)
|
91
|
-
|
92
|
-
# Try with relative path.
|
93
|
-
path ||= config.path_relative_to_config(file)
|
94
|
-
match_path?(pattern, path)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def sketchup_department_exclude_pattern
|
99
|
-
sketchup_cops_config
|
100
|
-
.fetch(department_name, {})
|
101
|
-
.fetch('Exclude', [])
|
102
|
-
end
|
103
|
-
|
104
|
-
def sketchup_exclude_pattern
|
105
|
-
sketchup_cops_config
|
106
|
-
.fetch('Exclude', [])
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module SketchUp
|
5
|
+
|
6
|
+
WorkaroundCop = RuboCop::Cop::Cop.dup
|
7
|
+
|
8
|
+
# Clone of the the normal RuboCop::Cop::Cop class so we can rewrite
|
9
|
+
# the inherited method without breaking functionality
|
10
|
+
class WorkaroundCop
|
11
|
+
# Remove the Cop.inherited method to be a noop. Our SketchUp::Cop
|
12
|
+
# class will invoke the inherited hook instead
|
13
|
+
class << self
|
14
|
+
undef inherited
|
15
|
+
def inherited(*) end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Special case `Module#<` so that the rspec support rubocop exports
|
19
|
+
# is compatible with our subclass
|
20
|
+
def self.<(other)
|
21
|
+
other.equal?(RuboCop::Cop::Cop) || super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
private_constant(:WorkaroundCop)
|
25
|
+
|
26
|
+
# @abstract parent class to SketchUp cops
|
27
|
+
#
|
28
|
+
# The criteria for whether rubocop-sketchup analyzes a certain ruby file
|
29
|
+
# is configured via `AllCops/SketchUp`. For example, if you want to
|
30
|
+
# customize your project to scan all files within a `test/` directory
|
31
|
+
# then you could add this to your configuration:
|
32
|
+
#
|
33
|
+
# @example configuring analyzed paths
|
34
|
+
#
|
35
|
+
# AllCops:
|
36
|
+
# SketchUp:
|
37
|
+
# SketchupDeprecations:
|
38
|
+
# Exclude:
|
39
|
+
# - '_test.rb$'
|
40
|
+
# - '(?:^|/)test/'
|
41
|
+
class Cop < WorkaroundCop
|
42
|
+
|
43
|
+
include SketchUp::Config
|
44
|
+
|
45
|
+
# Invoke the original inherited hook so our cops are recognized
|
46
|
+
def self.inherited(subclass)
|
47
|
+
RuboCop::Cop::Cop.inherited(subclass)
|
48
|
+
end
|
49
|
+
|
50
|
+
def relevant_file?(file)
|
51
|
+
relevant_rubocop_sketchup_file?(file) && super
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def default_severity
|
57
|
+
sketchup_severity || super
|
58
|
+
end
|
59
|
+
|
60
|
+
def sketchup_severity
|
61
|
+
case self.class.department
|
62
|
+
when :SketchupRequirements
|
63
|
+
:error
|
64
|
+
when :SketchupDeprecations
|
65
|
+
:warning
|
66
|
+
when :SketchupPerformance
|
67
|
+
:warning
|
68
|
+
when :SketchupSuggestions
|
69
|
+
:convention
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def department_name
|
74
|
+
self.class.department.to_s
|
75
|
+
end
|
76
|
+
|
77
|
+
def relevant_rubocop_sketchup_file?(file)
|
78
|
+
!sketchup_excluded?(file)
|
79
|
+
end
|
80
|
+
|
81
|
+
def sketchup_excluded?(file)
|
82
|
+
matches_file?(file, sketchup_exclude_pattern) ||
|
83
|
+
matches_file?(file, sketchup_department_exclude_pattern)
|
84
|
+
end
|
85
|
+
|
86
|
+
def matches_file?(file, patterns)
|
87
|
+
path = nil
|
88
|
+
patterns.any? do |pattern|
|
89
|
+
# Try to match the absolute path, as Exclude properties are absolute.
|
90
|
+
next true if match_path?(pattern, file)
|
91
|
+
|
92
|
+
# Try with relative path.
|
93
|
+
path ||= config.path_relative_to_config(file)
|
94
|
+
match_path?(pattern, path)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def sketchup_department_exclude_pattern
|
99
|
+
sketchup_cops_config
|
100
|
+
.fetch(department_name, {})
|
101
|
+
.fetch('Exclude', [])
|
102
|
+
end
|
103
|
+
|
104
|
+
def sketchup_exclude_pattern
|
105
|
+
sketchup_cops_config
|
106
|
+
.fetch('Exclude', [])
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module SketchUp
|
5
|
-
module DynamicComponentGlobals
|
6
|
-
|
7
|
-
DC_GLOBALS = %i[
|
8
|
-
$dc_strings
|
9
|
-
$dc_extension
|
10
|
-
$dc_CONFIGURATOR_NAME
|
11
|
-
$dc_REPORTER_NAME
|
12
|
-
$dc_MANAGER_NAME
|
13
|
-
$dc_observers
|
14
|
-
].freeze
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def dc_global_var?(global_var)
|
19
|
-
DC_GLOBALS.include?(global_var)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module SketchUp
|
5
|
+
module DynamicComponentGlobals
|
6
|
+
|
7
|
+
DC_GLOBALS = %i[
|
8
|
+
$dc_strings
|
9
|
+
$dc_extension
|
10
|
+
$dc_CONFIGURATOR_NAME
|
11
|
+
$dc_REPORTER_NAME
|
12
|
+
$dc_MANAGER_NAME
|
13
|
+
$dc_observers
|
14
|
+
].freeze
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def dc_global_var?(global_var)
|
19
|
+
DC_GLOBALS.include?(global_var)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -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
|