From 3b9a8cb8c1b3a662cf1c279a05be5eefb5d03590 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 14 Apr 2020 11:59:41 +0100 Subject: [PATCH 1/3] rubocops/lines: fix rule. This stops stuff like `clang=1` from being matched incorrectly. --- Library/Homebrew/rubocops/lines.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index dc17ec2ef1..5ed08a2e03 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -240,18 +240,18 @@ 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"]?}) + 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 From 604434566f0197d6126e7f34092412142c9473f3 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 14 Apr 2020 11:59:56 +0100 Subject: [PATCH 2/3] rubocops/text: whitelist goose. --- Library/Homebrew/rubocops/text.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/rubocops/text.rb b/Library/Homebrew/rubocops/text.rb index 9fe92b07be..97508b9b33 100644 --- a/Library/Homebrew/rubocops/text.rb +++ b/Library/Homebrew/rubocops/text.rb @@ -54,6 +54,7 @@ module RuboCop 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 From 14261be2e53f790b0da41fba3540075c4ddd12b5 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 14 Apr 2020 12:29:17 +0100 Subject: [PATCH 3/3] workflows/tests: run brew style on taps. Also, clarify where `brew readall` is run. --- .github/workflows/tests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 76ad3624bb..5863f20f39 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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