forked from troessner/reek
/
samples.feature
272 lines (268 loc) · 23.2 KB
/
samples.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
@samples
Feature: Basic smell detection
In order to write better software
As a developer
I want to detect the smells in my Ruby code
@inline
Scenario: Correct smells from inline.rb
When I run reek spec/samples/inline.rb
Then the exit status indicates smells
And it reports something like: spec/samples/inline.rb -- 41 warnings:
And it reports something like: File has no descriptive comment (IrresponsibleModule)
And it reports something like: Inline declares the class variable @@directory (ClassVariable)
And it reports something like: Inline declares the class variable @@rootdir (ClassVariable)
And it reports something like: Inline#self.rootdir calls env.nil? twice (Duplication)
And it reports something like: Inline#self.rootdir has approx 8 statements (LongMethod)
And it reports something like: Inline::C declares the class variable @@type_map (ClassVariable)
And it reports something like: Inline::C has at least 13 instance variables (LargeClass)
And it reports something like: Inline::C takes parameters [options, src] to 5 methods (DataClump)
And it reports something like: Inline::C tests $DEBUG at least 7 times (SimulatedPolymorphism)
And it reports something like: Inline::C tests $TESTING at least 4 times (SimulatedPolymorphism)
And it reports something like: Inline::C tests @@type_map.has_key?(type) at least 3 times (SimulatedPolymorphism)
And it reports something like: Inline::C#build calls ($? == 0) twice (Duplication)
And it reports something like: Inline::C#build calls Inline.directory 5 times (Duplication)
And it reports something like: Inline::C#build calls io.puts 6 times (Duplication)
And it reports something like: Inline::C#build calls io.puts("#endif") twice (Duplication)
And it reports something like: Inline::C#build calls io.puts("#ifdef __cplusplus") twice (Duplication)
And it reports something like: Inline::C#build calls module_name twice (Duplication)
And it reports something like (pending): Inline::C#build calls warn("Output:\n#{result}") twice (Duplication)
And it reports something like: Inline::C#build contains iterators nested 2 deep (NestedIterators)
And it reports something like: Inline::C#build has approx 60 statements (LongMethod)
And it reports something like: Inline::C#build has the variable name 'n' (UncommunicativeName)
And it reports something like: Inline::C#build has the variable name 't' (UncommunicativeName)
And it reports something like: Inline::C#c has the name 'c' (UncommunicativeName)
And it reports something like: Inline::C#crap_for_windoze calls Config::CONFIG["libdir"] twice (Duplication)
And it reports something like: Inline::C#generate calls result.sub!(/\A\n/, "") twice (Duplication)
And it reports something like: Inline::C#generate calls signature["args"] twice (Duplication)
And it reports something like: Inline::C#generate calls signature["args"].map twice (Duplication)
And it reports something like: Inline::C#generate has approx 32 statements (LongMethod)
And it reports something like: Inline::C#initialize calls stack.empty? twice (Duplication)
And it reports something like: Inline::C#load calls so_name twice (Duplication)
And it reports something like: Inline::C#module_name has the variable name 'm' (UncommunicativeName)
And it reports something like: Inline::C#module_name has the variable name 'x' (UncommunicativeName)
And it reports something like: Inline::C#parse_signature has approx 15 statements (LongMethod)
And it reports something like: Inline::C#parse_signature has boolean parameter 'raw' (ControlCouple)
And it reports something like: Inline::C#parse_signature has the variable name 'x' (UncommunicativeName)
And it reports something like: Inline::C#parse_signature is controlled by argument raw (ControlCouple)
And it reports something like: Inline::C#strip_comments doesn't depend on instance state (LowCohesion)
And it reports something like: Inline::C#strip_comments refers to src more than self (LowCohesion)
And it reports something like: Module#inline calls Inline.const_get(lang) twice (Duplication)
And it reports something like: Module#inline has approx 11 statements (LongMethod)
And it reports something like: Module#inline is controlled by argument options (ControlCouple)
Scenario: Correct smells from optparse.rb
When I run reek spec/samples/optparse.rb
Then the exit status indicates smells
And it reports something like: spec/samples/optparse.rb -- 109 warnings:
And it reports something like: OptionParser has at least 42 methods (LargeClass)
And it reports something like: OptionParser has the variable name 'f' (UncommunicativeName)
And it reports something like: OptionParser has the variable name 'k' (UncommunicativeName)
And it reports something like: OptionParser has the variable name 'o' (UncommunicativeName)
And it reports something like: OptionParser has the variable name 's' (UncommunicativeName)
And it reports something like: OptionParser has the variable name 'v' (UncommunicativeName)
And it reports something like: OptionParser tests ((argv.size == 1) and Array.===(argv[0])) at least 3 times (SimulatedPolymorphism)
And it reports something like: OptionParser tests a at least 7 times (SimulatedPolymorphism)
And it reports something like: OptionParser tests default_pattern at least 7 times (SimulatedPolymorphism)
And it reports something like: OptionParser tests not_style at least 3 times (SimulatedPolymorphism)
And it reports something like: OptionParser tests s at least 7 times (SimulatedPolymorphism)
And it reports something like: OptionParser#complete contains iterators nested 2 deep (NestedIterators)
And it reports something like: OptionParser#complete has 4 parameters (LongParameterList)
And it reports something like: OptionParser#complete has boolean parameter 'icase' (ControlCouple)
And it reports something like: OptionParser#getopts calls result[opt] = false twice (Duplication)
And it reports something like: OptionParser#getopts has approx 17 statements (LongMethod)
And it reports something like: OptionParser#load has the variable name 's' (UncommunicativeName)
And it reports something like: OptionParser#make_switch calls (long << o = q.downcase) twice (Duplication)
And it reports something like (pending): OptionParser#make_switch calls (sdesc << "-#{q}") twice (Duplication)
And it reports something like: OptionParser#make_switch calls default_style.guess(arg = a) 4 times (Duplication)
And it reports something like: OptionParser#make_switch calls notwice(NilClass, klass, "type") twice (Duplication)
And it reports something like: OptionParser#make_switch calls notwice(a ? (Object) : (TrueClass), klass, "type") twice (Duplication)
And it reports something like: OptionParser#make_switch calls pattern.method(:convert) twice (Duplication)
And it reports something like: OptionParser#make_switch calls pattern.method(:convert).to_proc twice (Duplication)
And it reports something like: OptionParser#make_switch calls pattern.respond_to?(:convert) twice (Duplication)
And it reports something like: OptionParser#make_switch calls q.downcase 3 times (Duplication)
And it reports something like: OptionParser#make_switch calls search(:atype, FalseClass) twice (Duplication)
And it reports something like: OptionParser#make_switch calls search(:atype, o) 6 times (Duplication)
And it reports something like: OptionParser#make_switch contains iterators nested 2 deep (NestedIterators)
And it reports something like: OptionParser#make_switch contains iterators nested 3 deep (NestedIterators)
And it reports something like: OptionParser#make_switch has approx 68 statements (LongMethod)
And it reports something like: OptionParser#make_switch has the variable name 'a' (UncommunicativeName)
And it reports something like: OptionParser#make_switch has the variable name 'c' (UncommunicativeName)
And it reports something like: OptionParser#make_switch has the variable name 'n' (UncommunicativeName)
And it reports something like: OptionParser#make_switch has the variable name 'o' (UncommunicativeName)
And it reports something like: OptionParser#make_switch has the variable name 'q' (UncommunicativeName)
And it reports something like: OptionParser#make_switch has the variable name 's' (UncommunicativeName)
And it reports something like: OptionParser#make_switch has the variable name 'v' (UncommunicativeName)
And it reports something like: OptionParser#order calls argv[0] twice (Duplication)
And it reports something like: OptionParser#order refers to argv more than self (LowCohesion)
And it reports something like: OptionParser#parse calls argv[0] twice (Duplication)
And it reports something like: OptionParser#parse refers to argv more than self (LowCohesion)
And it reports something like: OptionParser#parse_in_order calls $!.set_option(arg, true) twice (Duplication)
And it reports something like: OptionParser#parse_in_order calls cb.call(val) twice (Duplication)
And it reports something like: OptionParser#parse_in_order calls raise($!.set_option(arg, true)) twice (Duplication)
And it reports something like: OptionParser#parse_in_order calls raise(*exc) twice (Duplication)
And it reports something like: OptionParser#parse_in_order calls setter.call(sw.switch_name, val) twice (Duplication)
And it reports something like: OptionParser#parse_in_order calls sw.block twice (Duplication)
And it reports something like: OptionParser#parse_in_order calls sw.switch_name twice (Duplication)
And it reports something like: OptionParser#parse_in_order contains iterators nested 2 deep (NestedIterators)
And it reports something like: OptionParser#parse_in_order contains iterators nested 3 deep (NestedIterators)
And it reports something like: OptionParser#parse_in_order has approx 28 statements (LongMethod)
And it reports something like: OptionParser#parse_in_order is controlled by argument setter (ControlCouple)
And it reports something like: OptionParser#permute calls argv[0] twice (Duplication)
And it reports something like: OptionParser#permute refers to argv more than self (LowCohesion)
And it reports something like: OptionParser#search has the variable name 'k' (UncommunicativeName)
And it reports something like: OptionParser#summarize has 4 parameters (LongParameterList)
And it reports something like: OptionParser#summarize has the variable name 'l' (UncommunicativeName)
And it reports something like: OptionParser#ver has the variable name 'v' (UncommunicativeName)
And it reports something like: OptionParser::CompletingHash#match contains iterators nested 2 deep (NestedIterators)
And it reports something like: OptionParser::Completion#complete calls candidates.size twice (Duplication)
And it reports something like: OptionParser::Completion#complete calls k.id2name twice (Duplication)
And it reports something like: OptionParser::Completion#complete has approx 22 statements (LongMethod)
And it reports something like: OptionParser::Completion#complete has boolean parameter 'icase' (ControlCouple)
And it reports something like: OptionParser::Completion#complete has the variable name 'k' (UncommunicativeName)
And it reports something like: OptionParser::Completion#complete has the variable name 'v' (UncommunicativeName)
And it reports something like: OptionParser::Completion#complete refers to candidates more than self (LowCohesion)
And it reports something like: OptionParser::List#accept has the parameter name 't' (UncommunicativeName)
And it reports something like: OptionParser::List#accept is controlled by argument pat (ControlCouple)
And it reports something like: OptionParser::List#accept refers to pat more than self (LowCohesion)
And it reports something like: OptionParser::List#add_banner refers to opt more than self (LowCohesion)
And it reports something like: OptionParser::List#complete has 4 parameters (LongParameterList)
And it reports something like: OptionParser::List#complete has boolean parameter 'icase' (ControlCouple)
And it reports something like: OptionParser::List#reject has the parameter name 't' (UncommunicativeName)
And it reports something like: OptionParser::List#summarize refers to opt more than self (LowCohesion)
And it reports something like: OptionParser::List#update has 5 parameters (LongParameterList)
And it reports something like: OptionParser::List#update has approx 6 statements (LongMethod)
And it reports something like: OptionParser::List#update has the variable name 'o' (UncommunicativeName)
And it reports something like: OptionParser::List#update is controlled by argument lopts (ControlCouple)
And it reports something like: OptionParser::List#update is controlled by argument sopts (ControlCouple)
And it reports something like: OptionParser::ParseError#set_option is controlled by argument eq (ControlCouple)
And it reports something like: OptionParser::Switch#add_banner has the variable name 's' (UncommunicativeName)
And it reports something like: OptionParser::Switch#conv_arg calls conv twice (Duplication)
And it reports something like: OptionParser::Switch#initialize has 7 parameters (LongParameterList)
And it reports something like: OptionParser::Switch#parse_arg calls pattern twice (Duplication)
And it reports something like: OptionParser::Switch#parse_arg calls s.length twice (Duplication)
And it reports something like: OptionParser::Switch#parse_arg has approx 11 statements (LongMethod)
And it reports something like: OptionParser::Switch#parse_arg has the variable name 'm' (UncommunicativeName)
And it reports something like: OptionParser::Switch#parse_arg has the variable name 's' (UncommunicativeName)
And it reports something like: OptionParser::Switch#self.guess has the variable name 't' (UncommunicativeName)
And it reports something like: OptionParser::Switch#self.incompatible_argument_styles has the parameter name 't' (UncommunicativeName)
And it reports something like: OptionParser::Switch#summarize calls (indent + l) twice (Duplication)
And it reports something like: OptionParser::Switch#summarize calls arg 4 times (Duplication)
And it reports something like: OptionParser::Switch#summarize calls left.collect twice (Duplication)
And it reports something like: OptionParser::Switch#summarize calls left.collect { |s| s.length }.max twice (Duplication)
And it reports something like: OptionParser::Switch#summarize calls left.collect { |s| s.length }.max.to_i twice (Duplication)
And it reports something like: OptionParser::Switch#summarize calls left.shift twice (Duplication)
And it reports something like: OptionParser::Switch#summarize calls left[-1] 3 times (Duplication)
And it reports something like: OptionParser::Switch#summarize calls s.length 3 times (Duplication)
And it reports something like: OptionParser::Switch#summarize contains iterators nested 2 deep (NestedIterators)
And it reports something like: OptionParser::Switch#summarize has 5 parameters (LongParameterList)
And it reports something like: OptionParser::Switch#summarize has approx 25 statements (LongMethod)
And it reports something like: OptionParser::Switch#summarize has the variable name 'l' (UncommunicativeName)
And it reports something like: OptionParser::Switch#summarize has the variable name 'r' (UncommunicativeName)
And it reports something like: OptionParser::Switch#summarize has the variable name 's' (UncommunicativeName)
And it reports something like: OptionParser::Switch::NoArgument#parse is controlled by argument arg (ControlCouple)
And it reports something like: OptionParser::Switch::OptionalArgument#parse is controlled by argument arg (ControlCouple)
And it reports something like: OptionParser::Switch::PlacedArgument#parse has approx 6 statements (LongMethod)
And it reports something like: OptionParser::Switch::RequiredArgument#parse is controlled by argument arg (ControlCouple)
Scenario: Correct smells from redcloth.rb
When I run reek spec/samples/redcloth.rb
Then the exit status indicates smells
And it reports:
"""
spec/samples/redcloth.rb -- 97 warnings:
RedCloth has at least 44 methods (LargeClass)
RedCloth has the variable name 'a' (UncommunicativeName)
RedCloth has the variable name 'b' (UncommunicativeName)
RedCloth takes parameters [atts, cite, content, tag] to 3 methods (DataClump)
RedCloth tests atts at least 6 times (SimulatedPolymorphism)
RedCloth tests codepre.zero? at least 3 times (SimulatedPolymorphism)
RedCloth tests href at least 3 times (SimulatedPolymorphism)
RedCloth tests title at least 4 times (SimulatedPolymorphism)
RedCloth#block_markdown_atx refers to text more than self (LowCohesion)
RedCloth#block_markdown_bq has approx 6 statements (LongMethod)
RedCloth#block_markdown_rule refers to text more than self (LowCohesion)
RedCloth#block_markdown_setext refers to text more than self (LowCohesion)
RedCloth#block_textile_lists calls (line_id - 1) twice (Duplication)
RedCloth#block_textile_lists calls depth.last 5 times (Duplication)
RedCloth#block_textile_lists calls depth.last.length twice (Duplication)
RedCloth#block_textile_lists calls depth[i] twice (Duplication)
RedCloth#block_textile_lists calls lines[(line_id - 1)] twice (Duplication)
RedCloth#block_textile_lists calls tl.length 3 times (Duplication)
RedCloth#block_textile_lists contains iterators nested 3 deep (NestedIterators)
RedCloth#block_textile_lists has approx 20 statements (LongMethod)
RedCloth#block_textile_lists has the variable name 'i' (UncommunicativeName)
RedCloth#block_textile_lists has the variable name 'v' (UncommunicativeName)
RedCloth#block_textile_lists refers to depth more than self (LowCohesion)
RedCloth#block_textile_table contains iterators nested 2 deep (NestedIterators)
RedCloth#block_textile_table contains iterators nested 3 deep (NestedIterators)
RedCloth#block_textile_table has approx 18 statements (LongMethod)
RedCloth#block_textile_table has the variable name 'x' (UncommunicativeName)
RedCloth#blocks contains iterators nested 2 deep (NestedIterators)
RedCloth#blocks has approx 18 statements (LongMethod)
RedCloth#blocks has boolean parameter 'deep_code' (ControlCouple)
RedCloth#blocks is controlled by argument deep_code (ControlCouple)
RedCloth#check_refs is controlled by argument text (ControlCouple)
RedCloth#clean_html calls tags[tag] twice (Duplication)
RedCloth#clean_html contains iterators nested 3 deep (NestedIterators)
RedCloth#clean_html doesn't depend on instance state (LowCohesion)
RedCloth#clean_html has approx 14 statements (LongMethod)
RedCloth#clean_html has the variable name 'q' (UncommunicativeName)
RedCloth#clean_html has the variable name 'q2' (UncommunicativeName)
RedCloth#clean_html refers to raw more than self (LowCohesion)
RedCloth#clean_html refers to tags more than self (LowCohesion)
RedCloth#clean_white_space has approx 7 statements (LongMethod)
RedCloth#clean_white_space refers to text more than self (LowCohesion)
RedCloth#flush_left doesn't depend on instance state (LowCohesion)
RedCloth#flush_left refers to indt more than self (LowCohesion)
RedCloth#flush_left refers to text more than self (LowCohesion)
RedCloth#footnote_ref refers to text more than self (LowCohesion)
RedCloth#glyphs_textile has approx 10 statements (LongMethod)
RedCloth#htmlesc doesn't depend on instance state (LowCohesion)
RedCloth#htmlesc refers to str more than self (LowCohesion)
RedCloth#incoming_entities refers to text more than self (LowCohesion)
RedCloth#initialize has the variable name 'r' (UncommunicativeName)
RedCloth#inline contains iterators nested 2 deep (NestedIterators)
RedCloth#inline_markdown_link has approx 6 statements (LongMethod)
RedCloth#inline_markdown_link has the variable name 'm' (UncommunicativeName)
RedCloth#inline_markdown_reflink has approx 8 statements (LongMethod)
RedCloth#inline_markdown_reflink has the variable name 'm' (UncommunicativeName)
RedCloth#inline_textile_code has the variable name 'm' (UncommunicativeName)
RedCloth#inline_textile_image has approx 17 statements (LongMethod)
RedCloth#inline_textile_image has the variable name 'href_a1' (UncommunicativeName)
RedCloth#inline_textile_image has the variable name 'href_a2' (UncommunicativeName)
RedCloth#inline_textile_image has the variable name 'm' (UncommunicativeName)
RedCloth#inline_textile_link has approx 9 statements (LongMethod)
RedCloth#inline_textile_link has the variable name 'm' (UncommunicativeName)
RedCloth#inline_textile_span contains iterators nested 2 deep (NestedIterators)
RedCloth#inline_textile_span has approx 8 statements (LongMethod)
RedCloth#inline_textile_span has the variable name 'm' (UncommunicativeName)
RedCloth#lT has the name 'lT' (UncommunicativeName)
RedCloth#no_textile doesn't depend on instance state (LowCohesion)
RedCloth#no_textile refers to text more than self (LowCohesion)
RedCloth#pba calls $1.length twice (Duplication)
RedCloth#pba has approx 21 statements (LongMethod)
RedCloth#pba is controlled by argument text_in (ControlCouple)
RedCloth#pba refers to style more than self (LowCohesion)
RedCloth#pba refers to text more than self (LowCohesion)
RedCloth#refs_markdown has the variable name 'm' (UncommunicativeName)
RedCloth#refs_textile has the variable name 'm' (UncommunicativeName)
RedCloth#retrieve has the variable name 'i' (UncommunicativeName)
RedCloth#retrieve has the variable name 'r' (UncommunicativeName)
RedCloth#rip_offtags calls ((codepre - used_offtags.length) > 0) twice (Duplication)
RedCloth#rip_offtags calls (@pre_list.last << line) twice (Duplication)
RedCloth#rip_offtags calls (codepre - used_offtags.length) twice (Duplication)
RedCloth#rip_offtags calls @pre_list.last twice (Duplication)
RedCloth#rip_offtags calls codepre.zero? twice (Duplication)
RedCloth#rip_offtags calls htmlesc(line, :NoQuotes) twice (Duplication)
RedCloth#rip_offtags calls used_offtags.length twice (Duplication)
RedCloth#rip_offtags calls used_offtags["notextile"] 3 times (Duplication)
RedCloth#rip_offtags has approx 18 statements (LongMethod)
RedCloth#textile_bq has 4 parameters (LongParameterList)
RedCloth#textile_bq is controlled by argument atts (ControlCouple)
RedCloth#textile_bq is controlled by argument cite (ControlCouple)
RedCloth#textile_fn_ has 5 parameters (LongParameterList)
RedCloth#textile_fn_ is controlled by argument atts (ControlCouple)
RedCloth#textile_p has 4 parameters (LongParameterList)
RedCloth#textile_p is controlled by argument atts (ControlCouple)
RedCloth#textile_popup_help has the parameter name 'windowH' (UncommunicativeName)
RedCloth#textile_popup_help has the parameter name 'windowW' (UncommunicativeName)
RedCloth#to_html has approx 24 statements (LongMethod)
"""