Skip to content

Commit

Permalink
Merge pull request #10638 from Homebrew/dependabot/bundler/Library/Ho…
Browse files Browse the repository at this point in the history
…mebrew/warning-1.2.0

build(deps): bump warning from 1.1.0 to 1.2.0 in /Library/Homebrew
  • Loading branch information
MikeMcQuaid authored Feb 17, 2021
2 parents 74fd6c8 + 5a4ec39 commit 660dff5
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ GEM
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (2.0.0)
warning (1.1.0)
warning (1.2.0)
webrick (1.7.0)
webrobots (0.1.2)
zeitwerk (2.4.2)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/vendor/bundle/bundler/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thor-1.1.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/spoom-1.0.9/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tapioca-0.4.14/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/warning-1.1.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/warning-1.2.0/lib"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Warning
module Processor
# Map of symbols to regexps for warning messages to ignore.
IGNORE_MAP = {
ambiguous_slash: /: warning: ambiguous first argument; put parentheses or a space even after `\/' operator\n\z/,
ambiguous_slash: /: warning: ambiguous first argument; put parentheses or a space even after `\/' operator\n\z|: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `\/' operator\n\z/,
arg_prefix: /: warning: `[&\*]' interpreted as argument prefix\n\z/,
bignum: /: warning: constant ::Bignum is deprecated\n\z/,
fixnum: /: warning: constant ::Fixnum is deprecated\n\z/,
Expand All @@ -17,8 +17,9 @@ module Processor
useless_operator: /: warning: possibly useless use of [><!=]+ in void context\n\z/,
keyword_separation: /: warning: (?:Using the last argument (?:for `.+' )?as keyword parameters is deprecated; maybe \*\* should be added to the call|Passing the keyword argument (?:for `.+' )?as the last hash parameter is deprecated|Splitting the last argument (?:for `.+' )?into positional and keyword parameters is deprecated|The called method (?:`.+' )?is defined here)\n\z/,
safe: /: warning: (?:rb_safe_level_2_warning|rb_safe_level|rb_set_safe_level_force|rb_set_safe_level|rb_secure|rb_insecure_operation|rb_check_safe_obj|\$SAFE) will (?:be removed|become a normal global variable) in Ruby 3\.0\n\z/,
taint: /: warning: (?:rb_error_untrusted|rb_check_trusted|Pathname#taint|Pathname#untaint|rb_env_path_tainted|Object#tainted\?|Object#taint|Object#untaint|Object#untrusted\?|Object#untrust|Object#trust|rb_obj_infect|rb_tainted_str_new|rb_tainted_str_new_cstr) is deprecated and will be removed in Ruby 3\.2\.\n\z/,
taint: /: warning: (?:rb_error_untrusted|rb_check_trusted|Pathname#taint|Pathname#untaint|rb_env_path_tainted|Object#tainted\?|Object#taint|Object#untaint|Object#untrusted\?|Object#untrust|Object#trust|rb_obj_infect|rb_tainted_str_new|rb_tainted_str_new_cstr) is deprecated and will be removed in Ruby 3\.2\.?\n\z/,
mismatched_indentations: /: warning: mismatched indentations at '.+' with '.+' at \d+\n\z/,
void_context: /possibly useless use of :: in void context/,
}

# Map of action symbols to procs that return the symbol
Expand Down Expand Up @@ -75,6 +76,8 @@ def freeze
# :unused_var :: Ignore warnings for unused variables.
# :useless_operator :: Ignore warnings when using operators such as == and > when the
# result is not used.
# :void_context :: Ignore warnings for :: to reference constants when the result is not
# used (often used to trigger autoload).
#
# Examples:
#
Expand Down Expand Up @@ -126,7 +129,7 @@ def ignore(regexp, path='')
# Instead of passing a block, you can pass a hash of actions to take for specific
# warnings, using regexp as keys and a callable objects as values:
#
# Warning.ignore(__FILE__,
# Warning.process(__FILE__,
# /instance variable @\w+ not initialized/ => proc do |warning|
# LOGGER.warning(warning)
# end,
Expand Down Expand Up @@ -166,57 +169,63 @@ def process(path='', actions=nil, &block)
nil
end

# Handle ignored warnings and warning processors. If the warning is
# not ignored, is not a duplicate warning (if checking for duplicates)
# and there is no warning processor setup for the warning
# string, then use the default behavior of writing to $stderr.
def warn(str)
synchronize{@ignore.dup}.each do |path, regexp|
if str.start_with?(path) && str =~ regexp
return
end
end

if @dedup
if synchronize{@dedup[str]}
return
if RUBY_VERSION >= '3.0'
method_args = ', category: nil'
super_ = "category ? super : super(str)"
else
super_ = "super"
end

class_eval(<<-END, __FILE__, __LINE__+1)
def warn(str#{method_args})
synchronize{@ignore.dup}.each do |path, regexp|
if str.start_with?(path) && str =~ regexp
return
end
end
synchronize{@dedup[str] = true}
end
if @dedup
if synchronize{@dedup[str]}
return
end
synchronize{@dedup[str] = true}
end
action = catch(:action) do
synchronize{@process.dup}.each do |path, block|
if str.start_with?(path)
if block.is_a?(Hash)
block.each do |regexp, blk|
if str =~ regexp
throw :action, blk.call(str)
action = catch(:action) do
synchronize{@process.dup}.each do |path, block|
if str.start_with?(path)
if block.is_a?(Hash)
block.each do |regexp, blk|
if str =~ regexp
throw :action, blk.call(str)
end
end
else
throw :action, block.call(str)
end
else
throw :action, block.call(str)
end
end
:default
end
:default
end
case action
when :default
#{super_}
when :backtrace
#{super_}
$stderr.puts caller
when :raise
raise str
else
# nothing
end
case action
when :default
super
when :backtrace
super
$stderr.puts caller
when :raise
raise str
else
# nothing
nil
end

nil
end
END

private

Expand Down

0 comments on commit 660dff5

Please sign in to comment.