Merge pull request #7353 from MikeMcQuaid/rubocops-more

More RuboCops fixes
This commit is contained in:
Mike McQuaid 2020-04-14 12:48:35 +01:00 committed by GitHub
commit 9add43e6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View File

@ -125,9 +125,16 @@ jobs:
brew update-test --commit=HEAD brew update-test --commit=HEAD
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
- name: Run brew readall - name: Run brew readall on all taps
run: brew readall --aliases run: brew readall --aliases
- name: Run brew style on homebrew-core
if: matrix.os == 'macOS-latest'
run: brew style --display-cop-names homebrew/core
- name: Run brew style on official taps
run: brew style --display-cop-names homebrew/bundle homebrew/services homebrew/test-bot
- name: Run vale for docs linting - name: Run vale for docs linting
run: | run: |
brew install vale brew install vale

View File

@ -240,18 +240,18 @@ module RuboCop
# Avoid hard-coding compilers # Avoid hard-coding compilers
find_every_method_call_by_name(body_node, :system).each do |method| find_every_method_call_by_name(body_node, :system).each do |method|
param = parameters(method).first 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]}\"" 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]}\"" problem "Use \"\#{ENV.cxx}\" instead of hard-coding \"#{match[2]}\""
end end
end end
find_instance_method_call(body_node, "ENV", :[]=) do |method| find_instance_method_call(body_node, "ENV", :[]=) do |method|
param = parameters(method)[1] 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]}\"" 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]}\"" problem "Use \"\#{ENV.cxx}\" instead of hard-coding \"#{match[2]}\""
end end
end end

View File

@ -54,6 +54,7 @@ module RuboCop
find_method_with_args(body_node, :system, "dep", "ensure") do |d| find_method_with_args(body_node, :system, "dep", "ensure") do |d|
next if parameters_passed?(d, /vendor-only/) next if parameters_passed?(d, /vendor-only/)
next if @formula_name == "goose" # needed in 2.3.0
problem "use \"dep\", \"ensure\", \"-vendor-only\"" problem "use \"dep\", \"ensure\", \"-vendor-only\""
end end