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
@@ -1,46 +1,46 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module SketchUp
|
5
|
-
module NamespaceChecker
|
6
|
-
|
7
|
-
def on_class(node)
|
8
|
-
check_namespace(node)
|
9
|
-
end
|
10
|
-
|
11
|
-
def on_module(node)
|
12
|
-
check_namespace(node)
|
13
|
-
end
|
14
|
-
|
15
|
-
def on_def(node)
|
16
|
-
check_namespace(node)
|
17
|
-
end
|
18
|
-
alias on_defs on_def
|
19
|
-
|
20
|
-
# Constant assignment.
|
21
|
-
def on_casgn(node)
|
22
|
-
check_namespace(node)
|
23
|
-
end
|
24
|
-
|
25
|
-
def check_namespace(node)
|
26
|
-
return unless in_namespace?(node)
|
27
|
-
|
28
|
-
add_offense(node, location: :name, severity: :error)
|
29
|
-
end
|
30
|
-
|
31
|
-
def in_namespace?(node)
|
32
|
-
# parent_module_name might return nil if for instance a method is
|
33
|
-
# defined within a block. (Apparently that is possible...)
|
34
|
-
return false if node.parent_module_name.nil?
|
35
|
-
|
36
|
-
namespace = SketchUp::Namespace.new(node.parent_module_name)
|
37
|
-
namespaces.include?(namespace.first)
|
38
|
-
end
|
39
|
-
|
40
|
-
def namespaces
|
41
|
-
raise NotImplementedError
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module SketchUp
|
5
|
+
module NamespaceChecker
|
6
|
+
|
7
|
+
def on_class(node)
|
8
|
+
check_namespace(node)
|
9
|
+
end
|
10
|
+
|
11
|
+
def on_module(node)
|
12
|
+
check_namespace(node)
|
13
|
+
end
|
14
|
+
|
15
|
+
def on_def(node)
|
16
|
+
check_namespace(node)
|
17
|
+
end
|
18
|
+
alias on_defs on_def
|
19
|
+
|
20
|
+
# Constant assignment.
|
21
|
+
def on_casgn(node)
|
22
|
+
check_namespace(node)
|
23
|
+
end
|
24
|
+
|
25
|
+
def check_namespace(node)
|
26
|
+
return unless in_namespace?(node)
|
27
|
+
|
28
|
+
add_offense(node, location: :name, severity: :error)
|
29
|
+
end
|
30
|
+
|
31
|
+
def in_namespace?(node)
|
32
|
+
# parent_module_name might return nil if for instance a method is
|
33
|
+
# defined within a block. (Apparently that is possible...)
|
34
|
+
return false if node.parent_module_name.nil?
|
35
|
+
|
36
|
+
namespace = SketchUp::Namespace.new(node.parent_module_name)
|
37
|
+
namespaces.include?(namespace.first)
|
38
|
+
end
|
39
|
+
|
40
|
+
def namespaces
|
41
|
+
raise NotImplementedError
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module SketchUp
|
5
|
-
module NoCommentDisable
|
6
|
-
|
7
|
-
private
|
8
|
-
|
9
|
-
# This forces the cop to be run even if there is a source code comment
|
10
|
-
# that tries to disable it.
|
11
|
-
def enabled_line?(_line_number)
|
12
|
-
true
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module SketchUp
|
5
|
+
module NoCommentDisable
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
# This forces the cop to be run even if there is a source code comment
|
10
|
+
# that tries to disable it.
|
11
|
+
def enabled_line?(_line_number)
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,52 +1,52 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
# Methods that calculate and return Parser::Source::Ranges
|
6
|
-
module RangeHelp
|
7
|
-
|
8
|
-
private
|
9
|
-
|
10
|
-
def range_with_receiver(node)
|
11
|
-
receiver = node.receiver
|
12
|
-
loc_begin = if receiver.send_type?
|
13
|
-
receiver.loc.selector.begin_pos
|
14
|
-
else
|
15
|
-
receiver.loc.expression.begin_pos
|
16
|
-
end
|
17
|
-
loc_end = node.loc.selector.end_pos
|
18
|
-
range_between(loc_begin, loc_end)
|
19
|
-
end
|
20
|
-
|
21
|
-
def string_contents_range(node)
|
22
|
-
begin_pos = node.loc.begin.end_pos
|
23
|
-
end_pos = node.loc.end.begin_pos
|
24
|
-
range_between(begin_pos, end_pos)
|
25
|
-
end
|
26
|
-
|
27
|
-
def arguments_range(node)
|
28
|
-
begin_pos = node.arguments.first.loc.expression.begin_pos
|
29
|
-
end_pos = node.arguments.last.loc.expression.end_pos
|
30
|
-
range_between(begin_pos, end_pos)
|
31
|
-
end
|
32
|
-
|
33
|
-
def conditional_range(node)
|
34
|
-
if node.modifier_form?
|
35
|
-
range_between(node.loc.keyword.begin_pos,
|
36
|
-
node.loc.expression.end_pos)
|
37
|
-
else
|
38
|
-
:expression
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def file_ext_range(argument_node)
|
43
|
-
filename = argument_node.str_content
|
44
|
-
ext_size = File.extname(filename).size
|
45
|
-
end_pos = argument_node.loc.end.begin_pos
|
46
|
-
begin_pos = end_pos - ext_size
|
47
|
-
range_between(begin_pos, end_pos)
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
# Methods that calculate and return Parser::Source::Ranges
|
6
|
+
module RangeHelp
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def range_with_receiver(node)
|
11
|
+
receiver = node.receiver
|
12
|
+
loc_begin = if receiver.send_type?
|
13
|
+
receiver.loc.selector.begin_pos
|
14
|
+
else
|
15
|
+
receiver.loc.expression.begin_pos
|
16
|
+
end
|
17
|
+
loc_end = node.loc.selector.end_pos
|
18
|
+
range_between(loc_begin, loc_end)
|
19
|
+
end
|
20
|
+
|
21
|
+
def string_contents_range(node)
|
22
|
+
begin_pos = node.loc.begin.end_pos
|
23
|
+
end_pos = node.loc.end.begin_pos
|
24
|
+
range_between(begin_pos, end_pos)
|
25
|
+
end
|
26
|
+
|
27
|
+
def arguments_range(node)
|
28
|
+
begin_pos = node.arguments.first.loc.expression.begin_pos
|
29
|
+
end_pos = node.arguments.last.loc.expression.end_pos
|
30
|
+
range_between(begin_pos, end_pos)
|
31
|
+
end
|
32
|
+
|
33
|
+
def conditional_range(node)
|
34
|
+
if node.modifier_form?
|
35
|
+
range_between(node.loc.keyword.begin_pos,
|
36
|
+
node.loc.expression.end_pos)
|
37
|
+
else
|
38
|
+
:expression
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def file_ext_range(argument_node)
|
43
|
+
filename = argument_node.str_content
|
44
|
+
ext_size = File.extname(filename).size
|
45
|
+
end_pos = argument_node.loc.end.begin_pos
|
46
|
+
begin_pos = end_pos - ext_size
|
47
|
+
range_between(begin_pos, end_pos)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,87 +1,87 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module SketchUp
|
5
|
-
class SketchUpVersion
|
6
|
-
|
7
|
-
include Comparable
|
8
|
-
|
9
|
-
attr_reader :version, :maintenance
|
10
|
-
|
11
|
-
class InvalidVersion < StandardError; end
|
12
|
-
|
13
|
-
def initialize(version)
|
14
|
-
@version, @maintenance = parse_version(version)
|
15
|
-
end
|
16
|
-
|
17
|
-
def <=>(other)
|
18
|
-
if version == other.version
|
19
|
-
maintenance <=> other.maintenance
|
20
|
-
else
|
21
|
-
version <=> other.version
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def to_s
|
26
|
-
string_version = version < 2013 ? version.to_f : version.to_i
|
27
|
-
if maintenance > 0
|
28
|
-
"SketchUp #{string_version} M#{maintenance}"
|
29
|
-
else
|
30
|
-
"SketchUp #{string_version}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
VERSION_NUMBER_REGEX = /^(?:SketchUp )?([0-9.]+)(?: M(\d+))
|
37
|
-
|
38
|
-
# This list is compiled from the list of versions reported by YARD when
|
39
|
-
# running the `versions` template;
|
40
|
-
#
|
41
|
-
# yardoc -t versions -f text
|
42
|
-
#
|
43
|
-
# TODO(thomthom): Push the version template to the API stubs repository.
|
44
|
-
VALID_VERSIONS = [
|
45
|
-
[2018, 0],
|
46
|
-
[2017, 0],
|
47
|
-
[2016, 1],
|
48
|
-
[2016, 0],
|
49
|
-
[2015, 0],
|
50
|
-
[2014, 0],
|
51
|
-
[2013, 0],
|
52
|
-
[8.0, 2],
|
53
|
-
[8.0, 1],
|
54
|
-
[8.0, 0],
|
55
|
-
[7.1, 1],
|
56
|
-
[7.1, 0],
|
57
|
-
[7.0, 1],
|
58
|
-
[7.0, 0],
|
59
|
-
[6.0, 0],
|
60
|
-
].freeze
|
61
|
-
|
62
|
-
def parse_version(version)
|
63
|
-
v = 0
|
64
|
-
m = 0
|
65
|
-
if version.is_a?(String)
|
66
|
-
# Treat all LayOut versions as SketchUp versions for now.
|
67
|
-
normalised_version = version.gsub('LayOut', 'SketchUp')
|
68
|
-
result = normalised_version.match(VERSION_NUMBER_REGEX)
|
69
|
-
if result
|
70
|
-
v = result.captures[0].to_f
|
71
|
-
m = (result.captures[1] || '0').to_i
|
72
|
-
end
|
73
|
-
elsif version.is_a?(Numeric)
|
74
|
-
v = version
|
75
|
-
m = 0
|
76
|
-
end
|
77
|
-
version_parts = [v, m]
|
78
|
-
unless VALID_VERSIONS.include?(version_parts)
|
79
|
-
raise InvalidVersion, "#{version} is not a valid SketchUp version"
|
80
|
-
end
|
81
|
-
|
82
|
-
version_parts
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module SketchUp
|
5
|
+
class SketchUpVersion
|
6
|
+
|
7
|
+
include Comparable
|
8
|
+
|
9
|
+
attr_reader :version, :maintenance
|
10
|
+
|
11
|
+
class InvalidVersion < StandardError; end
|
12
|
+
|
13
|
+
def initialize(version)
|
14
|
+
@version, @maintenance = parse_version(version)
|
15
|
+
end
|
16
|
+
|
17
|
+
def <=>(other)
|
18
|
+
if version == other.version
|
19
|
+
maintenance <=> other.maintenance
|
20
|
+
else
|
21
|
+
version <=> other.version
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
string_version = version < 2013 ? version.to_f : version.to_i
|
27
|
+
if maintenance > 0
|
28
|
+
"SketchUp #{string_version} M#{maintenance}"
|
29
|
+
else
|
30
|
+
"SketchUp #{string_version}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
VERSION_NUMBER_REGEX = /^(?:SketchUp )?([0-9.]+)(?: M(\d+))?$/.freeze
|
37
|
+
|
38
|
+
# This list is compiled from the list of versions reported by YARD when
|
39
|
+
# running the `versions` template;
|
40
|
+
#
|
41
|
+
# yardoc -t versions -f text
|
42
|
+
#
|
43
|
+
# TODO(thomthom): Push the version template to the API stubs repository.
|
44
|
+
VALID_VERSIONS = [
|
45
|
+
[2018, 0],
|
46
|
+
[2017, 0],
|
47
|
+
[2016, 1],
|
48
|
+
[2016, 0],
|
49
|
+
[2015, 0],
|
50
|
+
[2014, 0],
|
51
|
+
[2013, 0],
|
52
|
+
[8.0, 2],
|
53
|
+
[8.0, 1],
|
54
|
+
[8.0, 0],
|
55
|
+
[7.1, 1],
|
56
|
+
[7.1, 0],
|
57
|
+
[7.0, 1],
|
58
|
+
[7.0, 0],
|
59
|
+
[6.0, 0],
|
60
|
+
].freeze
|
61
|
+
|
62
|
+
def parse_version(version)
|
63
|
+
v = 0
|
64
|
+
m = 0
|
65
|
+
if version.is_a?(String)
|
66
|
+
# Treat all LayOut versions as SketchUp versions for now.
|
67
|
+
normalised_version = version.gsub('LayOut', 'SketchUp')
|
68
|
+
result = normalised_version.match(VERSION_NUMBER_REGEX)
|
69
|
+
if result
|
70
|
+
v = result.captures[0].to_f
|
71
|
+
m = (result.captures[1] || '0').to_i
|
72
|
+
end
|
73
|
+
elsif version.is_a?(Numeric)
|
74
|
+
v = version
|
75
|
+
m = 0
|
76
|
+
end
|
77
|
+
version_parts = [v, m]
|
78
|
+
unless VALID_VERSIONS.include?(version_parts)
|
79
|
+
raise InvalidVersion, "#{version} is not a valid SketchUp version"
|
80
|
+
end
|
81
|
+
|
82
|
+
version_parts
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -1,43 +1,43 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module SketchUp
|
5
|
-
module ToolChecker
|
6
|
-
|
7
|
-
def on_class(node)
|
8
|
-
name, _base_class, body = *node
|
9
|
-
return unless name.const_name.end_with?('Tool')
|
10
|
-
|
11
|
-
check_body(body, node)
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
# rubocop:disable Lint/UnusedMethodArgument
|
17
|
-
def on_tool_class(class_node, body, body_methods)
|
18
|
-
raise NotImplementedError, 'Implement this method'
|
19
|
-
end
|
20
|
-
# rubocop:enable Lint/UnusedMethodArgument
|
21
|
-
|
22
|
-
def body_methods(body)
|
23
|
-
return [body] if body.def_type?
|
24
|
-
return unless body.begin_type?
|
25
|
-
|
26
|
-
body.each_child_node(:def)
|
27
|
-
end
|
28
|
-
|
29
|
-
def check_body(body, class_node)
|
30
|
-
return if body.nil? # Empty class etc.
|
31
|
-
|
32
|
-
body_methods = body_methods(body)
|
33
|
-
|
34
|
-
on_tool_class(class_node, body_methods)
|
35
|
-
end
|
36
|
-
|
37
|
-
def find_method(defs, method_name)
|
38
|
-
defs.find { |def_node| def_node.method?(method_name) }
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module SketchUp
|
5
|
+
module ToolChecker
|
6
|
+
|
7
|
+
def on_class(node)
|
8
|
+
name, _base_class, body = *node
|
9
|
+
return unless name.const_name.end_with?('Tool')
|
10
|
+
|
11
|
+
check_body(body, node)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
17
|
+
def on_tool_class(class_node, body, body_methods)
|
18
|
+
raise NotImplementedError, 'Implement this method'
|
19
|
+
end
|
20
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
21
|
+
|
22
|
+
def body_methods(body)
|
23
|
+
return [body] if body.def_type?
|
24
|
+
return unless body.begin_type?
|
25
|
+
|
26
|
+
body.each_child_node(:def)
|
27
|
+
end
|
28
|
+
|
29
|
+
def check_body(body, class_node)
|
30
|
+
return if body.nil? # Empty class etc.
|
31
|
+
|
32
|
+
body_methods = body_methods(body)
|
33
|
+
|
34
|
+
on_tool_class(class_node, body_methods)
|
35
|
+
end
|
36
|
+
|
37
|
+
def find_method(defs, method_name)
|
38
|
+
defs.find { |def_node| def_node.method?(method_name) }
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module RuboCop
|
2
|
-
module SketchUp
|
3
|
-
VERSION = '0.
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module RuboCop
|
2
|
+
module SketchUp
|
3
|
+
VERSION = '0.6.0'.freeze
|
4
|
+
end
|
5
|
+
end
|
data/lib/rubocop/sketchup.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
# RuboCop SketchUp project namespace
|
5
|
-
module SketchUp
|
6
|
-
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
7
|
-
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
8
|
-
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
9
|
-
|
10
|
-
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
11
|
-
end
|
12
|
-
end
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
# RuboCop SketchUp project namespace
|
5
|
+
module SketchUp
|
6
|
+
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
7
|
+
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
8
|
+
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
9
|
+
|
10
|
+
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
11
|
+
end
|
12
|
+
end
|
data/lib/rubocop-sketchup.rb
CHANGED
@@ -1,48 +1,48 @@
|
|
1
|
-
require 'rubocop'
|
2
|
-
require 'rubocop/sketchup'
|
3
|
-
require 'rubocop/sketchup/version'
|
4
|
-
require 'rubocop/sketchup/inject'
|
5
|
-
|
6
|
-
require 'rubocop/sketchup/formatter/extension_review'
|
7
|
-
require 'rubocop/sketchup/config'
|
8
|
-
require 'rubocop/sketchup/cop'
|
9
|
-
require 'rubocop/sketchup/dc_globals'
|
10
|
-
require 'rubocop/sketchup/dc_methods'
|
11
|
-
require 'rubocop/sketchup/extension_project'
|
12
|
-
require 'rubocop/sketchup/features'
|
13
|
-
require 'rubocop/sketchup/namespace'
|
14
|
-
require 'rubocop/sketchup/namespace_checker'
|
15
|
-
require 'rubocop/sketchup/no_comment_disable'
|
16
|
-
require 'rubocop/sketchup/range_help'
|
17
|
-
require 'rubocop/sketchup/sketchup_version'
|
18
|
-
require 'rubocop/sketchup/tool_checker'
|
19
|
-
|
20
|
-
RuboCop::SketchUp::Inject.defaults!
|
21
|
-
|
22
|
-
# Monkey patching the built in formatter list to add a short alias for custom
|
23
|
-
# formatters. Naughty! Naughty!
|
24
|
-
class RuboCop::Formatter::FormatterSet
|
25
|
-
formatters = BUILTIN_FORMATTERS_FOR_KEYS.dup
|
26
|
-
formatters['extension_review'] =
|
27
|
-
RuboCop::Formatter::ExtensionReviewFormatter
|
28
|
-
verbose = $VERBOSE
|
29
|
-
begin
|
30
|
-
$VERBOSE = nil
|
31
|
-
BUILTIN_FORMATTERS_FOR_KEYS = formatters.freeze
|
32
|
-
ensure
|
33
|
-
$VERBOSE = verbose
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# Make it easier to explore available methods on a method.
|
38
|
-
class Object
|
39
|
-
def methods!
|
40
|
-
methods.sort - Object.class.instance_methods
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# Load all custom cops.
|
45
|
-
pattern = File.join(__dir__, 'rubocop', 'sketchup', 'cop', '**/*rb')
|
46
|
-
Dir.glob(pattern) { |file|
|
47
|
-
require file
|
48
|
-
}
|
1
|
+
require 'rubocop'
|
2
|
+
require 'rubocop/sketchup'
|
3
|
+
require 'rubocop/sketchup/version'
|
4
|
+
require 'rubocop/sketchup/inject'
|
5
|
+
|
6
|
+
require 'rubocop/sketchup/formatter/extension_review'
|
7
|
+
require 'rubocop/sketchup/config'
|
8
|
+
require 'rubocop/sketchup/cop'
|
9
|
+
require 'rubocop/sketchup/dc_globals'
|
10
|
+
require 'rubocop/sketchup/dc_methods'
|
11
|
+
require 'rubocop/sketchup/extension_project'
|
12
|
+
require 'rubocop/sketchup/features'
|
13
|
+
require 'rubocop/sketchup/namespace'
|
14
|
+
require 'rubocop/sketchup/namespace_checker'
|
15
|
+
require 'rubocop/sketchup/no_comment_disable'
|
16
|
+
require 'rubocop/sketchup/range_help'
|
17
|
+
require 'rubocop/sketchup/sketchup_version'
|
18
|
+
require 'rubocop/sketchup/tool_checker'
|
19
|
+
|
20
|
+
RuboCop::SketchUp::Inject.defaults!
|
21
|
+
|
22
|
+
# Monkey patching the built in formatter list to add a short alias for custom
|
23
|
+
# formatters. Naughty! Naughty!
|
24
|
+
class RuboCop::Formatter::FormatterSet
|
25
|
+
formatters = BUILTIN_FORMATTERS_FOR_KEYS.dup
|
26
|
+
formatters['extension_review'] =
|
27
|
+
RuboCop::Formatter::ExtensionReviewFormatter
|
28
|
+
verbose = $VERBOSE
|
29
|
+
begin
|
30
|
+
$VERBOSE = nil
|
31
|
+
BUILTIN_FORMATTERS_FOR_KEYS = formatters.freeze
|
32
|
+
ensure
|
33
|
+
$VERBOSE = verbose
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Make it easier to explore available methods on a method.
|
38
|
+
class Object
|
39
|
+
def methods!
|
40
|
+
methods.sort - Object.class.instance_methods
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Load all custom cops.
|
45
|
+
pattern = File.join(__dir__, 'rubocop', 'sketchup', 'cop', '**/*rb')
|
46
|
+
Dir.glob(pattern) { |file|
|
47
|
+
require file
|
48
|
+
}
|