cleanup audit file

This commit is contained in:
Rylan Polster 2020-07-06 12:17:21 -04:00
parent 9e52712b08
commit a720d45bd0

View File

@ -231,11 +231,6 @@ module Homebrew
end end
def audit_file def audit_file
# TODO: check could be in RuboCop
if text.to_s.match?(/inreplace [^\n]* do [^\n]*\n[^\n]*\.gsub![^\n]*\n\ *end/m)
problem "'inreplace ... do' was used for a single substitution (use the non-block form instead)."
end
if formula.core_formula? && @versioned_formula if formula.core_formula? && @versioned_formula
unversioned_formula = begin unversioned_formula = begin
# build this ourselves as we want e.g. homebrew/core to be present # build this ourselves as we want e.g. homebrew/core to be present
@ -830,20 +825,6 @@ module Homebrew
end end
end end
def audit_lines
text.without_patch.split("\n").each_with_index do |line, lineno|
line_problems(line, lineno + 1)
end
end
def line_problems(line, _lineno)
# Check for string interpolation of single values.
return unless line =~ /(system|inreplace|gsub!|change_make_var!).*[ ,]"#\{([\w.]+)\}"/
# TODO: check could be in RuboCop
problem "Don't need to interpolate \"#{Regexp.last_match(2)}\" with #{Regexp.last_match(1)}"
end
def audit_reverse_migration def audit_reverse_migration
# Only enforce for new formula being re-added to core # Only enforce for new formula being re-added to core
return unless @strict return unless @strict