diff options
| author | Gautham Goli | 2017-08-14 22:44:28 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-08-14 22:44:28 +0530 |
| commit | 063cbe7acdb0af0a4cd9bd35f29f89bc0d638d4a (patch) | |
| tree | 81cd69f1566309db1e984225cbfa9fc68b54c7b7 /Library/Homebrew/rubocops | |
| parent | 9c9c280c8aeb97a6ec8956242727208d80247826 (diff) | |
| download | brew-063cbe7acdb0af0a4cd9bd35f29f89bc0d638d4a.tar.bz2 | |
add tests for formula path shortucut 3
Diffstat (limited to 'Library/Homebrew/rubocops')
| -rw-r--r-- | Library/Homebrew/rubocops/lines_cop.rb | 15 |
1 files changed, 8 insertions, 7 deletions
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 ... :!)' |
