Fix MissingFormula namespacing.

This commit is contained in:
Markus Reiter 2018-04-22 17:27:44 +02:00
parent 1669111bec
commit 33a9521576
2 changed files with 1267 additions and 1265 deletions

View File

@ -139,9 +139,8 @@ module Homebrew
ofail "#{Formatter.pluralize(problem_count, "problem")} in #{Formatter.pluralize(formula_count, "formula")}" ofail "#{Formatter.pluralize(problem_count, "problem")} in #{Formatter.pluralize(formula_count, "formula")}"
end end
end
class FormulaText class FormulaText
def initialize(path) def initialize(path)
@text = path.open("rb", &:read) @text = path.open("rb", &:read)
@lines = @text.lines.to_a @lines = @text.lines.to_a
@ -180,9 +179,9 @@ class FormulaText
index = @lines.reverse.index { |line| line =~ regex } index = @lines.reverse.index { |line| line =~ regex }
index ? @lines.count - index : nil index ? @lines.count - index : nil
end end
end end
class FormulaAuditor class FormulaAuditor
include FormulaCellarChecks include FormulaCellarChecks
attr_reader :formula, :text, :problems attr_reader :formula, :text, :problems
@ -823,9 +822,9 @@ class FormulaAuditor
def devel_only?(formula) def devel_only?(formula)
formula.devel && formula.stable.nil? formula.devel && formula.stable.nil?
end end
end end
class ResourceAuditor class ResourceAuditor
attr_reader :name, :version, :checksum, :url, :mirrors, :using, :specs, :owner attr_reader :name, :version, :checksum, :url, :mirrors, :using, :specs, :owner
attr_reader :spec_name, :problems attr_reader :spec_name, :problems
@ -969,4 +968,5 @@ class ResourceAuditor
def problem(text) def problem(text)
@problems << text @problems << text
end end
end
end end

View File

@ -8,7 +8,8 @@ module Count
end end
end end
describe FormulaText do module Homebrew
describe FormulaText do
alias_matcher :have_data, :be_data alias_matcher :have_data, :be_data
alias_matcher :have_end, :be_end alias_matcher :have_end, :be_end
alias_matcher :have_trailing_newline, :be_trailing_newline alias_matcher :have_trailing_newline, :be_trailing_newline
@ -61,9 +62,9 @@ describe FormulaText do
expect(ft).to have_end expect(ft).to have_end
expect(ft.without_patch).to eq("class End < Formula\n \nend") expect(ft.without_patch).to eq("class End < Formula\n \nend")
end end
end end
describe FormulaAuditor do describe FormulaAuditor do
def formula_auditor(name, text, options = {}) def formula_auditor(name, text, options = {})
path = Pathname.new "#{dir}/#{name}.rb" path = Pathname.new "#{dir}/#{name}.rb"
path.open("w") do |f| path.open("w") do |f|
@ -600,4 +601,5 @@ describe FormulaAuditor do
expect(fa.problems).to eq([]) expect(fa.problems).to eq([])
end end
end end
end
end end