From 7a95219d2b60253103f04424e743501e35fe18cb Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Fri, 10 Jun 2022 22:24:20 +0900 Subject: [PATCH] remove new method and reset without TODO --- Library/Homebrew/formula_cellar_checks.rb | 3 +-- Library/Homebrew/utils/ast.rb | 13 ------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index f1e92e30dd..3a663358fa 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -292,8 +292,7 @@ module FormulaCellarChecks dot_brew_formula = formula.prefix/".brew/#{formula.name}.rb" return unless dot_brew_formula.exist? - require "utils/ast" - return unless Utils::AST::FormulaAST.new(dot_brew_formula.read).include_runtime_cpu_detection? + return unless dot_brew_formula.read.include? "ENV.runtime_cpu_detection" # macOS `objdump` is a bit slow, so we prioritise llvm's `llvm-objdump` (~5.7x faster) # or binutils' `objdump` (~1.8x faster) if they are installed. diff --git a/Library/Homebrew/utils/ast.rb b/Library/Homebrew/utils/ast.rb index 8132023aef..5531fa376e 100644 --- a/Library/Homebrew/utils/ast.rb +++ b/Library/Homebrew/utils/ast.rb @@ -190,19 +190,6 @@ module Utils tree_rewriter.insert_after(preceding_expr, "\n#{stanza_text(name, value, indent: 2)}") end - sig { returns(T::Boolean) } - def include_runtime_cpu_detection? - install_node = children.find do |child| - (child.is_a? RuboCop::AST::DefNode) && child.method_name == :install - end - - return false if install_node.blank? - - install_node.each_node.any? do |node| - node.send_type? && node.receiver&.const_name == "ENV" && node.method_name == :runtime_cpu_detection - end - end - private sig { returns(String) }