aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/rubocops
diff options
context:
space:
mode:
authorGautham Goli2017-08-14 19:58:39 +0530
committerGautham Goli2017-08-14 19:58:39 +0530
commit77468fdae36ee58580a643d8bc0fdd9f8b6e61c3 (patch)
tree029a06e8fac08e102dc9e532450db1f71b1b7740 /Library/Homebrew/rubocops
parentaf5cd1a1da0e1b87696ae72b8a5f1c174e83e94e (diff)
downloadbrew-77468fdae36ee58580a643d8bc0fdd9f8b6e61c3.tar.bz2
add tests for hard coded compilers in system calls
Diffstat (limited to 'Library/Homebrew/rubocops')
-rw-r--r--Library/Homebrew/rubocops/lines_cop.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/Library/Homebrew/rubocops/lines_cop.rb b/Library/Homebrew/rubocops/lines_cop.rb
index cf1ac68c3..4d2d63cce 100644
--- a/Library/Homebrew/rubocops/lines_cop.rb
+++ b/Library/Homebrew/rubocops/lines_cop.rb
@@ -99,15 +99,15 @@ module RuboCop
problem "\"#{m.source}\" should be \"#{match[0]}\""
end
- # # Avoid hard-coding compilers
- # find_every_method_call_by_name(body_node, :system).each do |m|
- # param = parameters(m).first
- # 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
+ # Avoid hard-coding compilers
+ find_every_method_call_by_name(body_node, :system).each do |m|
+ param = parameters(m).first
+ 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
#
# find_instance_method_call(body_node, :ENV, :[]=) do |m|
# param = parameters(m)[1]