limit some heuristics to strict mode

This commit is contained in:
Viktor Szakats 2017-08-29 12:53:45 +00:00
parent c30b941358
commit 56ccf10efa

View File

@ -201,7 +201,7 @@ class FormulaAuditor
@specs = %w[stable devel head].map { |s| formula.send(s) }.compact @specs = %w[stable devel head].map { |s| formula.send(s) }.compact
end end
def self.check_http_content(url, name, user_agents: [:default], check_content: false) def self.check_http_content(url, name, user_agents: [:default], check_content: false, strict: false)
return unless url.start_with? "http" return unless url.start_with? "http"
details = nil details = nil
@ -251,6 +251,8 @@ class FormulaAuditor
return "The URL #{url} should use HTTPS rather than HTTP" return "The URL #{url} should use HTTPS rather than HTTP"
end end
return unless strict
# Same size, different content after normalization # Same size, different content after normalization
# (typical causes: Generated ID, Timestamp, Unix time) # (typical causes: Generated ID, Timestamp, Unix time)
if details[:file].length == secure_details[:file].length if details[:file].length == secure_details[:file].length
@ -590,7 +592,8 @@ class FormulaAuditor
if http_content_problem = FormulaAuditor.check_http_content(homepage, if http_content_problem = FormulaAuditor.check_http_content(homepage,
formula.name, formula.name,
user_agents: [:browser, :default], user_agents: [:browser, :default],
check_content: true) check_content: true,
strict: @strict)
problem http_content_problem problem http_content_problem
end end
end end