audit: warn about unknown bottle modifiers
This prevents typos like `bottle :uneeded` or `bottle :disable` Closes Homebrew/homebrew#45264. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
d6bf2f5749
commit
774a508d1a
@ -463,6 +463,12 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def audit_bottle_spec
|
||||||
|
if formula.bottle_disabled? && !formula.bottle_disable_reason.valid?
|
||||||
|
problem "Unrecognized bottle modifier"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def audit_github_repository
|
def audit_github_repository
|
||||||
return unless @online
|
return unless @online
|
||||||
|
|
||||||
@ -904,6 +910,7 @@ class FormulaAuditor
|
|||||||
audit_specs
|
audit_specs
|
||||||
audit_desc
|
audit_desc
|
||||||
audit_homepage
|
audit_homepage
|
||||||
|
audit_bottle_spec
|
||||||
audit_github_repository
|
audit_github_repository
|
||||||
audit_deps
|
audit_deps
|
||||||
audit_conflicts
|
audit_conflicts
|
||||||
|
|||||||
@ -58,6 +58,8 @@ end
|
|||||||
|
|
||||||
# Used to annotate formulae that don't require compiling or cannot build bottle.
|
# Used to annotate formulae that don't require compiling or cannot build bottle.
|
||||||
class BottleDisableReason
|
class BottleDisableReason
|
||||||
|
SUPPORTED_TYPES = [:unneeded, :disabled]
|
||||||
|
|
||||||
def initialize(type, reason)
|
def initialize(type, reason)
|
||||||
@type = type
|
@type = type
|
||||||
@reason = reason
|
@reason = reason
|
||||||
@ -67,6 +69,10 @@ class BottleDisableReason
|
|||||||
@type == :unneeded
|
@type == :unneeded
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def valid?
|
||||||
|
SUPPORTED_TYPES.include? @type
|
||||||
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
if @type == :unneeded
|
if @type == :unneeded
|
||||||
"This formula doesn't require compiling."
|
"This formula doesn't require compiling."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user