diff options
| author | Gautham Goli | 2017-08-14 20:10:45 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-08-14 20:10:45 +0530 |
| commit | 65ae6bacd8c92d718b259f7efd50fc3fe9f0838b (patch) | |
| tree | c3e0e1e9eb6a3fc0496381c8a6b479b904f2b933 /Library/Homebrew/rubocops | |
| parent | 77468fdae36ee58580a643d8bc0fdd9f8b6e61c3 (diff) | |
| download | brew-65ae6bacd8c92d718b259f7efd50fc3fe9f0838b.tar.bz2 | |
add tests for hardcoded compilers in ENV
Diffstat (limited to 'Library/Homebrew/rubocops')
| -rw-r--r-- | Library/Homebrew/rubocops/lines_cop.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Library/Homebrew/rubocops/lines_cop.rb b/Library/Homebrew/rubocops/lines_cop.rb index 4d2d63cce..919b21243 100644 --- a/Library/Homebrew/rubocops/lines_cop.rb +++ b/Library/Homebrew/rubocops/lines_cop.rb @@ -108,16 +108,16 @@ module RuboCop problem "Use \"\#{ENV.cxx}\" instead of hard-coding \"#{match[2]}\"" end end - # - # find_instance_method_call(body_node, :ENV, :[]=) do |m| - # param = parameters(m)[1] - # if match = regex_match_group(param, %r{(/usr/bin/)?(gcc|llvm-gcc|clang)\s?}) - # problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{match[3]}\"" - # elsif match = regex_match_group(param, %r{(/usr/bin/)?((g|llvm-g|clang)\+\+)\s?}) - # problem "Use \"\#{ENV.cxx}\" instead of hard-coding \"#{match[3]}\"" - # end - # end - # + + find_instance_method_call(body_node, "ENV", :[]=) do |m| + param = parameters(m)[1] + if match = regex_match_group(param, %r{(/usr/bin/)?(gcc|llvm-gcc|clang)\s?}) + problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{match[2]}\"" + elsif match = regex_match_group(param, %r{(/usr/bin/)?((g|llvm-g|clang)\+\+)\s?}) + problem "Use \"\#{ENV.cxx}\" instead of hard-coding \"#{match[2]}\"" + end + end + # # Prefer formula path shortcuts in strings # formula_path_strings(body_node, :prefix) do |p| # next unless match = regex_match_group(p, %r{(/(man))[/'"]}) |
