From ecd96a2c519f14864c0644af3b7279d3745da313 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 26 Apr 2024 15:24:12 +0100 Subject: [PATCH] utils/analytics: revert a test-bot analytics change. https://github.com/Homebrew/brew/pull/17154#discussion_r1581102553 was ignored by auto-merge, whoops. --- Library/Homebrew/utils/analytics.rb | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index 56eba82fc1053..6477c4f58e785 100644 --- a/Library/Homebrew/utils/analytics.rb +++ b/Library/Homebrew/utils/analytics.rb @@ -144,23 +144,13 @@ def report_test_bot_test(step_command_short, passed) os: HOMEBREW_SYSTEM, } + # Strip out any flag values to reduce cardinality and preserve privacy. + # Sort options to ensure consistent ordering and improve readability. command_and_package, options = step_command_short.split + .map { |arg| arg.sub(/=.*/, "=") } .partition { |arg| !arg.start_with?("-") } - - # Strip out any flag values to reduce cardinality and preserve privacy. - # Sort options to ensure consistent ordering and improve readability. - options = options.join(" ") - .split - .join(" ") - .split(/(-+)/) - .map { |a| a.sub(/[ =].+/, " ") } - .join(" ") - .strip - .split - .sort - - command = (command_and_package + options).join(" ") + command = (command_and_package + options.sort).join(" ") # Fields can have high cardinality. fields = { command: }