rubocop-sketchup 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/config/default.yml +8 -0
- data/lib/rubocop-sketchup.rb +2 -1
- data/lib/rubocop/sketchup/config.rb +1 -1
- data/lib/rubocop/sketchup/cop.rb +91 -0
- data/lib/rubocop/sketchup/{deprecations → cop/deprecations}/add_separator_to_menu.rb +1 -1
- data/lib/rubocop/sketchup/{deprecations → cop/deprecations}/operation_next_transparent.rb +1 -1
- data/lib/rubocop/sketchup/{deprecations → cop/deprecations}/require_all.rb +1 -1
- data/lib/rubocop/sketchup/{deprecations → cop/deprecations}/set_texture_projection.rb +1 -1
- data/lib/rubocop/sketchup/{deprecations → cop/deprecations}/show_ruby_panel.rb +1 -1
- data/lib/rubocop/sketchup/{deprecations → cop/deprecations}/sketchup_set.rb +1 -1
- data/lib/rubocop/sketchup/{performance → cop/performance}/openssl.rb +1 -1
- data/lib/rubocop/sketchup/{performance → cop/performance}/operation_disable_ui.rb +1 -1
- data/lib/rubocop/sketchup/{performance → cop/performance}/selection_bulk.rb +1 -1
- data/lib/rubocop/sketchup/{performance → cop/performance}/typename.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/api_namespace.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/exit.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/extension_namespace.rb +4 -4
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/file_structure.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/global_constants.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/global_include.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/global_methods.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/global_variables.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/language_handler_globals.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/load_path.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/minimal_registration.rb +5 -4
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/observers_start_operation.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/register_extension.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/ruby_core_namespace.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/ruby_stdlib_namespace.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/shipped_extensions_namespace.rb +1 -1
- data/lib/rubocop/sketchup/{requirements → cop/requirements}/sketchup_extension.rb +1 -1
- data/lib/rubocop/sketchup/{suggestions → cop/suggestions}/compatibility.rb +1 -2
- data/lib/rubocop/sketchup/{suggestions → cop/suggestions}/dc_internals.rb +1 -1
- data/lib/rubocop/sketchup/{suggestions → cop/suggestions}/file_encoding.rb +1 -1
- data/lib/rubocop/sketchup/cop/suggestions/model_entities.rb +51 -0
- data/lib/rubocop/sketchup/{suggestions → cop/suggestions}/monkey_patched_api.rb +1 -1
- data/lib/rubocop/sketchup/{suggestions → cop/suggestions}/operation_name.rb +1 -1
- data/lib/rubocop/sketchup/{suggestions → cop/suggestions}/sketchup_find_support_file.rb +1 -1
- data/lib/rubocop/sketchup/{suggestions → cop/suggestions}/sketchup_require.rb +5 -2
- data/lib/rubocop/sketchup/version.rb +1 -1
- metadata +39 -38
- data/lib/rubocop/sketchup/suggestions/model_entities.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f55bf3e2f4a93cec9b94539d6d4bcf713e962666975c92706ff64b2c3ba26819
|
4
|
+
data.tar.gz: 49784ee3c8506b69c3d9f2ff15166d2e53a169a5186e33bdd0bcd4e40b5b11ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bb0cd01b560f10d367adb0b8656be78f8db47bd73d3ce21fb2128194deacf791764a9cda0707e7c15c366a5194f5476315b39278753c755333a4549bc51e1b6
|
7
|
+
data.tar.gz: acedfe0376819dce12bcb722093659d2214bc965c44f46dcd4cef0aa7d7c9cfd8109be83c913dce6292caa8956b6f9e5172a1b14566313eba0ecd02a9c56ff84
|
data/config/default.yml
CHANGED
@@ -3,6 +3,14 @@ AllCops:
|
|
3
3
|
SketchUp:
|
4
4
|
SourcePath: src
|
5
5
|
TargetSketchUpVersion: 2016
|
6
|
+
SketchupDeprecations:
|
7
|
+
Exclude: []
|
8
|
+
SketchupPerformance:
|
9
|
+
Exclude: []
|
10
|
+
SketchupRequirements:
|
11
|
+
Exclude: []
|
12
|
+
SketchupSuggestions:
|
13
|
+
Exclude: []
|
6
14
|
|
7
15
|
SketchupDeprecations/AddSeparatorToMenu:
|
8
16
|
Description: The method `add_separator_to_menu` is deprecated.
|
data/lib/rubocop-sketchup.rb
CHANGED
@@ -5,6 +5,7 @@ require 'rubocop/sketchup/inject'
|
|
5
5
|
|
6
6
|
require 'rubocop/sketchup/formatter/extension_review'
|
7
7
|
require 'rubocop/sketchup/config'
|
8
|
+
require 'rubocop/sketchup/cop'
|
8
9
|
require 'rubocop/sketchup/dc_globals'
|
9
10
|
require 'rubocop/sketchup/dc_methods'
|
10
11
|
require 'rubocop/sketchup/extension_project'
|
@@ -32,7 +33,7 @@ class RuboCop::Formatter::FormatterSet
|
|
32
33
|
end
|
33
34
|
|
34
35
|
# Load all custom cops.
|
35
|
-
pattern = File.join(__dir__, 'rubocop', 'sketchup', '**/*rb')
|
36
|
+
pattern = File.join(__dir__, 'rubocop', 'sketchup', 'cop', '**/*rb')
|
36
37
|
Dir.glob(pattern) { |file|
|
37
38
|
require file
|
38
39
|
}
|
@@ -0,0 +1,91 @@
|
|
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 department_name
|
57
|
+
self.class.department.to_s
|
58
|
+
end
|
59
|
+
|
60
|
+
def relevant_rubocop_sketchup_file?(file)
|
61
|
+
!(department_exclude_pattern =~ file)
|
62
|
+
end
|
63
|
+
|
64
|
+
def department_exclude_pattern
|
65
|
+
if department_exclude_config?
|
66
|
+
patterns = department_exclude_config.map(&Regexp.public_method(:new))
|
67
|
+
Regexp.union(patterns)
|
68
|
+
else
|
69
|
+
DEFAULT_CONFIGURATION
|
70
|
+
.fetch(department_name)
|
71
|
+
.fetch('Exclude')
|
72
|
+
.map(&Regexp.public_method(:new))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def department_exclude_config?
|
77
|
+
return false unless all_cops_config.key?('SketchUp')
|
78
|
+
sketchup_config = all_cops_config.fetch('SketchUp')
|
79
|
+
return false unless sketchup_config.key?(department_name)
|
80
|
+
sketchup_config.fetch(department_name).key?('Exclude')
|
81
|
+
end
|
82
|
+
|
83
|
+
def department_exclude_config
|
84
|
+
sketchup_cops_config
|
85
|
+
.fetch(department_name)
|
86
|
+
.fetch('Exclude')
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -13,7 +13,7 @@ module RuboCop
|
|
13
13
|
# `SecureRandom` is also affected by this, as it uses OpenSSL to seed.
|
14
14
|
#
|
15
15
|
# It also affects Net::HTTP if making HTTPS connections.
|
16
|
-
class OpenSSL < Cop
|
16
|
+
class OpenSSL < SketchUp::Cop
|
17
17
|
|
18
18
|
MSG = 'Avoid use of OpenSSL within SketchUp due to severe performance issues.'.freeze
|
19
19
|
|
@@ -23,7 +23,7 @@ module RuboCop
|
|
23
23
|
# model = Sketchup.active_model
|
24
24
|
# faces = model.active_entities.grep(Sketchup::Face)
|
25
25
|
# model.selection.add(faces)
|
26
|
-
class SelectionBulkChanges < Cop
|
26
|
+
class SelectionBulkChanges < SketchUp::Cop
|
27
27
|
MSG = 'Avoid modifying selecting within loops.'.freeze
|
28
28
|
|
29
29
|
# http://www.rubydoc.info/gems/rubocop/RuboCop/NodePattern
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'rubocop/sketchup/requirements/api_namespace'
|
4
|
-
require 'rubocop/sketchup/requirements/ruby_core_namespace'
|
5
|
-
require 'rubocop/sketchup/requirements/ruby_stdlib_namespace'
|
3
|
+
require 'rubocop/sketchup/cop/requirements/api_namespace'
|
4
|
+
require 'rubocop/sketchup/cop/requirements/ruby_core_namespace'
|
5
|
+
require 'rubocop/sketchup/cop/requirements/ruby_stdlib_namespace'
|
6
6
|
|
7
7
|
module RuboCop
|
8
8
|
module Cop
|
9
9
|
module SketchupRequirements
|
10
|
-
class ExtensionNamespace < Cop
|
10
|
+
class ExtensionNamespace < SketchUp::Cop
|
11
11
|
|
12
12
|
include SketchUp::NoCommentDisable
|
13
13
|
include SketchUp
|
@@ -5,7 +5,7 @@ module RuboCop
|
|
5
5
|
module SketchupRequirements
|
6
6
|
# Check that the extension conform to expected file structure with a
|
7
7
|
# single root .rb file and a support folder with matching name.
|
8
|
-
class FileStructure < Cop
|
8
|
+
class FileStructure < SketchUp::Cop
|
9
9
|
|
10
10
|
include SketchUp::NoCommentDisable
|
11
11
|
include SketchUp::ExtensionProject
|
@@ -9,7 +9,7 @@ module RuboCop
|
|
9
9
|
# users can allow additional variables via the AllowedVariables option.
|
10
10
|
#
|
11
11
|
# Note that backreferences like $1, $2, etc are not global variables.
|
12
|
-
class GlobalVariables < Cop
|
12
|
+
class GlobalVariables < SketchUp::Cop
|
13
13
|
|
14
14
|
include SketchUp::NoCommentDisable
|
15
15
|
include SketchUp::DynamicComponentGlobals
|
@@ -6,7 +6,7 @@ module RuboCop
|
|
6
6
|
# Avoid using globals in general, but especially these which are known to
|
7
7
|
# be in use by other extensions made by SketchUp.
|
8
8
|
# They are still in use due to compatibility reasons.
|
9
|
-
class LanguageHandlerGlobals < Cop
|
9
|
+
class LanguageHandlerGlobals < SketchUp::Cop
|
10
10
|
|
11
11
|
include SketchUp::NoCommentDisable
|
12
12
|
|
@@ -7,7 +7,7 @@ module RuboCop
|
|
7
7
|
module SketchupRequirements
|
8
8
|
# Don't load extension files in the root file registering the extension.
|
9
9
|
# Extensions should not load additional files when it's disabled.
|
10
|
-
class MinimalRegistration < Cop
|
10
|
+
class MinimalRegistration < SketchUp::Cop
|
11
11
|
|
12
12
|
include SketchUp::NoCommentDisable
|
13
13
|
include SketchUp::ExtensionProject
|
@@ -16,9 +16,10 @@ module RuboCop
|
|
16
16
|
|
17
17
|
# Reference: http://rubocop.readthedocs.io/en/latest/node_pattern/
|
18
18
|
def_node_matcher :require_filename, <<-PATTERN
|
19
|
-
|
20
|
-
{(const nil? :Sketchup) nil?} :require
|
21
|
-
(str $_))
|
19
|
+
{
|
20
|
+
(send {(const nil? :Sketchup) nil?} {:require :load} (str $_))
|
21
|
+
(send nil? :require_relative (str $_))
|
22
|
+
}
|
22
23
|
PATTERN
|
23
24
|
|
24
25
|
def investigate(processed_source)
|
@@ -5,7 +5,7 @@ module RuboCop
|
|
5
5
|
module SketchupRequirements
|
6
6
|
# Always register extensions to load by default. Otherwise it might
|
7
7
|
# confuse users to think the extension isn't working.
|
8
|
-
class RegisterExtension < Cop
|
8
|
+
class RegisterExtension < SketchUp::Cop
|
9
9
|
|
10
10
|
include SketchUp::NoCommentDisable
|
11
11
|
|
@@ -4,7 +4,7 @@ module RuboCop
|
|
4
4
|
module Cop
|
5
5
|
module SketchupRequirements
|
6
6
|
# Don't modify SketchUp's shipped extensions.
|
7
|
-
class ShippedExtensionsNamespace < Cop
|
7
|
+
class ShippedExtensionsNamespace < SketchUp::Cop
|
8
8
|
|
9
9
|
include SketchUp::NoCommentDisable
|
10
10
|
include SketchUp::NamespaceChecker
|
@@ -5,7 +5,7 @@ module RuboCop
|
|
5
5
|
module SketchupRequirements
|
6
6
|
# Register a single instance of SketchupExtension per extension.
|
7
7
|
# This should be done by the root .rb file in the extension package.
|
8
|
-
class SketchupExtension < Cop
|
8
|
+
class SketchupExtension < SketchUp::Cop
|
9
9
|
|
10
10
|
include SketchUp::NoCommentDisable
|
11
11
|
include SketchUp::ExtensionProject
|
@@ -5,7 +5,7 @@ module RuboCop
|
|
5
5
|
module SketchupSuggestions
|
6
6
|
# Tapping into the internals of Dynamic Components is risky. It could
|
7
7
|
# change at any time.
|
8
|
-
class DynamicComponentInternals < Cop
|
8
|
+
class DynamicComponentInternals < SketchUp::Cop
|
9
9
|
|
10
10
|
include SketchUp::DynamicComponentGlobals
|
11
11
|
|
@@ -15,7 +15,7 @@ module RuboCop
|
|
15
15
|
# file = __FILE__.dup
|
16
16
|
# file.force_encoding('UTF-8') if file.respond_to?(:force_encoding)
|
17
17
|
# basename = File.basename(file, '.*')
|
18
|
-
class FileEncoding < Cop
|
18
|
+
class FileEncoding < SketchUp::Cop
|
19
19
|
|
20
20
|
MSG = 'Beware encoding bug with `__FILE__` and `__dir__`.'.freeze
|
21
21
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module SketchupSuggestions
|
6
|
+
class ModelEntities < SketchUp::Cop
|
7
|
+
|
8
|
+
MSG = 'Typically one should use model.active_entities instead of model.entities.'.freeze
|
9
|
+
|
10
|
+
# Reference: http://www.rubydoc.info/gems/rubocop/RuboCop/NodePattern
|
11
|
+
def_node_matcher :active_model_entities?, <<-PATTERN
|
12
|
+
(send
|
13
|
+
(send (const nil? :Sketchup) :active_model) :entities)
|
14
|
+
PATTERN
|
15
|
+
|
16
|
+
def_node_matcher :entities_receiver, <<-PATTERN
|
17
|
+
(send
|
18
|
+
({lvar ivar cvar} $_) :entities)
|
19
|
+
PATTERN
|
20
|
+
|
21
|
+
MODEL_VARIABLE_NAMES = %w[model mod]
|
22
|
+
|
23
|
+
def model_entities?(node)
|
24
|
+
return true if active_model_entities?(node)
|
25
|
+
name = entities_receiver(node)
|
26
|
+
name && model_variable?(name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def on_send(node)
|
30
|
+
add_offense(node, location: :expression) if model_entities?(node)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def model_variable?(name)
|
36
|
+
basename = variable_basename(name)
|
37
|
+
MODEL_VARIABLE_NAMES.include?(basename)
|
38
|
+
end
|
39
|
+
|
40
|
+
def variable_basename(name)
|
41
|
+
# Extract the basename from variables:
|
42
|
+
# model => model
|
43
|
+
# @model => model
|
44
|
+
# @@model => model
|
45
|
+
name.to_s.tr('@', '')
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -8,7 +8,7 @@ module RuboCop
|
|
8
8
|
# before the extension best-practices were established. These functions
|
9
9
|
# might change or be removed at any time. They will also not work when
|
10
10
|
# the extensions are disabled. Avoid using these methods.
|
11
|
-
class MonkeyPatchedApi < Cop
|
11
|
+
class MonkeyPatchedApi < SketchUp::Cop
|
12
12
|
|
13
13
|
include SketchUp::DynamicComponentMethods
|
14
14
|
|
@@ -4,7 +4,7 @@ module RuboCop
|
|
4
4
|
module Cop
|
5
5
|
module SketchupSuggestions
|
6
6
|
# Avoid Sketchup.find_support_file to find your extension's files.
|
7
|
-
class SketchupFindSupportFile < Cop
|
7
|
+
class SketchupFindSupportFile < SketchUp::Cop
|
8
8
|
|
9
9
|
MSG = "Avoid Sketchup.find_support_file to find your extension's files.".freeze
|
10
10
|
|
@@ -5,7 +5,7 @@ module RuboCop
|
|
5
5
|
module SketchupSuggestions
|
6
6
|
# Omit file extensions when using Sketchup.require to allow encrypted
|
7
7
|
# files to be loaded.
|
8
|
-
class SketchupRequire < Cop
|
8
|
+
class SketchupRequire < SketchUp::Cop
|
9
9
|
|
10
10
|
MSG = "Don't hard code file extensions with Sketchup.require".freeze
|
11
11
|
|
@@ -41,6 +41,9 @@ module RuboCop
|
|
41
41
|
PATTERN
|
42
42
|
|
43
43
|
|
44
|
+
TOOLS_RUBY_FILES = %w[extensions.rb langhandler.rb sketchup.rb]
|
45
|
+
|
46
|
+
|
44
47
|
def on_send(node)
|
45
48
|
if sketchup_require?(node)
|
46
49
|
filename = sketchup_require(node)
|
@@ -55,7 +58,7 @@ module RuboCop
|
|
55
58
|
private
|
56
59
|
|
57
60
|
def valid_filename?(filename)
|
58
|
-
File.extname(filename).empty?
|
61
|
+
File.extname(filename).empty? || TOOLS_RUBY_FILES.include?(filename)
|
59
62
|
end
|
60
63
|
|
61
64
|
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.3.
|
4
|
+
version: 0.3.1
|
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: 2018-
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -49,14 +49,44 @@ files:
|
|
49
49
|
- lib/rubocop-sketchup.rb
|
50
50
|
- lib/rubocop/sketchup.rb
|
51
51
|
- lib/rubocop/sketchup/config.rb
|
52
|
+
- lib/rubocop/sketchup/cop.rb
|
53
|
+
- lib/rubocop/sketchup/cop/deprecations/add_separator_to_menu.rb
|
54
|
+
- lib/rubocop/sketchup/cop/deprecations/operation_next_transparent.rb
|
55
|
+
- lib/rubocop/sketchup/cop/deprecations/require_all.rb
|
56
|
+
- lib/rubocop/sketchup/cop/deprecations/set_texture_projection.rb
|
57
|
+
- lib/rubocop/sketchup/cop/deprecations/show_ruby_panel.rb
|
58
|
+
- lib/rubocop/sketchup/cop/deprecations/sketchup_set.rb
|
59
|
+
- lib/rubocop/sketchup/cop/performance/openssl.rb
|
60
|
+
- lib/rubocop/sketchup/cop/performance/operation_disable_ui.rb
|
61
|
+
- lib/rubocop/sketchup/cop/performance/selection_bulk.rb
|
62
|
+
- lib/rubocop/sketchup/cop/performance/typename.rb
|
63
|
+
- lib/rubocop/sketchup/cop/requirements/api_namespace.rb
|
64
|
+
- lib/rubocop/sketchup/cop/requirements/exit.rb
|
65
|
+
- lib/rubocop/sketchup/cop/requirements/extension_namespace.rb
|
66
|
+
- lib/rubocop/sketchup/cop/requirements/file_structure.rb
|
67
|
+
- lib/rubocop/sketchup/cop/requirements/global_constants.rb
|
68
|
+
- lib/rubocop/sketchup/cop/requirements/global_include.rb
|
69
|
+
- lib/rubocop/sketchup/cop/requirements/global_methods.rb
|
70
|
+
- lib/rubocop/sketchup/cop/requirements/global_variables.rb
|
71
|
+
- lib/rubocop/sketchup/cop/requirements/language_handler_globals.rb
|
72
|
+
- lib/rubocop/sketchup/cop/requirements/load_path.rb
|
73
|
+
- lib/rubocop/sketchup/cop/requirements/minimal_registration.rb
|
74
|
+
- lib/rubocop/sketchup/cop/requirements/observers_start_operation.rb
|
75
|
+
- lib/rubocop/sketchup/cop/requirements/register_extension.rb
|
76
|
+
- lib/rubocop/sketchup/cop/requirements/ruby_core_namespace.rb
|
77
|
+
- lib/rubocop/sketchup/cop/requirements/ruby_stdlib_namespace.rb
|
78
|
+
- lib/rubocop/sketchup/cop/requirements/shipped_extensions_namespace.rb
|
79
|
+
- lib/rubocop/sketchup/cop/requirements/sketchup_extension.rb
|
80
|
+
- lib/rubocop/sketchup/cop/suggestions/compatibility.rb
|
81
|
+
- lib/rubocop/sketchup/cop/suggestions/dc_internals.rb
|
82
|
+
- lib/rubocop/sketchup/cop/suggestions/file_encoding.rb
|
83
|
+
- lib/rubocop/sketchup/cop/suggestions/model_entities.rb
|
84
|
+
- lib/rubocop/sketchup/cop/suggestions/monkey_patched_api.rb
|
85
|
+
- lib/rubocop/sketchup/cop/suggestions/operation_name.rb
|
86
|
+
- lib/rubocop/sketchup/cop/suggestions/sketchup_find_support_file.rb
|
87
|
+
- lib/rubocop/sketchup/cop/suggestions/sketchup_require.rb
|
52
88
|
- lib/rubocop/sketchup/dc_globals.rb
|
53
89
|
- lib/rubocop/sketchup/dc_methods.rb
|
54
|
-
- lib/rubocop/sketchup/deprecations/add_separator_to_menu.rb
|
55
|
-
- lib/rubocop/sketchup/deprecations/operation_next_transparent.rb
|
56
|
-
- lib/rubocop/sketchup/deprecations/require_all.rb
|
57
|
-
- lib/rubocop/sketchup/deprecations/set_texture_projection.rb
|
58
|
-
- lib/rubocop/sketchup/deprecations/show_ruby_panel.rb
|
59
|
-
- lib/rubocop/sketchup/deprecations/sketchup_set.rb
|
60
90
|
- lib/rubocop/sketchup/extension_project.rb
|
61
91
|
- lib/rubocop/sketchup/features.rb
|
62
92
|
- lib/rubocop/sketchup/formatter/extension_review.rb
|
@@ -64,36 +94,7 @@ files:
|
|
64
94
|
- lib/rubocop/sketchup/namespace.rb
|
65
95
|
- lib/rubocop/sketchup/namespace_checker.rb
|
66
96
|
- lib/rubocop/sketchup/no_comment_disable.rb
|
67
|
-
- lib/rubocop/sketchup/performance/openssl.rb
|
68
|
-
- lib/rubocop/sketchup/performance/operation_disable_ui.rb
|
69
|
-
- lib/rubocop/sketchup/performance/selection_bulk.rb
|
70
|
-
- lib/rubocop/sketchup/performance/typename.rb
|
71
|
-
- lib/rubocop/sketchup/requirements/api_namespace.rb
|
72
|
-
- lib/rubocop/sketchup/requirements/exit.rb
|
73
|
-
- lib/rubocop/sketchup/requirements/extension_namespace.rb
|
74
|
-
- lib/rubocop/sketchup/requirements/file_structure.rb
|
75
|
-
- lib/rubocop/sketchup/requirements/global_constants.rb
|
76
|
-
- lib/rubocop/sketchup/requirements/global_include.rb
|
77
|
-
- lib/rubocop/sketchup/requirements/global_methods.rb
|
78
|
-
- lib/rubocop/sketchup/requirements/global_variables.rb
|
79
|
-
- lib/rubocop/sketchup/requirements/language_handler_globals.rb
|
80
|
-
- lib/rubocop/sketchup/requirements/load_path.rb
|
81
|
-
- lib/rubocop/sketchup/requirements/minimal_registration.rb
|
82
|
-
- lib/rubocop/sketchup/requirements/observers_start_operation.rb
|
83
|
-
- lib/rubocop/sketchup/requirements/register_extension.rb
|
84
|
-
- lib/rubocop/sketchup/requirements/ruby_core_namespace.rb
|
85
|
-
- lib/rubocop/sketchup/requirements/ruby_stdlib_namespace.rb
|
86
|
-
- lib/rubocop/sketchup/requirements/shipped_extensions_namespace.rb
|
87
|
-
- lib/rubocop/sketchup/requirements/sketchup_extension.rb
|
88
97
|
- lib/rubocop/sketchup/sketchup_version.rb
|
89
|
-
- lib/rubocop/sketchup/suggestions/compatibility.rb
|
90
|
-
- lib/rubocop/sketchup/suggestions/dc_internals.rb
|
91
|
-
- lib/rubocop/sketchup/suggestions/file_encoding.rb
|
92
|
-
- lib/rubocop/sketchup/suggestions/model_entities.rb
|
93
|
-
- lib/rubocop/sketchup/suggestions/monkey_patched_api.rb
|
94
|
-
- lib/rubocop/sketchup/suggestions/operation_name.rb
|
95
|
-
- lib/rubocop/sketchup/suggestions/sketchup_find_support_file.rb
|
96
|
-
- lib/rubocop/sketchup/suggestions/sketchup_require.rb
|
97
98
|
- lib/rubocop/sketchup/version.rb
|
98
99
|
- rubocop-sketchup.gemspec
|
99
100
|
homepage: http://github.com/sketchup/rubocop-sketchup
|
@@ -116,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
117
|
version: '0'
|
117
118
|
requirements: []
|
118
119
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.7.3
|
120
121
|
signing_key:
|
121
122
|
specification_version: 4
|
122
123
|
summary: RuboCop rules for SketchUp extensions.
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
module SketchupSuggestions
|
6
|
-
class ModelEntities < Cop
|
7
|
-
|
8
|
-
MSG = 'Typically one should use model.active_entities instead of model.entities.'.freeze
|
9
|
-
|
10
|
-
# Reference: http://www.rubydoc.info/gems/rubocop/RuboCop/NodePattern
|
11
|
-
#
|
12
|
-
# {} will match any of the patterns inside the brackets.
|
13
|
-
#
|
14
|
-
# Testing for; Sketchup.active_model
|
15
|
-
# (send (const nil :Sketchup) :active_model)
|
16
|
-
#
|
17
|
-
# Testing for; model.entities or mod.entities
|
18
|
-
# (lvar {:model :mod})
|
19
|
-
def_node_matcher :model_entities?, <<-PATTERN
|
20
|
-
(send
|
21
|
-
{
|
22
|
-
(send (const nil? :Sketchup) :active_model)
|
23
|
-
(lvar {:model :mod})
|
24
|
-
}
|
25
|
-
:entities)
|
26
|
-
PATTERN
|
27
|
-
|
28
|
-
def on_send(node)
|
29
|
-
add_offense(node, location: :expression) if model_entities?(node)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|