Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More RuboCops fixes #7353

Merged
merged 3 commits into from Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/tests.yml
Expand Up @@ -125,9 +125,16 @@ jobs:
brew update-test --commit=HEAD
if: github.event_name == 'pull_request'

- name: Run brew readall
- name: Run brew readall on all taps
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
run: |
brew install vale
Expand Down
8 changes: 4 additions & 4 deletions Library/Homebrew/rubocops/lines.rb
Expand Up @@ -240,18 +240,18 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
# 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"]?})
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 |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
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/rubocops/text.rb
Expand Up @@ -54,6 +54,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)

find_method_with_args(body_node, :system, "dep", "ensure") do |d|
next if parameters_passed?(d, /vendor-only/)
next if @formula_name == "goose" # needed in 2.3.0

problem "use \"dep\", \"ensure\", \"-vendor-only\""
end
Expand Down