kevinrutherford-reek 1.1.3.10 → 1.1.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -1
- data/bin/reek +2 -17
- data/features/masking_smells.feature +22 -8
- data/features/options.feature +12 -5
- data/features/reports.feature +22 -12
- data/features/samples.feature +66 -66
- data/lib/reek/adapters/application.rb +47 -0
- data/lib/reek/{config_file.rb → adapters/config_file.rb} +0 -0
- data/lib/reek/adapters/core_extras.rb +72 -0
- data/lib/reek/{object_source.rb → adapters/object_source.rb} +7 -6
- data/lib/reek/{rake_task.rb → adapters/rake_task.rb} +2 -2
- data/lib/reek/adapters/report.rb +91 -0
- data/lib/reek/adapters/source.rb +49 -0
- data/lib/reek/{spec.rb → adapters/spec.rb} +20 -9
- data/lib/reek/block_context.rb +1 -1
- data/lib/reek/class_context.rb +3 -2
- data/lib/reek/code_parser.rb +4 -0
- data/lib/reek/command_line.rb +85 -0
- data/lib/reek/detector_stack.rb +23 -6
- data/lib/reek/exceptions.reek +5 -1
- data/lib/reek/smell_warning.rb +5 -1
- data/lib/reek/smells/duplication.rb +5 -3
- data/lib/reek/smells/smell_detector.rb +15 -1
- data/lib/reek/smells/uncommunicative_name.rb +1 -1
- data/lib/reek/sniffer.rb +34 -66
- data/lib/reek.rb +1 -1
- data/reek.gemspec +3 -3
- data/spec/quality/reek_source_spec.rb +15 -0
- data/spec/reek/adapters/report_spec.rb +48 -0
- data/spec/reek/{should_reek_of_spec.rb → adapters/should_reek_of_spec.rb} +14 -11
- data/spec/reek/{should_reek_only_of_spec.rb → adapters/should_reek_only_of_spec.rb} +6 -4
- data/spec/reek/{should_reek_spec.rb → adapters/should_reek_spec.rb} +13 -10
- data/spec/reek/block_context_spec.rb +6 -0
- data/spec/reek/code_parser_spec.rb +6 -1
- data/spec/reek/config_spec.rb +3 -3
- data/spec/reek/smell_warning_spec.rb +2 -1
- data/spec/reek/smells/duplication_spec.rb +1 -1
- data/spec/reek/smells/large_class_spec.rb +3 -2
- data/spec/reek/smells/long_method_spec.rb +4 -3
- data/spec/reek/smells/long_parameter_list_spec.rb +0 -2
- data/spec/reek/smells/smell_detector_spec.rb +2 -16
- data/spec/reek/smells/uncommunicative_name_spec.rb +1 -2
- data/spec/reek/smells/utility_function_spec.rb +4 -0
- data/spec/samples/not_quite_masked/dirty.rb +8 -0
- data/spec/samples/not_quite_masked/masked.reek +5 -0
- data/spec/spec_helper.rb +1 -1
- data/tasks/reek.rake +2 -2
- data/tasks/test.rake +8 -8
- metadata +18 -20
- data/features/rake_task.feature +0 -9
- data/lib/reek/core_extras.rb +0 -50
- data/lib/reek/options.rb +0 -103
- data/lib/reek/report.rb +0 -115
- data/lib/reek/source.rb +0 -36
- data/spec/reek/options_spec.rb +0 -13
- data/spec/reek/report_spec.rb +0 -49
- data/spec/slow/inline_spec.rb +0 -44
- data/spec/slow/optparse_spec.rb +0 -112
- data/spec/slow/redcloth_spec.rb +0 -105
- data/spec/slow/reek_source_spec.rb +0 -13
data/reek.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{reek}
|
5
|
-
s.version = "1.1.3.
|
5
|
+
s.version = "1.1.3.11"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Kevin Rutherford"]
|
9
|
-
s.date = %q{2009-07-
|
9
|
+
s.date = %q{2009-07-23}
|
10
10
|
s.default_executable = %q{reek}
|
11
11
|
s.description = %q{Code smell detector for Ruby}
|
12
12
|
s.email = ["kevin@rutherford-software.com"]
|
13
13
|
s.executables = ["reek"]
|
14
14
|
s.extra_rdoc_files = ["History.txt", "License.txt", "README.txt"]
|
15
|
-
s.files = ["History.txt", "License.txt", "README.txt", "Rakefile", "bin/reek", "config/defaults.reek", "features/masking_smells.feature", "features/options.feature", "features/
|
15
|
+
s.files = ["History.txt", "License.txt", "README.txt", "Rakefile", "bin/reek", "config/defaults.reek", "features/masking_smells.feature", "features/options.feature", "features/reports.feature", "features/samples.feature", "features/stdin.feature", "features/step_definitions/reek_steps.rb", "features/support/env.rb", "lib/reek.rb", "lib/reek/adapters/application.rb", "lib/reek/adapters/config_file.rb", "lib/reek/adapters/core_extras.rb", "lib/reek/adapters/object_source.rb", "lib/reek/adapters/rake_task.rb", "lib/reek/adapters/report.rb", "lib/reek/adapters/source.rb", "lib/reek/adapters/spec.rb", "lib/reek/block_context.rb", "lib/reek/class_context.rb", "lib/reek/code_context.rb", "lib/reek/code_parser.rb", "lib/reek/command_line.rb", "lib/reek/detector_stack.rb", "lib/reek/exceptions.reek", "lib/reek/if_context.rb", "lib/reek/method_context.rb", "lib/reek/module_context.rb", "lib/reek/name.rb", "lib/reek/object_refs.rb", "lib/reek/sexp_formatter.rb", "lib/reek/singleton_method_context.rb", "lib/reek/smell_warning.rb", "lib/reek/smells/control_couple.rb", "lib/reek/smells/duplication.rb", "lib/reek/smells/feature_envy.rb", "lib/reek/smells/large_class.rb", "lib/reek/smells/long_method.rb", "lib/reek/smells/long_parameter_list.rb", "lib/reek/smells/long_yield_list.rb", "lib/reek/smells/nested_iterators.rb", "lib/reek/smells/smell_detector.rb", "lib/reek/smells/uncommunicative_name.rb", "lib/reek/smells/utility_function.rb", "lib/reek/sniffer.rb", "lib/reek/stop_context.rb", "lib/reek/yield_call_context.rb", "reek.gemspec", "spec/quality/reek_source_spec.rb", "spec/reek/adapters/report_spec.rb", "spec/reek/adapters/should_reek_of_spec.rb", "spec/reek/adapters/should_reek_only_of_spec.rb", "spec/reek/adapters/should_reek_spec.rb", "spec/reek/block_context_spec.rb", "spec/reek/class_context_spec.rb", "spec/reek/code_context_spec.rb", "spec/reek/code_parser_spec.rb", "spec/reek/config_spec.rb", "spec/reek/if_context_spec.rb", "spec/reek/method_context_spec.rb", "spec/reek/module_context_spec.rb", "spec/reek/name_spec.rb", "spec/reek/object_refs_spec.rb", "spec/reek/object_source_spec.rb", "spec/reek/singleton_method_context_spec.rb", "spec/reek/smell_warning_spec.rb", "spec/reek/smells/control_couple_spec.rb", "spec/reek/smells/duplication_spec.rb", "spec/reek/smells/feature_envy_spec.rb", "spec/reek/smells/large_class_spec.rb", "spec/reek/smells/long_method_spec.rb", "spec/reek/smells/long_parameter_list_spec.rb", "spec/reek/smells/nested_iterators_spec.rb", "spec/reek/smells/smell_detector_spec.rb", "spec/reek/smells/uncommunicative_name_spec.rb", "spec/reek/smells/utility_function_spec.rb", "spec/reek/sniffer_spec.rb", "spec/samples/all_but_one_masked/clean_one.rb", "spec/samples/all_but_one_masked/dirty.rb", "spec/samples/all_but_one_masked/masked.reek", "spec/samples/clean_due_to_masking/clean_one.rb", "spec/samples/clean_due_to_masking/clean_three.rb", "spec/samples/clean_due_to_masking/clean_two.rb", "spec/samples/clean_due_to_masking/dirty_one.rb", "spec/samples/clean_due_to_masking/dirty_two.rb", "spec/samples/clean_due_to_masking/masked.reek", "spec/samples/corrupt_config_file/corrupt.reek", "spec/samples/corrupt_config_file/dirty.rb", "spec/samples/empty_config_file/dirty.rb", "spec/samples/empty_config_file/empty.reek", "spec/samples/inline.rb", "spec/samples/masked/dirty.rb", "spec/samples/masked/masked.reek", "spec/samples/mixed_results/clean_one.rb", "spec/samples/mixed_results/clean_three.rb", "spec/samples/mixed_results/clean_two.rb", "spec/samples/mixed_results/dirty_one.rb", "spec/samples/mixed_results/dirty_two.rb", "spec/samples/not_quite_masked/dirty.rb", "spec/samples/not_quite_masked/masked.reek", "spec/samples/optparse.rb", "spec/samples/redcloth.rb", "spec/samples/three_clean_files/clean_one.rb", "spec/samples/three_clean_files/clean_three.rb", "spec/samples/three_clean_files/clean_two.rb", "spec/samples/two_smelly_files/dirty_one.rb", "spec/samples/two_smelly_files/dirty_two.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/reek.rake", "tasks/test.rake"]
|
16
16
|
s.homepage = %q{http://wiki.github.com/kevinrutherford/reek}
|
17
17
|
s.post_install_message = %q{
|
18
18
|
For more information on reek, see http://wiki.github.com/kevinrutherford/reek
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'Reek source code' do
|
4
|
+
it 'has no smells' do
|
5
|
+
Dir['lib/**/*.rb'].should_not reek
|
6
|
+
end
|
7
|
+
|
8
|
+
nucleus = Dir['lib/reek/**.rb'] - Dir['lib/reek/adapters/**/*.rb']
|
9
|
+
nucleus.each do |src|
|
10
|
+
it "#{src} contains no references from the nucleus out to the adapters" do
|
11
|
+
File.new(src).lines.grep(/adapters/).should be_empty
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
|
+
|
3
|
+
require 'reek/adapters/core_extras'
|
4
|
+
require 'reek/adapters/report'
|
5
|
+
require 'reek/adapters/source'
|
6
|
+
require 'reek/smells/feature_envy'
|
7
|
+
|
8
|
+
include Reek
|
9
|
+
|
10
|
+
describe ReportSection, " when empty" do
|
11
|
+
before(:each) do
|
12
|
+
@rpt = ReportSection.new(''.sniff)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has an empty quiet_report' do
|
16
|
+
@rpt.quiet_report.should == ''
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ReportSection, "smell_list" do
|
21
|
+
before(:each) do
|
22
|
+
rpt = ReportSection.new('def simple(a) a[3] end'.sniff)
|
23
|
+
@lines = rpt.smell_list.split("\n")
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should mention every smell name' do
|
27
|
+
@lines.should have_at_least(2).lines
|
28
|
+
@lines[0].should match(/[Utility Function]/)
|
29
|
+
@lines[1].should match(/[Feature Envy]/)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe ReportSection, " as a SortedSet" do
|
34
|
+
it 'should only add a smell once' do
|
35
|
+
rpt = ReportSection.new(''.sniff)
|
36
|
+
rpt << SmellWarning.new(Smells::FeatureEnvy.new, "self", 'too many!')
|
37
|
+
rpt << SmellWarning.new(Smells::FeatureEnvy.new, "self", 'too many!')
|
38
|
+
lines = rpt.smell_list.split("\n")
|
39
|
+
lines.should have(1).lines
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should not count an identical masked smell' do
|
43
|
+
rpt = ReportSection.new(''.sniff)
|
44
|
+
rpt << SmellWarning.new(Smells::FeatureEnvy.new, "self", 'too many!')
|
45
|
+
rpt.record_masked_smell(SmellWarning.new(Smells::FeatureEnvy.new, "self", 'too many!'))
|
46
|
+
rpt.header.should == 'string -- 1 warning'
|
47
|
+
end
|
48
|
+
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
require File.dirname(__FILE__) + '
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
2
|
|
3
|
-
require 'reek/
|
3
|
+
require 'reek/adapters/report'
|
4
|
+
require 'reek/adapters/spec'
|
4
5
|
|
6
|
+
include Reek
|
5
7
|
include Reek::Spec
|
6
8
|
|
7
9
|
describe ShouldReekOf, 'rdoc demo example' do
|
@@ -37,7 +39,7 @@ describe ShouldReekOf, 'checking code in a string' do
|
|
37
39
|
|
38
40
|
it 'reports the smells when should_not fails' do
|
39
41
|
@matcher.matches?(@smelly_code).should be_true
|
40
|
-
@matcher.failure_message_for_should_not.should include(@smelly_code.sniff.quiet_report)
|
42
|
+
@matcher.failure_message_for_should_not.should include(Report.new(@smelly_code.sniff).quiet_report)
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
@@ -58,7 +60,7 @@ describe ShouldReekOf, 'checking code in a Dir' do
|
|
58
60
|
|
59
61
|
it 'reports the smells when should_not fails' do
|
60
62
|
@matcher.matches?(@smelly_dir).should be_true
|
61
|
-
@matcher.failure_message_for_should_not.should include(@smelly_dir.sniff.quiet_report)
|
63
|
+
@matcher.failure_message_for_should_not.should include(Report.new(@smelly_dir.sniff.sniffers).quiet_report)
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
@@ -79,15 +81,17 @@ describe ShouldReekOf, 'checking code in a File' do
|
|
79
81
|
|
80
82
|
it 'reports the smells when should_not fails' do
|
81
83
|
@matcher.matches?(@smelly_file).should be_true
|
82
|
-
@matcher.failure_message_for_should_not.should include(@smelly_file.sniff.quiet_report)
|
84
|
+
@matcher.failure_message_for_should_not.should include(Report.new(@smelly_file.sniff).quiet_report)
|
83
85
|
end
|
84
86
|
end
|
85
87
|
|
86
88
|
describe ShouldReekOf, 'report formatting' do
|
87
89
|
before :each do
|
88
|
-
@
|
90
|
+
sn_clean = 'def clean() @thing = 4; end'.sniff
|
91
|
+
sn_dirty = 'def dirty() thing.cool + thing.cool; end'.sniff
|
92
|
+
sniffers = SnifferSet.new([sn_clean, sn_dirty], '')
|
89
93
|
@matcher = ShouldReekOf.new(:UncommunicativeName, [/Dirty/, /@s/])
|
90
|
-
@matcher.matches?(
|
94
|
+
@matcher.matches?(sniffers)
|
91
95
|
@lines = @matcher.failure_message_for_should_not.split("\n").map {|str| str.chomp}
|
92
96
|
@error_message = @lines.shift
|
93
97
|
@smells = @lines.grep(/^ /)
|
@@ -95,11 +99,10 @@ describe ShouldReekOf, 'report formatting' do
|
|
95
99
|
end
|
96
100
|
|
97
101
|
it 'mentions every smell in the report' do
|
98
|
-
@smells.should have(
|
102
|
+
@smells.should have(2).warnings
|
99
103
|
end
|
100
104
|
|
101
|
-
it 'doesnt mention the clean
|
102
|
-
@headers.should have(
|
103
|
-
@headers.should_not include('clean')
|
105
|
+
it 'doesnt mention the clean source' do
|
106
|
+
@headers.should have(1).headers
|
104
107
|
end
|
105
108
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
require File.dirname(__FILE__) + '
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
2
|
|
3
|
-
require 'reek/
|
3
|
+
require 'reek/adapters/report'
|
4
|
+
require 'reek/adapters/spec'
|
4
5
|
|
6
|
+
include Reek
|
5
7
|
include Reek::Spec
|
6
8
|
|
7
9
|
describe ShouldReekOnlyOf, 'checking code in a string' do
|
@@ -42,7 +44,7 @@ describe ShouldReekOnlyOf, 'checking code in a Dir' do
|
|
42
44
|
|
43
45
|
it 'reports the smells when should_not fails' do
|
44
46
|
@matcher.matches?(@smelly_dir).should be_true
|
45
|
-
@matcher.failure_message_for_should.should include(@smelly_dir.sniff.quiet_report)
|
47
|
+
@matcher.failure_message_for_should.should include(Report.new(@smelly_dir.sniff.sniffers).quiet_report)
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
@@ -63,7 +65,7 @@ describe ShouldReekOnlyOf, 'checking code in a File' do
|
|
63
65
|
|
64
66
|
it 'reports the smells when should_not fails' do
|
65
67
|
@matcher.matches?(@smelly_file).should be_true
|
66
|
-
@matcher.failure_message_for_should.should include(@smelly_file.sniff.quiet_report)
|
68
|
+
@matcher.failure_message_for_should.should include(Report.new(@smelly_file.sniff).quiet_report)
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
@@ -1,7 +1,9 @@
|
|
1
|
-
require File.dirname(__FILE__) + '
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
2
|
|
3
|
-
require 'reek/
|
3
|
+
require 'reek/adapters/report'
|
4
|
+
require 'reek/adapters/spec'
|
4
5
|
|
6
|
+
include Reek
|
5
7
|
include Reek::Spec
|
6
8
|
|
7
9
|
describe ShouldReek, 'checking code in a string' do
|
@@ -21,7 +23,7 @@ describe ShouldReek, 'checking code in a string' do
|
|
21
23
|
|
22
24
|
it 'reports the smells when should_not fails' do
|
23
25
|
@matcher.matches?(@smelly_code).should be_true
|
24
|
-
@matcher.failure_message_for_should_not.should include(@smelly_code.sniff.quiet_report)
|
26
|
+
@matcher.failure_message_for_should_not.should include(Report.new(@smelly_code.sniff).quiet_report)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -42,7 +44,7 @@ describe ShouldReek, 'checking code in a Dir' do
|
|
42
44
|
|
43
45
|
it 'reports the smells when should_not fails' do
|
44
46
|
@matcher.matches?(@smelly_dir).should be_true
|
45
|
-
@matcher.failure_message_for_should_not.should include(@smelly_dir.sniff.quiet_report)
|
47
|
+
@matcher.failure_message_for_should_not.should include(Report.new(@smelly_dir.sniff.sniffers).quiet_report)
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
@@ -63,15 +65,17 @@ describe ShouldReek, 'checking code in a File' do
|
|
63
65
|
|
64
66
|
it 'reports the smells when should_not fails' do
|
65
67
|
@matcher.matches?(@smelly_file).should be_true
|
66
|
-
@matcher.failure_message_for_should_not.should include(@smelly_file.sniff.quiet_report)
|
68
|
+
@matcher.failure_message_for_should_not.should include(Report.new(@smelly_file.sniff).quiet_report)
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
70
72
|
describe ShouldReek, 'report formatting' do
|
71
73
|
before :each do
|
72
|
-
@
|
74
|
+
sn_clean = 'def clean() @thing = 4; end'.sniff
|
75
|
+
sn_dirty = 'def dirty() thing.cool + thing.cool; end'.sniff
|
76
|
+
sniffers = SnifferSet.new([sn_clean, sn_dirty], '')
|
73
77
|
@matcher = ShouldReek.new
|
74
|
-
@matcher.matches?(
|
78
|
+
@matcher.matches?(sniffers)
|
75
79
|
@lines = @matcher.failure_message_for_should_not.split("\n").map {|str| str.chomp}
|
76
80
|
@error_message = @lines.shift
|
77
81
|
@smells = @lines.grep(/^ /)
|
@@ -79,11 +83,10 @@ describe ShouldReek, 'report formatting' do
|
|
79
83
|
end
|
80
84
|
|
81
85
|
it 'mentions every smell in the report' do
|
82
|
-
@smells.should have(
|
86
|
+
@smells.should have(2).warnings
|
83
87
|
end
|
84
88
|
|
85
89
|
it 'doesnt mention the clean files' do
|
86
|
-
@headers.should have(
|
87
|
-
@headers.should_not include('clean')
|
90
|
+
@headers.should have(1).headers
|
88
91
|
end
|
89
92
|
end
|
@@ -37,4 +37,10 @@ describe BlockContext do
|
|
37
37
|
bctx.record_local_variable(:q2)
|
38
38
|
bctx.variable_names.should include(Name.new(:q2))
|
39
39
|
end
|
40
|
+
|
41
|
+
it 'copes with a yield to an ivar' do
|
42
|
+
scope = BlockContext.new(StopContext.new, [s(:iasgn, :@list), s(:self)])
|
43
|
+
scope.record_instance_variable(:@list)
|
44
|
+
scope.variable_names.should == [:@list]
|
45
|
+
end
|
40
46
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
2
|
|
3
3
|
require 'reek/code_parser'
|
4
|
-
require 'reek/report'
|
5
4
|
|
6
5
|
include Reek
|
7
6
|
|
@@ -32,3 +31,9 @@ end'
|
|
32
31
|
source.should_not reek
|
33
32
|
end
|
34
33
|
end
|
34
|
+
|
35
|
+
describe CodeParser do
|
36
|
+
it 'copes with a yield to an ivar' do
|
37
|
+
'def options() ozz.on { |@list| @prompt = !@list } end'.should_not reek
|
38
|
+
end
|
39
|
+
end
|
data/spec/reek/config_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
2
|
|
3
|
-
require 'reek/
|
3
|
+
require 'reek/sniffer'
|
4
4
|
require 'yaml'
|
5
5
|
|
6
6
|
include Reek
|
7
7
|
|
8
|
-
describe
|
8
|
+
describe Hash do
|
9
9
|
before :each do
|
10
10
|
@first = {
|
11
11
|
'one' => {'two' => 3, 'three' => 4},
|
@@ -32,7 +32,7 @@ describe 'Config' do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
describe
|
35
|
+
describe Hash, 'merging arrays' do
|
36
36
|
it 'should merge array values' do
|
37
37
|
first = {'key' => {'one' => [1,2,3]}}
|
38
38
|
second = {'key' => {'one' => [4,5]}}
|
@@ -1,15 +1,16 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
2
|
|
3
3
|
require 'reek/code_parser'
|
4
|
-
require 'reek/
|
4
|
+
require 'reek/sniffer'
|
5
5
|
require 'reek/smells/long_method'
|
6
6
|
|
7
7
|
include Reek
|
8
8
|
include Reek::Smells
|
9
9
|
|
10
10
|
def process_method(src)
|
11
|
-
|
12
|
-
|
11
|
+
source = src.to_reek_source
|
12
|
+
sniffer = Sniffer.new(source)
|
13
|
+
CodeParser.new(sniffer).process_defn(source.syntax_tree)
|
13
14
|
end
|
14
15
|
|
15
16
|
describe LongMethod do
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
2
|
|
3
|
-
require 'reek/report'
|
3
|
+
require 'reek/adapters/report'
|
4
4
|
require 'reek/smells/duplication'
|
5
5
|
require 'reek/smells/large_class'
|
6
|
+
require 'reek/smells/long_method'
|
6
7
|
|
7
8
|
include Reek
|
8
9
|
include Reek::Smells
|
@@ -35,21 +36,6 @@ describe SmellDetector, 'when copied' do
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
|
-
describe SmellDetector, 'when masked' do
|
39
|
-
before(:each) do
|
40
|
-
@detector = Duplication.new
|
41
|
-
@detector.be_masked
|
42
|
-
@detector.found(nil, 'help')
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'reports smells as masked' do
|
46
|
-
rpt = Report.new(Sniffer.new)
|
47
|
-
@detector.report_on(rpt)
|
48
|
-
rpt.length.should == 0
|
49
|
-
rpt.num_masked_smells.should == 1
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
39
|
describe SmellDetector, 'configuration' do
|
54
40
|
# it 'stays enabled when not disabled' do
|
55
41
|
# @detector = LargeClass.new
|
data/spec/spec_helper.rb
CHANGED
data/tasks/reek.rake
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
begin
|
2
|
-
require 'reek/rake_task'
|
2
|
+
require 'reek/adapters/rake_task'
|
3
3
|
|
4
4
|
Reek::RakeTask.new do |t|
|
5
5
|
t.fail_on_error = true
|
6
6
|
t.verbose = false
|
7
|
-
|
7
|
+
t.reek_opts = '--quiet --show-all'
|
8
8
|
end
|
9
9
|
rescue Gem::LoadError
|
10
10
|
end
|
data/tasks/test.rake
CHANGED
@@ -5,24 +5,24 @@ require 'spec'
|
|
5
5
|
require 'spec/rake/spectask'
|
6
6
|
|
7
7
|
namespace 'test' do
|
8
|
-
|
9
|
-
|
8
|
+
UNIT_TESTS = FileList['spec/reek/**/*_spec.rb']
|
9
|
+
QUALITY_TESTS = FileList['spec/quality/**/*_spec.rb']
|
10
10
|
|
11
11
|
Spec::Rake::SpecTask.new('spec') do |t|
|
12
|
-
t.spec_files =
|
12
|
+
t.spec_files = UNIT_TESTS
|
13
13
|
t.ruby_opts = ['-Ilib']
|
14
14
|
t.rcov = false
|
15
15
|
end
|
16
16
|
|
17
|
-
Spec::Rake::SpecTask.new('
|
18
|
-
t.spec_files =
|
17
|
+
Spec::Rake::SpecTask.new('quality') do |t|
|
18
|
+
t.spec_files = QUALITY_TESTS
|
19
19
|
t.ruby_opts = ['-Ilib']
|
20
20
|
t.rcov = false
|
21
21
|
end
|
22
22
|
|
23
23
|
desc 'Runs all unit tests under RCov'
|
24
24
|
Spec::Rake::SpecTask.new('rcov') do |t|
|
25
|
-
t.spec_files =
|
25
|
+
t.spec_files = UNIT_TESTS + QUALITY_TESTS
|
26
26
|
t.rcov = true
|
27
27
|
t.rcov_dir = 'build/coverage'
|
28
28
|
end
|
@@ -31,8 +31,8 @@ namespace 'test' do
|
|
31
31
|
t.cucumber_opts = "features --format progress --no-color"
|
32
32
|
end
|
33
33
|
|
34
|
-
desc 'Runs all unit tests and
|
35
|
-
task 'all' => ['test:spec', 'test:
|
34
|
+
desc 'Runs all unit tests, acceptance tests and quality checks'
|
35
|
+
task 'all' => ['test:spec', 'test:features', 'test:quality']
|
36
36
|
end
|
37
37
|
|
38
38
|
task 'clobber_rcov' => 'test:clobber_rcov'
|
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.11
|
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-23 00:00:00 -07:00
|
13
13
|
default_executable: reek
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -62,19 +62,25 @@ files:
|
|
62
62
|
- config/defaults.reek
|
63
63
|
- features/masking_smells.feature
|
64
64
|
- features/options.feature
|
65
|
-
- features/rake_task.feature
|
66
65
|
- features/reports.feature
|
67
66
|
- features/samples.feature
|
68
67
|
- features/stdin.feature
|
69
68
|
- features/step_definitions/reek_steps.rb
|
70
69
|
- features/support/env.rb
|
71
70
|
- lib/reek.rb
|
71
|
+
- lib/reek/adapters/application.rb
|
72
|
+
- lib/reek/adapters/config_file.rb
|
73
|
+
- lib/reek/adapters/core_extras.rb
|
74
|
+
- lib/reek/adapters/object_source.rb
|
75
|
+
- lib/reek/adapters/rake_task.rb
|
76
|
+
- lib/reek/adapters/report.rb
|
77
|
+
- lib/reek/adapters/source.rb
|
78
|
+
- lib/reek/adapters/spec.rb
|
72
79
|
- lib/reek/block_context.rb
|
73
80
|
- lib/reek/class_context.rb
|
74
81
|
- lib/reek/code_context.rb
|
75
82
|
- lib/reek/code_parser.rb
|
76
|
-
- lib/reek/
|
77
|
-
- lib/reek/core_extras.rb
|
83
|
+
- lib/reek/command_line.rb
|
78
84
|
- lib/reek/detector_stack.rb
|
79
85
|
- lib/reek/exceptions.reek
|
80
86
|
- lib/reek/if_context.rb
|
@@ -82,10 +88,6 @@ files:
|
|
82
88
|
- lib/reek/module_context.rb
|
83
89
|
- lib/reek/name.rb
|
84
90
|
- lib/reek/object_refs.rb
|
85
|
-
- lib/reek/object_source.rb
|
86
|
-
- lib/reek/options.rb
|
87
|
-
- lib/reek/rake_task.rb
|
88
|
-
- lib/reek/report.rb
|
89
91
|
- lib/reek/sexp_formatter.rb
|
90
92
|
- lib/reek/singleton_method_context.rb
|
91
93
|
- lib/reek/smell_warning.rb
|
@@ -101,11 +103,14 @@ files:
|
|
101
103
|
- lib/reek/smells/uncommunicative_name.rb
|
102
104
|
- lib/reek/smells/utility_function.rb
|
103
105
|
- lib/reek/sniffer.rb
|
104
|
-
- lib/reek/source.rb
|
105
|
-
- lib/reek/spec.rb
|
106
106
|
- lib/reek/stop_context.rb
|
107
107
|
- lib/reek/yield_call_context.rb
|
108
108
|
- reek.gemspec
|
109
|
+
- spec/quality/reek_source_spec.rb
|
110
|
+
- spec/reek/adapters/report_spec.rb
|
111
|
+
- spec/reek/adapters/should_reek_of_spec.rb
|
112
|
+
- spec/reek/adapters/should_reek_only_of_spec.rb
|
113
|
+
- spec/reek/adapters/should_reek_spec.rb
|
109
114
|
- spec/reek/block_context_spec.rb
|
110
115
|
- spec/reek/class_context_spec.rb
|
111
116
|
- spec/reek/code_context_spec.rb
|
@@ -117,11 +122,6 @@ files:
|
|
117
122
|
- spec/reek/name_spec.rb
|
118
123
|
- spec/reek/object_refs_spec.rb
|
119
124
|
- spec/reek/object_source_spec.rb
|
120
|
-
- spec/reek/options_spec.rb
|
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
|
125
125
|
- spec/reek/singleton_method_context_spec.rb
|
126
126
|
- spec/reek/smell_warning_spec.rb
|
127
127
|
- spec/reek/smells/control_couple_spec.rb
|
@@ -156,6 +156,8 @@ files:
|
|
156
156
|
- spec/samples/mixed_results/clean_two.rb
|
157
157
|
- spec/samples/mixed_results/dirty_one.rb
|
158
158
|
- spec/samples/mixed_results/dirty_two.rb
|
159
|
+
- spec/samples/not_quite_masked/dirty.rb
|
160
|
+
- spec/samples/not_quite_masked/masked.reek
|
159
161
|
- spec/samples/optparse.rb
|
160
162
|
- spec/samples/redcloth.rb
|
161
163
|
- spec/samples/three_clean_files/clean_one.rb
|
@@ -163,10 +165,6 @@ files:
|
|
163
165
|
- spec/samples/three_clean_files/clean_two.rb
|
164
166
|
- spec/samples/two_smelly_files/dirty_one.rb
|
165
167
|
- spec/samples/two_smelly_files/dirty_two.rb
|
166
|
-
- spec/slow/inline_spec.rb
|
167
|
-
- spec/slow/optparse_spec.rb
|
168
|
-
- spec/slow/redcloth_spec.rb
|
169
|
-
- spec/slow/reek_source_spec.rb
|
170
168
|
- spec/spec.opts
|
171
169
|
- spec/spec_helper.rb
|
172
170
|
- tasks/reek.rake
|
data/features/rake_task.feature
DELETED