Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 70fac14

Browse files
authored
More filtering of JRuby (#417)
* Add back ffi line explicitly * Add any jruby io line * Refactor to remove cyclomatic complexity
1 parent 20f703a commit 70fac14

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

lib/rspec/support/spec/shell_out.rb

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,30 @@ def run_ruby_with_current_load_path(ruby_command, *flags)
5353
end
5454
end
5555

56-
def strip_known_warnings(input)
57-
input.split("\n").reject do |l|
56+
LINES_TO_IGNORE =
57+
[
5858
# Ignore bundler warning.
59-
l =~ %r{bundler/source/rubygems} ||
59+
%r{bundler/source/rubygems},
6060
# Ignore bundler + rubygems warning.
61-
l =~ %r{site_ruby/\d\.\d\.\d/rubygems} ||
62-
l =~ %r{jruby-\d\.\d\.\d\.\d/lib/ruby/stdlib/rubygems} ||
61+
%r{site_ruby/\d\.\d\.\d/rubygems},
62+
%r{jruby-\d\.\d\.\d\.\d/lib/ruby/stdlib/rubygems},
6363
# This is required for windows for some reason
64-
l =~ %r{lib/bundler/rubygems} ||
64+
%r{lib/bundler/rubygems},
6565
# This is a JRuby file that generates warnings on 9.0.3.0
66-
l =~ %r{lib/ruby/stdlib/jar} ||
66+
%r{lib/ruby/stdlib/jar},
6767
# This is a JRuby file that generates warnings on 9.1.7.0
68-
l =~ %r{org/jruby/RubyKernel\.java} ||
68+
%r{org/jruby/RubyKernel\.java},
6969
# This is a JRuby gem that generates warnings on 9.1.7.0
70-
l =~ %r{uninitialized constant FFI} ||
71-
l =~ %r{io/console on JRuby shells out to stty for most operations} ||
70+
%r{ffi-1\.13\.\d+-java},
71+
%r{uninitialized constant FFI},
72+
# These are related to the above, there is a warning about io from FFI
73+
%r{jruby-\d\.\d\.\d\.\d/lib/ruby/stdlib/io},
74+
%r{io/console on JRuby shells out to stty for most operations},
75+
]
76+
77+
def strip_known_warnings(input)
78+
input.split("\n").reject do |l|
79+
LINES_TO_IGNORE.any? { |to_ignore| l =~ to_ignore } ||
7280
# Remove blank lines
7381
l == "" || l.nil?
7482
end.join("\n")

0 commit comments

Comments
 (0)