Ignore more parser warnings
This commit is contained in:
parent
1cc983f00d
commit
79e93f54e2
@ -78,7 +78,13 @@ module Homebrew
|
||||
fix: false, except_cops: nil, only_cops: nil, display_cop_names: false, reset_cache: false,
|
||||
debug: false, verbose: false)
|
||||
Homebrew.install_bundler_gems!
|
||||
|
||||
require "warnings"
|
||||
|
||||
Warnings.ignore :parser_syntax do
|
||||
require "rubocop"
|
||||
end
|
||||
|
||||
require "rubocops"
|
||||
|
||||
args = %w[
|
||||
|
||||
@ -23,12 +23,17 @@ if ENV["HOMEBREW_TESTS_COVERAGE"]
|
||||
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters)
|
||||
end
|
||||
|
||||
require_relative "../warnings"
|
||||
|
||||
Warnings.ignore :parser_syntax do
|
||||
require "rubocop"
|
||||
end
|
||||
|
||||
require "rspec/its"
|
||||
require "rspec/github"
|
||||
require "rspec/wait"
|
||||
require "rspec/retry"
|
||||
require "rspec/sorbet"
|
||||
require "rubocop"
|
||||
require "rubocop/rspec/support"
|
||||
require "find"
|
||||
require "byebug"
|
||||
|
||||
@ -2,18 +2,10 @@
|
||||
# typed: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "warning"
|
||||
require_relative "../warnings"
|
||||
|
||||
warnings = [
|
||||
%r{warning: parser/current is loading parser/ruby\d+, which recognizes},
|
||||
/warning: \d+\.\d+\.\d+-compliant syntax, but you are running \d+\.\d+\.\d+\./,
|
||||
%r{warning: please see https://github\.com/whitequark/parser#compatibility-with-ruby-mri\.},
|
||||
]
|
||||
|
||||
warnings.each do |warning|
|
||||
Warning.ignore warning
|
||||
Warnings.ignore :parser_syntax do
|
||||
require "rubocop"
|
||||
end
|
||||
|
||||
require "rubocop"
|
||||
|
||||
exit RuboCop::CLI.new.run
|
||||
|
||||
36
Library/Homebrew/warnings.rb
Normal file
36
Library/Homebrew/warnings.rb
Normal file
@ -0,0 +1,36 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "warning"
|
||||
|
||||
# Helper module for handling warnings.
|
||||
#
|
||||
# @api private
|
||||
module Warnings
|
||||
module_function
|
||||
|
||||
COMMON_WARNINGS = {
|
||||
parser_syntax: [
|
||||
%r{warning: parser/current is loading parser/ruby\d+, which recognizes},
|
||||
/warning: \d+\.\d+\.\d+-compliant syntax, but you are running \d+\.\d+\.\d+\./,
|
||||
%r{warning: please see https://github\.com/whitequark/parser#compatibility-with-ruby-mri\.},
|
||||
],
|
||||
}.freeze
|
||||
|
||||
def ignore(*warnings)
|
||||
warnings.map! do |warning|
|
||||
next warning if !warning.is_a?(Symbol) || !COMMON_WARNINGS.key?(warning)
|
||||
|
||||
COMMON_WARNINGS[warning]
|
||||
end
|
||||
|
||||
warnings.flatten.each do |warning|
|
||||
Warning.ignore warning
|
||||
end
|
||||
return unless block_given?
|
||||
|
||||
result = yield
|
||||
Warning.clear
|
||||
result
|
||||
end
|
||||
end
|
||||
5
Library/Homebrew/warnings.rbi
Normal file
5
Library/Homebrew/warnings.rbi
Normal file
@ -0,0 +1,5 @@
|
||||
# typed: strict
|
||||
|
||||
module Warnings
|
||||
include Kernel
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user