From f0084e611ae5cbebb66bebc8391bf9edd57ff3f6 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 28 Jul 2024 17:15:56 +0100 Subject: [PATCH] rubocops/text: Allow all "#{bin}/foo" interpolated strings with spaces - This was complaining about `shell_output("#{bin}/abricate-get_db --help 2>&1")` which it shouldn't have. --- Library/Homebrew/rubocops/text.rb | 2 ++ Library/Homebrew/test/rubocops/text/strict_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Library/Homebrew/rubocops/text.rb b/Library/Homebrew/rubocops/text.rb index 8955a6d31e..fe32fc3260 100644 --- a/Library/Homebrew/rubocops/text.rb +++ b/Library/Homebrew/rubocops/text.rb @@ -158,6 +158,8 @@ module RuboCop end def path_starts_with_bin?(path, starts_with) + return false if path.include?(" ") + path_starts_with?(path, starts_with, bin: true) end diff --git a/Library/Homebrew/test/rubocops/text/strict_spec.rb b/Library/Homebrew/test/rubocops/text/strict_spec.rb index 92bca3593d..b5d6bba278 100644 --- a/Library/Homebrew/test/rubocops/text/strict_spec.rb +++ b/Library/Homebrew/test/rubocops/text/strict_spec.rb @@ -150,6 +150,8 @@ RSpec.describe RuboCop::Cop::FormulaAuditStrict::Text do class Foo < Formula test do shell_output("\#{bin}/foo --version") + assert_match "help", shell_output("\#{bin}/foo-something --help 2>&1") + assert_match "OK", shell_output("\#{bin}/foo-something_else --check 2>&1") end end RUBY