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,93 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'sample gem source code' do
|
4
|
+
it "reports the correct smells in redcloth.rb" do
|
5
|
+
ruby = File.new('spec/samples/redcloth.rb').to_source
|
6
|
+
ruby.should reek_of(:ControlCouple, /RedCloth#blocks\/block/, /deep_code/)
|
7
|
+
ruby.should reek_of(:ControlCouple, /RedCloth#check_refs/, /text/)
|
8
|
+
ruby.should reek_of(:ControlCouple, /RedCloth#pba/, /text_in/)
|
9
|
+
ruby.should reek_of(:ControlCouple, /RedCloth#textile_bq/, /atts/)
|
10
|
+
ruby.should reek_of(:ControlCouple, /RedCloth#textile_bq/, /cite/)
|
11
|
+
ruby.should reek_of(:ControlCouple, /RedCloth#textile_fn_/, /atts/)
|
12
|
+
ruby.should reek_of(:ControlCouple, /RedCloth#textile_p/, /atts/)
|
13
|
+
ruby.should reek_of(:Duplication, /RedCloth#block_textile_lists/, /depth.last/)
|
14
|
+
ruby.should reek_of(:Duplication, /RedCloth#block_textile_lists/, /depth.last.length/)
|
15
|
+
ruby.should reek_of(:Duplication, /RedCloth#block_textile_lists/, /depth\[i\]/)
|
16
|
+
ruby.should reek_of(:Duplication, /RedCloth#block_textile_lists/, /line_id.-\(1\)/)
|
17
|
+
ruby.should reek_of(:Duplication, /RedCloth#block_textile_lists/, /lines\[line_id.-\(1\)\]/)
|
18
|
+
ruby.should reek_of(:Duplication, /RedCloth#block_textile_lists/, /tl.length/)
|
19
|
+
ruby.should reek_of(:Duplication, /RedCloth#clean_html/, /tags\[tag\]/)
|
20
|
+
ruby.should reek_of(:Duplication, /RedCloth#pba/, /\$1.length/)
|
21
|
+
ruby.should reek_of(:Duplication, /RedCloth#rip_offtags/, /@pre_list.last/)
|
22
|
+
ruby.should reek_of(:Duplication, /RedCloth#rip_offtags/, /@pre_list.last.<<\(line\)/)
|
23
|
+
ruby.should reek_of(:Duplication, /RedCloth#rip_offtags/, /codepre.-\(used_offtags.length\)/)
|
24
|
+
ruby.should reek_of(:Duplication, /RedCloth#rip_offtags/, /codepre.-\(used_offtags.length\).>\(0\)/)
|
25
|
+
ruby.should reek_of(:Duplication, /RedCloth#rip_offtags/, /codepre.zero?/)
|
26
|
+
ruby.should reek_of(:Duplication, /RedCloth#rip_offtags/, /used_offtags.length/)
|
27
|
+
ruby.should reek_of(:Duplication, /RedCloth#rip_offtags/, /used_offtags\[notextile\]/)
|
28
|
+
ruby.should reek_of(:FeatureEnvy, /RedCloth#clean_html/, /tags/)
|
29
|
+
ruby.should reek_of(:FeatureEnvy, /RedCloth#clean_white_space/, /text/)
|
30
|
+
ruby.should reek_of(:FeatureEnvy, /RedCloth#flush_left/, /indt/)
|
31
|
+
ruby.should reek_of(:FeatureEnvy, /RedCloth#flush_left/, /text/)
|
32
|
+
ruby.should reek_of(:FeatureEnvy, /RedCloth#htmlesc/, /str/)
|
33
|
+
ruby.should reek_of(:FeatureEnvy, /RedCloth#no_textile/, /text/)
|
34
|
+
ruby.should reek_of(:FeatureEnvy, /RedCloth#pba/, /style/)
|
35
|
+
ruby.should reek_of(:FeatureEnvy, /RedCloth#pba/, /text/)
|
36
|
+
ruby.should reek_of(:LargeClass, /RedCloth/)
|
37
|
+
ruby.should reek_of(:LongMethod, /RedCloth#block_markdown_bq/)
|
38
|
+
ruby.should reek_of(:LongMethod, /RedCloth#block_textile_lists/)
|
39
|
+
ruby.should reek_of(:LongMethod, /RedCloth#block_textile_table/)
|
40
|
+
ruby.should reek_of(:LongMethod, /RedCloth#blocks/)
|
41
|
+
ruby.should reek_of(:LongMethod, /RedCloth#clean_html/)
|
42
|
+
ruby.should reek_of(:LongMethod, /RedCloth#clean_white_space/)
|
43
|
+
ruby.should reek_of(:LongMethod, /RedCloth#glyphs_textile/)
|
44
|
+
ruby.should reek_of(:LongMethod, /RedCloth#inline_markdown_link/)
|
45
|
+
ruby.should reek_of(:LongMethod, /RedCloth#inline_markdown_reflink/)
|
46
|
+
ruby.should reek_of(:LongMethod, /RedCloth#inline_textile_image/)
|
47
|
+
ruby.should reek_of(:LongMethod, /RedCloth#inline_textile_link/)
|
48
|
+
ruby.should reek_of(:LongMethod, /RedCloth#inline_textile_span/)
|
49
|
+
ruby.should reek_of(:LongMethod, /RedCloth#pba/)
|
50
|
+
ruby.should reek_of(:LongMethod, /RedCloth#rip_offtags/)
|
51
|
+
ruby.should reek_of(:LongMethod, /RedCloth#to_html/)
|
52
|
+
ruby.should reek_of(:LongParameterList, /RedCloth#textile_bq/)
|
53
|
+
ruby.should reek_of(:LongParameterList, /RedCloth#textile_fn_/)
|
54
|
+
ruby.should reek_of(:LongParameterList, /RedCloth#textile_p/)
|
55
|
+
ruby.should reek_of(:NestedIterators, /RedCloth#block_textile_lists/)
|
56
|
+
ruby.should reek_of(:NestedIterators, /RedCloth#block_textile_lists/)
|
57
|
+
ruby.should reek_of(:NestedIterators, /RedCloth#block_textile_table/)
|
58
|
+
ruby.should reek_of(:NestedIterators, /RedCloth#block_textile_table/)
|
59
|
+
ruby.should reek_of(:NestedIterators, /RedCloth#blocks/)
|
60
|
+
ruby.should reek_of(:NestedIterators, /RedCloth#clean_html/)
|
61
|
+
ruby.should reek_of(:NestedIterators, /RedCloth#clean_html/)
|
62
|
+
ruby.should reek_of(:NestedIterators, /RedCloth#inline/)
|
63
|
+
ruby.should reek_of(:NestedIterators, /RedCloth#inline_textile_span/)
|
64
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#block/, /'a'/)
|
65
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#block/, /'b'/)
|
66
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#block_textile_lists/, /'i'/)
|
67
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#block_textile_lists/, /'v'/)
|
68
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#block_textile_table/, /'x'/)
|
69
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#clean_html/, /'q'/)
|
70
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#clean_html/, /'q2'/)
|
71
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#initialize/, /'r'/)
|
72
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#inline_markdown_link/, /'m'/)
|
73
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#inline_markdown_reflink/, /'m'/)
|
74
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#inline_textile_code/, /'m'/)
|
75
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#inline_textile_image/, /'m'/)
|
76
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#inline_textile_link/, /'m'/)
|
77
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#inline_textile_span/, /'m'/)
|
78
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#refs_markdown/, /'m'/)
|
79
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#refs_textile/, /'m'/)
|
80
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#retrieve/, /'i'/)
|
81
|
+
ruby.should reek_of(:UncommunicativeName, /RedCloth#retrieve/, /'r'/)
|
82
|
+
ruby.should reek_of(:UtilityFunction, /RedCloth#block_markdown_rule/)
|
83
|
+
ruby.should reek_of(:UtilityFunction, /RedCloth#clean_html/)
|
84
|
+
ruby.should reek_of(:UtilityFunction, /RedCloth#flush_left/)
|
85
|
+
ruby.should reek_of(:UtilityFunction, /RedCloth#footnote_ref/)
|
86
|
+
ruby.should reek_of(:UtilityFunction, /RedCloth#h_align/)
|
87
|
+
ruby.should reek_of(:UtilityFunction, /RedCloth#htmlesc/)
|
88
|
+
ruby.should reek_of(:UtilityFunction, /RedCloth#incoming_entities/)
|
89
|
+
ruby.should reek_of(:UtilityFunction, /RedCloth#no_textile/)
|
90
|
+
ruby.should reek_of(:UtilityFunction, /RedCloth#v_align/)
|
91
|
+
ruby.report.length.should == 85
|
92
|
+
end
|
93
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'spec'
|
5
|
+
rescue LoadError
|
6
|
+
require 'rubygems'
|
7
|
+
gem 'rspec'
|
8
|
+
require 'spec'
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'reek/spec'
|
12
|
+
|
13
|
+
Spec::Runner.configure do |config|
|
14
|
+
config.include(Reek::Spec)
|
15
|
+
end
|
data/tasks/reek.rake
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'reek/rake_task'
|
2
|
+
|
3
|
+
Reek::RakeTask.new do |t|
|
4
|
+
t.fail_on_error = true
|
5
|
+
t.verbose = false
|
6
|
+
# t.reek_opts = '-f "Smell: %s: %c %w"'
|
7
|
+
end
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'flay'
|
11
|
+
|
12
|
+
desc 'Check for code duplication'
|
13
|
+
task 'flay' do
|
14
|
+
files = FileList['lib/**/*.rb']
|
15
|
+
flayer = Flay.new(16)
|
16
|
+
flayer.process(*files)
|
17
|
+
flayer.report
|
18
|
+
end
|
19
|
+
rescue LoadError
|
20
|
+
end
|
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'spec'
|
3
|
+
require 'spec/rake/spectask'
|
4
|
+
|
5
|
+
namespace 'rspec' do
|
6
|
+
FAST = FileList['spec/reek/**/*_spec.rb']
|
7
|
+
SLOW = FileList['spec/integration/**/*_spec.rb'] + FileList['spec/samples/**/*_spec.rb']
|
8
|
+
|
9
|
+
Spec::Rake::SpecTask.new('fast') do |t|
|
10
|
+
t.spec_files = FAST
|
11
|
+
t.ruby_opts = ['-Ilib']
|
12
|
+
t.rcov = false
|
13
|
+
end
|
14
|
+
|
15
|
+
Spec::Rake::SpecTask.new('all') do |t|
|
16
|
+
t.spec_files = FAST + SLOW
|
17
|
+
t.rcov = false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'runs the unit tests'
|
22
|
+
task 'spec' => 'rspec:fast'
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kevinrutherford-reek
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin Rutherford
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-03-31 00:00:00 -07:00
|
13
|
+
default_executable: reek
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ParseTree
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "3.0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sexp_processor
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "3.0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: newgem
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.3.0
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: hoe
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.8.0
|
54
|
+
version:
|
55
|
+
description: ""
|
56
|
+
email:
|
57
|
+
- kevin@rutherford-software.com
|
58
|
+
executables:
|
59
|
+
- reek
|
60
|
+
extensions: []
|
61
|
+
|
62
|
+
extra_rdoc_files:
|
63
|
+
- History.txt
|
64
|
+
- README.txt
|
65
|
+
files:
|
66
|
+
- History.txt
|
67
|
+
- README.txt
|
68
|
+
- Rakefile
|
69
|
+
- bin/reek
|
70
|
+
- config/defaults.reek
|
71
|
+
- lib/reek.rb
|
72
|
+
- lib/reek/block_context.rb
|
73
|
+
- lib/reek/class_context.rb
|
74
|
+
- lib/reek/code_context.rb
|
75
|
+
- lib/reek/code_parser.rb
|
76
|
+
- lib/reek/exceptions.reek
|
77
|
+
- lib/reek/if_context.rb
|
78
|
+
- lib/reek/method_context.rb
|
79
|
+
- lib/reek/module_context.rb
|
80
|
+
- lib/reek/name.rb
|
81
|
+
- lib/reek/object_refs.rb
|
82
|
+
- lib/reek/options.rb
|
83
|
+
- lib/reek/rake_task.rb
|
84
|
+
- lib/reek/report.rb
|
85
|
+
- lib/reek/smell_warning.rb
|
86
|
+
- lib/reek/source.rb
|
87
|
+
- lib/reek/spec.rb
|
88
|
+
- lib/reek/sexp_formatter.rb
|
89
|
+
- lib/reek/singleton_method_context.rb
|
90
|
+
- lib/reek/smells/control_couple.rb
|
91
|
+
- lib/reek/smells/duplication.rb
|
92
|
+
- lib/reek/smells/feature_envy.rb
|
93
|
+
- lib/reek/smells/large_class.rb
|
94
|
+
- lib/reek/smells/long_method.rb
|
95
|
+
- lib/reek/smells/long_parameter_list.rb
|
96
|
+
- lib/reek/smells/long_yield_list.rb
|
97
|
+
- lib/reek/smells/nested_iterators.rb
|
98
|
+
- lib/reek/smells/smell_detector.rb
|
99
|
+
- lib/reek/smells/smells.rb
|
100
|
+
- lib/reek/smells/uncommunicative_name.rb
|
101
|
+
- lib/reek/smells/utility_function.rb
|
102
|
+
- lib/reek/stop_context.rb
|
103
|
+
- lib/reek/yield_call_context.rb
|
104
|
+
- spec/integration/reek_source_spec.rb
|
105
|
+
- spec/integration/script_spec.rb
|
106
|
+
- spec/reek/class_context_spec.rb
|
107
|
+
- spec/reek/code_context_spec.rb
|
108
|
+
- spec/reek/code_parser_spec.rb
|
109
|
+
- spec/reek/config_spec.rb
|
110
|
+
- spec/reek/module_context_spec.rb
|
111
|
+
- spec/reek/object_refs_spec.rb
|
112
|
+
- spec/reek/options_spec.rb
|
113
|
+
- spec/reek/report_spec.rb
|
114
|
+
- spec/reek/sexp_formatter_spec.rb
|
115
|
+
- spec/reek/singleton_method_context_spec.rb
|
116
|
+
- spec/reek/smells/control_couple_spec.rb
|
117
|
+
- spec/reek/smells/duplication_spec.rb
|
118
|
+
- spec/reek/smells/feature_envy_spec.rb
|
119
|
+
- spec/reek/smells/large_class_spec.rb
|
120
|
+
- spec/reek/smells/long_method_spec.rb
|
121
|
+
- spec/reek/smells/long_parameter_list_spec.rb
|
122
|
+
- spec/reek/smells/nested_iterators_spec.rb
|
123
|
+
- spec/reek/smells/smell_spec.rb
|
124
|
+
- spec/reek/smells/uncommunicative_name_spec.rb
|
125
|
+
- spec/reek/smells/utility_function_spec.rb
|
126
|
+
- spec/samples/inline.rb
|
127
|
+
- spec/samples/inline_spec.rb
|
128
|
+
- spec/samples/optparse.rb
|
129
|
+
- spec/samples/optparse_spec.rb
|
130
|
+
- spec/samples/redcloth.rb
|
131
|
+
- spec/samples/redcloth_spec.rb
|
132
|
+
- spec/spec.opts
|
133
|
+
- spec/spec_helper.rb
|
134
|
+
- tasks/reek.rake
|
135
|
+
- tasks/rspec.rake
|
136
|
+
has_rdoc: true
|
137
|
+
homepage: http://wiki.github.com/kevinrutherford/reek
|
138
|
+
post_install_message: |
|
139
|
+
|
140
|
+
For more information on reek, see http://wiki.github.com/kevinrutherford/reek
|
141
|
+
|
142
|
+
rdoc_options:
|
143
|
+
- --main
|
144
|
+
- README.txt
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: "0"
|
152
|
+
version:
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: "0"
|
158
|
+
version:
|
159
|
+
requirements: []
|
160
|
+
|
161
|
+
rubyforge_project: reek
|
162
|
+
rubygems_version: 1.2.0
|
163
|
+
signing_key:
|
164
|
+
specification_version: 2
|
165
|
+
summary: Code smell detector for Ruby
|
166
|
+
test_files: []
|
167
|
+
|