From 063cbe7acdb0af0a4cd9bd35f29f89bc0d638d4a Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 14 Aug 2017 22:44:28 +0530 Subject: add tests for formula path shortucut 3 --- Library/Homebrew/rubocops/lines_cop.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Library/Homebrew/rubocops') diff --git a/Library/Homebrew/rubocops/lines_cop.rb b/Library/Homebrew/rubocops/lines_cop.rb index 49eff510d..d3640c9ef 100644 --- a/Library/Homebrew/rubocops/lines_cop.rb +++ b/Library/Homebrew/rubocops/lines_cop.rb @@ -124,15 +124,15 @@ module RuboCop problem "\"\#\{share}#{match[1]}\" should be \"\#{#{match[2]}}\"" end - formula_path_strings(body_node, :share) do |p| - if match = regex_match_group(p, %r{/(bin|include|libexec|lib|sbin|share|Frameworks)}i) - problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[1].downcase}}\"" + formula_path_strings(body_node, :prefix) do |p| + if match = regex_match_group(p, %r{(/share/(info|man))$}) + problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[2]}}\"" end - if match = regex_match_group(p, %r{((/share/man/|\#\{man\}/)(man[1-8]))}) + if match = regex_match_group(p, %r{((/share/man/)(man[1-8]))}) problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[3]}}\"" end - if match = regex_match_group(p, %r{(/share/(info|man))}) - problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[2]}}\"" + if match = regex_match_group(p, %r{(/(bin|include|libexec|lib|sbin|share|Frameworks))}i) + problem "\"\#\{prefix}#{match[1]}\" should be \"\#{#{match[2].downcase}}\"" end end @@ -350,7 +350,8 @@ module RuboCop EOS def_node_search :formula_path_strings, <<-EOS.undent - (dstr (begin (send nil %1)) $(str _ )) + {(dstr (begin (send nil %1)) $(str _ )) + (dstr _ (begin (send nil %1)) $(str _ ))} EOS def_node_matcher :negation?, '(send ... :!)' -- cgit v1.2.3