teksymmetry-reek 1.1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +131 -0
- data/README.txt +36 -0
- data/Rakefile +17 -0
- data/bin/reek +27 -0
- data/config/defaults.reek +51 -0
- data/lib/reek/block_context.rb +59 -0
- data/lib/reek/class_context.rb +68 -0
- data/lib/reek/code_context.rb +54 -0
- data/lib/reek/code_parser.rb +221 -0
- data/lib/reek/exceptions.reek +13 -0
- data/lib/reek/if_context.rb +25 -0
- data/lib/reek/method_context.rb +91 -0
- data/lib/reek/module_context.rb +33 -0
- data/lib/reek/name.rb +49 -0
- data/lib/reek/object_refs.rb +52 -0
- data/lib/reek/object_source.rb +53 -0
- data/lib/reek/options.rb +100 -0
- data/lib/reek/rake_task.rb +121 -0
- data/lib/reek/report.rb +81 -0
- data/lib/reek/sexp_formatter.rb +10 -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 +69 -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 +81 -0
- data/lib/reek/smells/uncommunicative_name.rb +97 -0
- data/lib/reek/smells/utility_function.rb +34 -0
- data/lib/reek/source.rb +127 -0
- data/lib/reek/spec.rb +146 -0
- data/lib/reek/stop_context.rb +50 -0
- data/lib/reek/yield_call_context.rb +12 -0
- data/lib/reek.rb +7 -0
- data/reek.gemspec +44 -0
- data/spec/reek/block_context_spec.rb +40 -0
- data/spec/reek/class_context_spec.rb +169 -0
- data/spec/reek/code_context_spec.rb +93 -0
- data/spec/reek/code_parser_spec.rb +34 -0
- data/spec/reek/config_spec.rb +42 -0
- data/spec/reek/if_context_spec.rb +17 -0
- data/spec/reek/method_context_spec.rb +66 -0
- data/spec/reek/module_context_spec.rb +38 -0
- data/spec/reek/name_spec.rb +13 -0
- data/spec/reek/object_refs_spec.rb +131 -0
- data/spec/reek/options_spec.rb +13 -0
- data/spec/reek/report_spec.rb +48 -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 +221 -0
- data/spec/reek/smells/large_class_spec.rb +87 -0
- data/spec/reek/smells/long_method_spec.rb +195 -0
- data/spec/reek/smells/long_parameter_list_spec.rb +85 -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 +123 -0
- data/spec/reek/smells/utility_function_spec.rb +93 -0
- data/spec/slow/inline_spec.rb +40 -0
- data/spec/slow/optparse_spec.rb +109 -0
- data/spec/slow/redcloth_spec.rb +101 -0
- data/spec/slow/reek_source_spec.rb +20 -0
- data/spec/slow/samples/inline.rb +704 -0
- data/spec/slow/samples/optparse.rb +1788 -0
- data/spec/slow/samples/redcloth.rb +1130 -0
- data/spec/slow/script_spec.rb +55 -0
- data/spec/slow/source_list_spec.rb +40 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +13 -0
- data/tasks/reek.rake +7 -0
- data/tasks/rspec.rake +22 -0
- metadata +163 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'reek'
|
2
|
+
|
3
|
+
describe 'version number' do
|
4
|
+
it 'should report the correct value' do
|
5
|
+
actual = `ruby -Ilib bin/reek --version`.split
|
6
|
+
$?.exitstatus.should == 0
|
7
|
+
actual[0].should == 'reek'
|
8
|
+
actual[1].should == Reek::VERSION
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'exit status', 'when reek is used incorrectly' do
|
13
|
+
it 'should return non-zero status on bad option' do
|
14
|
+
`ruby -Ilib bin/reek --no-such-option`
|
15
|
+
$?.exitstatus.should == 1
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should complain about missing file' do
|
19
|
+
`ruby -Ilib bin/reek nosuchfile.rb`
|
20
|
+
$?.exitstatus.should == 1
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should return non-zero status on missing argument' do
|
24
|
+
`ruby -Ilib bin/reek -f 2>/dev/null`
|
25
|
+
$?.exitstatus.should == 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'exit status', 'when reek is used correctly' do
|
30
|
+
it 'should return non-zero status when smells are reported' do
|
31
|
+
`echo "def x() 3; end" | ruby -Ilib bin/reek`
|
32
|
+
$?.exitstatus.should == 2
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should return zero status with no smells' do
|
36
|
+
`echo "def simple() @fred = 3 end" | ruby -Ilib bin/reek`
|
37
|
+
$?.exitstatus.should == 0
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'report format', 'with one source' do
|
42
|
+
it 'should output nothing with empty source' do
|
43
|
+
`echo "" | ruby -Ilib bin/reek`.should be_empty
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should output nothing when no smells' do
|
47
|
+
`echo "def simple() @fred = 3; end" | ruby -Ilib bin/reek`.should be_empty
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should not adorn the list of warnings' do
|
51
|
+
report = `echo "class Turn; def y() @x = 3; end end" | ruby -Ilib bin/reek`
|
52
|
+
report.split(/\n/).length.should == 2
|
53
|
+
report.should_not match(/\n\n/)
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'spec/expectations'
|
5
|
+
rescue LoadError
|
6
|
+
require 'rubygems'
|
7
|
+
gem 'rspec'
|
8
|
+
require 'spec/expectations'
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'reek/spec'
|
12
|
+
|
13
|
+
SAMPLES_DIR = 'spec/slow/samples' unless Object.const_defined?('SAMPLES_DIR')
|
data/tasks/reek.rake
ADDED
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec'
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
|
+
namespace 'rspec' do
|
5
|
+
FAST = FileList['spec/reek/**/*_spec.rb']
|
6
|
+
SLOW = FileList['spec/slow/**/*_spec.rb']
|
7
|
+
|
8
|
+
Spec::Rake::SpecTask.new('fast') do |t|
|
9
|
+
t.spec_files = FAST
|
10
|
+
t.ruby_opts = ['-Ilib']
|
11
|
+
t.rcov = false
|
12
|
+
end
|
13
|
+
|
14
|
+
Spec::Rake::SpecTask.new('all') do |t|
|
15
|
+
t.spec_files = FAST + SLOW
|
16
|
+
t.rcov = true
|
17
|
+
t.rcov_dir = 'build/coverage'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'runs the unit tests'
|
22
|
+
task 'spec' => 'rspec:fast'
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: teksymmetry-reek
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.3.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin Rutherford
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-04 00:00:00 -07:00
|
13
|
+
default_executable: reek
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ruby_parser
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "2.0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: ruby2ruby
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "1.2"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: sexp_processor
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "3.0"
|
44
|
+
version:
|
45
|
+
description: Code smell detector for Ruby
|
46
|
+
email:
|
47
|
+
- kevin@rutherford-software.com
|
48
|
+
executables:
|
49
|
+
- reek
|
50
|
+
extensions: []
|
51
|
+
|
52
|
+
extra_rdoc_files:
|
53
|
+
- History.txt
|
54
|
+
- README.txt
|
55
|
+
files:
|
56
|
+
- History.txt
|
57
|
+
- README.txt
|
58
|
+
- Rakefile
|
59
|
+
- bin/reek
|
60
|
+
- config/defaults.reek
|
61
|
+
- lib/reek.rb
|
62
|
+
- lib/reek/block_context.rb
|
63
|
+
- lib/reek/class_context.rb
|
64
|
+
- lib/reek/code_context.rb
|
65
|
+
- lib/reek/code_parser.rb
|
66
|
+
- lib/reek/exceptions.reek
|
67
|
+
- lib/reek/if_context.rb
|
68
|
+
- lib/reek/method_context.rb
|
69
|
+
- lib/reek/module_context.rb
|
70
|
+
- lib/reek/name.rb
|
71
|
+
- lib/reek/object_refs.rb
|
72
|
+
- lib/reek/object_source.rb
|
73
|
+
- lib/reek/options.rb
|
74
|
+
- lib/reek/rake_task.rb
|
75
|
+
- lib/reek/report.rb
|
76
|
+
- lib/reek/sexp_formatter.rb
|
77
|
+
- lib/reek/singleton_method_context.rb
|
78
|
+
- lib/reek/smell_warning.rb
|
79
|
+
- lib/reek/smells/control_couple.rb
|
80
|
+
- lib/reek/smells/duplication.rb
|
81
|
+
- lib/reek/smells/feature_envy.rb
|
82
|
+
- lib/reek/smells/large_class.rb
|
83
|
+
- lib/reek/smells/long_method.rb
|
84
|
+
- lib/reek/smells/long_parameter_list.rb
|
85
|
+
- lib/reek/smells/long_yield_list.rb
|
86
|
+
- lib/reek/smells/nested_iterators.rb
|
87
|
+
- lib/reek/smells/smell_detector.rb
|
88
|
+
- lib/reek/smells/smells.rb
|
89
|
+
- lib/reek/smells/uncommunicative_name.rb
|
90
|
+
- lib/reek/smells/utility_function.rb
|
91
|
+
- lib/reek/source.rb
|
92
|
+
- lib/reek/spec.rb
|
93
|
+
- lib/reek/stop_context.rb
|
94
|
+
- lib/reek/yield_call_context.rb
|
95
|
+
- reek.gemspec
|
96
|
+
- spec/reek/block_context_spec.rb
|
97
|
+
- spec/reek/class_context_spec.rb
|
98
|
+
- spec/reek/code_context_spec.rb
|
99
|
+
- spec/reek/code_parser_spec.rb
|
100
|
+
- spec/reek/config_spec.rb
|
101
|
+
- spec/reek/if_context_spec.rb
|
102
|
+
- spec/reek/method_context_spec.rb
|
103
|
+
- spec/reek/module_context_spec.rb
|
104
|
+
- spec/reek/name_spec.rb
|
105
|
+
- spec/reek/object_refs_spec.rb
|
106
|
+
- spec/reek/options_spec.rb
|
107
|
+
- spec/reek/report_spec.rb
|
108
|
+
- spec/reek/singleton_method_context_spec.rb
|
109
|
+
- spec/reek/smells/control_couple_spec.rb
|
110
|
+
- spec/reek/smells/duplication_spec.rb
|
111
|
+
- spec/reek/smells/feature_envy_spec.rb
|
112
|
+
- spec/reek/smells/large_class_spec.rb
|
113
|
+
- spec/reek/smells/long_method_spec.rb
|
114
|
+
- spec/reek/smells/long_parameter_list_spec.rb
|
115
|
+
- spec/reek/smells/nested_iterators_spec.rb
|
116
|
+
- spec/reek/smells/smell_spec.rb
|
117
|
+
- spec/reek/smells/uncommunicative_name_spec.rb
|
118
|
+
- spec/reek/smells/utility_function_spec.rb
|
119
|
+
- spec/slow/inline_spec.rb
|
120
|
+
- spec/slow/optparse_spec.rb
|
121
|
+
- spec/slow/redcloth_spec.rb
|
122
|
+
- spec/slow/reek_source_spec.rb
|
123
|
+
- spec/slow/samples/inline.rb
|
124
|
+
- spec/slow/samples/optparse.rb
|
125
|
+
- spec/slow/samples/redcloth.rb
|
126
|
+
- spec/slow/script_spec.rb
|
127
|
+
- spec/slow/source_list_spec.rb
|
128
|
+
- spec/spec.opts
|
129
|
+
- spec/spec_helper.rb
|
130
|
+
- tasks/reek.rake
|
131
|
+
- tasks/rspec.rake
|
132
|
+
has_rdoc: false
|
133
|
+
homepage: http://wiki.github.com/kevinrutherford/reek
|
134
|
+
post_install_message: |
|
135
|
+
|
136
|
+
For more information on reek, see http://wiki.github.com/kevinrutherford/reek
|
137
|
+
|
138
|
+
rdoc_options:
|
139
|
+
- --main
|
140
|
+
- README.txt
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: "0"
|
148
|
+
version:
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: "0"
|
154
|
+
version:
|
155
|
+
requirements: []
|
156
|
+
|
157
|
+
rubyforge_project: reek
|
158
|
+
rubygems_version: 1.2.0
|
159
|
+
signing_key:
|
160
|
+
specification_version: 3
|
161
|
+
summary: Code smell detector for Ruby
|
162
|
+
test_files: []
|
163
|
+
|