forked from dependabot/dependabot-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise on ruby 2.7 deprecation warnings
Break tests if we introduce any ruby 2.7 deprecation warnings.
- Loading branch information
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
ALLOW_PATTERNS = [ | ||
# Ignore parser warnings for ruby 2.7 minor version mismatches | ||
# TODO: Fix these by upgrading to ruby 2.7.3 (requires ubuntu upgrade) | ||
%r{parser/current is loading parser/ruby27}, | ||
/2.7.\d-compliant syntax, but you are running 2.7.\d/, | ||
%r{whitequark/parser} | ||
].freeze | ||
|
||
# Called internally by Ruby for all warnings | ||
module Warning | ||
def self.warn(message) | ||
$stderr.print(message) | ||
|
||
raise message if ENV["RAISE_ON_WARNINGS"].to_s == "true" && ALLOW_PATTERNS.none? { |pattern| pattern =~ message } | ||
|
||
return unless ENV["DEBUG_WARNINGS"] | ||
|
||
warn caller | ||
$stderr.puts | ||
end | ||
end |