kevinrutherford-reek 1.1.3.5 → 1.1.3.6
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 +1 -0
- data/Rakefile +0 -1
- data/lib/reek.rb +1 -1
- data/lib/reek/report.rb +17 -5
- data/lib/reek/source.rb +9 -1
- data/reek.gemspec +3 -3
- data/spec/reek/object_source_spec.rb +14 -0
- data/tasks/test.rake +42 -0
- metadata +4 -3
- data/tasks/rspec.rake +0 -22
data/History.txt
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
== 1.2 (in git)
|
2
2
|
|
3
3
|
=== Major Changes
|
4
|
+
* Reek's RDoc is now hosted at http://rdoc.info/projects/kevinrutherford/reek
|
4
5
|
* Reek's output reports are now formatted differently:
|
5
6
|
** Reek is no longer silent about smell-free source code
|
6
7
|
** Output now reports on all files examined, even if they have no smells
|
data/Rakefile
CHANGED
data/lib/reek.rb
CHANGED
data/lib/reek/report.rb
CHANGED
@@ -19,6 +19,14 @@ module Reek
|
|
19
19
|
@report.each { |smell| yield smell }
|
20
20
|
end
|
21
21
|
|
22
|
+
#
|
23
|
+
# Checks this report for instances of +smell_class+, and returns +true+
|
24
|
+
# only if one of them has a report string matching all of the +patterns+.
|
25
|
+
#
|
26
|
+
def has_smell?(smell_class, patterns)
|
27
|
+
@report.any? { |smell| smell.matches?(smell_class, patterns) }
|
28
|
+
end
|
29
|
+
|
22
30
|
def <<(smell) # :nodoc:
|
23
31
|
@report << smell
|
24
32
|
true
|
@@ -90,12 +98,16 @@ module Reek
|
|
90
98
|
@sources.inject(0) {|sum, src| sum + src.report.length }
|
91
99
|
end
|
92
100
|
|
93
|
-
def smelly_sources
|
94
|
-
@sources.select {|src| src.smelly? }
|
95
|
-
end
|
96
|
-
|
97
101
|
def full_report
|
98
102
|
@sources.map { |src| src.full_report }.join
|
99
103
|
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# Checks this report for instances of +smell_class+, and returns +true+
|
107
|
+
# only if one of them has a report string matching all of the +patterns+.
|
108
|
+
#
|
109
|
+
def has_smell?(smell_class, patterns)
|
110
|
+
@sources.any? { |smell| smell.has_smell?(smell_class, patterns) }
|
111
|
+
end
|
100
112
|
end
|
101
|
-
end
|
113
|
+
end
|
data/lib/reek/source.rb
CHANGED
@@ -92,7 +92,7 @@ module Reek
|
|
92
92
|
# only if one of them has a report string matching all of the +patterns+.
|
93
93
|
#
|
94
94
|
def has_smell?(smell_class, patterns)
|
95
|
-
report.
|
95
|
+
report.has_smell?(smell_class, patterns)
|
96
96
|
end
|
97
97
|
|
98
98
|
# Creates a formatted report of all the +Smells::SmellWarning+ objects recorded in
|
@@ -114,6 +114,14 @@ module Reek
|
|
114
114
|
@sources = sources
|
115
115
|
end
|
116
116
|
|
117
|
+
#
|
118
|
+
# Checks this source for instances of +smell_class+, and returns +true+
|
119
|
+
# only if one of them has a report string matching all of the +patterns+.
|
120
|
+
#
|
121
|
+
def has_smell?(smell_class, patterns=[])
|
122
|
+
report.has_smell?(smell_class, patterns)
|
123
|
+
end
|
124
|
+
|
117
125
|
def smelly?
|
118
126
|
@sources.any? {|source| source.smelly? }
|
119
127
|
end
|
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.6"
|
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-06-
|
9
|
+
s.date = %q{2009-06-30}
|
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/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/
|
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"]
|
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,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
|
3
|
+
include Reek
|
4
|
+
|
5
|
+
describe Dir do
|
6
|
+
it 'reports correct smells via the Dir matcher' do
|
7
|
+
Dir['spec/samples/two_smelly_files/*.rb'].should reek_of(:UncommunicativeName)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'reports correct smells via SourceList' do
|
11
|
+
src = Dir['spec/samples/two_smelly_files/*.rb'].to_source
|
12
|
+
src.has_smell?(:UncommunicativeName).should be_true
|
13
|
+
end
|
14
|
+
end
|
data/tasks/test.rake
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'cucumber'
|
3
|
+
require 'cucumber/rake/task'
|
4
|
+
require 'spec'
|
5
|
+
require 'spec/rake/spectask'
|
6
|
+
|
7
|
+
namespace 'test' do
|
8
|
+
FAST = FileList['spec/reek/**/*_spec.rb']
|
9
|
+
SLOW = FileList['spec/slow/**/*_spec.rb']
|
10
|
+
|
11
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
12
|
+
t.spec_files = FAST
|
13
|
+
t.ruby_opts = ['-Ilib']
|
14
|
+
t.rcov = false
|
15
|
+
end
|
16
|
+
|
17
|
+
Spec::Rake::SpecTask.new('slow') do |t|
|
18
|
+
t.spec_files = SLOW
|
19
|
+
t.ruby_opts = ['-Ilib']
|
20
|
+
t.rcov = false
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Runs all unit tests under RCov'
|
24
|
+
Spec::Rake::SpecTask.new('rcov') do |t|
|
25
|
+
t.spec_files = FAST + SLOW
|
26
|
+
t.rcov = true
|
27
|
+
t.rcov_dir = 'build/coverage'
|
28
|
+
end
|
29
|
+
|
30
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
31
|
+
t.cucumber_opts = "features --format progress --no-color"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Runs all unit tests and acceptance tests'
|
35
|
+
task 'all' => ['test:spec', 'test:slow', 'test:features']
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'synonym for test:spec'
|
39
|
+
task 'spec' => 'test:spec'
|
40
|
+
|
41
|
+
desc 'synonym for test:all'
|
42
|
+
task 'test' => 'test:all'
|
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.6
|
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-06-
|
12
|
+
date: 2009-06-30 00:00:00 -07:00
|
13
13
|
default_executable: reek
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- spec/reek/module_context_spec.rb
|
112
112
|
- spec/reek/name_spec.rb
|
113
113
|
- spec/reek/object_refs_spec.rb
|
114
|
+
- spec/reek/object_source_spec.rb
|
114
115
|
- spec/reek/options_spec.rb
|
115
116
|
- spec/reek/report_spec.rb
|
116
117
|
- spec/reek/singleton_method_context_spec.rb
|
@@ -144,7 +145,7 @@ files:
|
|
144
145
|
- spec/spec.opts
|
145
146
|
- spec/spec_helper.rb
|
146
147
|
- tasks/reek.rake
|
147
|
-
- tasks/
|
148
|
+
- tasks/test.rake
|
148
149
|
has_rdoc: false
|
149
150
|
homepage: http://wiki.github.com/kevinrutherford/reek
|
150
151
|
post_install_message: |
|
data/tasks/rspec.rake
DELETED
@@ -1,22 +0,0 @@
|
|
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'
|