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

utils/analytics: cleanup test-bot analytics. #17154

Merged
merged 1 commit into from
Apr 26, 2024
Merged
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
19 changes: 16 additions & 3 deletions Library/Homebrew/utils/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,23 @@
os: HOMEBREW_SYSTEM,
}

command_and_package, options =
step_command_short.split
.partition { |arg| !arg.start_with?("-") }

# Strip out any flag values to reduce cardinality and preserve privacy.
command = step_command_short.split
.map { |arg| arg.sub(/=.*/, "=") }
.join(" ")
# Sort options to ensure consistent ordering and improve readability.
options = options.join(" ")
.split
.join(" ")
.split(/(-+)/)
.map { |a| a.sub(/[ =].+/, " ") }

Check warning on line 157 in Library/Homebrew/utils/analytics.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/analytics.rb#L157

Added line #L157 was not covered by tests
.join(" ")
.strip
.split
.sort

command = (command_and_package + options).join(" ")

# Fields can have high cardinality.
fields = { command: }
Expand Down