aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd/audit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/dev-cmd/audit.rb')
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb84
1 files changed, 0 insertions, 84 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 8d76c2075..32130f343 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -248,70 +248,6 @@ class FormulaAuditor
end
end
- def component_problem(before, after, offset = 0)
- problem "`#{before[1]}` (line #{before[0] + offset}) should be put before `#{after[1]}` (line #{after[0] + offset})"
- end
-
- # scan in the reverse direction for remaining problems but report problems
- # in the forward direction so that contributors don't reverse the order of
- # lines in the file simply by following instructions
- def audit_components(reverse = true, previous_pair = nil)
- component_list = [
- [/^ include Language::/, "include directive"],
- [/^ desc ["'][\S\ ]+["']/, "desc"],
- [/^ homepage ["'][\S\ ]+["']/, "homepage"],
- [/^ url ["'][\S\ ]+["']/, "url"],
- [/^ mirror ["'][\S\ ]+["']/, "mirror"],
- [/^ version ["'][\S\ ]+["']/, "version"],
- [/^ (sha1|sha256) ["'][\S\ ]+["']/, "checksum"],
- [/^ revision/, "revision"],
- [/^ version_scheme/, "version_scheme"],
- [/^ head ["'][\S\ ]+["']/, "head"],
- [/^ stable do/, "stable block"],
- [/^ bottle do/, "bottle block"],
- [/^ devel do/, "devel block"],
- [/^ head do/, "head block"],
- [/^ bottle (:unneeded|:disable)/, "bottle modifier"],
- [/^ keg_only/, "keg_only"],
- [/^ option/, "option"],
- [/^ depends_on/, "depends_on"],
- [/^ conflicts_with/, "conflicts_with"],
- [/^ (go_)?resource/, "resource"],
- [/^ def install/, "install method"],
- [/^ def caveats/, "caveats method"],
- [/^ (plist_options|def plist)/, "plist block"],
- [/^ test do/, "test block"],
- ]
- if previous_pair
- previous_before = previous_pair[0]
- previous_after = previous_pair[1]
- end
- offset = previous_after && previous_after[0] && previous_after[0] >= 1 ? previous_after[0] - 1 : 0
- present = component_list.map do |regex, name|
- lineno = if reverse
- text.reverse_line_number regex
- else
- text.line_number regex, offset
- end
- next unless lineno
- [lineno, name]
- end.compact
- no_problem = true
- present.each_cons(2) do |c1, c2|
- if reverse
- # scan in the forward direction from the offset
- audit_components(false, [c1, c2]) if c1[0] > c2[0] # at least one more offense
- elsif c1[0] > c2[0] && (offset.zero? || previous_pair.nil? || (c1[0] + offset) != previous_before[0] || (c2[0] + offset) != previous_after[0])
- component_problem c1, c2, offset
- no_problem = false
- end
- end
- if no_problem && previous_pair
- component_problem previous_before, previous_after
- end
- present
- end
-
def audit_file
# Under normal circumstances (umask 0022), we expect a file mode of 644. If
# the user's umask is more restrictive, respect that by masking out the
@@ -374,26 +310,6 @@ class FormulaAuditor
EOS
end
end
-
- return unless @strict
-
- present = audit_components
-
- present.map!(&:last)
- if present.include?("stable block")
- %w[url checksum mirror].each do |component|
- if present.include?(component)
- problem "`#{component}` should be put inside `stable block`"
- end
- end
- end
-
- if present.include?("head") && present.include?("head block")
- problem "Should not have both `head` and `head do`"
- end
-
- return unless present.include?("bottle modifier") && present.include?("bottle block")
- problem "Should not have `bottle :unneeded/:disable` and `bottle do`"
end
def audit_class