kevinrutherford-reek 1.1.3.11 → 1.1.3.12

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 CHANGED
@@ -25,6 +25,7 @@
25
25
  * Now reports an error for corrupt config files
26
26
  * Empty config files are ignored
27
27
 
28
+
28
29
  == 1.1.3 2009-05-19
29
30
 
30
31
  === Minor Changes
data/bin/reek CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # Reek examines Ruby source code for smells.
4
- # Visit http://reek.rubyforge.org/ for docs etc.
4
+ # Visit http://wiki.github.com/kevinrutherford/reek for docs etc.
5
5
  #
6
6
  # Author: Kevin Rutherford
7
7
  #
@@ -17,7 +17,7 @@ module Reek
17
17
  sniffer.configure(LargeClass, disabled_config)
18
18
  end
19
19
 
20
- def can_parse_objects?
20
+ def self.can_parse_objects?
21
21
  return true if Object.const_defined?(:ParseTree)
22
22
  begin
23
23
  require 'parse_tree'
@@ -28,7 +28,7 @@ module Reek
28
28
  end
29
29
 
30
30
  def syntax_tree
31
- if can_parse_objects?
31
+ if ObjectSource.can_parse_objects?
32
32
  ObjectSource.unify(ParseTree.new.parse_tree(@source))
33
33
  else
34
34
  throw ArgumentError.new('You must install the ParseTree gem to use this feature')
@@ -27,9 +27,13 @@ module Reek
27
27
  #
28
28
  class SourceFile < Source
29
29
 
30
+ def self.lines(file)
31
+ IO.readlines(file.path)
32
+ end
33
+
30
34
  def initialize(file)
31
35
  @file = file
32
- super(@file.lines.to_a.join, @file.path)
36
+ super(SourceFile.lines(@file).join, @file.path)
33
37
  end
34
38
 
35
39
  def configure(sniffer)
data/lib/reek.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
 
3
3
  module Reek # :doc:
4
- VERSION = '1.1.3.11'
4
+ VERSION = '1.1.3.12'
5
5
  end
data/reek.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{reek}
5
- s.version = "1.1.3.11"
5
+ s.version = "1.1.3.12"
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-07-23}
9
+ s.date = %q{2009-07-25}
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"]
@@ -11,6 +11,7 @@ include Reek::Smells
11
11
  describe LargeClass, 'checking Class objects' do
12
12
 
13
13
  it 'should not report class with 26 methods' do
14
+ pending('test requires ParseTree') unless ObjectSource.can_parse_objects?
14
15
  class BigOne
15
16
  26.times do |i|
16
17
  define_method "method#{i}".to_sym do
@@ -22,6 +23,7 @@ describe LargeClass, 'checking Class objects' do
22
23
  end
23
24
 
24
25
  it 'should not report short class' do
26
+ pending('test requires ParseTree') unless ObjectSource.can_parse_objects?
25
27
  class ShortClass
26
28
  def method1() @var1; end
27
29
  def method2() @var2; end
@@ -35,6 +37,7 @@ describe LargeClass, 'checking Class objects' do
35
37
 
36
38
  describe LargeClass, 'counting instance variables' do
37
39
  it 'should not report class with 10 ivars' do
40
+ pending('test requires ParseTree') unless ObjectSource.can_parse_objects?
38
41
  class ManyIvars
39
42
  def method
40
43
  @vara = @varb = @varc = @vard = @vare
@@ -45,10 +48,12 @@ describe LargeClass, 'checking Class objects' do
45
48
  end
46
49
 
47
50
  it 'ignores class with only a couple of ivars' do
51
+ pending('test requires ParseTree') unless ObjectSource.can_parse_objects?
48
52
  LargeClass.should_not reek_of(:LargeClass)
49
53
  end
50
54
 
51
55
  it 'ignores fq class with only a couple of ivars' do
56
+ pending('test requires ParseTree') unless ObjectSource.can_parse_objects?
52
57
  Reek::Smells::LargeClass.should_not reek_of(:LargeClass)
53
58
  end
54
59
  end
@@ -61,6 +61,7 @@ describe LongParameterList do
61
61
  end
62
62
 
63
63
  it 'should only report long param list' do
64
+ pending('test requires ParseTree') unless ObjectSource.can_parse_objects?
64
65
  InnerTest.should reek_only_of(:LongParameterList, /abc/)
65
66
  end
66
67
  end
@@ -7,13 +7,6 @@ include Reek::Smells
7
7
 
8
8
  describe UtilityFunction do
9
9
 
10
- it 'should not report attrset' do
11
- class Fred
12
- attr_writer :xyz
13
- end
14
- Fred.should_not reek
15
- end
16
-
17
10
  it 'should count usages of self'do
18
11
  'def <=>(other) Options[:sort_order].compare(self, other) end'.should_not reek
19
12
  end
@@ -29,16 +22,6 @@ describe UtilityFunction do
29
22
  it 'should report message chain' do
30
23
  'def simple(arga) arga.b.c end'.should reek_of(:UtilityFunction, /simple/)
31
24
  end
32
-
33
- it 'should not report overriding methods' do
34
- class Father
35
- def thing(ff); @kids = 0; end
36
- end
37
- class Son < Father
38
- def thing(ff); ff; end
39
- end
40
- Son.should_not reek
41
- end
42
25
 
43
26
  it 'does not report a method that calls super' do
44
27
  'def child(arg) super; arg.to_s; end'.should_not reek
@@ -81,3 +64,24 @@ describe UtilityFunction, 'should only report a method containing a call' do
81
64
  'def clean(text) text.each { @fred = 3} end'.should_not reek
82
65
  end
83
66
  end
67
+
68
+ describe UtilityFunction do
69
+ it 'should not report attrset' do
70
+ pending('test requires ParseTree') unless ObjectSource.can_parse_objects?
71
+ class Fred
72
+ attr_writer :xyz
73
+ end
74
+ Fred.should_not reek
75
+ end
76
+
77
+ it 'should not report overriding methods' do
78
+ pending('test requires ParseTree') unless ObjectSource.can_parse_objects?
79
+ class Father
80
+ def thing(ff); @kids = 0; end
81
+ end
82
+ class Son < Father
83
+ def thing(ff); ff; end
84
+ end
85
+ Son.should_not reek
86
+ end
87
+ 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.11
4
+ version: 1.1.3.12
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-07-23 00:00:00 -07:00
12
+ date: 2009-07-25 00:00:00 -07:00
13
13
  default_executable: reek
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency