metric_fu-roodi 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
data/History.txt CHANGED
@@ -1,7 +1,25 @@
1
+ = Master
2
+
3
+ Features
4
+ Fixes
5
+ Misc
6
+
7
+ = 2.2.2
8
+
9
+ Fixes
10
+ * Better check if OS is windows (#2 Martin Gotink)
11
+ * Accept 'next' in a rescue block (#1 Virgil Mihailovici)
12
+
13
+ = 2.2.1
14
+
15
+ Fixes
16
+ * Rescue line count when there are no lines
17
+
1
18
  = 2.2.0
2
19
 
3
20
  * Pull down updates from https://github.com/zdennis/roodi that includes updates from https://github.com/hooroo/roodi and https://github.com/aselder/roodi re: pull request https://github.com/martinjandrews/roodi/pull/12 https://github.com/martinjandrews/roodi/pull/11
4
21
  * Did not pull in updates from https://github.com/ssassi/roodi/commits/master re: https://github.com/martinjandrews/roodi/pull/10
22
+ * Release under gem name metric_fu-roodi
5
23
 
6
24
  = 2.0.1
7
25
 
@@ -7,7 +7,7 @@ module Roodi
7
7
  # When the body of a rescue block is empty, exceptions can get caught and swallowed without
8
8
  # any feedback to the user.
9
9
  class EmptyRescueBodyCheck < Check
10
- STATEMENT_NODES = [:fcall, :return, :attrasgn, :vcall, :nil, :call, :lasgn, :true, :false]
10
+ STATEMENT_NODES = [:fcall, :return, :attrasgn, :vcall, :nil, :call, :lasgn, :true, :false, :next]
11
11
 
12
12
  def interesting_nodes
13
13
  [:resbody]
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'ruby_parser'
3
+ require 'rbconfig'
3
4
 
4
5
  module Roodi
5
6
  module Core
@@ -14,7 +15,7 @@ module Roodi
14
15
 
15
16
  def silence_stream(stream)
16
17
  old_stream = stream.dup
17
- stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
18
+ stream.reopen(null_stream_output)
18
19
  stream.sync = true
19
20
  yield
20
21
  ensure
@@ -25,6 +26,23 @@ module Roodi
25
26
  @parser ||= RubyParser.new
26
27
  @parser.parse(content, filename)
27
28
  end
29
+
30
+ def null_stream_output
31
+ null_output_for_platform(RbConfig::CONFIG['host_os'])
32
+ end
33
+
34
+ def null_output_for_platform(host_os)
35
+ case host_os
36
+ when windows_host_os_matcher
37
+ 'NUL:'
38
+ else
39
+ '/dev/null'
40
+ end
41
+ end
42
+
43
+ def windows_host_os_matcher
44
+ /mingw|mswin32|cygwin/o
45
+ end
28
46
  end
29
47
  end
30
48
  end
data/lib/roodi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Roodi
2
- VERSION = '2.2.1'
2
+ VERSION = '2.2.2'
3
3
  end
@@ -137,4 +137,18 @@ describe Roodi::Checks::EmptyRescueBodyCheck do
137
137
  errors = @roodi.errors
138
138
  errors.should be_empty
139
139
  end
140
+
141
+ it "should accept a rescue block that has only a next statement" do
142
+ content = <<-END
143
+ begin
144
+ call_method
145
+ rescue Exception => e
146
+ next
147
+ end
148
+ END
149
+ @roodi.check_content(content)
150
+ errors = @roodi.errors
151
+ errors.should be_empty
152
+ end
153
+
140
154
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metric_fu-roodi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-03 00:00:00.000000000 Z
12
+ date: 2013-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby_parser
@@ -116,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  segments:
118
118
  - 0
119
- hash: 2672130625479100514
119
+ hash: -3420305304026942047
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
@@ -125,10 +125,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  segments:
127
127
  - 0
128
- hash: 2672130625479100514
128
+ hash: -3420305304026942047
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 1.8.24
131
+ rubygems_version: 1.8.25
132
132
  signing_key:
133
133
  specification_version: 3
134
134
  summary: Roodi stands for Ruby Object Oriented Design Inferometer