kevinrutherford-reek 1.1.3.9 → 1.1.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -1
- data/License.txt +20 -0
- data/bin/reek +5 -5
- data/features/options.feature +1 -0
- data/features/reports.feature +40 -0
- data/features/stdin.feature +10 -1
- data/features/step_definitions/reek_steps.rb +2 -2
- data/features/support/env.rb +2 -2
- data/lib/reek/class_context.rb +2 -2
- data/lib/reek/code_parser.rb +4 -0
- data/lib/reek/core_extras.rb +50 -0
- data/lib/reek/object_source.rb +7 -18
- data/lib/reek/options.rb +13 -3
- data/lib/reek/report.rb +27 -28
- data/lib/reek/sexp_formatter.rb +2 -0
- data/lib/reek/smells/control_couple.rb +5 -0
- data/lib/reek/sniffer.rb +98 -3
- data/lib/reek/source.rb +9 -112
- data/lib/reek/spec.rb +29 -55
- data/lib/reek.rb +1 -1
- data/reek.gemspec +4 -4
- data/spec/reek/object_source_spec.rb +3 -3
- data/spec/reek/report_spec.rb +9 -5
- data/spec/reek/should_reek_of_spec.rb +105 -0
- data/spec/reek/should_reek_only_of_spec.rb +85 -0
- data/spec/reek/{spec_spec.rb → should_reek_spec.rb} +24 -3
- data/spec/reek/smells/duplication_spec.rb +1 -1
- data/spec/reek/smells/large_class_spec.rb +1 -0
- data/spec/reek/smells/long_method_spec.rb +4 -4
- data/spec/reek/smells/long_parameter_list_spec.rb +1 -1
- data/spec/reek/smells/smell_detector_spec.rb +1 -1
- data/spec/reek/smells/uncommunicative_name_spec.rb +2 -1
- data/spec/reek/sniffer_spec.rb +10 -0
- data/spec/samples/all_but_one_masked/clean_one.rb +6 -0
- data/spec/samples/all_but_one_masked/dirty.rb +7 -0
- data/spec/samples/all_but_one_masked/masked.reek +5 -0
- data/spec/samples/clean_due_to_masking/clean_one.rb +6 -0
- data/spec/samples/clean_due_to_masking/clean_three.rb +6 -0
- data/spec/samples/clean_due_to_masking/clean_two.rb +6 -0
- data/spec/samples/clean_due_to_masking/dirty_one.rb +7 -0
- data/spec/samples/clean_due_to_masking/dirty_two.rb +7 -0
- data/spec/samples/clean_due_to_masking/masked.reek +7 -0
- data/spec/samples/mixed_results/clean_one.rb +6 -0
- data/spec/samples/mixed_results/clean_three.rb +6 -0
- data/spec/samples/mixed_results/clean_two.rb +6 -0
- data/spec/samples/mixed_results/dirty_one.rb +7 -0
- data/spec/samples/mixed_results/dirty_two.rb +7 -0
- data/spec/slow/inline_spec.rb +6 -2
- data/spec/slow/optparse_spec.rb +6 -2
- data/spec/slow/redcloth_spec.rb +6 -2
- data/tasks/test.rake +2 -0
- metadata +23 -4
- data/spec/slow/source_list_spec.rb +0 -40
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
2
|
require 'ostruct'
|
3
|
+
require 'reek/core_extras'
|
3
4
|
require 'reek/method_context'
|
4
5
|
require 'reek/smells/uncommunicative_name'
|
5
6
|
|
@@ -85,7 +86,7 @@ end
|
|
85
86
|
describe UncommunicativeName, "several names" do
|
86
87
|
|
87
88
|
it 'should report all bad names' do
|
88
|
-
ruby =
|
89
|
+
ruby = 'class Oof; def y(x) @z = x end end'.sniff
|
89
90
|
ruby.should reek_of(:UncommunicativeName, /'x'/)
|
90
91
|
ruby.should reek_of(:UncommunicativeName, /'y'/)
|
91
92
|
ruby.should reek_of(:UncommunicativeName, /'@z'/)
|
data/spec/slow/inline_spec.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
2
|
|
3
|
+
require 'reek/report'
|
4
|
+
|
5
|
+
include Reek
|
6
|
+
|
3
7
|
describe 'sample gem source code' do
|
4
8
|
it "reports the correct smells in inline.rb" do
|
5
|
-
ruby = File.new("#{SAMPLES_DIR}/inline.rb").
|
9
|
+
ruby = File.new("#{SAMPLES_DIR}/inline.rb").sniff
|
6
10
|
ruby.should reek_of(:ControlCouple, /Inline::C#parse_signature/, /raw/)
|
7
11
|
ruby.should reek_of(:ControlCouple, /Module#inline/, /options/)
|
8
12
|
ruby.should reek_of(:Duplication, /Inline::C#build/, /\(\$\?\ == 0\)/)
|
@@ -35,6 +39,6 @@ describe 'sample gem source code' do
|
|
35
39
|
ruby.should reek_of(:UncommunicativeName, /Inline::C#module_name/, /'x'/)
|
36
40
|
ruby.should reek_of(:UncommunicativeName, /Inline::C#parse_signature/, /'x'/)
|
37
41
|
ruby.should reek_of(:UtilityFunction, /Inline::C#strip_comments/)
|
38
|
-
ruby.
|
42
|
+
Report.new(ruby).length.should == 32
|
39
43
|
end
|
40
44
|
end
|
data/spec/slow/optparse_spec.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
2
|
|
3
|
+
require 'reek/report'
|
4
|
+
|
5
|
+
include Reek
|
6
|
+
|
3
7
|
describe 'sample gem source code' do
|
4
8
|
it "reports the correct smells in optparse.rb" do
|
5
|
-
ruby = File.new("#{SAMPLES_DIR}/optparse.rb").
|
9
|
+
ruby = File.new("#{SAMPLES_DIR}/optparse.rb").sniff
|
6
10
|
ruby.should reek_of(:ControlCouple, /OptionParser#List#accept/, /pat/)
|
7
11
|
ruby.should reek_of(:ControlCouple, /OptionParser#List#update/, /lopts/)
|
8
12
|
ruby.should reek_of(:ControlCouple, /OptionParser#List#update/, /sopts/)
|
@@ -103,6 +107,6 @@ describe 'sample gem source code' do
|
|
103
107
|
ruby.should reek_of(:UncommunicativeName, /OptionParser#summarize/, /'l'/)
|
104
108
|
ruby.should reek_of(:UncommunicativeName, /OptionParser#ver/, /'v'/)
|
105
109
|
ruby.should reek_of(:UncommunicativeName, /block/, /'q'/)
|
106
|
-
ruby.
|
110
|
+
Report.new(ruby).length.should == 117
|
107
111
|
end
|
108
112
|
end
|
data/spec/slow/redcloth_spec.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
2
|
|
3
|
+
require 'reek/report'
|
4
|
+
|
5
|
+
include Reek
|
6
|
+
|
3
7
|
describe 'sample gem source code' do
|
4
8
|
it "reports the correct smells in redcloth.rb" do
|
5
|
-
ruby = File.new("#{SAMPLES_DIR}/redcloth.rb").
|
9
|
+
ruby = File.new("#{SAMPLES_DIR}/redcloth.rb").sniff
|
6
10
|
ruby.should reek_of(:ControlCouple, /RedCloth#blocks\/block/, /deep_code/)
|
7
11
|
ruby.should reek_of(:ControlCouple, /RedCloth#check_refs/, /text/)
|
8
12
|
ruby.should reek_of(:ControlCouple, /RedCloth#pba/, /text_in/)
|
@@ -96,6 +100,6 @@ describe 'sample gem source code' do
|
|
96
100
|
ruby.should reek_of(:UtilityFunction, /RedCloth#incoming_entities/)
|
97
101
|
ruby.should reek_of(:UtilityFunction, /RedCloth#no_textile/)
|
98
102
|
ruby.should reek_of(:UtilityFunction, /RedCloth#v_align/)
|
99
|
-
ruby.
|
103
|
+
Report.new(ruby).length.should == 93
|
100
104
|
end
|
101
105
|
end
|
data/tasks/test.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kevinrutherford-reek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.3.
|
4
|
+
version: 1.1.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Rutherford
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-15 00:00:00 -07:00
|
13
13
|
default_executable: reek
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,9 +51,11 @@ extensions: []
|
|
51
51
|
|
52
52
|
extra_rdoc_files:
|
53
53
|
- History.txt
|
54
|
+
- License.txt
|
54
55
|
- README.txt
|
55
56
|
files:
|
56
57
|
- History.txt
|
58
|
+
- License.txt
|
57
59
|
- README.txt
|
58
60
|
- Rakefile
|
59
61
|
- bin/reek
|
@@ -72,6 +74,7 @@ files:
|
|
72
74
|
- lib/reek/code_context.rb
|
73
75
|
- lib/reek/code_parser.rb
|
74
76
|
- lib/reek/config_file.rb
|
77
|
+
- lib/reek/core_extras.rb
|
75
78
|
- lib/reek/detector_stack.rb
|
76
79
|
- lib/reek/exceptions.reek
|
77
80
|
- lib/reek/if_context.rb
|
@@ -116,6 +119,9 @@ files:
|
|
116
119
|
- spec/reek/object_source_spec.rb
|
117
120
|
- spec/reek/options_spec.rb
|
118
121
|
- spec/reek/report_spec.rb
|
122
|
+
- spec/reek/should_reek_of_spec.rb
|
123
|
+
- spec/reek/should_reek_only_of_spec.rb
|
124
|
+
- spec/reek/should_reek_spec.rb
|
119
125
|
- spec/reek/singleton_method_context_spec.rb
|
120
126
|
- spec/reek/smell_warning_spec.rb
|
121
127
|
- spec/reek/smells/control_couple_spec.rb
|
@@ -128,7 +134,16 @@ files:
|
|
128
134
|
- spec/reek/smells/smell_detector_spec.rb
|
129
135
|
- spec/reek/smells/uncommunicative_name_spec.rb
|
130
136
|
- spec/reek/smells/utility_function_spec.rb
|
131
|
-
- spec/reek/
|
137
|
+
- spec/reek/sniffer_spec.rb
|
138
|
+
- spec/samples/all_but_one_masked/clean_one.rb
|
139
|
+
- spec/samples/all_but_one_masked/dirty.rb
|
140
|
+
- spec/samples/all_but_one_masked/masked.reek
|
141
|
+
- spec/samples/clean_due_to_masking/clean_one.rb
|
142
|
+
- spec/samples/clean_due_to_masking/clean_three.rb
|
143
|
+
- spec/samples/clean_due_to_masking/clean_two.rb
|
144
|
+
- spec/samples/clean_due_to_masking/dirty_one.rb
|
145
|
+
- spec/samples/clean_due_to_masking/dirty_two.rb
|
146
|
+
- spec/samples/clean_due_to_masking/masked.reek
|
132
147
|
- spec/samples/corrupt_config_file/corrupt.reek
|
133
148
|
- spec/samples/corrupt_config_file/dirty.rb
|
134
149
|
- spec/samples/empty_config_file/dirty.rb
|
@@ -136,6 +151,11 @@ files:
|
|
136
151
|
- spec/samples/inline.rb
|
137
152
|
- spec/samples/masked/dirty.rb
|
138
153
|
- spec/samples/masked/masked.reek
|
154
|
+
- spec/samples/mixed_results/clean_one.rb
|
155
|
+
- spec/samples/mixed_results/clean_three.rb
|
156
|
+
- spec/samples/mixed_results/clean_two.rb
|
157
|
+
- spec/samples/mixed_results/dirty_one.rb
|
158
|
+
- spec/samples/mixed_results/dirty_two.rb
|
139
159
|
- spec/samples/optparse.rb
|
140
160
|
- spec/samples/redcloth.rb
|
141
161
|
- spec/samples/three_clean_files/clean_one.rb
|
@@ -147,7 +167,6 @@ files:
|
|
147
167
|
- spec/slow/optparse_spec.rb
|
148
168
|
- spec/slow/redcloth_spec.rb
|
149
169
|
- spec/slow/reek_source_spec.rb
|
150
|
-
- spec/slow/source_list_spec.rb
|
151
170
|
- spec/spec.opts
|
152
171
|
- spec/spec_helper.rb
|
153
172
|
- tasks/reek.rake
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
-
|
3
|
-
require 'reek/source'
|
4
|
-
|
5
|
-
include Reek
|
6
|
-
|
7
|
-
describe SourceList, 'from_pathlist' do
|
8
|
-
|
9
|
-
describe 'with no smells in any source' do
|
10
|
-
before :each do
|
11
|
-
@src = Dir['lib/reek/*.rb'].to_source
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'reports no smells' do
|
15
|
-
@src.report.length.should == 0
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'is empty' do
|
19
|
-
@src.report.should be_empty
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'with smells in one source' do
|
24
|
-
before :each do
|
25
|
-
@src = Source.from_pathlist(["#{SAMPLES_DIR}/inline.rb", 'lib/reek.rb'])
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'reports some smells in the samples' do
|
29
|
-
@src.report.should have_at_least(30).smells
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'is smelly' do
|
33
|
-
@src.should be_smelly
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'reports an UncommunicativeName' do
|
37
|
-
@src.report.any? {|warning| warning.report =~ /Uncommunicative Name/}.should be_true
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|