diff options
| author | Mike McQuaid | 2017-10-25 08:02:33 +0100 |
|---|---|---|
| committer | GitHub | 2017-10-25 08:02:33 +0100 |
| commit | 0cec599b28c23fb6bade4202fd455d54c07dfd27 (patch) | |
| tree | 2015993b83a650263541c80d9bfc4d7985deae39 /Library | |
| parent | 8be34a98f8f88e0ea304429b10350ebb64d06652 (diff) | |
| parent | d067b5f4344b31beef8cf0adb494c819a0e337bf (diff) | |
| download | brew-0cec599b28c23fb6bade4202fd455d54c07dfd27.tar.bz2 | |
Merge pull request #3361 from MikeMcQuaid/lines_cop_clang
lines_cop: fix clang detection.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/rubocops/lines_cop.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/rubocops/lines_cop.rb b/Library/Homebrew/rubocops/lines_cop.rb index 9c6c97b13..c5f2e7585 100644 --- a/Library/Homebrew/rubocops/lines_cop.rb +++ b/Library/Homebrew/rubocops/lines_cop.rb @@ -176,7 +176,7 @@ module RuboCop # Avoid hard-coding compilers find_every_method_call_by_name(body_node, :system).each do |method| param = parameters(method).first - if match = regex_match_group(param, %r{(/usr/bin/)?(gcc|llvm-gcc|clang)\s?}) + 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]}\"" @@ -185,9 +185,9 @@ module RuboCop find_instance_method_call(body_node, "ENV", :[]=) do |method| param = parameters(method)[1] - if match = regex_match_group(param, %r{(/usr/bin/)?(gcc|llvm-gcc|clang)\s?}) + 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?}) + 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 |
