Merge pull request #11447 from scpeters/lowercase_formula_names

audit: complain about uppercase formula names
This commit is contained in:
Mike McQuaid 2021-05-31 12:30:42 +01:00 committed by GitHub
commit 8171fd6b1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 2 deletions

View File

@ -120,11 +120,13 @@ module Homebrew
end
def audit_formula_name
name = formula.name
problem "Formula name '#{name}' must not contain uppercase letters." if name != name.downcase
return unless @strict
return unless @core_tap
name = formula.name
problem "'#{name}' is not allowed in homebrew/core." if MissingFormula.disallowed_reason(name)
if Formula.aliases.include? name

View File

@ -488,6 +488,32 @@ module Homebrew
end
end
describe "#audit_formula_name" do
specify "no issue" do
fa = formula_auditor "foo", <<~RUBY, core_tap: true, strict: true
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
homepage "https://brew.sh"
end
RUBY
fa.audit_formula_name
expect(fa.problems).to be_empty
end
specify "uppercase formula name" do
fa = formula_auditor "Foo", <<~RUBY
class Foo < Formula
url "https://brew.sh/Foo-1.0.tgz"
homepage "https://brew.sh"
end
RUBY
fa.audit_formula_name
expect(fa.problems.first[:message]).to match "must not contain uppercase letters"
end
end
describe "#check_service_command" do
specify "Not installed" do
fa = formula_auditor "foo", <<~RUBY