kevinrutherford-reek 0.3.1.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -3
- data/Rakefile +11 -1
- data/lib/reek.rb +1 -4
- data/reek.gemspec +42 -0
- data/spec/reek/if_context_spec.rb +17 -0
- data/spec/reek/method_context_spec.rb +52 -0
- data/spec/samples/inline_spec.rb +1 -1
- data/spec/samples/optparse_spec.rb +1 -1
- data/spec/samples/redcloth_spec.rb +1 -1
- data/tasks/reek.rake +0 -13
- data/tasks/rspec.rake +1 -2
- metadata +9 -26
data/History.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
== 0.
|
1
|
+
== 1.0.0 2009-04-05
|
2
2
|
|
3
3
|
=== Major enhancements:
|
4
4
|
|
5
|
-
*
|
5
|
+
* Use *.reek files in source tree to configure Reek's behaviour
|
6
6
|
* Added -f option to configure report format
|
7
7
|
* --sort_order replaced by -f, -c and -s
|
8
8
|
* Matchers provided for rspec; eg. foo.should_not reek
|
@@ -17,7 +17,6 @@
|
|
17
17
|
|
18
18
|
* Corrected false reports of long arg lists to yield
|
19
19
|
* A method can now be a UtilityFunction only when it includes a call
|
20
|
-
* Removed the website from the gem [#12]
|
21
20
|
|
22
21
|
== 0.3.1 2008-11-17
|
23
22
|
|
data/Rakefile
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/clean'
|
3
|
-
require 'fileutils'
|
4
3
|
|
5
4
|
$:.unshift File.dirname(__FILE__) + '/lib'
|
6
5
|
|
6
|
+
PROJECT_NAME = 'reek'
|
7
|
+
|
8
|
+
BUILD_DIR = 'build'; directory BUILD_DIR
|
9
|
+
PKG_DIR = "#{BUILD_DIR}/pkg"; directory PKG_DIR
|
10
|
+
RDOC_DIR = "#{BUILD_DIR}/rdoc"; directory RDOC_DIR
|
11
|
+
|
12
|
+
GEM_MANIFEST = "Manifest.txt"
|
13
|
+
VERSION_FILE = 'lib/reek.rb'
|
14
|
+
|
15
|
+
CLOBBER.include("#{BUILD_DIR}/*")
|
16
|
+
|
7
17
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
data/lib/reek.rb
CHANGED
data/reek.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{reek}
|
5
|
+
s.version = "1.0.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Kevin Rutherford"]
|
9
|
+
s.date = %q{2009-04-05}
|
10
|
+
s.default_executable = %q{reek}
|
11
|
+
s.description = %q{Code smell detector for Ruby}
|
12
|
+
s.email = ["kevin@rutherford-software.com"]
|
13
|
+
s.executables = ["reek"]
|
14
|
+
s.extra_rdoc_files = ["History.txt", "README.txt"]
|
15
|
+
s.files = ["History.txt", "README.txt", "Rakefile", "bin/reek", "config/defaults.reek", "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/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/smells.rb", "lib/reek/smells/uncommunicative_name.rb", "lib/reek/smells/utility_function.rb", "lib/reek/source.rb", "lib/reek/spec.rb", "lib/reek/stop_context.rb", "lib/reek/yield_call_context.rb", "reek.gemspec", "spec/integration/reek_source_spec.rb", "spec/integration/script_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/object_refs_spec.rb", "spec/reek/options_spec.rb", "spec/reek/report_spec.rb", "spec/reek/sexp_formatter_spec.rb", "spec/reek/singleton_method_context_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_spec.rb", "spec/reek/smells/uncommunicative_name_spec.rb", "spec/reek/smells/utility_function_spec.rb", "spec/samples/inline.rb", "spec/samples/inline_spec.rb", "spec/samples/optparse.rb", "spec/samples/optparse_spec.rb", "spec/samples/redcloth.rb", "spec/samples/redcloth_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/reek.rake", "tasks/rspec.rake"]
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.homepage = %q{http://wiki.github.com/kevinrutherford/reek}
|
18
|
+
s.post_install_message = %q{
|
19
|
+
For more information on reek, see http://wiki.github.com/kevinrutherford/reek
|
20
|
+
}
|
21
|
+
s.rdoc_options = ["--main", "README.txt"]
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
s.rubyforge_project = %q{reek}
|
24
|
+
s.rubygems_version = %q{1.3.1}
|
25
|
+
s.summary = %q{Code smell detector for Ruby}
|
26
|
+
|
27
|
+
if s.respond_to? :specification_version then
|
28
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
29
|
+
s.specification_version = 2
|
30
|
+
|
31
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
32
|
+
s.add_runtime_dependency(%q<ParseTree>, ["~> 3.0"])
|
33
|
+
s.add_runtime_dependency(%q<sexp_processor>, ["~> 3.0"])
|
34
|
+
else
|
35
|
+
s.add_dependency(%q<ParseTree>, ["~> 3.0"])
|
36
|
+
s.add_dependency(%q<sexp_processor>, ["~> 3.0"])
|
37
|
+
end
|
38
|
+
else
|
39
|
+
s.add_dependency(%q<ParseTree>, ["~> 3.0"])
|
40
|
+
s.add_dependency(%q<sexp_processor>, ["~> 3.0"])
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
|
3
|
+
require 'reek/if_context'
|
4
|
+
|
5
|
+
include Reek
|
6
|
+
|
7
|
+
describe IfContext do
|
8
|
+
it 'should find a class within top-level code' do
|
9
|
+
'unless jim; class Array; end; end'.should_not reek
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should find class within top-level code' do
|
13
|
+
stopctx = StopContext.new
|
14
|
+
ifctx = IfContext.new(stopctx, [:if, [:vcall, :jim]])
|
15
|
+
ifctx.find_module(Name.new(:Array)).should_not be_nil
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
|
3
|
+
require 'reek/method_context'
|
4
|
+
require 'reek/stop_context'
|
5
|
+
|
6
|
+
include Reek
|
7
|
+
|
8
|
+
describe MethodContext, 'matching' do
|
9
|
+
before :each do
|
10
|
+
@element = MethodContext.new(StopContext.new, [0, :mod])
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should recognise itself in a collection of names' do
|
14
|
+
@element.matches?(['banana', 'mod']).should == true
|
15
|
+
@element.matches?(['banana']).should == false
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should recognise itself in a collection of REs' do
|
19
|
+
@element.matches?([/banana/, /mod/]).should == true
|
20
|
+
@element.matches?([/banana/]).should == false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe MethodContext, 'matching fq names' do
|
25
|
+
before :each do
|
26
|
+
element = StopContext.new
|
27
|
+
element = ModuleContext.new(element, [0, :mod])
|
28
|
+
element = ClassContext.new(element, [0, :klass])
|
29
|
+
@element = MethodContext.new(element, [0, :meth])
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should recognise itself in a collection of names' do
|
33
|
+
@element.matches?(['banana', 'meth']).should == true
|
34
|
+
@element.matches?(['banana', 'klass#meth']).should == true
|
35
|
+
@element.matches?(['banana']).should == false
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should recognise itself in a collection of names' do
|
39
|
+
@element.matches?([/banana/, /meth/]).should == true
|
40
|
+
@element.matches?([/banana/, /klass#meth/]).should == true
|
41
|
+
@element.matches?([/banana/]).should == false
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe MethodContext do
|
46
|
+
it 'should record ivars as refs to self' do
|
47
|
+
mctx = MethodContext.new(StopContext.new, [:defn, :feed])
|
48
|
+
mctx.envious_receivers.should == []
|
49
|
+
mctx.record_call_to([:call, [:ivar, :@cow], :feed_to])
|
50
|
+
mctx.envious_receivers.should == []
|
51
|
+
end
|
52
|
+
end
|
data/spec/samples/inline_spec.rb
CHANGED
@@ -35,6 +35,6 @@ describe 'sample gem source code' do
|
|
35
35
|
ruby.should reek_of(:UncommunicativeName, /Inline::C#module_name/, /'x'/)
|
36
36
|
ruby.should reek_of(:UncommunicativeName, /Inline::C#parse_signature/, /'x'/)
|
37
37
|
ruby.should reek_of(:UtilityFunction, /Inline::C#strip_comments/)
|
38
|
-
ruby.report.
|
38
|
+
ruby.report.should have_at_most(32).smells
|
39
39
|
end
|
40
40
|
end
|
@@ -95,6 +95,6 @@ describe 'sample gem source code' do
|
|
95
95
|
ruby.should reek_of(:UncommunicativeName, /OptionParser#summarize/, /'l'/)
|
96
96
|
ruby.should reek_of(:UncommunicativeName, /OptionParser#ver/, /'v'/)
|
97
97
|
ruby.should reek_of(:UncommunicativeName, /block/, /'q'/)
|
98
|
-
ruby.report.
|
98
|
+
ruby.report.should have_at_most(92).smells
|
99
99
|
end
|
100
100
|
end
|
@@ -88,6 +88,6 @@ describe 'sample gem source code' do
|
|
88
88
|
ruby.should reek_of(:UtilityFunction, /RedCloth#incoming_entities/)
|
89
89
|
ruby.should reek_of(:UtilityFunction, /RedCloth#no_textile/)
|
90
90
|
ruby.should reek_of(:UtilityFunction, /RedCloth#v_align/)
|
91
|
-
ruby.report.
|
91
|
+
ruby.report.should have_at_most(85).smells
|
92
92
|
end
|
93
93
|
end
|
data/tasks/reek.rake
CHANGED
@@ -5,16 +5,3 @@ Reek::RakeTask.new do |t|
|
|
5
5
|
t.verbose = false
|
6
6
|
# t.reek_opts = '-f "Smell: %s: %c %w"'
|
7
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
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
require 'rake/clean'
|
2
1
|
require 'spec'
|
3
2
|
require 'spec/rake/spectask'
|
4
3
|
|
5
4
|
namespace 'rspec' do
|
6
5
|
FAST = FileList['spec/reek/**/*_spec.rb']
|
7
|
-
SLOW = FileList['spec/integration/**/*_spec.rb'
|
6
|
+
SLOW = FileList['spec/integration/**/*_spec.rb', 'spec/samples/**/*_spec.rb']
|
8
7
|
|
9
8
|
Spec::Rake::SpecTask.new('fast') do |t|
|
10
9
|
t.spec_files = FAST
|
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: 0.
|
4
|
+
version: 1.0.0
|
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-04-05 00:00:00 -07:00
|
13
13
|
default_executable: reek
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,27 +32,7 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: "3.0"
|
34
34
|
version:
|
35
|
-
|
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: ""
|
35
|
+
description: Code smell detector for Ruby
|
56
36
|
email:
|
57
37
|
- kevin@rutherford-software.com
|
58
38
|
executables:
|
@@ -82,11 +62,9 @@ files:
|
|
82
62
|
- lib/reek/options.rb
|
83
63
|
- lib/reek/rake_task.rb
|
84
64
|
- lib/reek/report.rb
|
85
|
-
- lib/reek/smell_warning.rb
|
86
|
-
- lib/reek/source.rb
|
87
|
-
- lib/reek/spec.rb
|
88
65
|
- lib/reek/sexp_formatter.rb
|
89
66
|
- lib/reek/singleton_method_context.rb
|
67
|
+
- lib/reek/smell_warning.rb
|
90
68
|
- lib/reek/smells/control_couple.rb
|
91
69
|
- lib/reek/smells/duplication.rb
|
92
70
|
- lib/reek/smells/feature_envy.rb
|
@@ -99,14 +77,19 @@ files:
|
|
99
77
|
- lib/reek/smells/smells.rb
|
100
78
|
- lib/reek/smells/uncommunicative_name.rb
|
101
79
|
- lib/reek/smells/utility_function.rb
|
80
|
+
- lib/reek/source.rb
|
81
|
+
- lib/reek/spec.rb
|
102
82
|
- lib/reek/stop_context.rb
|
103
83
|
- lib/reek/yield_call_context.rb
|
84
|
+
- reek.gemspec
|
104
85
|
- spec/integration/reek_source_spec.rb
|
105
86
|
- spec/integration/script_spec.rb
|
106
87
|
- spec/reek/class_context_spec.rb
|
107
88
|
- spec/reek/code_context_spec.rb
|
108
89
|
- spec/reek/code_parser_spec.rb
|
109
90
|
- spec/reek/config_spec.rb
|
91
|
+
- spec/reek/if_context_spec.rb
|
92
|
+
- spec/reek/method_context_spec.rb
|
110
93
|
- spec/reek/module_context_spec.rb
|
111
94
|
- spec/reek/object_refs_spec.rb
|
112
95
|
- spec/reek/options_spec.rb
|