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.
- data/bin/{cuke_sniffer.rb → cuke_sniffer} +4 -1
- data/lib/cuke_sniffer.rb +16 -15
- data/lib/cuke_sniffer/cli.rb +319 -110
- data/lib/cuke_sniffer/constants.rb +34 -22
- data/lib/cuke_sniffer/feature.rb +77 -22
- data/lib/cuke_sniffer/feature_rules_evaluator.rb +115 -69
- data/lib/cuke_sniffer/hook.rb +160 -0
- data/lib/cuke_sniffer/report/markup.rhtml +266 -308
- data/lib/cuke_sniffer/rule_config.rb +192 -94
- data/lib/cuke_sniffer/rules_evaluator.rb +70 -53
- data/lib/cuke_sniffer/scenario.rb +238 -178
- data/lib/cuke_sniffer/step_definition.rb +239 -202
- metadata +6 -5
@@ -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:
|
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:
|
54
|
-
|
23
|
+
font-size: 21pt;
|
24
|
+
cursor: hand;
|
55
25
|
}
|
56
26
|
|
57
|
-
.
|
58
|
-
|
59
|
-
|
60
|
-
font-size: 13px;
|
27
|
+
.shrink_section {
|
28
|
+
border: 2px solid #90ee90;
|
29
|
+
display: none;
|
61
30
|
}
|
62
31
|
|
63
|
-
.
|
32
|
+
.table_top {
|
64
33
|
width: 20%;
|
65
34
|
font-size: 14pt;
|
35
|
+
padding: 0;
|
66
36
|
}
|
67
37
|
|
68
|
-
.
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
77
|
-
|
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
|
-
|
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:
|
93
|
-
|
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="
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
<td class="
|
117
|
-
<td class="
|
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
|
123
|
-
|
124
|
-
|
125
|
-
|
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
|
129
|
-
|
130
|
-
|
131
|
-
|
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
|
135
|
-
|
136
|
-
|
137
|
-
|
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
|
141
|
-
|
142
|
-
|
143
|
-
|
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
|
147
|
-
|
148
|
-
|
149
|
-
|
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
|
153
|
-
|
154
|
-
|
155
|
-
|
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
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
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
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
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="
|
186
|
-
|
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="
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
<
|
212
|
-
<%
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
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
|
-
</
|
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="
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
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
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
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="
|
286
|
-
|
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
|
-
</
|
312
|
-
</
|
313
|
-
<% i+=1 %>
|
193
|
+
</td>
|
194
|
+
</tr>
|
314
195
|
<% end %>
|
315
|
-
</
|
196
|
+
</table>
|
316
197
|
</div>
|
317
|
-
<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
|
320
|
-
|
321
|
-
|
322
|
-
|
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="
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
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
|
-
<%
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
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
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
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
|
-
|
352
|
-
|
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
|
-
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
<br style="clear:both">
|
302
|
+
<% index += 1 %>
|
303
|
+
<% end %>
|
304
|
+
</div>
|
305
|
+
<br style="clear:both">
|
360
306
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
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
|
-
|
392
|
-
|
393
|
-
|
349
|
+
</div>
|
350
|
+
<% index += 1 %>
|
351
|
+
<% end %>
|
394
352
|
</div>
|
395
|
-
|
353
|
+
<br style="clear:both">
|