rubocop-sketchup 0.5.0 → 0.6.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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +19 -19
  3. data/assets/output.html.erb +301 -301
  4. data/config/default.yml +355 -355
  5. data/lib/rubocop/sketchup/config.rb +63 -63
  6. data/lib/rubocop/sketchup/cop/deprecations/add_separator_to_menu.rb +25 -25
  7. data/lib/rubocop/sketchup/cop/deprecations/operation_next_transparent.rb +30 -30
  8. data/lib/rubocop/sketchup/cop/deprecations/require_all.rb +27 -27
  9. data/lib/rubocop/sketchup/cop/deprecations/set_texture_projection.rb +26 -26
  10. data/lib/rubocop/sketchup/cop/deprecations/show_ruby_panel.rb +25 -25
  11. data/lib/rubocop/sketchup/cop/deprecations/sketchup_set.rb +30 -30
  12. data/lib/rubocop/sketchup/cop/performance/openssl.rb +41 -41
  13. data/lib/rubocop/sketchup/cop/performance/operation_disable_ui.rb +33 -33
  14. data/lib/rubocop/sketchup/cop/performance/selection_bulk.rb +79 -79
  15. data/lib/rubocop/sketchup/cop/performance/type_check.rb +63 -63
  16. data/lib/rubocop/sketchup/cop/performance/typename.rb +24 -24
  17. data/lib/rubocop/sketchup/cop/requirements/api_namespace.rb +30 -30
  18. data/lib/rubocop/sketchup/cop/requirements/exit.rb +32 -32
  19. data/lib/rubocop/sketchup/cop/requirements/extension_namespace.rb +108 -108
  20. data/lib/rubocop/sketchup/cop/requirements/file_structure.rb +97 -97
  21. data/lib/rubocop/sketchup/cop/requirements/gem_install.rb +45 -45
  22. data/lib/rubocop/sketchup/cop/requirements/get_extension_license.rb +95 -95
  23. data/lib/rubocop/sketchup/cop/requirements/global_constants.rb +38 -38
  24. data/lib/rubocop/sketchup/cop/requirements/global_include.rb +42 -42
  25. data/lib/rubocop/sketchup/cop/requirements/global_methods.rb +65 -65
  26. data/lib/rubocop/sketchup/cop/requirements/global_variables.rb +95 -95
  27. data/lib/rubocop/sketchup/cop/requirements/language_handler_globals.rb +46 -46
  28. data/lib/rubocop/sketchup/cop/requirements/load_path.rb +83 -83
  29. data/lib/rubocop/sketchup/cop/requirements/minimal_registration.rb +73 -73
  30. data/lib/rubocop/sketchup/cop/requirements/observers_start_operation.rb +161 -161
  31. data/lib/rubocop/sketchup/cop/requirements/register_extension.rb +45 -45
  32. data/lib/rubocop/sketchup/cop/requirements/ruby_core_namespace.rb +291 -291
  33. data/lib/rubocop/sketchup/cop/requirements/ruby_stdlib_namespace.rb +634 -634
  34. data/lib/rubocop/sketchup/cop/requirements/shipped_extensions_namespace.rb +61 -61
  35. data/lib/rubocop/sketchup/cop/requirements/sketchup_extension.rb +119 -119
  36. data/lib/rubocop/sketchup/cop/requirements/sketchup_require.rb +163 -163
  37. data/lib/rubocop/sketchup/cop/suggestions/add_group.rb +49 -49
  38. data/lib/rubocop/sketchup/cop/suggestions/compatibility.rb +117 -117
  39. data/lib/rubocop/sketchup/cop/suggestions/dc_internals.rb +34 -34
  40. data/lib/rubocop/sketchup/cop/suggestions/file_encoding.rb +78 -78
  41. data/lib/rubocop/sketchup/cop/suggestions/model_entities.rb +58 -58
  42. data/lib/rubocop/sketchup/cop/suggestions/monkey_patched_api.rb +45 -45
  43. data/lib/rubocop/sketchup/cop/suggestions/operation_name.rb +103 -103
  44. data/lib/rubocop/sketchup/cop/suggestions/sketchup_find_support_file.rb +39 -39
  45. data/lib/rubocop/sketchup/cop/suggestions/tool_drawing_bounds.rb +44 -44
  46. data/lib/rubocop/sketchup/cop/suggestions/tool_invalidate.rb +66 -66
  47. data/lib/rubocop/sketchup/cop/suggestions/tool_user_input.rb +41 -41
  48. data/lib/rubocop/sketchup/cop/suggestions/toolbar_timer.rb +65 -65
  49. data/lib/rubocop/sketchup/cop.rb +111 -111
  50. data/lib/rubocop/sketchup/dc_globals.rb +24 -24
  51. data/lib/rubocop/sketchup/dc_methods.rb +130 -130
  52. data/lib/rubocop/sketchup/extension_project.rb +65 -65
  53. data/lib/rubocop/sketchup/features.rb +738 -738
  54. data/lib/rubocop/sketchup/formatter/extension_review.rb +259 -259
  55. data/lib/rubocop/sketchup/inject.rb +19 -19
  56. data/lib/rubocop/sketchup/namespace.rb +47 -47
  57. data/lib/rubocop/sketchup/namespace_checker.rb +46 -46
  58. data/lib/rubocop/sketchup/no_comment_disable.rb +17 -17
  59. data/lib/rubocop/sketchup/range_help.rb +52 -52
  60. data/lib/rubocop/sketchup/sketchup_version.rb +87 -87
  61. data/lib/rubocop/sketchup/tool_checker.rb +43 -43
  62. data/lib/rubocop/sketchup/version.rb +5 -5
  63. data/lib/rubocop/sketchup.rb +12 -12
  64. data/lib/rubocop-sketchup.rb +48 -48
  65. data/rubocop-sketchup.gemspec +27 -27
  66. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8448db9503c27737fd716aa0716081f12c3cd4e0
4
- data.tar.gz: 96eb24afd3fc615f47fbc6e7b701026285f980ed
3
+ metadata.gz: db4ab60dcb0baad7e658bc66f7a5f2f53a4fe7ba
4
+ data.tar.gz: af3b55cb7cc033028e68149a419b8e8f9d9253de
5
5
  SHA512:
6
- metadata.gz: d799fc6bcbb9836632c2cc5e43b2c3d010a56f529558f75373f0280843d31f7ff2ddbc9b95b9a5397a53d76573a6ce37708f8c6b2c78efc71f9a7e63ca64ce76
7
- data.tar.gz: 89cd66f0910a0f3d6d9e0c8e8f36cbc1570691a07f8cfdc615bf2da50e4ee1099033f0bfd77ac16239823a6ee54685880ad8c337842ca9b73475976e7653e58d
6
+ metadata.gz: 6f64b805d6cdfb9786eac071e70393085e30c50d5e64c08f91cf60a5bc9c77f6c0d98ed89aea7826ce583b3f96cbd43d443d91c131e010bfd46c3d07d504ee3f
7
+ data.tar.gz: 4a2c2efa5534d46e1e91c0c9c8a1f5fc27bc1631ae6375216f03c327cf08ff8d39fcb947d2209536bfbc350065432b7c07e241211e7bcc4f791bf4c74edef457
data/Gemfile CHANGED
@@ -1,19 +1,19 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- group :test do
8
- gem 'appveyor-worker', '~> 0.2', require: false
9
- gem 'rake', '~> 12.0', require: false
10
- gem 'rspec', '~> 3.7', require: false
11
- end
12
-
13
- group :development do
14
- gem 'bump', require: false
15
- gem 'nokogiri', '~> 1.8', require: false
16
- gem 'simplecov', '~> 0.10'
17
- gem 'thor', '~> 0.20', require: false
18
- gem 'yard', '~> 0.9'
19
- end
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ group :test do
8
+ gem 'appveyor-worker', '~> 0.2', require: false
9
+ gem 'rake', '~> 12.0', require: false
10
+ gem 'rspec', '~> 3.7', require: false
11
+ end
12
+
13
+ group :development do
14
+ gem 'bump', require: false
15
+ gem 'nokogiri', '~> 1.8', require: false
16
+ gem 'simplecov', '~> 0.10'
17
+ gem 'thor', '~> 0.20', require: false
18
+ gem 'yard', '~> 0.9'
19
+ end
@@ -1,301 +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>
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>