audit: use versioned_formula instead of formula.versioned_formula?

This commit is contained in:
commitay 2018-10-19 11:16:04 +10:00
parent 598909577c
commit 78a21c8bbf

View File

@ -252,7 +252,8 @@ module Homebrew
def initialize(formula, options = {}) def initialize(formula, options = {})
@formula = formula @formula = formula
@new_formula = options[:new_formula] && !formula.versioned_formula? @versioned_formula = formula.versioned_formula?
@new_formula = options[:new_formula] && !@versioned_formula
@strict = options[:strict] @strict = options[:strict]
@online = options[:online] @online = options[:online]
@display_cop_names = options[:display_cop_names] @display_cop_names = options[:display_cop_names]
@ -273,7 +274,7 @@ module Homebrew
@style_offenses.each do |offense| @style_offenses.each do |offense|
if offense.cop_name.start_with?("NewFormulaAudit") if offense.cop_name.start_with?("NewFormulaAudit")
next if formula.versioned_formula? next if @versioned_formula
new_formula_problem offense.to_s(display_cop_name: @display_cop_names) new_formula_problem offense.to_s(display_cop_name: @display_cop_names)
next next
@ -307,7 +308,7 @@ module Homebrew
problem "File should end with a newline" unless text.trailing_newline? problem "File should end with a newline" unless text.trailing_newline?
if formula.versioned_formula? if @versioned_formula
unversioned_formula = begin unversioned_formula = begin
# build this ourselves as we want e.g. homebrew/core to be present # build this ourselves as we want e.g. homebrew/core to be present
full_name = if formula.tap full_name = if formula.tap
@ -526,7 +527,7 @@ module Homebrew
end end
def audit_versioned_keg_only def audit_versioned_keg_only
return unless formula.versioned_formula? return unless @versioned_formula
return unless @core_tap return unless @core_tap
return if formula.keg_only? && formula.keg_only_reason.reason == :versioned_formula return if formula.keg_only? && formula.keg_only_reason.reason == :versioned_formula
@ -665,7 +666,7 @@ module Homebrew
unstable_spec_message = "Formulae should not have a `HEAD` or `devel` spec" unstable_spec_message = "Formulae should not have a `HEAD` or `devel` spec"
if @new_formula if @new_formula
new_formula_problem unstable_spec_message new_formula_problem unstable_spec_message
elsif formula.versioned_formula? elsif @versioned_formula
versioned_unstable_spec = %w[ versioned_unstable_spec = %w[
bash-completion@2 bash-completion@2
imagemagick@6 imagemagick@6