Skip to content

Commit 6cbd4f8

Browse files
committed
Handle warning formats produced by prism compiler
Most prism warnings are the same as parse.y, but there are a couple that are different.
1 parent e5c0bf2 commit 6cbd4f8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGELOG

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
=== master
22

3+
* Handle warning formats produced by prism compiler (jeremyevans)
4+
35
* Add support for :default_gem_removal as regexp argument to Warning.ignore (jamiemccarthy, jeremyevans) (#24)
46

57
=== 1.4.0 (2024-05-24)

lib/warning.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module Warning
44
module Processor
55
# Map of symbols to regexps for warning messages to ignore.
66
IGNORE_MAP = {
7-
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/,
8-
arg_prefix: /: warning: [`'][&\*]' interpreted as argument prefix\n\z/,
7+
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|ambiguous `\/`; wrap regexp in parentheses or add a space after `\/` operator\n\z/,
8+
arg_prefix: /: warning: ([`'][&\*]'||ambiguous `[\*&]` has been) interpreted as( an)? argument prefix\n\z/,
99
bignum: /: warning: constant ::Bignum is deprecated\n\z/,
1010
default_gem_removal: /: warning: .+? was loaded from the standard library, but will no longer be part of the default gems starting from Ruby [\d.]+\./,
1111
fixnum: /: warning: constant ::Fixnum is deprecated\n\z/,

test/test_warning.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,11 @@ def test_warning_ignore_useless_operator
340340
end
341341

342342
def test_warning_ignore_arg_prefix
343-
assert_warning(/: warning: [`']\*' interpreted as argument prefix/) do
343+
assert_warning(/: warning: ([`']\*'|ambiguous `\*` has been) interpreted as( an)? argument prefix/) do
344344
instance_eval('Array *[nil]', __FILE__)
345345
end
346346

347-
assert_warning(/: warning: [`']&' interpreted as argument prefix/) do
347+
assert_warning(/: warning: ([`']&'|ambiguous `&` has been) interpreted as( an)? argument prefix/) do
348348
instance_eval('tap &proc{}', __FILE__)
349349
end
350350
Warning.ignore(:arg_prefix, __FILE__)

0 commit comments

Comments
 (0)