Skip to content

Conversation

@MikeMcQuaid
Copy link
Member

Otherwise you can't really keep them set globally.

Otherwise you can't really keep them set globally.
Copilot AI review requested due to automatic review settings January 13, 2026 12:33
@MikeMcQuaid MikeMcQuaid enabled auto-merge January 13, 2026 12:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where setting HOMEBREW_BUNDLE_CHECK or HOMEBREW_BUNDLE_NO_SECRETS environment variables globally would prevent using brew bundle with incompatible subcommands. The change allows these environment variables to bypass the usage validation that would otherwise raise errors.

Changes:

  • Modified validation logic for --check flag to skip validation when HOMEBREW_BUNDLE_CHECK is set via environment variable
  • Modified validation logic for --no-secrets flag to skip validation when HOMEBREW_BUNDLE_NO_SECRETS is set via environment variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

end

if args.check? && BUNDLE_EXEC_COMMANDS.exclude?(subcommand)
if args.check? && !ENV["HOMEBREW_BUNDLE_NO_CHECK"] && BUNDLE_EXEC_COMMANDS.exclude?(subcommand)
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable check does not follow Homebrew's standard pattern for boolean environment variables. The expression !ENV["HOMEBREW_BUNDLE_NO_CHECK"] will evaluate to false (thus skipping validation) for any value set in the variable, including falsy values like "false", "no", "off", or "0".

According to Homebrew's EnvConfig pattern (Library/Homebrew/env_config.rb lines 591-596), boolean environment variables should check: env_value.present? && FALSY_VALUES.exclude?(env_value.downcase) where FALSY_VALUES includes "false", "no", "off", "nil", and "0".

Consider implementing this check consistently with other Homebrew boolean environment variables to avoid unexpected behavior when users set the variable to "0" or "false".

Copilot uses AI. Check for mistakes.
end

if args.no_secrets? && BUNDLE_EXEC_COMMANDS.exclude?(subcommand)
if args.no_secrets? && !ENV["HOMEBREW_BUNDLE_NO_SECRETS"] && BUNDLE_EXEC_COMMANDS.exclude?(subcommand)
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable check does not follow Homebrew's standard pattern for boolean environment variables. The expression !ENV["HOMEBREW_BUNDLE_NO_SECRETS"] will evaluate to false (thus skipping validation) for any value set in the variable, including falsy values like "false", "no", "off", or "0".

According to Homebrew's EnvConfig pattern (Library/Homebrew/env_config.rb lines 591-596), boolean environment variables should check: env_value.present? && FALSY_VALUES.exclude?(env_value.downcase) where FALSY_VALUES includes "false", "no", "off", "nil", and "0".

Consider implementing this check consistently with other Homebrew boolean environment variables to avoid unexpected behavior when users set the variable to "0" or "false".

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants