From 38c832b029f95764e9c8291765728b59f2f2a799 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 22 May 2018 18:16:46 +0530 Subject: [PATCH] audit: exit with code 1 if regular audit errors or new formula audit errors when comment is not created --- Library/Homebrew/dev-cmd/audit.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 8a561c948d..f1aa9097c7 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -74,6 +74,7 @@ module Homebrew formula_count = 0 problem_count = 0 + new_formula_problem_count = 0 new_formula = args.new_formula? strict = new_formula || args.strict? online = new_formula || args.online? @@ -148,13 +149,14 @@ module Homebrew end unless created_pr_comment - problem_count += new_formula_problem_lines.size + new_formula_problem_count += new_formula_problem_lines.size puts new_formula_problem_lines.map { |s| " #{s}" } end - errors_summary = "#{Formatter.pluralize(problem_count, "problem")} in #{Formatter.pluralize(formula_count, "formula")}" - return if problem_count.zero? - ofail errors_summary unless created_pr_comment + total_problems_count = problem_count + new_formula_problem_count + errors_summary = "#{Formatter.pluralize(total_problems_count, "problem")} in #{Formatter.pluralize(formula_count, "formula")}" + + ofail errors_summary if problem_count.positive? || (new_formula_problem_count.positive? && !created_pr_comment) end def format_problem_lines(problems)