rubocop-sketchup 0.15.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2334f4c89d95d0a67f773420a64210548648972215ffd39604e31d8f41eb7772
4
- data.tar.gz: d7fedb24560c0dd565d047697cfce245ae981326ffdf0f1ad6051a6782fc755e
3
+ metadata.gz: a7df76ab15e23629404f20058b4526fa349087d3565698da08ffc7cf684a4e76
4
+ data.tar.gz: 4854d4b9c5867484d75e80d9ab2a73d66928b73ebf3ba3690c6806dc609b93e2
5
5
  SHA512:
6
- metadata.gz: 4ba542095b93c86c14fd5d99a0a8f97da03c697f4365d27101c278f548e3fec968cb7085c3c9de03ce75789cb15e866c7a9e5fe489e3cf1f213b73e7bf63b954
7
- data.tar.gz: a706d89507d0dffa87085e5951267daab6f4815fcaf55f3261af7b4c1ca9b2fc7b72ef86aa6bef9398a777a6db74e2b2dd91bc1612cb3235e7e5fca43daba4b6
6
+ metadata.gz: ff776f302d5439f1b44324a4b41155f39b4cae4396d18675265fe17a696ec3220530f5b76cdf409aa1e28a6eac21f7be2c1e5e6ded7fcba53acdb71a91b58958
7
+ data.tar.gz: c54421dc0d103ac574be46ce850906282710fdb6e2ad1d3e3214596122f4d47154fc9017bc1ead17a8fe78aa2867eb8c333e6b7a9e923723638975f6c3d34499
data/Gemfile CHANGED
@@ -8,12 +8,12 @@ group :test do
8
8
  gem 'appveyor-worker', '~> 0.2', require: false
9
9
  gem 'rake', '~> 12.0', require: false
10
10
  gem 'rspec', '~> 3.7', require: false
11
+ gem 'rubocop-performance', '~> 1.7.0', require: false
12
+ gem 'simplecov', '~> 0.10', require: false
11
13
  end
12
14
 
13
15
  group :development do
14
16
  gem 'bump', '~> 0.5', require: false
15
- gem 'rubocop-performance', require: false
16
- gem 'simplecov', '~> 0.10', require: false
17
17
  gem 'solargraph', '~> 0.34', require: false
18
18
  gem 'thor', '~> 0.20', require: false
19
19
  gem 'yard', '~> 0.9', require: false
@@ -42,6 +42,14 @@ module RuboCop
42
42
 
43
43
  include SketchUp::Config
44
44
 
45
+ SKETCHUP_DEPARTMENT_SEVERITY = {
46
+ SketchupRequirements: :error,
47
+ SketchupDeprecations: :warning,
48
+ SketchupPerformance: :warning,
49
+ SketchupBugs: :warning,
50
+ SketchupSuggestions: :convention,
51
+ }.freeze
52
+
45
53
  # Invoke the original inherited hook so our cops are recognized
46
54
  def self.inherited(subclass)
47
55
  RuboCop::Cop::Cop.inherited(subclass)
@@ -58,16 +66,7 @@ module RuboCop
58
66
  end
59
67
 
60
68
  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
69
+ SKETCHUP_DEPARTMENT_SEVERITY[self.class.department]
71
70
  end
72
71
 
73
72
  def department_name
@@ -80,7 +80,7 @@ module RuboCop
80
80
  end
81
81
 
82
82
  # Invalid format.
83
- if extension_id !~ EXTENSION_ID_PATTERN
83
+ unless EXTENSION_ID_PATTERN.match?(extension_id)
84
84
  range = string_contents_range(node)
85
85
  add_offense(node, location: range, message: MSG_INVALID)
86
86
  return false
@@ -18,9 +18,16 @@
18
18
  # positives. The method names should be names that are not commonly used in
19
19
  # general context.
20
20
  #
21
+ # Since it's difficult to know what a variable in Ruby code represent by static
22
+ # analysis, these methods are assumed to belong to the FEATURES list.
23
+ #
21
24
  # When a new version is released and FEATURES is updated the new methods from
22
25
  # the new version should be considered for this list.
23
26
  #
27
+ # TODO(thomthom): Investigate if Solargraph's static analysis can be used to
28
+ # provide a more accurate analysis. Not sure how well it works on code bases
29
+ # that isn't well documented with YARD type tags.
30
+ #
24
31
  #
25
32
  # OBSERVER_METHODS constant:
26
33
  #
@@ -34,6 +41,48 @@ module RuboCop
34
41
 
35
42
  FEATURES = [
36
43
 
44
+ {
45
+ version: 'LayOut 2020.1',
46
+ types: {
47
+ method: [
48
+ 'Layout::Document#export',
49
+ 'Layout::Grid#clip_to_margins=',
50
+ 'Layout::Grid#clip_to_margins?',
51
+ 'Layout::Grid#in_front=',
52
+ 'Layout::Grid#in_front?',
53
+ 'Layout::Grid#major_color=',
54
+ 'Layout::Grid#major_spacing=',
55
+ 'Layout::Grid#minor_color=',
56
+ 'Layout::Grid#minor_divisions=',
57
+ 'Layout::Grid#print=',
58
+ 'Layout::Grid#show=',
59
+ 'Layout::Grid#show_major=',
60
+ 'Layout::Grid#show_minor=',
61
+ 'Layout::SketchUpModel#camera_modified?',
62
+ 'Layout::SketchUpModel#effects_modified?',
63
+ 'Layout::SketchUpModel#layers_modified?',
64
+ 'Layout::SketchUpModel#reset_camera',
65
+ 'Layout::SketchUpModel#reset_effects',
66
+ 'Layout::SketchUpModel#reset_layers',
67
+ 'Layout::SketchUpModel#reset_style',
68
+ 'Layout::SketchUpModel#style_modified?',
69
+ ],
70
+ },
71
+ },
72
+
73
+ {
74
+ version: 'SketchUp 2020.1',
75
+ types: {
76
+ method: [
77
+ 'Sketchup::Entities#weld',
78
+ 'Sketchup::Page#use_hidden_geometry=',
79
+ 'Sketchup::Page#use_hidden_geometry?',
80
+ 'Sketchup::Page#use_hidden_objects=',
81
+ 'Sketchup::Page#use_hidden_objects?',
82
+ ],
83
+ },
84
+ },
85
+
37
86
  {
38
87
  version: 'SketchUp 2020.0',
39
88
  types: {
@@ -1097,8 +1146,11 @@ module RuboCop
1097
1146
  attached_to
1098
1147
  attached_to=
1099
1148
  boundingbox_pick
1149
+ camera_modified?
1100
1150
  center_2d
1101
1151
  classifications
1152
+ clip_to_margins?
1153
+ clip_to_margins=
1102
1154
  colorize_deltas
1103
1155
  colorize_type
1104
1156
  colorize_type=
@@ -1107,6 +1159,7 @@ module RuboCop
1107
1159
  days_remaining
1108
1160
  drawing_element_visible?
1109
1161
  edit_transform
1162
+ effects_modified?
1110
1163
  end_attached_to
1111
1164
  end_attached_to=
1112
1165
  error_description
@@ -1127,12 +1180,15 @@ module RuboCop
1127
1180
  icon_tooltip
1128
1181
  icon_tooltip=
1129
1182
  image_rep
1183
+ in_front?
1184
+ in_front=
1130
1185
  include_in_animation?
1131
1186
  include_in_animation=
1132
1187
  instance_path
1133
1188
  instance_path_from_pid_path
1134
1189
  is_polygon?
1135
1190
  large_icon
1191
+ layers_modified?
1136
1192
  leader_break_point
1137
1193
  leader_break_point=
1138
1194
  leader_points
@@ -1145,7 +1201,11 @@ module RuboCop
1145
1201
  local_bounds
1146
1202
  lower_left
1147
1203
  lower_right
1204
+ major_color=
1205
+ major_spacing=
1148
1206
  menu_text
1207
+ minor_color=
1208
+ minor_divisions=
1149
1209
  mipmapping?
1150
1210
  mipmapping=
1151
1211
  navigation_buttons_enabled?
@@ -1161,6 +1221,10 @@ module RuboCop
1161
1221
  persistent_id_path
1162
1222
  refresh_thumbnail
1163
1223
  remove_classification
1224
+ reset_camera
1225
+ reset_effects
1226
+ reset_layers
1227
+ reset_style
1164
1228
  same_direction?
1165
1229
  scale_2d
1166
1230
  screen_scale_factor
@@ -1174,11 +1238,14 @@ module RuboCop
1174
1238
  set_upload_progress_callback
1175
1239
  set_uv
1176
1240
  show_differences
1241
+ show_major=
1242
+ show_minor=
1177
1243
  sketch_plane
1178
1244
  small_icon
1179
1245
  start_attached_to
1180
1246
  start_attached_to=
1181
1247
  status_bar_text
1248
+ style_modified?
1182
1249
  text_bounds
1183
1250
  unit_vector?
1184
1251
  unload_schema
@@ -17,9 +17,10 @@ module RuboCop
17
17
  # @param [Integer, Float] version
18
18
  # @param [Integer] maintenance
19
19
  def initialize(*args)
20
- if args.size == 1
20
+ case args.size
21
+ when 1
21
22
  @version, @maintenance = parse_version(args.first)
22
- elsif args.size == 2
23
+ when 2
23
24
  validate(args)
24
25
  @version, @maintenance = args
25
26
  else
@@ -66,6 +67,7 @@ module RuboCop
66
67
  #
67
68
  # The second item in the array is maintenance annotation
68
69
  VALID_VERSIONS = [
70
+ [2020.1, 0],
69
71
  [2020.0, 0],
70
72
  [2019.2, 0],
71
73
  [2019.0, 0], # SketchUp dropped M notation as of SU2019.
@@ -92,7 +94,8 @@ module RuboCop
92
94
  def parse_version(version)
93
95
  v = 0
94
96
  m = 0
95
- if version.is_a?(String)
97
+ case version
98
+ when String
96
99
  # Treat all LayOut versions as SketchUp versions for now.
97
100
  normalized_version = version.gsub('LayOut', 'SketchUp')
98
101
  result = normalized_version.match(VERSION_NUMBER_REGEX)
@@ -100,7 +103,7 @@ module RuboCop
100
103
  v = result.captures[0].to_f
101
104
  m = (result.captures[1] || '0').to_i
102
105
  end
103
- elsif version.is_a?(Numeric)
106
+ when Numeric
104
107
  v = version
105
108
  m = 0
106
109
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module SketchUp
5
- VERSION = '0.15.1'
5
+ VERSION = '0.17.0'
6
6
  end
7
7
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
 
14
14
  spec.version = RuboCop::SketchUp::VERSION
15
15
  spec.platform = Gem::Platform::RUBY
16
- spec.required_ruby_version = '>= 2.3.0'
16
+ spec.required_ruby_version = '>= 2.4.0'
17
17
 
18
18
  spec.require_paths = ['lib']
19
19
  spec.files = Dir[
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
24
24
  'Gemfile'
25
25
  ]
26
26
 
27
- spec.add_dependency 'rubocop', '>= 0.80', '<= 0.80'
27
+ spec.add_dependency 'rubocop', '>= 0.82', '<= 0.88'
28
28
  spec.add_development_dependency 'bundler', '>= 1.13', '< 3.0'
29
29
  end
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-sketchup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.17.0
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: 2020-02-27 00:00:00.000000000 Z
11
+ date: 2020-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<="
18
- - !ruby/object:Gem::Version
19
- version: '0.80'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: '0.80'
19
+ version: '0.82'
20
+ - - "<="
21
+ - !ruby/object:Gem::Version
22
+ version: '0.88'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "<="
28
- - !ruby/object:Gem::Version
29
- version: '0.80'
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
- version: '0.80'
29
+ version: '0.82'
30
+ - - "<="
31
+ - !ruby/object:Gem::Version
32
+ version: '0.88'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -137,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
- version: 2.3.0
140
+ version: 2.4.0
141
141
  required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="