Skip to content

Commit 83b2c77

Browse files
zzakbyroot
authored andcommitted
Assume some warnings might not have the full PROJECT_ROOT
In the case of minitest assert_nil: > Use assert_nil if expecting nil from test/application/configuration_test.rb:4031 We can cheat and expect any warning that has a path which includes "test/*.rb" should exist before raising in CI. If the message doesn't contain a path like that, and is not included in the PROJECT_ROOT then we can ignore it.
1 parent b575d93 commit 83b2c77

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/strict_warnings.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def warn(message, ...)
3030

3131
super
3232

33-
return unless message.include?(PROJECT_ROOT)
33+
testpath = message[/test\/.*\.rb/]&.chomp || message
34+
return unless message.include?(PROJECT_ROOT) || Pathname.new(testpath).exist?
3435
return if ALLOWED_WARNINGS.match?(message)
3536
return unless ENV["RAILS_STRICT_WARNINGS"] || ENV["BUILDKITE"]
3637

0 commit comments

Comments
 (0)