kevinrutherford-reek 0.3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +92 -0
- data/README.txt +6 -0
- data/Rakefile +7 -0
- data/bin/reek +19 -0
- data/lib/reek/block_context.rb +37 -0
- data/lib/reek/class_context.rb +73 -0
- data/lib/reek/code_context.rb +47 -0
- data/lib/reek/code_parser.rb +204 -0
- data/lib/reek/exceptions.reek +13 -0
- data/lib/reek/if_context.rb +25 -0
- data/lib/reek/method_context.rb +85 -0
- data/lib/reek/module_context.rb +34 -0
- data/lib/reek/name.rb +42 -0
- data/lib/reek/object_refs.rb +53 -0
- data/lib/reek/options.rb +92 -0
- data/lib/reek/rake_task.rb +121 -0
- data/lib/reek/report.rb +42 -0
- data/lib/reek/sexp_formatter.rb +52 -0
- data/lib/reek/singleton_method_context.rb +27 -0
- data/lib/reek/smell_warning.rb +49 -0
- data/lib/reek/smells/control_couple.rb +61 -0
- data/lib/reek/smells/duplication.rb +50 -0
- data/lib/reek/smells/feature_envy.rb +58 -0
- data/lib/reek/smells/large_class.rb +50 -0
- data/lib/reek/smells/long_method.rb +43 -0
- data/lib/reek/smells/long_parameter_list.rb +43 -0
- data/lib/reek/smells/long_yield_list.rb +18 -0
- data/lib/reek/smells/nested_iterators.rb +28 -0
- data/lib/reek/smells/smell_detector.rb +66 -0
- data/lib/reek/smells/smells.rb +85 -0
- data/lib/reek/smells/uncommunicative_name.rb +80 -0
- data/lib/reek/smells/utility_function.rb +34 -0
- data/lib/reek/source.rb +116 -0
- data/lib/reek/spec.rb +130 -0
- data/lib/reek/stop_context.rb +62 -0
- data/lib/reek/yield_call_context.rb +14 -0
- data/lib/reek.rb +8 -0
- data/spec/integration/reek_source_spec.rb +20 -0
- data/spec/integration/script_spec.rb +55 -0
- data/spec/reek/class_context_spec.rb +198 -0
- data/spec/reek/code_context_spec.rb +92 -0
- data/spec/reek/code_parser_spec.rb +44 -0
- data/spec/reek/config_spec.rb +42 -0
- data/spec/reek/module_context_spec.rb +38 -0
- data/spec/reek/object_refs_spec.rb +129 -0
- data/spec/reek/options_spec.rb +13 -0
- data/spec/reek/report_spec.rb +48 -0
- data/spec/reek/sexp_formatter_spec.rb +31 -0
- data/spec/reek/singleton_method_context_spec.rb +17 -0
- data/spec/reek/smells/control_couple_spec.rb +23 -0
- data/spec/reek/smells/duplication_spec.rb +81 -0
- data/spec/reek/smells/feature_envy_spec.rb +129 -0
- data/spec/reek/smells/large_class_spec.rb +86 -0
- data/spec/reek/smells/long_method_spec.rb +59 -0
- data/spec/reek/smells/long_parameter_list_spec.rb +92 -0
- data/spec/reek/smells/nested_iterators_spec.rb +33 -0
- data/spec/reek/smells/smell_spec.rb +24 -0
- data/spec/reek/smells/uncommunicative_name_spec.rb +118 -0
- data/spec/reek/smells/utility_function_spec.rb +96 -0
- data/spec/samples/inline.rb +704 -0
- data/spec/samples/inline_spec.rb +40 -0
- data/spec/samples/optparse.rb +1788 -0
- data/spec/samples/optparse_spec.rb +100 -0
- data/spec/samples/redcloth.rb +1130 -0
- data/spec/samples/redcloth_spec.rb +93 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +15 -0
- data/tasks/reek.rake +20 -0
- data/tasks/rspec.rake +22 -0
- metadata +167 -0
@@ -0,0 +1,100 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'sample gem source code' do
|
4
|
+
it "reports the correct smells in optparse.rb" do
|
5
|
+
ruby = File.new('spec/samples/optparse.rb').to_source
|
6
|
+
ruby.should reek_of(:ControlCouple, /OptionParser#List#accept/, /pat/)
|
7
|
+
ruby.should reek_of(:ControlCouple, /OptionParser#List#update/, /lopts/)
|
8
|
+
ruby.should reek_of(:ControlCouple, /OptionParser#List#update/, /sopts/)
|
9
|
+
ruby.should reek_of(:ControlCouple, /OptionParser#ParseError#set_option/, /eq/)
|
10
|
+
ruby.should reek_of(:ControlCouple, /OptionParser#Switch#NoArgument#parse/, /arg/)
|
11
|
+
ruby.should reek_of(:ControlCouple, /OptionParser#Switch#OptionalArgument#parse/, /arg/)
|
12
|
+
ruby.should reek_of(:ControlCouple, /OptionParser#Switch#RequiredArgument#parse/, /arg/)
|
13
|
+
ruby.should reek_of(:ControlCouple, /OptionParser#parse_in_order/, /setter/)
|
14
|
+
ruby.should reek_of(:Duplication, /OptionParser#Completion::complete/, /candidates.size/)
|
15
|
+
ruby.should reek_of(:Duplication, /OptionParser#Completion::complete/, /k.id2name/)
|
16
|
+
ruby.should reek_of(:Duplication, /OptionParser#Switch#parse_arg/, /s.length/)
|
17
|
+
ruby.should reek_of(:Duplication, /OptionParser#Switch#summarize/, /block.max/)
|
18
|
+
ruby.should reek_of(:Duplication, /OptionParser#Switch#summarize/, /block.max.to_i/)
|
19
|
+
ruby.should reek_of(:Duplication, /OptionParser#Switch#summarize/, /indent.+\(l\)/)
|
20
|
+
ruby.should reek_of(:Duplication, /OptionParser#Switch#summarize/, /left.collect/)
|
21
|
+
ruby.should reek_of(:Duplication, /OptionParser#Switch#summarize/, /left.shift/)
|
22
|
+
ruby.should reek_of(:Duplication, /OptionParser#Switch#summarize/, /left\[-1\]/)
|
23
|
+
ruby.should reek_of(:Duplication, /OptionParser#Switch#summarize/, /s.length/)
|
24
|
+
ruby.should reek_of(:Duplication, /OptionParser#make_switch/, /default_style.guess\(arg=a\)/)
|
25
|
+
ruby.should reek_of(:Duplication, /OptionParser#make_switch/, /long.<<\(o=q.downcase\)/)
|
26
|
+
ruby.should reek_of(:Duplication, /OptionParser#make_switch/, /pattern.method\(convert\)/)
|
27
|
+
ruby.should reek_of(:Duplication, /OptionParser#make_switch/, /pattern.method\(convert\).to_proc/)
|
28
|
+
ruby.should reek_of(:Duplication, /OptionParser#make_switch/, /pattern.respond_to\?\(convert\)/)
|
29
|
+
ruby.should reek_of(:Duplication, /OptionParser#make_switch/, /q.downcase/)
|
30
|
+
ruby.should reek_of(:Duplication, /OptionParser#make_switch/, /sdesc.<<\("-\#\{q\}"\)/)
|
31
|
+
ruby.should reek_of(:Duplication, /OptionParser#order/, /argv\[0\]/)
|
32
|
+
ruby.should reek_of(:Duplication, /OptionParser#parse/, /argv\[0\]/)
|
33
|
+
ruby.should reek_of(:Duplication, /OptionParser#parse_in_order/, /\$\!.set_option\(arg, true\)/)
|
34
|
+
ruby.should reek_of(:Duplication, /OptionParser#parse_in_order/, /cb.call\(val\)/)
|
35
|
+
ruby.should reek_of(:Duplication, /OptionParser#parse_in_order/, /setter.call\(sw.switch_name, val\)/)
|
36
|
+
ruby.should reek_of(:Duplication, /OptionParser#parse_in_order/, /sw.block/)
|
37
|
+
ruby.should reek_of(:Duplication, /OptionParser#parse_in_order/, /sw.switch_name/)
|
38
|
+
ruby.should reek_of(:Duplication, /OptionParser#permute/, /argv\[0\]/)
|
39
|
+
ruby.should reek_of(:FeatureEnvy, /OptionParser#Completion::complete/, /candidates/)
|
40
|
+
ruby.should reek_of(:FeatureEnvy, /OptionParser#List#accept/, /pat/)
|
41
|
+
ruby.should reek_of(:FeatureEnvy, /OptionParser#Switch#summarize/, /left/)
|
42
|
+
ruby.should reek_of(:FeatureEnvy, /OptionParser#order/, /argv/)
|
43
|
+
ruby.should reek_of(:FeatureEnvy, /OptionParser#parse/, /argv/)
|
44
|
+
ruby.should reek_of(:FeatureEnvy, /OptionParser#permute/, /argv/)
|
45
|
+
ruby.should reek_of(:LargeClass, /OptionParser/)
|
46
|
+
ruby.should reek_of(:LongMethod, /OptionParser#Completion::complete/)
|
47
|
+
ruby.should reek_of(:LongMethod, /OptionParser#List#update/)
|
48
|
+
ruby.should reek_of(:LongMethod, /OptionParser#Switch#PlacedArgument#parse/)
|
49
|
+
ruby.should reek_of(:LongMethod, /OptionParser#Switch#parse_arg/)
|
50
|
+
ruby.should reek_of(:LongMethod, /OptionParser#Switch#summarize/)
|
51
|
+
ruby.should reek_of(:LongMethod, /OptionParser#getopts/)
|
52
|
+
ruby.should reek_of(:LongMethod, /OptionParser#make_switch/)
|
53
|
+
ruby.should reek_of(:LongMethod, /OptionParser#parse_in_order/)
|
54
|
+
ruby.should reek_of(:LongParameterList, /OptionParser#List#complete/)
|
55
|
+
ruby.should reek_of(:LongParameterList, /OptionParser#List#update/)
|
56
|
+
ruby.should reek_of(:LongParameterList, /OptionParser#Switch#initialize/)
|
57
|
+
ruby.should reek_of(:LongParameterList, /OptionParser#Switch#summarize/)
|
58
|
+
ruby.should reek_of(:LongParameterList, /OptionParser#complete/)
|
59
|
+
ruby.should reek_of(:LongParameterList, /OptionParser#summarize/)
|
60
|
+
ruby.should reek_of(:NestedIterators, /OptionParser#CompletingHash#match/)
|
61
|
+
ruby.should reek_of(:NestedIterators, /OptionParser#Switch#summarize/)
|
62
|
+
ruby.should reek_of(:NestedIterators, /OptionParser#block/)
|
63
|
+
ruby.should reek_of(:NestedIterators, /OptionParser#complete/)
|
64
|
+
ruby.should reek_of(:NestedIterators, /OptionParser#make_switch/)
|
65
|
+
ruby.should reek_of(:NestedIterators, /OptionParser#make_switch/)
|
66
|
+
ruby.should reek_of(:NestedIterators, /OptionParser#parse_in_order/)
|
67
|
+
ruby.should reek_of(:NestedIterators, /OptionParser#parse_in_order/)
|
68
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Completion::complete/, /'k'/)
|
69
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Completion::complete/, /'v'/)
|
70
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#List#accept/, /'t'/)
|
71
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#List#reject/, /'t'/)
|
72
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#List#update/, /'o'/)
|
73
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Switch#add_banner/, /'s'/)
|
74
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Switch#parse_arg/, /'m'/)
|
75
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Switch#parse_arg/, /'s'/)
|
76
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Switch#self.guess/, /'t'/)
|
77
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Switch#self.incompatible_argument_styles/, /'t'/)
|
78
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Switch#summarize/, /'l'/)
|
79
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Switch#summarize/, /'r'/)
|
80
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#Switch#summarize/, /'s'/)
|
81
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#block/, /'f'/)
|
82
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#block/, /'k'/)
|
83
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#block/, /'o'/)
|
84
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#block/, /'s'/)
|
85
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#block/, /'v'/)
|
86
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#load/, /'s'/)
|
87
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#make_switch/, /'a'/)
|
88
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#make_switch/, /'n'/)
|
89
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#make_switch/, /'o'/)
|
90
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#make_switch/, /'q'/)
|
91
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#make_switch/, /'s'/)
|
92
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#make_switch/, /'c'/)
|
93
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#make_switch/, /'v'/)
|
94
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#search/, /'k'/)
|
95
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#summarize/, /'l'/)
|
96
|
+
ruby.should reek_of(:UncommunicativeName, /OptionParser#ver/, /'v'/)
|
97
|
+
ruby.should reek_of(:UncommunicativeName, /block/, /'q'/)
|
98
|
+
ruby.report.length.should == 92
|
99
|
+
end
|
100
|
+
end
|