Merge pull request #4765 from GauthamGoli/style-results-npe-fix-2
audit: Use `fetch` with default value prevent NPE
This commit is contained in:
commit
b707d2a232
@ -130,7 +130,7 @@ module Homebrew
|
|||||||
formula_count += 1
|
formula_count += 1
|
||||||
problem_count += fa.problems.size
|
problem_count += fa.problems.size
|
||||||
problem_lines = format_problem_lines(fa.problems)
|
problem_lines = format_problem_lines(fa.problems)
|
||||||
corrected_problem_count = options[:style_offenses]&.count(&:corrected?)
|
corrected_problem_count = options.fetch(:style_offenses, []).count(&:corrected?)
|
||||||
new_formula_problem_lines = format_problem_lines(fa.new_formula_problems)
|
new_formula_problem_lines = format_problem_lines(fa.new_formula_problems)
|
||||||
if args.display_filename?
|
if args.display_filename?
|
||||||
puts problem_lines.map { |s| "#{f.path}: #{s}" }
|
puts problem_lines.map { |s| "#{f.path}: #{s}" }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user