rubocop-sketchup 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -1
  3. data/assets/logo.png +0 -0
  4. data/assets/output.html.erb +301 -0
  5. data/config/default.yml +141 -36
  6. data/lib/rubocop/sketchup/config.rb +28 -8
  7. data/lib/rubocop/sketchup/cop/deprecations/add_separator_to_menu.rb +4 -1
  8. data/lib/rubocop/sketchup/cop/deprecations/operation_next_transparent.rb +11 -2
  9. data/lib/rubocop/sketchup/cop/deprecations/require_all.rb +7 -2
  10. data/lib/rubocop/sketchup/cop/deprecations/set_texture_projection.rb +6 -2
  11. data/lib/rubocop/sketchup/cop/deprecations/show_ruby_panel.rb +4 -1
  12. data/lib/rubocop/sketchup/cop/deprecations/sketchup_set.rb +8 -0
  13. data/lib/rubocop/sketchup/cop/performance/openssl.rb +5 -3
  14. data/lib/rubocop/sketchup/cop/performance/operation_disable_ui.rb +10 -2
  15. data/lib/rubocop/sketchup/cop/performance/selection_bulk.rb +11 -4
  16. data/lib/rubocop/sketchup/cop/performance/type_check.rb +63 -0
  17. data/lib/rubocop/sketchup/cop/performance/typename.rb +6 -1
  18. data/lib/rubocop/sketchup/cop/requirements/api_namespace.rb +8 -2
  19. data/lib/rubocop/sketchup/cop/requirements/exit.rb +7 -3
  20. data/lib/rubocop/sketchup/cop/requirements/extension_namespace.rb +32 -2
  21. data/lib/rubocop/sketchup/cop/requirements/file_structure.rb +22 -10
  22. data/lib/rubocop/sketchup/cop/requirements/gem_install.rb +45 -0
  23. data/lib/rubocop/sketchup/cop/requirements/get_extension_license.rb +95 -0
  24. data/lib/rubocop/sketchup/cop/requirements/global_constants.rb +10 -1
  25. data/lib/rubocop/sketchup/cop/requirements/global_include.rb +9 -2
  26. data/lib/rubocop/sketchup/cop/requirements/global_methods.rb +10 -1
  27. data/lib/rubocop/sketchup/cop/requirements/global_variables.rb +13 -4
  28. data/lib/rubocop/sketchup/cop/requirements/language_handler_globals.rb +6 -4
  29. data/lib/rubocop/sketchup/cop/requirements/load_path.rb +9 -6
  30. data/lib/rubocop/sketchup/cop/requirements/minimal_registration.rb +26 -2
  31. data/lib/rubocop/sketchup/cop/requirements/observers_start_operation.rb +28 -2
  32. data/lib/rubocop/sketchup/cop/requirements/register_extension.rb +12 -2
  33. data/lib/rubocop/sketchup/cop/requirements/ruby_core_namespace.rb +14 -8
  34. data/lib/rubocop/sketchup/cop/requirements/ruby_stdlib_namespace.rb +594 -588
  35. data/lib/rubocop/sketchup/cop/requirements/shipped_extensions_namespace.rb +6 -6
  36. data/lib/rubocop/sketchup/cop/requirements/sketchup_extension.rb +28 -9
  37. data/lib/rubocop/sketchup/cop/requirements/sketchup_require.rb +163 -0
  38. data/lib/rubocop/sketchup/cop/suggestions/add_group.rb +49 -0
  39. data/lib/rubocop/sketchup/cop/suggestions/compatibility.rb +35 -6
  40. data/lib/rubocop/sketchup/cop/suggestions/dc_internals.rb +6 -3
  41. data/lib/rubocop/sketchup/cop/suggestions/file_encoding.rb +3 -0
  42. data/lib/rubocop/sketchup/cop/suggestions/model_entities.rb +9 -2
  43. data/lib/rubocop/sketchup/cop/suggestions/monkey_patched_api.rb +5 -1
  44. data/lib/rubocop/sketchup/cop/suggestions/operation_name.rb +20 -9
  45. data/lib/rubocop/sketchup/cop/suggestions/sketchup_find_support_file.rb +13 -2
  46. data/lib/rubocop/sketchup/cop/suggestions/tool_drawing_bounds.rb +44 -0
  47. data/lib/rubocop/sketchup/cop/suggestions/tool_invalidate.rb +66 -0
  48. data/lib/rubocop/sketchup/cop/suggestions/tool_user_input.rb +41 -0
  49. data/lib/rubocop/sketchup/cop/suggestions/toolbar_timer.rb +65 -0
  50. data/lib/rubocop/sketchup/cop.rb +38 -18
  51. data/lib/rubocop/sketchup/dc_globals.rb +1 -1
  52. data/lib/rubocop/sketchup/dc_methods.rb +27 -27
  53. data/lib/rubocop/sketchup/extension_project.rb +19 -2
  54. data/lib/rubocop/sketchup/formatter/extension_review.rb +35 -15
  55. data/lib/rubocop/sketchup/inject.rb +1 -1
  56. data/lib/rubocop/sketchup/namespace.rb +1 -0
  57. data/lib/rubocop/sketchup/namespace_checker.rb +4 -1
  58. data/lib/rubocop/sketchup/no_comment_disable.rb +1 -1
  59. data/lib/rubocop/sketchup/range_help.rb +52 -0
  60. data/lib/rubocop/sketchup/sketchup_version.rb +4 -2
  61. data/lib/rubocop/sketchup/tool_checker.rb +43 -0
  62. data/lib/rubocop/sketchup/version.rb +1 -1
  63. data/lib/rubocop/sketchup.rb +1 -1
  64. data/lib/rubocop-sketchup.rb +9 -0
  65. data/rubocop-sketchup.gemspec +8 -11
  66. metadata +18 -6
  67. data/lib/rubocop/sketchup/cop/suggestions/sketchup_require.rb +0 -67
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f29d33d3dde495840f196c30a5c5e6190231c61
4
- data.tar.gz: 16ea3bd669011b84962e5a29bc5b1196960d631a
3
+ metadata.gz: 8448db9503c27737fd716aa0716081f12c3cd4e0
4
+ data.tar.gz: 96eb24afd3fc615f47fbc6e7b701026285f980ed
5
5
  SHA512:
6
- metadata.gz: 1fd30ffbe9b4a7c5529bea92520d42ecacc933e0185008f896b00732991dcf2de9308eef4e65018acf35615f971b1393d22b456601b5895c3eb32755fa1eb3e1
7
- data.tar.gz: 3add40109dba159c303504367c78a50b358155e8dbb628ac38b544fa30aedf7cd32248c3f5dd89ac8a39ccc7591cb6c37c90fc24593ea4d5e204db239bb7f262
6
+ metadata.gz: d799fc6bcbb9836632c2cc5e43b2c3d010a56f529558f75373f0280843d31f7ff2ddbc9b95b9a5397a53d76573a6ce37708f8c6b2c78efc71f9a7e63ca64ce76
7
+ data.tar.gz: 89cd66f0910a0f3d6d9e0c8e8f36cbc1570691a07f8cfdc615bf2da50e4ee1099033f0bfd77ac16239823a6ee54685880ad8c337842ca9b73475976e7653e58d
data/Gemfile CHANGED
@@ -1,13 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
7
  group :test do
6
- gem "appveyor-worker", '~> 0.2', require: false
8
+ gem 'appveyor-worker', '~> 0.2', require: false
7
9
  gem 'rake', '~> 12.0', require: false
8
10
  gem 'rspec', '~> 3.7', require: false
9
11
  end
10
12
 
11
13
  group :development do
14
+ gem 'bump', require: false
12
15
  gem 'nokogiri', '~> 1.8', require: false
16
+ gem 'simplecov', '~> 0.10'
17
+ gem 'thor', '~> 0.20', require: false
18
+ gem 'yard', '~> 0.9'
13
19
  end
data/assets/logo.png ADDED
Binary file
@@ -0,0 +1,301 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='UTF-8' />
5
+ <title>SketchUp Extension RuboCop Inspection Report</title>
6
+ <%# TODO: Clean up the messy markup and style definitions. %>
7
+ <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
8
+ <style>
9
+ * {
10
+ -webkit-box-sizing: border-box;
11
+ -moz-box-sizing: border-box;
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ body, html {
16
+ font-size: 62.5%;
17
+ }
18
+ body {
19
+ background-color: #f3f3f7;
20
+ color: #363545;
21
+ font-family: 'Open Sans', sans-serif;
22
+ margin: 0;
23
+ }
24
+ code {
25
+ font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
26
+ font-size: 85%;
27
+ }
28
+ h1, h2, h3, h4, h5, h6 {
29
+ font-weight: normal;
30
+ }
31
+ a {
32
+ color: #e72b2d;
33
+ text-decoration: none;
34
+ }
35
+ #header {
36
+ background: #363545;
37
+ color: #fff;
38
+ height: 60px;
39
+ padding: 0;
40
+ }
41
+ #header .logo {
42
+ float: left;
43
+ margin: 10px 12px 7px 20px;
44
+ width: 38px;
45
+ height: 38px;
46
+ }
47
+ #header .title {
48
+ display: inline-block;
49
+ float: left;
50
+ height: 60px;
51
+ font-size: 2.4rem;
52
+ letter-spacing: normal;
53
+ line-height: 60px;
54
+ margin: 0;
55
+ }
56
+
57
+ .information, #offenses {
58
+ width: 100%;
59
+ padding: 20px;
60
+ color: #333;
61
+ }
62
+ #offenses {
63
+ padding: 0 20px;
64
+ }
65
+
66
+ .information .infobox {
67
+ border-left: 3px solid;
68
+ background-color: #fff;
69
+ padding: 15px;
70
+ border-color: #e72b2d;
71
+ font-size: 1.4rem;
72
+ }
73
+ .information .infobox .total {
74
+ font-weight: bold;
75
+ }
76
+ .information .infobox .info-title {
77
+ font-size: 1.8rem;
78
+ line-height: 2.2rem;
79
+ margin: 0 0 0.5em;
80
+ }
81
+ .information .offenses-list li {
82
+ line-height: 2.6rem;
83
+ }
84
+ .information .offenses-list {
85
+ padding-left: 20px;
86
+ margin-bottom: 0;
87
+ }
88
+
89
+ #offenses .offense-box {
90
+ margin-bottom: 20px;
91
+ background-color: #fff;
92
+ }
93
+ .fixed .box-title {
94
+ position: fixed;
95
+ top: 0;
96
+ z-index: 10;
97
+ width: 100%;
98
+ }
99
+ .box-title-placeholder {
100
+ display: none;
101
+ }
102
+ .fixed .box-title-placeholder {
103
+ display: block;
104
+ }
105
+ #offenses .offense-box .box-title h3, #offenses .offense-box .box-title-placeholder h3 {
106
+ color: #33353f;
107
+ background-color: #f6f6f6;
108
+ font-size: 2rem;
109
+ line-height: 2rem;
110
+ display: block;
111
+ padding: 15px;
112
+ margin: 0;
113
+ }
114
+ #offenses .offense-box .offense-reports {
115
+ padding: 0 15px;
116
+ }
117
+ #offenses .offense-box .offense-reports .report {
118
+ border-bottom: 1px solid #e2e2e7;
119
+ padding: 15px 0px;
120
+ position: relative;
121
+ font-size: 1.3rem;
122
+ }
123
+ #offenses .offense-box .offense-reports .report:last-child {
124
+ border-bottom: none;
125
+ }
126
+ #offenses .offense-box .offense-reports .report pre code {
127
+ display: block;
128
+ background: #222;
129
+ color: #fff;
130
+ padding: 10px 15px;
131
+ line-height: 1.6rem;
132
+ }
133
+ #offenses .offense-box .offense-reports .report .location {
134
+ font-weight: bold;
135
+ }
136
+ #offenses .offense-box .offense-reports .report .message code {
137
+ padding: 0.3em;
138
+ background-color: rgba(0,0,0,0.07);
139
+ }
140
+ .severity {
141
+ text-transform: capitalize;
142
+ font-weight: bold;
143
+ }
144
+ .highlight {
145
+ padding: 2px;
146
+ border-radius: 2px;
147
+ font-weight: bold;
148
+ }
149
+ <%- SEVERITY_COLORS.each do |severity, color| %>
150
+ .severity.<%= severity %> {
151
+ color: <%= color %>;
152
+ }
153
+ .highlight.<%= severity %> {
154
+ background-color: <%= color.fade_out(0.4) %>;
155
+ border: 1px solid <%= color.fade_out(0.6) %>;
156
+ }
157
+ <%- end %>
158
+ footer {
159
+ margin-bottom: 20px;
160
+ margin-right: 20px;
161
+ font-size: 1.3rem;
162
+ color: #777;
163
+ text-align: right;
164
+ }
165
+ .extra-code {
166
+ color: #ED9C28
167
+ }
168
+ hr {
169
+ border: none;
170
+ border-top: 3px solid #e2e2e7;
171
+ margin: 20px 0;
172
+ }
173
+ #offenses .offense-box.department {
174
+ background-color: #f3f3f7;
175
+ /* border-top: 3px solid #e2e2e7; */
176
+ }
177
+ #offenses .offense-box.department .box-title h3,
178
+ #offenses .offense-box.department .box-title-placeholder h3 {
179
+ background-color: #f3f3f7;
180
+ color: #363545;
181
+ font-weight: bold;
182
+ }
183
+ #offenses .offense-box.department .offense-reports .report {
184
+ padding: 0 0 5px 0;
185
+ }
186
+ </style>
187
+
188
+ <script>
189
+ (function() {
190
+ // floating headers. requires classList support.
191
+ if (!('classList' in document.createElement("_"))) return;
192
+
193
+ var loaded = false,
194
+ boxes,
195
+ boxPositions;
196
+
197
+ window.onload = function() {
198
+ var scrollY = window.scrollY;
199
+ boxes = document.querySelectorAll('.offense-box');
200
+ boxPositions = [];
201
+ for (var i = 0; i < boxes.length; i++)
202
+ // need to add scrollY because the page might be somewhere other than the top when loaded.
203
+ boxPositions[i] = boxes[i].getBoundingClientRect().top + scrollY;
204
+ loaded = true;
205
+ };
206
+
207
+ window.onscroll = function() {
208
+ if (!loaded) return;
209
+ var i,
210
+ idx,
211
+ scrollY = window.scrollY;
212
+ for (i = 0; i < boxPositions.length; i++) {
213
+ if (scrollY <= boxPositions[i] - 1) {
214
+ idx = i;
215
+ break;
216
+ }
217
+ }
218
+ if (typeof idx == 'undefined') idx = boxes.length;
219
+ if (idx > 0)
220
+ boxes[idx - 1].classList.add('fixed');
221
+ for (i = 0; i < boxes.length; i++) {
222
+ if (i < idx) continue;
223
+ boxes[i].classList.remove('fixed');
224
+ }
225
+ };
226
+ })();
227
+ </script>
228
+ </head>
229
+ <body>
230
+ <div id="header">
231
+ <img class="logo" src="data:image/png;base64,<%= base64_encoded_logo_image %>" alt="">
232
+ <h1 class="title">SketchUp Extension RuboCop Inspection Report</h1>
233
+ </div>
234
+ <div class="information">
235
+ <div class="infobox">
236
+ <div class="total">
237
+ <%= pluralize(files.count, 'file') %> inspected,
238
+ <%= pluralize(summary.offense_count, 'offense', no_for_zero: true) %> detected:
239
+ </div>
240
+ <ul class="offenses-list">
241
+ <% categories.each do |category, offenses| %>
242
+ <li>
243
+ <a href="#<%= cop_anchor(category) %>">
244
+ <%= category %> <%= pluralize(offenses.count, 'offense') %>
245
+ </a>
246
+ </li>
247
+ <% end %>
248
+ </ul>
249
+ </div>
250
+ </div>
251
+ <div id="offenses">
252
+ <% categories.each do |category, offenses| %>
253
+ <% if new_department?(category) %>
254
+ <hr>
255
+ <div class="offense-box department">
256
+ <div class="box-title">
257
+ <h3>
258
+ <%= department(category) %> -
259
+ <%= pluralize(department_offense_count(category), 'offense') %>
260
+ </h3>
261
+ </div>
262
+ <div class="offense-reports">
263
+ <div class="report">
264
+ <span class="message">
265
+ <%= department_description(category) %>
266
+ </span>
267
+ </div>
268
+ </div>
269
+ </div>
270
+ <% end %>
271
+ <div class="offense-box" id="<%= cop_anchor(category) %>">
272
+ <div class="box-title-placeholder"><h3>&nbsp;</h3></div>
273
+ <div class="box-title"><h3><%= category %> - <%= pluralize(offenses.count, 'offense') %></h3></div>
274
+ <div class="offense-reports">
275
+ <% offenses.each do |report| %>
276
+ <% offense = report.offense %>
277
+ <div class="report">
278
+ <div class="meta">
279
+ <span class="severity <%= offense.severity %>"><%= offense.severity %>:</span>
280
+ <span class="location">
281
+ <%= relative_path(report.path) %>:<%= offense.location.line %>
282
+ </span> –
283
+ <span class="message"><%= decorated_message(offense) %></span>
284
+ </div>
285
+ <% unless offense.location.source_line.strip.empty? %>
286
+ <pre><code><%= highlighted_source_line(offense) %></code></pre>
287
+ <% end %>
288
+ </div>
289
+ <% end %>
290
+ </div>
291
+ </div>
292
+ <% end %>
293
+ </div>
294
+ <footer>
295
+ Generated by <a href="https://github.com/rubocop-hq/rubocop">RuboCop</a>
296
+ <span class="version"><%= RuboCop::Version::STRING %></span> -
297
+ <a href="https://github.com/SketchUp/rubocop-sketchup">RuboCop SketchUp</a>
298
+ <span class="version"><%= RuboCop::SketchUp::VERSION %></span>
299
+ </footer>
300
+ </body>
301
+ </html>