reek 1.2.11 → 1.2.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ == 1.2.12 (2012-06-09)
2
+
3
+ * (mvz) Use ripper_ruby_parser on Ruby 1.9.3 and up (thus making reek able
4
+ to parse the new 1.9 hash syntax).
5
+
1
6
  == 1.2.11 (2012-06-08)
2
7
 
3
8
  * (mvz) Make Bundler a development dependency.
data/README.md CHANGED
@@ -67,8 +67,6 @@ Reek integrates with many of your favourite tools:
67
67
  * `require 'reek/spec'` to add the `should_not reek` custom matcher to your Rspec examples
68
68
  * Reek is compatible with Ruby 1.8.6, 1.8.7, 1.9.2 and 1.9.3
69
69
 
70
- At present Reek is unable to parse the new Ruby 1.9 hash syntax of {a: 1}.
71
-
72
70
  ### Dependencies
73
71
 
74
72
  Reek makes use of the following other gems:
@@ -48,9 +48,5 @@ Feature: Reek reads from $stdin when no files are given
48
48
  $stdin -- 0 warnings
49
49
 
50
50
  """
51
- And stderr reports:
52
- """
53
- $stdin: Racc::ParseError:
54
- parse error on value "$end" ($end)
51
+ And it reports a parsing error
55
52
 
56
- """
@@ -56,6 +56,14 @@ Then /^it reports the error ['"](.*)['"]$/ do |string|
56
56
  @last_stderr.chomp.should == string
57
57
  end
58
58
 
59
+ Then /^it reports a parsing error$/ do
60
+ if RUBY_VERSION < "1.9.3"
61
+ @last_stderr.chomp.should match /Racc::ParseError/
62
+ else
63
+ @last_stderr.chomp.should match /RipperRubyParser::SyntaxError/
64
+ end
65
+ end
66
+
59
67
  Then /^it reports the current version$/ do
60
68
  @last_stdout.should == "reek #{Reek::VERSION}\n"
61
69
  end
@@ -1,4 +1,3 @@
1
- require 'ruby_parser'
2
1
  require File.join(File.dirname(File.expand_path(__FILE__)), 'config_file')
3
2
  require File.join(File.dirname(File.expand_path(__FILE__)), 'tree_dresser')
4
3
 
@@ -22,7 +21,19 @@ module Reek
22
21
 
23
22
  attr_reader :desc
24
23
 
25
- def initialize(code, desc, parser = RubyParser.new)
24
+ # At runtime, reek tries to load ripper_ruby_parser. If that succeeds,
25
+ # reek uses that parser and will be able to handle Ruby 1.9 syntax. On
26
+ # Ruby versions below 1.9.3, it will fail and reek will use ruby_parser
27
+ # and handle Ruby 1.8 syntax only.
28
+ PARSER_CLASS = begin
29
+ require 'ripper_ruby_parser'
30
+ RipperRubyParser::Parser
31
+ rescue LoadError
32
+ require 'ruby_parser'
33
+ RubyParser
34
+ end
35
+
36
+ def initialize(code, desc, parser = PARSER_CLASS.new)
26
37
  @source = code
27
38
  @desc = desc
28
39
  @parser = parser
@@ -1,3 +1,3 @@
1
1
  module Reek
2
- VERSION = '1.2.11'
2
+ VERSION = '1.2.12'
3
3
  end
@@ -13,8 +13,8 @@ and reports any code smells it finds.
13
13
  }
14
14
  s.email = ["timo.roessner@googlemail.com"]
15
15
  s.executables = ["reek"]
16
- s.extra_rdoc_files = ["History.txt", "License.txt"]
17
- s.files = Dir[".yardopts", "History.txt", "License.txt", "README.md",
16
+ s.extra_rdoc_files = ["CHANGELOG", "License.txt"]
17
+ s.files = Dir[".yardopts", "CHANGELOG", "License.txt", "README.md",
18
18
  "Rakefile", "bin/reek", "config/defaults.reek",
19
19
  "{features,lib,spec,tasks}/**/*",
20
20
  "reek.gemspec" ] & `git ls-files -z`.split("\0")
@@ -27,6 +27,7 @@ and reports any code smells it finds.
27
27
  s.summary = %q{Code smell detector for Ruby}
28
28
 
29
29
  s.add_runtime_dependency(%q<ruby_parser>, ["~> 2.0"])
30
+ s.add_runtime_dependency(%q<ripper_ruby_parser>, ["~> 0.0.7"])
30
31
  s.add_runtime_dependency(%q<ruby2ruby>, ["~> 1.2.5"])
31
32
  s.add_runtime_dependency(%q<sexp_processor>, ["~> 3.0"])
32
33
 
@@ -51,7 +51,11 @@ EOS
51
51
 
52
52
  it 'has the correct fields' do
53
53
  @warning.smell[ControlCouple::PARAMETER_KEY].should == 'arg'
54
- @warning.lines.should == [3,6]
54
+ if RUBY_VERSION < "1.9.3"
55
+ @warning.lines.should == [3,6]
56
+ else
57
+ @warning.lines.should == [3,5]
58
+ end
55
59
  end
56
60
  end
57
61
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reek
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 11
10
- version: 1.2.11
9
+ - 12
10
+ version: 1.2.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kevin Rutherford
@@ -35,9 +35,25 @@ dependencies:
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: ruby2ruby
38
+ name: ripper_ruby_parser
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 17
46
+ segments:
47
+ - 0
48
+ - 0
49
+ - 7
50
+ version: 0.0.7
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: ruby2ruby
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
41
57
  none: false
42
58
  requirements:
43
59
  - - ~>
@@ -49,11 +65,11 @@ dependencies:
49
65
  - 5
50
66
  version: 1.2.5
51
67
  type: :runtime
52
- version_requirements: *id002
68
+ version_requirements: *id003
53
69
  - !ruby/object:Gem::Dependency
54
70
  name: sexp_processor
55
71
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
72
+ requirement: &id004 !ruby/object:Gem::Requirement
57
73
  none: false
58
74
  requirements:
59
75
  - - ~>
@@ -64,11 +80,11 @@ dependencies:
64
80
  - 0
65
81
  version: "3.0"
66
82
  type: :runtime
67
- version_requirements: *id003
83
+ version_requirements: *id004
68
84
  - !ruby/object:Gem::Dependency
69
85
  name: bundler
70
86
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
87
+ requirement: &id005 !ruby/object:Gem::Requirement
72
88
  none: false
73
89
  requirements:
74
90
  - - ~>
@@ -79,11 +95,11 @@ dependencies:
79
95
  - 1
80
96
  version: "1.1"
81
97
  type: :development
82
- version_requirements: *id004
98
+ version_requirements: *id005
83
99
  - !ruby/object:Gem::Dependency
84
100
  name: rake
85
101
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
102
+ requirement: &id006 !ruby/object:Gem::Requirement
87
103
  none: false
88
104
  requirements:
89
105
  - - ">="
@@ -93,11 +109,11 @@ dependencies:
93
109
  - 0
94
110
  version: "0"
95
111
  type: :development
96
- version_requirements: *id005
112
+ version_requirements: *id006
97
113
  - !ruby/object:Gem::Dependency
98
114
  name: cucumber
99
115
  prerelease: false
100
- requirement: &id006 !ruby/object:Gem::Requirement
116
+ requirement: &id007 !ruby/object:Gem::Requirement
101
117
  none: false
102
118
  requirements:
103
119
  - - ">="
@@ -107,11 +123,11 @@ dependencies:
107
123
  - 0
108
124
  version: "0"
109
125
  type: :development
110
- version_requirements: *id006
126
+ version_requirements: *id007
111
127
  - !ruby/object:Gem::Dependency
112
128
  name: rspec
113
129
  prerelease: false
114
- requirement: &id007 !ruby/object:Gem::Requirement
130
+ requirement: &id008 !ruby/object:Gem::Requirement
115
131
  none: false
116
132
  requirements:
117
133
  - - "="
@@ -123,7 +139,7 @@ dependencies:
123
139
  - 2
124
140
  version: 1.3.2
125
141
  type: :development
126
- version_requirements: *id007
142
+ version_requirements: *id008
127
143
  description: |
128
144
  Reek is a tool that examines Ruby classes, modules and methods
129
145
  and reports any code smells it finds.
@@ -135,11 +151,11 @@ executables:
135
151
  extensions: []
136
152
 
137
153
  extra_rdoc_files:
138
- - History.txt
154
+ - CHANGELOG
139
155
  - License.txt
140
156
  files:
141
157
  - .yardopts
142
- - History.txt
158
+ - CHANGELOG
143
159
  - License.txt
144
160
  - README.md
145
161
  - Rakefile