kevinrutherford-reek 1.1.3.6 → 1.1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +1 -1
- data/features/reports.feature +13 -1
- data/lib/reek/report.rb +2 -1
- data/lib/reek/spec.rb +3 -3
- data/lib/reek.rb +1 -1
- data/reek.gemspec +3 -3
- data/spec/reek/object_source_spec.rb +9 -0
- data/spec/reek/spec_spec.rb +68 -0
- data/spec/samples/three_clean_files/clean_one.rb +6 -0
- data/spec/samples/three_clean_files/clean_three.rb +6 -0
- data/spec/samples/three_clean_files/clean_two.rb +6 -0
- metadata +6 -2
data/History.txt
CHANGED
data/features/reports.feature
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
@reports
|
2
|
-
Feature:
|
2
|
+
Feature: Correctly formatted reports
|
3
3
|
In order to get the most out of reek
|
4
4
|
As a developer
|
5
5
|
I want to be able to parse reek's output simply and consistently
|
@@ -26,3 +26,15 @@ Feature: Correclty formatted reports
|
|
26
26
|
|
27
27
|
"""
|
28
28
|
|
29
|
+
Scenario: good files show headers consecutively
|
30
|
+
When I run reek spec/samples/three_clean_files/*.rb
|
31
|
+
Then it succeeds
|
32
|
+
And it reports:
|
33
|
+
"""
|
34
|
+
spec/samples/three_clean_files/clean_one.rb -- 0 warnings
|
35
|
+
spec/samples/three_clean_files/clean_three.rb -- 0 warnings
|
36
|
+
spec/samples/three_clean_files/clean_two.rb -- 0 warnings
|
37
|
+
|
38
|
+
"""
|
39
|
+
|
40
|
+
|
data/lib/reek/report.rb
CHANGED
data/lib/reek/spec.rb
CHANGED
@@ -49,7 +49,7 @@ module Reek
|
|
49
49
|
"Expected source to reek, but it didn't"
|
50
50
|
end
|
51
51
|
def failure_message_for_should_not
|
52
|
-
"Expected no smells, but got:\n#{@source.
|
52
|
+
"Expected no smells, but got:\n#{@source.full_report}"
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -73,7 +73,7 @@ module Reek
|
|
73
73
|
"Expected #{@source} to reek of #{@klass}, but it didn't"
|
74
74
|
end
|
75
75
|
def failure_message_for_should_not
|
76
|
-
"Expected #{@source} not to reek of #{@klass}, but got:\n#{@source.
|
76
|
+
"Expected #{@source} not to reek of #{@klass}, but got:\n#{@source.full_report}"
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -96,7 +96,7 @@ module Reek
|
|
96
96
|
@source.report.length == 1 and @source.has_smell?(@klass, @patterns)
|
97
97
|
end
|
98
98
|
def failure_message_for_should
|
99
|
-
"Expected source to reek only of #{@klass}, but got:\n#{@source.
|
99
|
+
"Expected source to reek only of #{@klass}, but got:\n#{@source.full_report}"
|
100
100
|
end
|
101
101
|
def failure_message_for_should_not
|
102
102
|
"Expected source not to reek only of #{@klass}, but it did"
|
data/lib/reek.rb
CHANGED
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.7"
|
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-
|
9
|
+
s.date = %q{2009-07-02}
|
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", "README.txt"]
|
15
|
-
s.files = ["History.txt", "README.txt", "Rakefile", "bin/reek", "config/defaults.reek", "features/masking_smells.feature", "features/options.feature", "features/rake_task.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/block_context.rb", "lib/reek/class_context.rb", "lib/reek/code_context.rb", "lib/reek/code_parser.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/object_source.rb", "lib/reek/options.rb", "lib/reek/rake_task.rb", "lib/reek/report.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/source.rb", "lib/reek/spec.rb", "lib/reek/stop_context.rb", "lib/reek/yield_call_context.rb", "reek.gemspec", "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/options_spec.rb", "spec/reek/report_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/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/optparse.rb", "spec/samples/redcloth.rb", "spec/samples/two_smelly_files/dirty_one.rb", "spec/samples/two_smelly_files/dirty_two.rb", "spec/slow/inline_spec.rb", "spec/slow/optparse_spec.rb", "spec/slow/redcloth_spec.rb", "spec/slow/reek_source_spec.rb", "spec/slow/source_list_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/reek.rake", "tasks/test.rake"]
|
15
|
+
s.files = ["History.txt", "README.txt", "Rakefile", "bin/reek", "config/defaults.reek", "features/masking_smells.feature", "features/options.feature", "features/rake_task.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/block_context.rb", "lib/reek/class_context.rb", "lib/reek/code_context.rb", "lib/reek/code_parser.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/object_source.rb", "lib/reek/options.rb", "lib/reek/rake_task.rb", "lib/reek/report.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/source.rb", "lib/reek/spec.rb", "lib/reek/stop_context.rb", "lib/reek/yield_call_context.rb", "reek.gemspec", "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/options_spec.rb", "spec/reek/report_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/spec_spec.rb", "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/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/slow/inline_spec.rb", "spec/slow/optparse_spec.rb", "spec/slow/redcloth_spec.rb", "spec/slow/reek_source_spec.rb", "spec/slow/source_list_spec.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
|
@@ -4,6 +4,7 @@ include Reek
|
|
4
4
|
|
5
5
|
describe Dir do
|
6
6
|
it 'reports correct smells via the Dir matcher' do
|
7
|
+
Dir['spec/samples/two_smelly_files/*.rb'].should reek
|
7
8
|
Dir['spec/samples/two_smelly_files/*.rb'].should reek_of(:UncommunicativeName)
|
8
9
|
end
|
9
10
|
|
@@ -11,4 +12,12 @@ describe Dir do
|
|
11
12
|
src = Dir['spec/samples/two_smelly_files/*.rb'].to_source
|
12
13
|
src.has_smell?(:UncommunicativeName).should be_true
|
13
14
|
end
|
15
|
+
|
16
|
+
it 'copes with daft file specs' do
|
17
|
+
Dir["spec/samples/two_smelly_files/*/.rb"].should_not reek
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'copes with empty array' do
|
21
|
+
[].should_not reek
|
22
|
+
end
|
14
23
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
|
3
|
+
require 'reek/spec'
|
4
|
+
|
5
|
+
include Reek::Spec
|
6
|
+
|
7
|
+
describe ShouldReek, 'checking code in a string' do
|
8
|
+
before :each do
|
9
|
+
@clean_code = 'def good() true; end'
|
10
|
+
@smelly_code = 'def x() y = 4; end'
|
11
|
+
@matcher = ShouldReek.new
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'matches a smelly String' do
|
15
|
+
@matcher.matches?(@smelly_code).should be_true
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'doesnt match a fragrant String' do
|
19
|
+
@matcher.matches?(@clean_code).should be_false
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'reports the smells when should_not fails' do
|
23
|
+
@matcher.matches?(@smelly_code).should be_true
|
24
|
+
@matcher.failure_message_for_should_not.should include(@smelly_code.to_source.full_report)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe ShouldReek, 'checking code in a Dir' do
|
29
|
+
before :each do
|
30
|
+
@clean_dir = Dir['spec/samples/three_clean_files/*.rb']
|
31
|
+
@smelly_dir = Dir['spec/samples/two_smelly_files/*.rb']
|
32
|
+
@matcher = ShouldReek.new
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'matches a smelly String' do
|
36
|
+
@matcher.matches?(@smelly_dir).should be_true
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'doesnt match a fragrant String' do
|
40
|
+
@matcher.matches?(@clean_dir).should be_false
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'reports the smells when should_not fails' do
|
44
|
+
@matcher.matches?(@smelly_dir).should be_true
|
45
|
+
@matcher.failure_message_for_should_not.should include(@smelly_dir.to_source.full_report)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe ShouldReek, 'checking code in a File' do
|
50
|
+
before :each do
|
51
|
+
@clean_file = File.new(Dir['spec/samples/three_clean_files/*.rb'][0])
|
52
|
+
@smelly_file = File.new(Dir['spec/samples/two_smelly_files/*.rb'][0])
|
53
|
+
@matcher = ShouldReek.new
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'matches a smelly String' do
|
57
|
+
@matcher.matches?(@smelly_file).should be_true
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'doesnt match a fragrant String' do
|
61
|
+
@matcher.matches?(@clean_file).should be_false
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'reports the smells when should_not fails' do
|
65
|
+
@matcher.matches?(@smelly_file).should be_true
|
66
|
+
@matcher.failure_message_for_should_not.should include(@smelly_file.to_source.full_report)
|
67
|
+
end
|
68
|
+
end
|
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.7
|
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-
|
12
|
+
date: 2009-07-02 00:00:00 -07:00
|
13
13
|
default_executable: reek
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- spec/reek/smells/smell_detector_spec.rb
|
127
127
|
- spec/reek/smells/uncommunicative_name_spec.rb
|
128
128
|
- spec/reek/smells/utility_function_spec.rb
|
129
|
+
- spec/reek/spec_spec.rb
|
129
130
|
- spec/samples/corrupt_config_file/corrupt.reek
|
130
131
|
- spec/samples/corrupt_config_file/dirty.rb
|
131
132
|
- spec/samples/empty_config_file/dirty.rb
|
@@ -135,6 +136,9 @@ files:
|
|
135
136
|
- spec/samples/masked/masked.reek
|
136
137
|
- spec/samples/optparse.rb
|
137
138
|
- spec/samples/redcloth.rb
|
139
|
+
- spec/samples/three_clean_files/clean_one.rb
|
140
|
+
- spec/samples/three_clean_files/clean_three.rb
|
141
|
+
- spec/samples/three_clean_files/clean_two.rb
|
138
142
|
- spec/samples/two_smelly_files/dirty_one.rb
|
139
143
|
- spec/samples/two_smelly_files/dirty_two.rb
|
140
144
|
- spec/slow/inline_spec.rb
|