cuke_sniffer 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,4 @@
1
1
  <script>
2
- function toggle(item, off) {
3
- updateDisplayStatus(item.getElementsByTagName("div")[off]);
4
- }
5
2
  function toggleById(item, link) {
6
3
  updateDisplayStatus(document.getElementById(item));
7
4
  toggleText(link)
@@ -13,383 +10,344 @@
13
10
  var char_result = link.innerHTML.indexOf("+") > -1 ? "-" : "+";
14
11
  link.innerHTML = link.innerHTML.replace(/(\+|\-)/, char_result)
15
12
  }
16
-
17
13
  </script>
18
14
  <style>
19
- body {
20
- font-size: 12pt;
21
- font-family: arial;
22
- }
23
-
24
- .sections {
25
- border: 2px solid #90ee90;
26
- }
27
-
28
- .shrink_section {
29
- display: none;
30
- }
31
-
32
- .scenarios, .steps, {
33
- border-top: 1px solid #bbb;
34
- padding: 4px;
35
- padding-left: 90px;
36
- }
37
-
38
- .scenarios, .steps {
39
- border-top: 1px solid #bbb;
40
- padding: 4px;
41
- padding-left: 90px;
42
- }
43
-
44
15
  .title {
45
- padding-left: 2%;
16
+ padding-left: 1%;
46
17
  width: 25%;
47
18
  background-color: green;
48
19
  color: white;
49
20
  border-top: 0;
50
21
  border-bottom: 0;
51
- padding-top: 4px;
52
22
  font-weight: bold;
53
- font-size: 15pt;
54
- padding-bottom: 1%;
23
+ font-size: 21pt;
24
+ cursor: hand;
55
25
  }
56
26
 
57
- .rule {
58
- background-color: #ffaaaa;
59
- padding: 3px;
60
- font-size: 13px;
27
+ .shrink_section {
28
+ border: 2px solid #90ee90;
29
+ display: none;
61
30
  }
62
31
 
63
- .summary_col {
32
+ .table_top {
64
33
  width: 20%;
65
34
  font-size: 14pt;
35
+ padding: 0;
66
36
  }
67
37
 
68
- .major_summary_col {
69
- width: 20%;
70
- font-size: 14pt;
71
- padding: 0%;
72
- border-bottom: solid lightgreen 3px;
73
- padding-bottom: 3%;
38
+ .divide_row {
39
+ border-bottom: 1px solid black;
40
+ }
41
+
42
+ .red_number {
43
+ width: 3%;
44
+ color: red;
45
+ text-indent: 1%;
46
+ font-weight: bold;
74
47
  }
75
48
 
76
- span {
77
- font-size: 20pt;
49
+ .notes {
50
+ text-indent: 1%;
78
51
  font-weight: bold;
79
- width: 100%;
80
- border-left: 2px solid #fff;
81
- padding-bottom: 3px;
82
- padding-left: 30px;
83
- padding-top: 4px
84
52
  }
85
53
 
54
+ .sub_section {
55
+ display: none;
56
+ margin-left: 1%;
57
+ margin-right: 1%;
58
+ border-top: 2px solid #add8e6;
59
+ }
86
60
  </style>
87
- <div style="float:left; color: green; font-weight: bold; padding-left:10px;">
61
+
62
+
63
+ <div style="float: left; color: green; font-size: 20px; font-weight: bold; padding-bottom: 1px;">
88
64
  Cuke Sniffer
89
65
  </div>
90
66
  <br style="clear:both">
91
- <div style="border-top: 2px solid lightgreen;">
92
- <div style="float:right;border-right: 2px solid lightgreen;">
93
- <div style="background-color:green;border-right:2px solid #fff; color:white;padding:4px; padding-left:40px;font-size:11pt;font-weight:bold;padding-right:10px;">
94
- <%= summary[:total_score] %> Total Score
95
- </div>
96
- </div>
97
- </div>
98
- <br style="clear:both">
99
- <div style="float:left;" class="title">
100
- <a href=#summary style="color: white;font-style: normal;">
101
- <span style="border-left-color:green;cursor: hand;" onclick="toggleById('summary',this)">- Summary</span>
102
- </a>
67
+ <div style="border-top: 2px solid lightgreen; text-align: right;">
68
+ <div style="float: right; background-color:green;border-right:2px solid #fff; color:white;padding:4px; padding-left:40px;font-size:11pt;font-weight:bold;padding-right:10px;">
69
+ Score: <%= cuke_sniffer.summary[:total_score] %></div>
103
70
  </div>
104
71
  <br style="clear:both">
105
72
 
106
- <div class="sections">
107
- <div name="summary" class="shrink_section" id="summary" style="display:block">
108
- <%
109
- feature_results = cuke_sniffer.summary[:features]
110
- scenario_results = cuke_sniffer.summary[:scenarios]
111
- step_definition_results = cuke_sniffer.summary[:step_definitions]
112
- %>
113
- <br>
114
- <table style="padding-left: 3%;">
115
- <tr>
116
- <td class="major_summary_col"></td>
117
- <td class="major_summary_col">Features</td>
118
- <td class="major_summary_col">Scenarios</td>
119
- <td class="major_summary_col">Step Definitions</td>
73
+ <div class="title" onclick="toggleById('summary_data', this)">
74
+ Summary -
75
+ </div>
76
+ <div class="shrink_section" style="display: block;" id="summary_data">
77
+ <% data_symbols = [:features, :scenarios, :step_definitions, :hooks] %>
78
+ <table style="width: 100%;" class="notes">
79
+ <tr class="divide_row">
80
+ <td class="table_top"></td>
81
+ <td class="table_top">Features</td>
82
+ <td class="table_top">Scenarios</td>
83
+ <td class="table_top">Step Definitions</td>
84
+ <td class="table_top">Hooks</td>
120
85
  </tr>
121
86
  <tr>
122
- <td class="summary_col">Total Score</td>
123
- <td class="summary_col"><%= feature_results[:total_score] %></td>
124
- <td class="summary_col"><%= scenario_results[:total_score] %></td>
125
- <td class="summary_col"><%= step_definition_results[:total_score] %></td>
87
+ <td>Total Score</td>
88
+ <% data_symbols.each do |symbol| %>
89
+ <td><%= cuke_sniffer.summary[symbol][:total_score] %></td>
90
+ <% end %>
126
91
  </tr>
127
92
  <tr>
128
- <td class="major_summary_col">Count</td>
129
- <td class="major_summary_col"><%= cuke_sniffer.features.count %></td>
130
- <td class="major_summary_col"><%= cuke_sniffer.scenarios.count %></td>
131
- <td class="major_summary_col"><%= cuke_sniffer.step_definitions.count %></td>
93
+ <td>Count</td>
94
+ <% data_symbols.each do |symbol| %>
95
+ <td><%= cuke_sniffer.summary[symbol][:total].inspect %></td>
96
+ <% end %>
132
97
  </tr>
98
+ <tr/>
133
99
  <tr>
134
- <td class="summary_col">Lowest Score</td>
135
- <td class="summary_col"><%= feature_results[:min] %></td>
136
- <td class="summary_col"><%= scenario_results[:min] %></td>
137
- <td class="summary_col"><%= step_definition_results[:min] %></td>
100
+ <td>Lowest Score</td>
101
+ <% data_symbols.each do |symbol| %>
102
+ <td><%= cuke_sniffer.summary[symbol][:min] %></td>
103
+ <% end %>
138
104
  </tr>
139
105
  <tr>
140
- <td class="summary_col">Highest Score</td>
141
- <td class="summary_col"><%= feature_results[:max] %></td>
142
- <td class="summary_col"><%= scenario_results[:max] %></td>
143
- <td class="summary_col"><%= step_definition_results[:max] %></td>
106
+ <td>Highest Score</td>
107
+ <% data_symbols.each do |symbol| %>
108
+ <td><%= cuke_sniffer.summary[symbol][:max] %></td>
109
+ <% end %>
144
110
  </tr>
145
111
  <tr>
146
- <td class="major_summary_col">Average Score</td>
147
- <td class="major_summary_col"><%= feature_results[:average] %></td>
148
- <td class="major_summary_col"><%= scenario_results[:average] %></td>
149
- <td class="major_summary_col"><%= step_definition_results[:average] %></td>
112
+ <td>Average Score</td>
113
+ <% data_symbols.each do |symbol| %>
114
+ <td><%= cuke_sniffer.summary[symbol][:average] %></td>
115
+ <% end %>
150
116
  </tr>
117
+ <tr/>
118
+
151
119
  <tr>
152
- <td class="summary_col">Threshold</td>
153
- <td class="summary_col"><%= feature_results[:threshold] %></td>
154
- <td class="summary_col"><%= scenario_results[:threshold] %></td>
155
- <td class="summary_col"><%= step_definition_results[:threshold] %></td>
120
+ <td>Threshold</td>
121
+ <% data_symbols.each do |symbol| %>
122
+ <td><%= cuke_sniffer.summary[symbol][:threshold] %></td>
123
+ <% end %>
156
124
  </tr>
157
125
  <tr>
158
- <td class="summary_col">Good</td>
159
- <td class="summary_col"><%= (feature_results[:good].to_f/feature_results[:total].to_f*100).round(2) %>%</td>
160
- <td class="summary_col"><%= (scenario_results[:good].to_f/scenario_results[:total].to_f*100).round(2) %>%</td>
161
- <td class="summary_col"><%= (step_definition_results[:good].to_f/step_definition_results[:total].to_f*100).round(2) %>
162
- %
163
- </td>
126
+ <td>Good</td>
127
+ <% data_symbols.each do |symbol| %>
128
+ <td><%= ((cuke_sniffer.summary[symbol][:good].to_f/cuke_sniffer.summary[symbol][:total].to_f) * 100).round(2) %>
129
+ %
130
+ </td>
131
+ <% end %>
164
132
  </tr>
165
133
  <tr>
166
- <td class="summary_col">Bad</td>
167
- <td class="summary_col"><%= (feature_results[:bad].to_f/feature_results[:total].to_f*100).round(2) %>%</td>
168
- <td class="summary_col"><%= (scenario_results[:bad].to_f/scenario_results[:total].to_f*100).round(2) %>%</td>
169
- <td class="summary_col"><%= (step_definition_results[:bad].to_f/step_definition_results[:total].to_f*100).round(2) %>
170
- %
171
- </td>
134
+ <td>Bad</td>
135
+ <% data_symbols.each do |symbol| %>
136
+ <td><%= ((cuke_sniffer.summary[symbol][:bad].to_f/cuke_sniffer.summary[symbol][:total].to_f) * 100).round(2) %>
137
+ %
138
+ </td>
139
+ <% end %>
172
140
  </tr>
173
141
  </table>
174
142
  </div>
175
- <br><br>
176
-
177
- <div style="float:left;" class="title">
178
- <a href=#improvement_list style="color: white;font-style: normal;">
179
- <span style="border-left-color:green;cursor: hand;" onclick="toggleById('improvement_list',this)">+ Improvement List</span>
180
- </a>
181
- </div>
182
- <div class="links" style="float:right"></div>
183
143
  <br style="clear:both">
184
144
 
185
- <div class="sections">
186
- <div name="improvement_list" class="shrink_section" id="improvement_list">
187
- <div style="padding-left:3%;font:bold;font-size:14pt;">Types of
188
- improvements: <%= cuke_sniffer.summary[:improvement_list].keys.count %></div>
189
- <table style="padding-left: 5%;font-size:14pt;">
190
- <% cuke_sniffer.summary[:improvement_list].each do |improvement, count| %>
191
- <tr>
192
- <td style="width: 20px"><%= count %></td>
193
- <td style="width: 400px"><%= improvement %></td>
194
- </tr>
195
- <% end %>
196
- </table>
197
- <br>
198
- </div>
199
- </div>
200
- <br><br>
201
-
202
- <div style="float:left;" class="title">
203
- <a href=#dead_steps style="color: white;font-style: normal;">
204
- <span style="border-left-color:green;cursor: hand;" onclick="toggleById('dead_steps',this)">+ Dead Steps</span>
205
- </a>
145
+ <div class="title" onclick="toggleById('improvement_list_data', this)">
146
+ Improvement List +
206
147
  </div>
207
- <div class="links" style="float:right"></div>
208
- <br style="clear:both">
209
-
210
- <div class="sections">
211
- <div name="dead_steps" class="shrink_section" id="dead_steps">
212
- <% dead_steps = cuke_sniffer.get_dead_steps %>
213
- <br>
214
- <div style="font:bold;padding-left:3%;font:bold;font-size:14pt;">Total Dead
215
- Steps: <%= dead_steps[:total] %></div>
216
- <% dead_steps.delete :total%>
217
- <% dead_steps.each_key do |step_file| %>
218
- <div style="font:bold;padding-left:3%;font-size:14pt;">
219
- <%= step_file %>
220
- <br>
221
- <div style="padding-left:3%;font-size:12pt;">
222
- <%dead_steps[step_file].each do |regex|%>
223
- <%= regex %>
224
- <br>
225
- <% end %>
226
- </div></div>
227
- <br>
148
+ <div class="shrink_section" id="improvement_list_data">
149
+ <% if cuke_sniffer.summary[:improvement_list].empty? %>
150
+ <div class="notes">No Improvements to make!</div>
151
+ <% end %>
152
+ <table style="width: 100%">
153
+ <% cuke_sniffer.summary[:improvement_list].each do |improvement, count| %>
154
+ <tr>
155
+ <td class="red_number"><%= count %></td>
156
+ <td class="notes"><%= improvement %></td>
157
+ </tr>
228
158
  <% end %>
229
- </div>
230
- </div>
231
- <br><br>
232
-
233
-
234
- <div style="float:left;" class="title">
235
- <a href=#feature_details style="color: white;font-style: normal;">
236
- <span style="border-left-color:green;cursor: hand;" onclick="toggleById('feature_details',this)">+ Features</span>
237
- </a>
159
+ </table>
238
160
  </div>
239
- <div class="links" style="float:right"></div>
240
161
  <br style="clear:both">
241
162
 
242
- <div class="sections">
243
- <div name="feature_details" class="shrink_section" id="feature_details">
244
- <% i=0 %>
245
- <% cuke_sniffer.features.each do |feature| %>
246
- <% next if feature.score == 0 and feature.scenarios_score == 0 %>
247
- <div style="cursor: hand;" onclick="toggle(this,3)" class="feature <%= i%2==0 ? "even" : "odd" %>">
248
- <div style="float:left;padding:4px;font-weight:bold;color:red; width:3%"><%= feature.score + feature.scenarios_score %></div>
249
-
250
- <div style=" float:left;">
251
- <font class="featurename"><%= feature.name %></font></div>
252
- <div style="width:60%;padding:4px; float:right">
253
- <font class="featurepath"></font></div>
254
- <br style="clear:both;">
255
-
256
- <div class="scenarios" style="display:none;">
257
- <b style="text-indent:5px"><%= feature.location.gsub(cuke_sniffer.features_location, "") %></b>
258
- <table>
259
- <tr>
260
- <td style="width: 600px;vertical-align:top;">
261
- <b style="text-indent:5px">Scenarios: <%= feature.scenarios.size %></b>
262
- </td>
263
- <td style="width: 600px;vertical-align:top;">
264
- <b style="text-indent:5px">Score: <%= feature.score %></b>
265
- <br>
266
- <% unless feature.rules_hash.empty? %>
267
- <b>Feature Improvements:</b>
163
+ <div class="title" onclick="toggleById('dead_steps_data', this)">
164
+ Dead Steps +
165
+ </div>
166
+ <div class="shrink_section" id="dead_steps_data">
167
+ <% dead_steps = cuke_sniffer.get_dead_steps %>
168
+ <% dead_steps.delete(:total) %>
169
+ <% dead_step_count = dead_steps.values.flatten.count %>
170
+ <% if dead_step_count == 0 %>
171
+ <div class="notes">No dead steps found!</div>
172
+ <% elsif dead_step_count == 1 %>
173
+ <div class="notes" style="color: red"><%= dead_step_count %> Dead Step found.</div>
174
+ <% else %>
175
+ <div class="notes" style="color: red"><%= dead_step_count %> Dead Steps found.</div>
176
+ <% end %>
268
177
 
269
- <div style="padding: 1%">
270
- <% feature.rules_hash.each_key do |rule| %>
271
- <%= rule %>
272
- <br>
273
- <% end %>
274
- </div>
275
- <% end %>
276
- </td>
277
- </tr>
278
- </table>
279
- <br>
280
- <% feature.scenarios = [feature.background, feature.scenarios].flatten unless feature.background.nil? %>
281
- <table style="border-bottom:2px solid lightgreen">
282
- <% feature.scenarios.each do |scenario| %>
283
- <% next if scenario.rules_hash.empty? %>
178
+ <table style="width: 100%">
179
+ <% dead_steps.each_key do |file_name| %>
180
+ <tr>
181
+ <td>
182
+ <div style="text-indent: 2%;font-weight: bold;"><%= file_name.gsub(cuke_sniffer.step_definitions_location, "") %>
183
+ .rb
184
+ </div>
185
+ <table style="width: 100%; padding-left: 3%;">
186
+ <% dead_steps[file_name].each do |regex| %>
284
187
  <tr>
285
- <td style="border-top:2px solid lightblue;width: 600px;vertical-align:top;">
286
- <b style="padding:1%;"><%= scenario.type %>: <%= scenario.name %></b>
287
- <br>
288
- <% scenario.steps.each do |step| %>
289
- <div style="text-indent:15px">
290
- <%= step %>
291
- </div>
292
- <% end %>
293
- <br>
294
- </td>
295
- <td style="border-top:2px solid lightblue;width: 600px;vertical-align:top;">
296
- <b>Score: <%= scenario.score %></b>
297
- <br>
298
- <b>Line: <%= scenario.start_line %></b>
299
- <br>
300
- <b>Scenario Improvements:</b>
301
- <br>
302
- <% scenario.rules_hash.each_key do |rule| %>
303
- <div style="text-indent:15px">
304
- <%= rule %>
305
- </div>
306
- <% end %>
307
- </td>
188
+ <td style="width: 3%"><%= regex.match(/(?<line>\d+):/)[:line] %></td>
189
+ <td><%= regex.match(/:(?<regex>.*)/)[:regex] %></td>
308
190
  </tr>
309
191
  <% end %>
310
192
  </table>
311
- </div>
312
- </div>
313
- <% i+=1 %>
193
+ </td>
194
+ </tr>
314
195
  <% end %>
315
- </div>
196
+ </table>
316
197
  </div>
317
- <br><br>
198
+ <br style="clear:both">
199
+
200
+ <div class="title" onclick="toggleById('features_data', this)">
201
+ Features +
202
+ </div>
203
+ <div class="shrink_section" id="features_data">
204
+ <% if cuke_sniffer.features.count == 0 %>
205
+ <div class="notes">No Feature/Scenario smells!</div>
206
+ <% end %>
207
+ <% index = 0 %>
208
+ <% cuke_sniffer.features.each do |feature| %>
209
+ <% next if feature.total_score <= 0 %>
210
+ <div style="cursor: hand; padding-top: 3px" onclick="updateDisplayStatus(document.getElementById('feature_<%=index%>'))">
211
+ <div class="red_number" style="float:left"><%= feature.total_score + feature.scenarios_score %></div>
212
+ <div class="notes"><%= feature.name %></div>
213
+ </div>
214
+ <div id="feature_<%= index %>" class="sub_section">
215
+ <div style="text-indent: 4%; float: left; width: 45%; border-right: 2px solid #add8e6; padding-bottom: 4px">
216
+ <% if feature.rules_hash.empty? %>
217
+ <pre style="margin: 0;"> </pre>
218
+ <% end %>
219
+ <% feature.rules_hash.each_key do |rule| %>
220
+ <pre style="margin: 0;"><%= rule %></pre>
221
+ <% end %>
222
+ </div>
223
+ <div style="text-indent: 1%; padding-bottom: 4px">
224
+ <%= feature.location.gsub(cuke_sniffer.features_location, "") %>
225
+ </div>
226
+ <br style="clear:both">
318
227
 
319
- <div style="float:left;" class="title">
320
- <a href=#step_definitions style="color: white;font-style: normal;">
321
- <span style="border-left-color:green;cursor: hand;" onclick="toggleById('step_definitions',this)">+ Step Definitions</span>
322
- </a>
228
+ <div>
229
+ <% unless feature.background.nil? or feature.background.score > 0 %>
230
+ <div class="red_number" style="float:left; padding-left: 1%"><%= feature.background.score %></div>
231
+ <div style="float: left; width: 45%;"><%= feature.background.type + ": " + feature.background.name %></div>
232
+ <div style="margin-left:1%;float: left; border-left: 2px solid #90ee90; border-top: 2px solid #90ee90;text-indent: 1%;">
233
+ <% feature.background.rules_hash.each_key do |rule| %>
234
+ <pre style="margin: 0; text_indent: 3%;"><%= rule %></pre>
235
+ <% end %>
236
+ </div>
237
+ <br style="clear:both">
238
+ <% end %>
239
+ </div>
240
+ <div>
241
+ <% feature.scenarios.each do |scenario| %>
242
+ <% next if scenario.score <= 0 %>
243
+ <div class="red_number" style="float:left; padding-left: 1%"><%= scenario.score %></div>
244
+ <div style="float: left; width: 45%;"><%= scenario.type + ": " + scenario.name %></div>
245
+ <div style="margin-left:1%;float: left; border-left: 2px solid #90ee90; border-top: 2px solid #90ee90; text-indent: 1%">
246
+ <% scenario.rules_hash.each_key do |rule| %>
247
+ <pre style="margin: 0; text_indent: 3%;"><%= rule %></pre>
248
+ <% end %>
249
+ </div>
250
+ <br style="clear:both">
251
+ <% end %>
252
+ </div>
253
+ </div>
254
+ <% index += 1 %>
255
+ <% end %>
323
256
  </div>
324
- <div class="links" style="float:right"></div>
325
257
  <br style="clear:both">
326
258
 
327
- <div class="sections">
328
- <div name="step_definitions" class="shrink_section" id="step_definitions">
329
- <% i=0 %>
330
- <% cuke_sniffer.step_definitions.each do |step_definition| %>
331
- <div style="cursor: hand;" onclick="toggle(this,4)" class="feature <%= i%2==0 ? "even" : "odd" %>">
332
- <% next if step_definition.score <= 0 or step_definition.calls.empty? %>
333
- <div style="float:left;padding:4px;font-weight:bold;color:red;"><%= step_definition.score %></div>
334
- <div style="width:55%;padding:4px; float:left;">
259
+ <div class="title" onclick="toggleById('step_definitions_data', this)">
260
+ Step Definitions +
261
+ </div>
262
+ <div class="shrink_section" id="step_definitions_data">
263
+ <% if cuke_sniffer.step_definitions.count == 0 %>
264
+ <div class="notes">No Step Definition smells!</div>
265
+ <% end %>
266
+ <% index = 0 %>
267
+ <% cuke_sniffer.step_definitions.each do |step_definition| %>
268
+ <% next if step_definition.score <= 0 %>
269
+ <div style="cursor: hand; padding-top: 3px" onclick="updateDisplayStatus(document.getElementById('step_definition_<%=index%>'))">
270
+ <div class="red_number" style="float:left"><%= step_definition.score %></div>
271
+ <% parameters = "" %>
272
+ <% step_definition.parameters.each do |param| %>
273
+ <% if param == step_definition.parameters.first %>
274
+ <% parameters << "| " %>
275
+ <% end %>
276
+ <% parameters << param %>
335
277
 
336
- <% parameters = "" %>
337
- <% step_definition.parameters.each do |param| %>
338
- <% if param == step_definition.parameters.first %>
339
- <% parameters << "| " %>
340
- <% end %>
341
- <% parameters << param %>
278
+ <% if param == step_definition.parameters.last %>
279
+ <% parameters << " |" %>
280
+ <% else %>
281
+ <% parameters << ", " %>
282
+ <% end %>
283
+ <% end %>
284
+ <div style="float: left" class="notes"><%= "/" + step_definition.regex.to_s.match(/\(\?\-mix\:(?<regex>.*)\)/)[:regex] + "/ do " + parameters %></div>
285
+ <div style="float: right; padding-right:1%" class="notes"><%= step_definition.calls.keys.count %> Call(s)</div>
286
+ </div>
287
+ <div id="step_definition_<%= index %>" style="display:none;">
288
+ <br style="clear:both">
342
289
 
343
- <% if param == step_definition.parameters.last %>
344
- <% parameters << " |" %>
345
- <% else %>
346
- <% parameters << ", " %>
347
- <% end %>
290
+ <div class="sub_section" style="display:block">
291
+ <div style="text-indent: 4%; float: left; width: 45%; border-right: 2px solid #add8e6;">
292
+ <% step_definition.rules_hash.each_key do |rule| %>
293
+ <pre style="margin: 0;"><%= rule %></pre>
348
294
  <% end %>
349
- <font class="featurename"><%= "/" + step_definition.regex.to_s.match(/\(\?\-mix\:(?<regex>.*)\)/)[:regex] + "/ do " + parameters %></font>
350
295
  </div>
351
- <% if step_definition.calls.empty? %>
352
- <div style="float:left; width:10%;padding:4px;"><span class="rule"><b>Dead step!</b></span></div>
353
- <% else %>
354
- <div style="float:left; width:10%;padding:4px;">Calls: <%= step_definition.calls.size %></div>
355
- <% end %>
356
- <div style="width:30%;padding:4px; float:left;">
357
-
296
+ <div style="text-indent: 1%">
297
+ <p style="margin:0"><%= step_definition.location.gsub(cuke_sniffer.step_definitions_location, "") %></p>
358
298
  </div>
359
- <br style="clear:both;">
299
+ </div>
300
+ </div>
301
+ <br style="clear:both">
302
+ <% index += 1 %>
303
+ <% end %>
304
+ </div>
305
+ <br style="clear:both">
360
306
 
361
- <div class="steps" style="display:none;">
362
- <b class="featurepath"><%= step_definition.location.gsub(cuke_sniffer.step_definitions_location, "") %></b>
363
- <br>
364
- <table>
365
- <tr>
366
- <td style="width: 600px;vertical-align:top;">
367
- <% unless step_definition.parameters.empty? %>
368
- <% calls = step_definition.condensed_call_list %>
369
- <% calls.each_key do |step_string| %>
370
- <div style="text-indent: 15px;"><%= step_string %></div>
371
- <% calls[step_string].each do |call| %>
372
- <div style="text-indent: 30px;"><%= call %></div>
373
- <% end %>
374
- <br>
375
- <% end %>
376
- <% end %>
377
- </td>
378
- <td style="width: 600px;vertical-align:top;">
379
- <b>Step Definition improvements:</b>
380
- <br>
381
- <% step_definition.rules_hash.each_key do |improvement| %>
382
- <div style="text-indent: 15px;">
383
- (<%= step_definition.rules_hash[improvement] %>) <%= improvement %>
384
- </div>
385
- <% end %>
386
- </td>
387
- </tr>
388
- </table>
307
+ <div class="title" onclick="toggleById('hooks_data', this)">
308
+ Hooks +
309
+ </div>
310
+ <div class="shrink_section" id="hooks_data">
311
+ <% if cuke_sniffer.hooks.count == 0 %>
312
+ <div class="notes">No Hook smells!</div>
313
+ <% end %>
314
+ <% index = 0 %>
315
+ <% cuke_sniffer.hooks.each do |hook| %>
316
+ <% next if hook.score <= 0 %>
317
+ <div style="cursor: hand; padding-top: 3px" onclick="updateDisplayStatus(document.getElementById('hook_<%=index%>'))">
318
+ <div class="red_number" style="float:left"><%= hook.score %></div>
319
+ <% tags = "(" %>
320
+ <% hook.tags.each do |tag| %>
321
+ <% tags << tag %>
322
+ <% tags << ", " unless tag == hook.tags.last %>
323
+ <% end %>
324
+ <% tags += ")" %>
325
+ <% parameters = "| " %>
326
+ <% hook.parameters.each do |parameter| %>
327
+ <% parameters << parameter %>
328
+ <% parameters << ", " unless parameter == hook.parameters.last %>
329
+ <% end %>
330
+ <% parameters += " |" %>
331
+ <% name = hook.type %>
332
+ <% name += tags unless tags == "()" %>
333
+ <% name += " do " %>
334
+ <% name += parameters unless parameters == "| |" %>
335
+ <div class="notes"><%= name %></div>
336
+ </div>
337
+ <div id="hook_<%= index %>" style="display:none;">
338
+ <div class="sub_section" style="display:block;">
339
+ <div style="text-indent: 4%; float: left; width: 45%; border-right: 2px solid #add8e6;">
340
+ <% hook.rules_hash.each_key do |rule| %>
341
+ <pre style="margin: 0;"><%= rule %></pre>
342
+ <% end %>
343
+ </div>
344
+ <div style="text-indent: 1%">
345
+ <%= hook.location.gsub(cuke_sniffer.hooks_location, "") %>
389
346
  </div>
347
+ <br style="clear:both">
390
348
  </div>
391
- <% i+=1 %>
392
- <% end %>
393
- </div>
349
+ </div>
350
+ <% index += 1 %>
351
+ <% end %>
394
352
  </div>
395
- </div>
353
+ <br style="clear:both">