rubocop-sketchup 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d7b803688f7c17a0b11ab8b6ac5452d1a4fa925
4
- data.tar.gz: 3b0c7b2667761ea2d5a298f9906aeb5c0dd90c93
3
+ metadata.gz: 2641cf07a13c7fa7c33f484a10bcfcb22f8daa4f
4
+ data.tar.gz: a235e082f106d088b245768d5f639d503b75a4db
5
5
  SHA512:
6
- metadata.gz: bb8900616392157c20a242834e96163a94aa73a98179679e518b4882297b9875916431383e90ff2883fe109de663783b78d6d274f6f3be338575c2cf83986396
7
- data.tar.gz: 0ac20236f7f5e6046dd072ae3722861f3e008709fa9e4e39b5b9f93036124710718c8bfb170df2c8c5a73ecad9f949dc6b7efcbf455214eee1dc4d3138f3c880
6
+ metadata.gz: 55caaf069752bc471b957b034b7c62702639be84596f21745a21ecd4e06b66bc5091ffdf13c30fd72aa9144f70bc53affecf8b410f904496a7b483908fcd230c
7
+ data.tar.gz: 96327fe0f81942432a3bf4895e4256f69d9b7ba978e3c98c9087bf356cec06788498633f72ac54c78957a27c0d5bd8ce40ce46f4ca5d5d2e73868a30d3c22d67
data/config/default.yml CHANGED
@@ -3,6 +3,13 @@ AllCops:
3
3
  SketchUp:
4
4
  SourcePath: src
5
5
 
6
+ SketchupDeprecations/AddSeparatorToMenu:
7
+ Description: The method `add_separator_to_menu` is deprecated.
8
+ Details: >-
9
+ Avoid adding separators to top level menus. If you require
10
+ grouping use a sub-menu instead.
11
+ Enabled: true
12
+
6
13
  SketchupDeprecations/OperationNextTransparent:
7
14
  Description: Third argument in `model.start_operation` is deprecated.
8
15
  Details: >-
@@ -10,6 +17,33 @@ SketchupDeprecations/OperationNextTransparent:
10
17
  making the next operation transparent.
11
18
  Enabled: true
12
19
 
20
+ SketchupDeprecations/RequireAll:
21
+ Description: The method `require_all` is deprecated.
22
+ Details: >-
23
+ This method adds the path given to `$LOAD_PATH` which can affect
24
+ other extensions.
25
+ Enabled: true
26
+
27
+ SketchupDeprecations/SetTextureProjection:
28
+ Description: The method `Sketchup::Face#set_texture_projection` is deprecated.
29
+ Details: >-
30
+ This method never worked right. It's not possible to control the
31
+ position and orientation of the texture.
32
+ Enabled: true
33
+
34
+ SketchupDeprecations/ShowRubyPanel:
35
+ Description: The method `show_ruby_panel` is deprecated.
36
+ Details: >-
37
+ Use `SKETCHUP_CONSOLE.show` instead.
38
+ Enabled: true
39
+
40
+ SketchupDeprecations/SketchupSet:
41
+ Description: The class `Sketchup::Set` is deprecated.
42
+ Details: >-
43
+ It's slow and with limited functionality. Use the `Set` class in
44
+ the Ruby StdLib instead.
45
+ Enabled: true
46
+
13
47
  SketchupPerformance/OpenSSL:
14
48
  Description: Avoid using Ruby's OpenSSL within SketchUp.
15
49
  Details: >-
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module SketchupDeprecations
6
+ class AddSeparatorToMenu < Cop
7
+
8
+ MSG = 'Method is deprecated.'.freeze
9
+
10
+ def_node_matcher :add_separator_to_menu?, <<-PATTERN
11
+ (send nil? :add_separator_to_menu _)
12
+ PATTERN
13
+
14
+ def on_send(node)
15
+ return unless add_separator_to_menu?(node)
16
+ add_offense(node, location: :expression)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module SketchupDeprecations
6
+ class RequireAll < Cop
7
+
8
+ MSG = 'Method is deprecated because it adds the given path to $LOAD_PATH.'.freeze
9
+
10
+ def_node_matcher :require_all?, <<-PATTERN
11
+ (send nil? :require_all _)
12
+ PATTERN
13
+
14
+ def on_send(node)
15
+ return unless require_all?(node)
16
+ add_offense(node, location: :expression)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module SketchupDeprecations
6
+ class SetTextureProjection < Cop
7
+
8
+ MSG = 'Method is deprecated. It creates invalid UV mapping.'.freeze
9
+
10
+ def_node_matcher :set_texture_projection?, <<-PATTERN
11
+ (send _ :set_texture_projection ...)
12
+ PATTERN
13
+
14
+ def on_send(node)
15
+ return unless set_texture_projection?(node)
16
+ add_offense(node, location: :expression)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module SketchupDeprecations
6
+ class ShowRubyPanel < Cop
7
+
8
+ MSG = 'Method is deprecated. Use `SKETCHUP_CONSOLE.show` instead.'.freeze
9
+
10
+ def_node_matcher :show_ruby_panel?, <<-PATTERN
11
+ (send nil? :show_ruby_panel)
12
+ PATTERN
13
+
14
+ def on_send(node)
15
+ return unless show_ruby_panel?(node)
16
+ add_offense(node, location: :expression)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module SketchupDeprecations
6
+ class SketchupSet < Cop
7
+
8
+ MSG = 'Class is deprecated.'.freeze
9
+
10
+ def_node_matcher :sketchup_set?, <<-PATTERN
11
+ (const (const nil? :Sketchup) :Set)
12
+ PATTERN
13
+
14
+ def on_const(node)
15
+ return unless sketchup_set?(node)
16
+ add_offense(node, location: :expression)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module RuboCop
2
2
  module SketchUp
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  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.2.0
4
+ version: 0.2.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-03-02 00:00:00.000000000 Z
11
+ date: 2018-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -50,7 +50,12 @@ files:
50
50
  - lib/rubocop/sketchup.rb
51
51
  - lib/rubocop/sketchup/config.rb
52
52
  - lib/rubocop/sketchup/dc_globals.rb
53
+ - lib/rubocop/sketchup/deprecations/add_separator_to_menu.rb
53
54
  - lib/rubocop/sketchup/deprecations/operation_next_transparent.rb
55
+ - lib/rubocop/sketchup/deprecations/require_all.rb
56
+ - lib/rubocop/sketchup/deprecations/set_texture_projection.rb
57
+ - lib/rubocop/sketchup/deprecations/show_ruby_panel.rb
58
+ - lib/rubocop/sketchup/deprecations/sketchup_set.rb
54
59
  - lib/rubocop/sketchup/extension_project.rb
55
60
  - lib/rubocop/sketchup/formatter/extension_review.rb
56
61
  - lib/rubocop/sketchup/inject.rb
@@ -72,7 +77,6 @@ files:
72
77
  - lib/rubocop/sketchup/requirements/load_path.rb
73
78
  - lib/rubocop/sketchup/requirements/minimal_registration.rb
74
79
  - lib/rubocop/sketchup/requirements/register_extension.rb
75
- - lib/rubocop/sketchup/requirements/require_tools_ruby_files.rb
76
80
  - lib/rubocop/sketchup/requirements/ruby_core_namespace.rb
77
81
  - lib/rubocop/sketchup/requirements/ruby_stdlib_namespace.rb
78
82
  - lib/rubocop/sketchup/requirements/shipped_extensions_namespace.rb
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module SketchupRequirements
6
- # Due to how require and Sketchup.require checks whether a file has been
7
- # loaded, files from SketchUp's Tools folder should be required in using
8
- # `require` and with their file extension to avoid duplicate loading.
9
- class RequireToolsRubyFiles < Cop
10
-
11
- include SketchUp::NoCommentDisable
12
-
13
- MSG = "Require files from SketchUp's Tools directory with require.".freeze
14
-
15
- RUBY_FILES = %w[extensions.rb langhandler.rb sketchup.rb]
16
-
17
-
18
- def_node_matcher :ruby_require, <<-PATTERN
19
- (send nil? :require (str $_))
20
- PATTERN
21
-
22
- def_node_matcher :ruby_require?, <<-PATTERN
23
- (send nil? :require (str _))
24
- PATTERN
25
-
26
-
27
- def_node_matcher :sketchup_require, <<-PATTERN
28
- (send
29
- (const nil? :Sketchup) :require
30
- (str $_)
31
- )
32
- PATTERN
33
-
34
- def_node_matcher :sketchup_require?, <<-PATTERN
35
- (send
36
- (const nil? :Sketchup) :require
37
- (str _)
38
- )
39
- PATTERN
40
-
41
-
42
- def on_send(node)
43
- if ruby_require?(node)
44
- # The Tools folder Ruby files should be loaded using `require` and
45
- # include the ".rb" file extension.
46
- filename = ruby_require(node)
47
- return unless tools_file_required?(filename)
48
- return if expected_require_syntax?(filename)
49
- add_offense(node, location: :expression, severity: :error)
50
- elsif sketchup_require?(node)
51
- # The Tools folder Ruby files should not be loaded using
52
- # `Sketchup.require`.
53
- filename = sketchup_require(node)
54
- return unless tools_file_required?(filename)
55
- add_offense(node, location: :expression, severity: :error)
56
- end
57
- end
58
-
59
- private
60
-
61
- def tools_file_required?(filename)
62
- ext = File.extname(filename)
63
- full_filename = ext.empty? ? "#{filename}.rb" : filename
64
- RUBY_FILES.include?(full_filename.downcase)
65
- end
66
-
67
- def expected_require_syntax?(filename)
68
- RUBY_FILES.include?(filename)
69
- end
70
-
71
- end
72
- end
73
- end
74
- end