Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audit: use versioned_formula instead of formula.versioned_formula? #5130

Merged
merged 1 commit into from
Oct 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ class FormulaAuditor

def initialize(formula, options = {})
@formula = formula
@new_formula = options[:new_formula] && !formula.versioned_formula?
@versioned_formula = formula.versioned_formula?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth putting this on the line above and using @versioned_formula there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@new_formula = options[:new_formula] && !@versioned_formula
@strict = options[:strict]
@online = options[:online]
@display_cop_names = options[:display_cop_names]
Expand All @@ -273,7 +274,7 @@ def audit_style

@style_offenses.each do |offense|
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)
next
Expand Down Expand Up @@ -307,7 +308,7 @@ def audit_file

problem "File should end with a newline" unless text.trailing_newline?

if formula.versioned_formula?
if @versioned_formula
unversioned_formula = begin
# build this ourselves as we want e.g. homebrew/core to be present
full_name = if formula.tap
Expand Down Expand Up @@ -526,7 +527,7 @@ def audit_keg_only_style
end

def audit_versioned_keg_only
return unless formula.versioned_formula?
return unless @versioned_formula
return unless @core_tap

return if formula.keg_only? && formula.keg_only_reason.reason == :versioned_formula
Expand Down Expand Up @@ -665,7 +666,7 @@ def audit_specs
unstable_spec_message = "Formulae should not have a `HEAD` or `devel` spec"
if @new_formula
new_formula_problem unstable_spec_message
elsif formula.versioned_formula?
elsif @versioned_formula
versioned_unstable_spec = %w[
bash-completion@2
imagemagick@6
Expand Down