text
stringlengths
19
585k
label
stringclasses
2 values
category
stringclasses
2 values
language
stringclasses
14 values
repo
stringclasses
932 values
sha
stringlengths
40
40
@@ -207,122 +209,102 @@ impl ApiProvider { #[must_use] pub fn parse(value: &str) -> Option<Self> { - match value.trim().to_ascii_lowercase().as_str() { - "deepseek" | "deep-seek" => Some(Self::Deepseek), - "deepseek-cn" | "deepseek_china" | "deepseekcn" | "deepseek-china" => { -...
bad
review
rust
Hmbown/CodeWhale
f64cf6f0ff79bbfcfc53600e2922e3a077c90e73
diff --git a/crates/tui/src/config.rs b/crates/tui/src/config.rs index 140c8f803..fdca413bc 100644 --- a/crates/tui/src/config.rs +++ b/crates/tui/src/config.rs @@ -212,126 +212,105 @@ impl ApiProvider { #[must_use] pub fn parse(value: &str) -> Option<Self> { - match value.trim().to_ascii_lowercase()...
good
review_fixed
rust
Hmbown/CodeWhale
f64cf6f0ff79bbfcfc53600e2922e3a077c90e73
@@ -87,25 +90,28 @@ class GenerateZap < AbstractCommand def run input = args.named.fetch(0) - app_name = if args.name? - input + patterns = if args.name? + [input] else - resolve_app_name_from_cask(input) + resolve_patterns_from_cask(input) ...
bad
review
ruby
Homebrew/brew
8afc96d27677fd234eaa226f04b3cd11935347ff
diff --git a/Library/Homebrew/dev-cmd/generate-zap.rb b/Library/Homebrew/dev-cmd/generate-zap.rb index e9ca72c5ee171..43075520ae191 100644 --- a/Library/Homebrew/dev-cmd/generate-zap.rb +++ b/Library/Homebrew/dev-cmd/generate-zap.rb @@ -3,10 +3,13 @@ require "abstract_command" require "cask/cask_loader" +require "s...
good
review_fixed
ruby
Homebrew/brew
8afc96d27677fd234eaa226f04b3cd11935347ff
@@ -87,25 +90,28 @@ class GenerateZap < AbstractCommand def run input = args.named.fetch(0) - app_name = if args.name? - input + patterns = if args.name? + [input] else - resolve_app_name_from_cask(input) + resolve_patterns_from_cask(input) ...
bad
review
ruby
Homebrew/brew
8afc96d27677fd234eaa226f04b3cd11935347ff
diff --git a/Library/Homebrew/dev-cmd/generate-zap.rb b/Library/Homebrew/dev-cmd/generate-zap.rb index e9ca72c5ee171..43075520ae191 100644 --- a/Library/Homebrew/dev-cmd/generate-zap.rb +++ b/Library/Homebrew/dev-cmd/generate-zap.rb @@ -3,10 +3,13 @@ require "abstract_command" require "cask/cask_loader" +require "s...
good
review_fixed
ruby
Homebrew/brew
8afc96d27677fd234eaa226f04b3cd11935347ff
@@ -87,25 +90,28 @@ class GenerateZap < AbstractCommand def run input = args.named.fetch(0) - app_name = if args.name? - input + patterns = if args.name? + [input] else - resolve_app_name_from_cask(input) + resolve_patterns_from_cask(input) ...
bad
review
ruby
Homebrew/brew
8afc96d27677fd234eaa226f04b3cd11935347ff
diff --git a/Library/Homebrew/dev-cmd/generate-zap.rb b/Library/Homebrew/dev-cmd/generate-zap.rb index e9ca72c5ee171..43075520ae191 100644 --- a/Library/Homebrew/dev-cmd/generate-zap.rb +++ b/Library/Homebrew/dev-cmd/generate-zap.rb @@ -3,10 +3,13 @@ require "abstract_command" require "cask/cask_loader" +require "s...
good
review_fixed
ruby
Homebrew/brew
8afc96d27677fd234eaa226f04b3cd11935347ff
@@ -115,19 +121,33 @@ def run private - sig { params(token: String).returns(String) } - def resolve_app_name_from_cask(token) + sig { params(token: String).returns(T::Array[String]) } + def resolve_patterns_from_cask(token) cask = Cask::CaskLoader.load(token) app_artif...
bad
review
ruby
Homebrew/brew
8afc96d27677fd234eaa226f04b3cd11935347ff
diff --git a/Library/Homebrew/dev-cmd/generate-zap.rb b/Library/Homebrew/dev-cmd/generate-zap.rb index e9ca72c5ee171..43075520ae191 100644 --- a/Library/Homebrew/dev-cmd/generate-zap.rb +++ b/Library/Homebrew/dev-cmd/generate-zap.rb @@ -3,10 +3,13 @@ require "abstract_command" require "cask/cask_loader" +require "s...
good
review_fixed
ruby
Homebrew/brew
8afc96d27677fd234eaa226f04b3cd11935347ff
@@ -107,6 +107,20 @@ end end + describe "::set_variable_in_profile" do + it "supports Bash" do + ENV["SHELL"] = "/bin/bash" + expect(described_class.set_variable_in_profile("HOMEBREW_FOO", "bar")) + .to eq("echo 'export HOMEBREW_FOO=bar' >> #{described_class.profile}")
bad
review
ruby
Homebrew/brew
44f2b5ad7e21e668419f889744d98b544fa727f5
diff --git a/Library/Homebrew/test/utils/shell_spec.rb b/Library/Homebrew/test/utils/shell_spec.rb index dc088f3f006e4..35edc4226dbb9 100644 --- a/Library/Homebrew/test/utils/shell_spec.rb +++ b/Library/Homebrew/test/utils/shell_spec.rb @@ -107,6 +107,14 @@ end end + describe "::set_variable_in_profile" do +...
good
review_fixed
ruby
Homebrew/brew
44f2b5ad7e21e668419f889744d98b544fa727f5
@@ -107,6 +107,20 @@ end end + describe "::set_variable_in_profile" do + it "supports Bash" do + ENV["SHELL"] = "/bin/bash" + expect(described_class.set_variable_in_profile("HOMEBREW_FOO", "bar")) + .to eq("echo 'export HOMEBREW_FOO=bar' >> #{described_class.profile}") + end + + it ...
bad
review
ruby
Homebrew/brew
44f2b5ad7e21e668419f889744d98b544fa727f5
diff --git a/Library/Homebrew/test/utils/shell_spec.rb b/Library/Homebrew/test/utils/shell_spec.rb index dc088f3f006e4..35edc4226dbb9 100644 --- a/Library/Homebrew/test/utils/shell_spec.rb +++ b/Library/Homebrew/test/utils/shell_spec.rb @@ -107,6 +107,14 @@ end end + describe "::set_variable_in_profile" do +...
good
review_fixed
ruby
Homebrew/brew
44f2b5ad7e21e668419f889744d98b544fa727f5
@@ -89,8 +89,11 @@ # - no arguments are passed if empty_argv || help_flag require "help" + # A self-documenting external command (no `#:` comments) needs the help flag + # in ARGV so `Homebrew::Help.help` can defer to its `--help`, e.g. `brew help <cmd>`. + ARGV.push("--help") if external_cmd_path &...
bad
review
ruby
Homebrew/brew
1d6f0377bf2726b48bc4eaf75818bb4a98ba088c
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index f44dc932e1d3d..07205a3039273 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -89,8 +89,15 @@ # - no arguments are passed if empty_argv || help_flag require "help" + # `Homebrew::Help.help` may defer to a self-do...
good
review_fixed
ruby
Homebrew/brew
1d6f0377bf2726b48bc4eaf75818bb4a98ba088c
@@ -46,6 +46,16 @@ def self.help(cmd = nil, empty_argv: false, usage_error: nil, remaining_args: [] # Resume execution in `brew.rb` for unknown commands. return if path.nil? + # An external command with no `#:` comments documents itself by running its + # own `--help`, so resume execution in `...
bad
review
ruby
Homebrew/brew
1d6f0377bf2726b48bc4eaf75818bb4a98ba088c
diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index 9b3170b682806..682eeaca52c35 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -46,6 +46,15 @@ def self.help(cmd = nil, empty_argv: false, usage_error: nil, remaining_args: [] # Resume execution in `brew.rb` for unknown ...
good
review_fixed
ruby
Homebrew/brew
1d6f0377bf2726b48bc4eaf75818bb4a98ba088c
@@ -144,6 +144,38 @@ def run; end expect { brew "help", "hello-tap" } .not_to output(/^From tap:/).to_stdout end + + it "runs an external command's own `--help` when it has no `#:` comments" do + tap_path = setup_test_tap + cmd_path = tap_path/"cmd/brew-selfdoc" + cmd_path.dirname...
bad
review
ruby
Homebrew/brew
1d6f0377bf2726b48bc4eaf75818bb4a98ba088c
diff --git a/Library/Homebrew/test/cmd/help_spec.rb b/Library/Homebrew/test/cmd/help_spec.rb index 9bca5e35aa490..a81fb776e2465 100644 --- a/Library/Homebrew/test/cmd/help_spec.rb +++ b/Library/Homebrew/test/cmd/help_spec.rb @@ -144,6 +144,40 @@ def run; end expect { brew "help", "hello-tap" } .not_to o...
good
review_fixed
ruby
Homebrew/brew
1d6f0377bf2726b48bc4eaf75818bb4a98ba088c
@@ -144,6 +144,38 @@ def run; end expect { brew "help", "hello-tap" } .not_to output(/^From tap:/).to_stdout end + + it "runs an external command's own `--help` when it has no `#:` comments" do + tap_path = setup_test_tap + cmd_path = tap_path/"cmd/brew-selfdoc" + cmd_path.dirname...
bad
review
ruby
Homebrew/brew
1d6f0377bf2726b48bc4eaf75818bb4a98ba088c
diff --git a/Library/Homebrew/test/cmd/help_spec.rb b/Library/Homebrew/test/cmd/help_spec.rb index 9bca5e35aa490..a81fb776e2465 100644 --- a/Library/Homebrew/test/cmd/help_spec.rb +++ b/Library/Homebrew/test/cmd/help_spec.rb @@ -144,6 +144,40 @@ def run; end expect { brew "help", "hello-tap" } .not_to o...
good
review_fixed
ruby
Homebrew/brew
1d6f0377bf2726b48bc4eaf75818bb4a98ba088c
@@ -25,6 +25,30 @@ def initialize(url, name, version, **meta) super end + sig { override.returns(Pathname) } + def cached_location + return super unless immutable_bottle_blob? + + cached_location = @cached_location + return cached_location unless cached_location.nil? + + @cached_location = cache...
bad
review
ruby
Homebrew/brew
5b4c8af08fe4701f1ee7031ae338e43ec74f15e4
diff --git a/Library/Homebrew/download_strategy/curl_github_packages_download_strategy.rb b/Library/Homebrew/download_strategy/curl_github_packages_download_strategy.rb index b328d0c69a2c2..99bcc8859f628 100644 --- a/Library/Homebrew/download_strategy/curl_github_packages_download_strategy.rb +++ b/Library/Homebrew/dow...
good
review_fixed
ruby
Homebrew/brew
5b4c8af08fe4701f1ee7031ae338e43ec74f15e4
@@ -0,0 +1,19 @@ +# typed: strict +# frozen_string_literal: true + +require "abstract_command" +require "shell_command" + +module Homebrew + module Cmd + class SetupSandbox < AbstractCommand + include ShellCommand + + cmd_args do + description <<~EOS + Set up the Homebrew sandbox. Must be ...
bad
review
ruby
Homebrew/brew
a642916b83d69821b804fb80c7f0b2db15c86544
diff --git a/Library/Homebrew/cmd/setup-sandbox.rb b/Library/Homebrew/cmd/setup-sandbox.rb new file mode 100644 index 0000000000000..ace0d09277fab --- /dev/null +++ b/Library/Homebrew/cmd/setup-sandbox.rb @@ -0,0 +1,20 @@ +# typed: strict +# frozen_string_literal: true + +require "abstract_command" +require "shell_comm...
good
review_fixed
ruby
Homebrew/brew
a642916b83d69821b804fb80c7f0b2db15c86544
@@ -0,0 +1,46 @@ +# Documentation defined in Library/Homebrew/cmd/setup-sandbox.rb + +# GITHUB_ACTIONS is set by the GitHub Actions runner. +# This Bubblewrap installation mirrors the package manager approaches in +# https://github.com/Homebrew/install and the Homebrew formula fallback in +# `ensure_sandbox_installed!`...
bad
review
Homebrew/brew
a642916b83d69821b804fb80c7f0b2db15c86544
diff --git a/Library/Homebrew/cmd/setup-sandbox.sh b/Library/Homebrew/cmd/setup-sandbox.sh new file mode 100644 index 0000000000000..87c764528b24d --- /dev/null +++ b/Library/Homebrew/cmd/setup-sandbox.sh @@ -0,0 +1,53 @@ +# Documentation defined in Library/Homebrew/cmd/setup-sandbox.rb + +# This Bubblewrap installatio...
good
review_fixed
Homebrew/brew
a642916b83d69821b804fb80c7f0b2db15c86544
@@ -2893,7 +2893,8 @@ def missing_dependencies(hide: []) # A dep is "missing" if it's in the hide list (pretend uninstalled) or # genuinely not installed in the cellar. base_name = Utils.name_from_full_name(full_name) - next if hide.exclude?(base_name) && (HOMEBREW_CELLAR/base_name).directory?...
bad
review
ruby
Homebrew/brew
9119819bf6a79a842c173aa76b0ebd7a4132bb30
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 8e41a4e034024..9eec286e8f76a 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2893,7 +2893,8 @@ def missing_dependencies(hide: []) # A dep is "missing" if it's in the hide list (pretend uninstalled) or ...
good
review_fixed
ruby
Homebrew/brew
9119819bf6a79a842c173aa76b0ebd7a4132bb30
@@ -11,20 +11,37 @@ homebrew-which-formula() { case "$1" in --explain) HOMEBREW_EXPLAIN=1 - shift ;; + -\? | -h | --help | --usage) + brew help which-formula + return $? + ;; + --verbose) : ;; + --debug) HOMEBREW_DEBUG=1 ;; + --quiet) : ;; ...
bad
review
Homebrew/brew
62b3a44e8bd9fdf10670ebdcdd9f1df060e3473a
diff --git a/Library/Homebrew/cmd/which-formula.sh b/Library/Homebrew/cmd/which-formula.sh index 8e4c70dbe1677..6a4f9b06559de 100644 --- a/Library/Homebrew/cmd/which-formula.sh +++ b/Library/Homebrew/cmd/which-formula.sh @@ -1,6 +1,7 @@ # Documentation defined in Library/Homebrew/cmd/which-formula.rb # shellcheck d...
good
review_fixed
Homebrew/brew
62b3a44e8bd9fdf10670ebdcdd9f1df060e3473a
@@ -11,20 +11,37 @@ homebrew-which-formula() { case "$1" in --explain) HOMEBREW_EXPLAIN=1 - shift ;; + -\? | -h | --help | --usage) + brew help which-formula + return $? + ;; + --verbose) : ;; + --debug) HOMEBREW_DEBUG=1 ;; + --quiet) : ;;
bad
review
Homebrew/brew
62b3a44e8bd9fdf10670ebdcdd9f1df060e3473a
diff --git a/Library/Homebrew/cmd/which-formula.sh b/Library/Homebrew/cmd/which-formula.sh index 8e4c70dbe1677..6a4f9b06559de 100644 --- a/Library/Homebrew/cmd/which-formula.sh +++ b/Library/Homebrew/cmd/which-formula.sh @@ -1,6 +1,7 @@ # Documentation defined in Library/Homebrew/cmd/which-formula.rb # shellcheck d...
good
review_fixed
Homebrew/brew
62b3a44e8bd9fdf10670ebdcdd9f1df060e3473a
@@ -223,23 +223,77 @@ def deny_read_home ENV.fetch("RUNNER_TEMP", nil), Homebrew::Trust.trust_file, *home_write_paths.select { |path| File.exist?(path) }, - ].compact.flat_map do |path| + ].compact.any? do |path| path = Pathname(path) - [path.expand_path, (path.realpath if path.ex...
bad
review
ruby
Homebrew/brew
315b280a203a687418fc59a08adaac7147495797
diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index bbf06f0549a2f..b33351cafd908 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -212,7 +212,7 @@ def deny_read_path(path) sig { void } def deny_read_home home = Pathname(Dir.home(ENV.fetch("USER"))).realpa...
good
review_fixed
ruby
Homebrew/brew
315b280a203a687418fc59a08adaac7147495797
@@ -293,60 +293,103 @@ def executable_usable?(candidate) expect(sandbox.send(:profile).rules).to be_empty end - it "denies every home entry except the directories Homebrew needs" do + it "denies known sensitive home paths when Homebrew needs home access" do cache = home/"Library/Caches/Homebr...
bad
review
ruby
Homebrew/brew
315b280a203a687418fc59a08adaac7147495797
diff --git a/Library/Homebrew/test/sandbox_shared_spec.rb b/Library/Homebrew/test/sandbox_shared_spec.rb index 11111eb82da4d..165ec3c0ec721 100644 --- a/Library/Homebrew/test/sandbox_shared_spec.rb +++ b/Library/Homebrew/test/sandbox_shared_spec.rb @@ -293,60 +293,120 @@ def executable_usable?(candidate) expect(...
good
review_fixed
ruby
Homebrew/brew
315b280a203a687418fc59a08adaac7147495797
@@ -3738,18 +3744,23 @@ def exec_cmd(cmd, args, out, log_filename) exit! 1 # never gets here unless exec threw or failed end - # Common environment variables used at both build and test time. + # Common environment variables used by sandboxed build, test and postinstall phases. sig { params(home: Pathnam...
bad
review
ruby
Homebrew/brew
bfd1209e3551c5bf64c3ff70b92349d5c00f121a
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 8e41a4e034024..715096154e502 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1662,7 +1662,6 @@ def run_post_install TMPDIR: HOMEBREW_TEMP, TEMP: HOMEBREW_TEMP, TMP: ...
good
review_fixed
ruby
Homebrew/brew
bfd1209e3551c5bf64c3ff70b92349d5c00f121a
@@ -304,22 +304,36 @@ def run skip_link: args.skip_link?, ) - dependants = Upgrade.dependants( - installed_formulae, - flags: args.flags_only, - ask: ask, - installed_on_request: !args.as_...
bad
review
ruby
Homebrew/brew
a40d2df7f5536d09333bdd6bee023d8126ff7b2d
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 194be044f1acd..89b7df85907ca 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -304,22 +304,35 @@ def run skip_link: args.skip_link?, ) - dependants = Up...
good
review_fixed
ruby
Homebrew/brew
a40d2df7f5536d09333bdd6bee023d8126ff7b2d
@@ -193,22 +193,34 @@ def run ) end - dependants = Upgrade.dependants( - formulae, - flags: args.flags_only, - ask: ask, - force_bottle: args.force_bottle?, - build_from_so...
bad
review
ruby
Homebrew/brew
a40d2df7f5536d09333bdd6bee023d8126ff7b2d
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 9bc3720686887..2dfbd9d1aa624 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -193,22 +193,33 @@ def run ) end - dependants = Upgrade.dependants( - ...
good
review_fixed
ruby
Homebrew/brew
a40d2df7f5536d09333bdd6bee023d8126ff7b2d
@@ -304,22 +304,36 @@ def run skip_link: args.skip_link?, ) - dependants = Upgrade.dependants( - installed_formulae, - flags: args.flags_only, - ask: ask, - installed_on_request: !args.as_...
bad
review
ruby
Homebrew/brew
a40d2df7f5536d09333bdd6bee023d8126ff7b2d
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 194be044f1acd..89b7df85907ca 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -304,22 +304,35 @@ def run skip_link: args.skip_link?, ) - dependants = Up...
good
review_fixed
ruby
Homebrew/brew
a40d2df7f5536d09333bdd6bee023d8126ff7b2d
@@ -193,22 +193,34 @@ def run ) end - dependants = Upgrade.dependants( - formulae, - flags: args.flags_only, - ask: ask, - force_bottle: args.force_bottle?, - build_from_so...
bad
review
ruby
Homebrew/brew
a40d2df7f5536d09333bdd6bee023d8126ff7b2d
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 9bc3720686887..2dfbd9d1aa624 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -193,22 +193,33 @@ def run ) end - dependants = Upgrade.dependants( - ...
good
review_fixed
ruby
Homebrew/brew
a40d2df7f5536d09333bdd6bee023d8126ff7b2d
@@ -408,7 +411,11 @@ def run(*args) # @api private sig { params(path: T.any(String, Pathname), type: Symbol).returns(SandboxPathFilter) } def path_filter(path, type) - invalid_char = ['"', "'", "(", ")", "\n", "\\"].find do |c| + # Parentheses and single quotes are safe inside double-quoted seatbelt + ...
bad
review
ruby
Homebrew/brew
677b433222972287ff113b680e32c30a03d24897
diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index 6ba86884bd6d5..bbf06f0549a2f 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -5,6 +5,7 @@ require "pty" require "tempfile" require "exceptions" +require "trust" require "utils/fork" require "utils/output" @...
good
review_fixed
ruby
Homebrew/brew
677b433222972287ff113b680e32c30a03d24897
@@ -60,6 +60,38 @@ def self.untrust!(type, name) end end + sig { params(name: String, remote: T.nilable(String)).returns(T::Boolean) } + def self.invalidate_tap_references!(name, remote: nil) + name = normalise_name(name) + references = [name] + references << normalise_name(remote) if...
bad
review
ruby
Homebrew/brew
1717af5d68524c9ed69c210665d4040bca65d296
diff --git a/Library/Homebrew/trust.rb b/Library/Homebrew/trust.rb index 8fc1545cb0edd..e1f1e378362ef 100644 --- a/Library/Homebrew/trust.rb +++ b/Library/Homebrew/trust.rb @@ -60,6 +60,38 @@ def self.untrust!(type, name) end end + sig { params(name: String, remote: T.nilable(String)).returns(T::Boolea...
good
review_fixed
ruby
Homebrew/brew
1717af5d68524c9ed69c210665d4040bca65d296
@@ -167,6 +170,60 @@ def run private + sig { returns(T::Boolean) } + def fetch_api_formula_bottles? + return false if Homebrew::EnvConfig.no_install_from_api? + return false if args.only_formula_or_cask == :cask + return false if args.deps? || args.HEAD? + return false i...
bad
review
ruby
Homebrew/brew
a07da124a28a1f6b21f50766344f6424d25ae4ad
diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 0f47010ef0019..db8aae55d274d 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -4,6 +4,7 @@ require "abstract_command" require "formula" require "fetch" +require "api/formula_bottle" require "cask/config...
good
review_fixed
ruby
Homebrew/brew
a07da124a28a1f6b21f50766344f6424d25ae4ad
@@ -104,6 +104,20 @@ def self.configure! reset_state! end + sig { params(command: T.any(String, Pathname), writable_path: T.any(String, Pathname), deny_network: T::Boolean).void } + def self.run_command(*command, writable_path:, deny_network: false) + ensure_sandbox_installed! + raise failure_reason |...
bad
review
ruby
Homebrew/brew
c70e39541e12c1fca4c61725fa000a5d5303b31d
diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index fc837e80a6a02..6ee9a6dad1b3a 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -4,6 +4,7 @@ require "io/console" require "pty" require "tempfile" +require "exceptions" require "utils/fork" require "utils/output...
good
review_fixed
ruby
Homebrew/brew
c70e39541e12c1fca4c61725fa000a5d5303b31d
@@ -143,6 +143,13 @@ .and(output("Error: `--formulae` requires a comma-separated formula list.\n").to_stderr), ) + expect do + expect(brew_sh("exec", "--sandbox=", executable_name, brew_sh_env)).to be_a_failure + end.to( + output("").to_stdout + .and(output("Error: `...
bad
review
ruby
Homebrew/brew
c70e39541e12c1fca4c61725fa000a5d5303b31d
diff --git a/Library/Homebrew/test/cmd/exec_spec.rb b/Library/Homebrew/test/cmd/exec_spec.rb index 2a14d0101f182..4ebd176667a25 100644 --- a/Library/Homebrew/test/cmd/exec_spec.rb +++ b/Library/Homebrew/test/cmd/exec_spec.rb @@ -143,6 +143,13 @@ .and(output("Error: `--formulae` requires a comma-separated for...
good
review_fixed
ruby
Homebrew/brew
c70e39541e12c1fca4c61725fa000a5d5303b31d
@@ -0,0 +1,39 @@ +# typed: strict +# frozen_string_literal: true + +require "abstract_command" +require "sandbox" + +module Homebrew + module Cmd + class SandboxExec < AbstractCommand + cmd_args do + usage_banner <<~EOS + `sandbox-exec` [`--deny-network`] <writable-path> [`--`] <command> [<args...
bad
review
ruby
Homebrew/brew
c70e39541e12c1fca4c61725fa000a5d5303b31d
diff --git a/Library/Homebrew/cmd/sandbox-exec.rb b/Library/Homebrew/cmd/sandbox-exec.rb new file mode 100644 index 0000000000000..2c856cdbfad1e --- /dev/null +++ b/Library/Homebrew/cmd/sandbox-exec.rb @@ -0,0 +1,39 @@ +# typed: strict +# frozen_string_literal: true + +require "abstract_command" +require "sandbox" + +m...
good
review_fixed
ruby
Homebrew/brew
c70e39541e12c1fca4c61725fa000a5d5303b31d
@@ -160,20 +162,24 @@ __brew_internal_command_alias() { # https://github.com/Homebrew/homebrew-aliases __brew_list_aliases() { - local aliases_dir="${HOME}/.brew-aliases" - local pattern="^# alias: brew ([[:alnum:]-]+)$" + local aliases_dir="${HOME}/.config/brew-aliases" + local pattern="^# alias: brew ([^[:spa...
bad
review
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
diff --git a/Library/Homebrew/completions/bash.erb b/Library/Homebrew/completions/bash.erb index b1d942329496a..4cf86396cbb28 100644 --- a/Library/Homebrew/completions/bash.erb +++ b/Library/Homebrew/completions/bash.erb @@ -114,6 +114,7 @@ __brew_complete_commands() { local cur="${COMP_WORDS[COMP_CWORD]}" local ...
good
review_fixed
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
@@ -163,20 +165,24 @@ __brew_internal_command_alias() { # https://github.com/Homebrew/homebrew-aliases __brew_list_aliases() { - local aliases_dir="${HOME}/.brew-aliases" - local pattern="^# alias: brew ([[:alnum:]-]+)$" + local aliases_dir="${HOME}/.config/brew-aliases" + local pattern="^# alias: brew ([^[:spa...
bad
review
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
diff --git a/completions/bash/brew b/completions/bash/brew index 67a4122cbc3af..d7d6e56504e17 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -99,6 +99,7 @@ __brew_complete_commands() { local cur="${COMP_WORDS[COMP_CWORD]}" local cmds local maintainer_cmds + local user_aliases if [[ -n ...
good
review_fixed
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
@@ -35,6 +35,29 @@ __brew_list_aliases() { echo "${aliases}" } +__brew_user_aliases() { + local aliases_dir="${HOME}/.config/brew-aliases" + local pattern="^# alias: brew ([^[:space:]]+)$" + local file line alias_name + local -a aliases + + [[ ! -d ${aliases_dir} ]] && aliases_dir="${HOME}/.brew-aliases" + ...
bad
review
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
diff --git a/Library/Homebrew/completions/zsh.erb b/Library/Homebrew/completions/zsh.erb index c3ba83336d3ff..7c8e2d14acb14 100644 --- a/Library/Homebrew/completions/zsh.erb +++ b/Library/Homebrew/completions/zsh.erb @@ -35,6 +35,29 @@ __brew_list_aliases() { echo "${aliases}" } +__brew_user_aliases() { + local ...
good
review_fixed
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
@@ -38,6 +38,29 @@ __brew_list_aliases() { echo "${aliases}" } +__brew_user_aliases() { + local aliases_dir="${HOME}/.config/brew-aliases" + local pattern="^# alias: brew ([^[:space:]]+)$" + local file line alias_name + local -a aliases + + [[ ! -d ${aliases_dir} ]] && aliases_dir="${HOME}/.brew-aliases" + ...
bad
review
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 82ae4124861ea..d795d4aa960d8 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -38,6 +38,29 @@ __brew_list_aliases() { echo "${aliases}" } +__brew_user_aliases() { + local aliases_dir="${HOME}/.config/brew-aliases" + local pattern=...
good
review_fixed
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
@@ -156,6 +156,24 @@ function __fish_brew_suggest_taps_installed -d "List all available taps" | string replace (brew --repo)/Library/Taps/ "" end +function __fish_brew_suggest_aliases -d "Lists user-defined aliases" + set -l aliases_dir "$HOME/.config/brew-aliases" + test -d $aliases_dir; or set aliases_d...
bad
review
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
diff --git a/Library/Homebrew/completions/fish.erb b/Library/Homebrew/completions/fish.erb index 1e35b9a609f39..5da72187dadbd 100644 --- a/Library/Homebrew/completions/fish.erb +++ b/Library/Homebrew/completions/fish.erb @@ -156,6 +156,25 @@ function __fish_brew_suggest_taps_installed -d "List all available taps" ...
good
review_fixed
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
@@ -178,6 +178,24 @@ function __fish_brew_suggest_taps_installed -d "List all available taps" | string replace (brew --repo)/Library/Taps/ "" end +function __fish_brew_suggest_aliases -d "Lists user-defined aliases" + set -l aliases_dir "$HOME/.config/brew-aliases" + test -d $aliases_dir; or set aliases_d...
bad
review
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index dcf5618d9be1f..9c83679e5aece 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -178,6 +178,25 @@ function __fish_brew_suggest_taps_installed -d "List all available taps" | string replace (brew --repo)/Library/Taps/...
good
review_fixed
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
@@ -395,13 +395,17 @@ def stub_nested_completion_command(command, subcommands) expect(file).to match(/^complete -o bashdefault -o default -F _brew brew$/) end - it "doesn't add aliases to command completions" do + it "doesn't add internal aliases to command completions" do file = de...
bad
review
ruby
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
diff --git a/Library/Homebrew/test/completions_spec.rb b/Library/Homebrew/test/completions_spec.rb index a83bd33847d67..256047ddeb219 100644 --- a/Library/Homebrew/test/completions_spec.rb +++ b/Library/Homebrew/test/completions_spec.rb @@ -395,13 +395,18 @@ def stub_nested_completion_command(command, subcommands) ...
good
review_fixed
ruby
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
@@ -481,11 +485,15 @@ def stub_nested_completion_command(command, subcommands) expect(completion).to include("*:service:__brew_services") end - it "doesn't generate alias completion functions" do + it "doesn't generate internal alias completion functions" do file = described_class.g...
bad
review
ruby
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
diff --git a/Library/Homebrew/test/completions_spec.rb b/Library/Homebrew/test/completions_spec.rb index a83bd33847d67..256047ddeb219 100644 --- a/Library/Homebrew/test/completions_spec.rb +++ b/Library/Homebrew/test/completions_spec.rb @@ -395,13 +395,18 @@ def stub_nested_completion_command(command, subcommands) ...
good
review_fixed
ruby
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
@@ -591,10 +599,14 @@ def stub_nested_completion_command(command, subcommands) expect(file).to match(/^__fish_brew_complete_cmd 'update' 'Fetch the newest version of Homebrew .*'$/) end - it "omits aliases from command completions" do + it "omits internal aliases from command completions" do...
bad
review
ruby
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
diff --git a/Library/Homebrew/test/completions_spec.rb b/Library/Homebrew/test/completions_spec.rb index a83bd33847d67..256047ddeb219 100644 --- a/Library/Homebrew/test/completions_spec.rb +++ b/Library/Homebrew/test/completions_spec.rb @@ -395,13 +395,18 @@ def stub_nested_completion_command(command, subcommands) ...
good
review_fixed
ruby
Homebrew/brew
dea60f17d95ff007d89c71ebe100a8abc57ed26a
@@ -288,16 +308,16 @@ def self.trust_name(type, name, include_existing: false) end private_class_method :trust_name - # Per-item trust cannot be created for custom-remote taps (trust the whole tap by URL); existing - # entries are still resolvable so `brew untrust` (`include_existing`) can remove lega...
bad
review
ruby
Homebrew/brew
b80ca424184087b1154cae77ed75d11427f0ca0b
diff --git a/Library/Homebrew/trust.rb b/Library/Homebrew/trust.rb index 8fc1545cb0edd..05ea546a82e21 100644 --- a/Library/Homebrew/trust.rb +++ b/Library/Homebrew/trust.rb @@ -45,10 +45,18 @@ def self.trust!(type, name) def self.untrust!(type, name) key = setting_key(type) name = normalise_name(name...
good
review_fixed
ruby
Homebrew/brew
b80ca424184087b1154cae77ed75d11427f0ca0b
@@ -506,26 +506,36 @@ def final_upgrade_summary @final_upgrade_summary end - sig { params(context: FormulaeUpgradeContext, include_sizes: T::Boolean).void } - def record_formula_upgrade_summary(context, include_sizes: false) + sig { + params( + context: Formul...
bad
review
ruby
Homebrew/brew
22ba10e9d942ecd2d9b7a42b71fc0f324bc6098f
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index da79100d7eaaf..99621f05290a3 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -506,13 +506,23 @@ def final_upgrade_summary @final_upgrade_summary end - sig { params(context: F...
good
review_fixed
ruby
Homebrew/brew
22ba10e9d942ecd2d9b7a42b71fc0f324bc6098f
@@ -712,6 +729,16 @@ def upgrade_outdated_formulae!(formulae, prefetch_only: false, use_prefetched: f skip_formula_names: ) + unless dry_run + record_formula_upgrade_summary( + context, + formulae_installer: upgraded_formula_installers, + version_ch...
bad
review
ruby
Homebrew/brew
22ba10e9d942ecd2d9b7a42b71fc0f324bc6098f
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index da79100d7eaaf..99621f05290a3 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -506,13 +506,23 @@ def final_upgrade_summary @final_upgrade_summary end - sig { params(context: F...
good
review_fixed
ruby
Homebrew/brew
22ba10e9d942ecd2d9b7a42b71fc0f324bc6098f
@@ -454,6 +435,23 @@ def path_filter(path, type) sig { returns(T.nilable(Time)) } attr_reader :start + sig { params(dir: Pathname, required: T::Array[Pathname]).void } + def deny_read_home_except(dir, required) + dir.children.each do |child| + next if required.include?(child) + + # Only descend i...
bad
review
ruby
Homebrew/brew
080ffb3d1bdeeea3213650d0382cd3095285176c
diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index fc837e80a6a02..0a855198eab70 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -190,7 +190,7 @@ def deny_read_path(path) sig { void } def deny_read_home home = Pathname(Dir.home(ENV.fetch("USER"))).realpa...
good
review_fixed
ruby
Homebrew/brew
080ffb3d1bdeeea3213650d0382cd3095285176c
@@ -225,23 +225,17 @@ def executable_usable?(candidate) expect(sandbox.send(:profile).rules).to be_empty end - it "denies sensitive home paths when the real home cannot be denied" do - [".ssh", "Documents", "Library/Keychains", "Library/Mobile Documents", "Dropbox"].each do |directory| - (h...
bad
review
ruby
Homebrew/brew
080ffb3d1bdeeea3213650d0382cd3095285176c
diff --git a/Library/Homebrew/test/sandbox_shared_spec.rb b/Library/Homebrew/test/sandbox_shared_spec.rb index 537160694b705..4642c3abf6479 100644 --- a/Library/Homebrew/test/sandbox_shared_spec.rb +++ b/Library/Homebrew/test/sandbox_shared_spec.rb @@ -225,25 +225,32 @@ def executable_usable?(candidate) expect(s...
good
review_fixed
ruby
Homebrew/brew
080ffb3d1bdeeea3213650d0382cd3095285176c
@@ -5,7 +5,7 @@ "hooks": [ { "type": "command", - "command": "./bin/brew lgtm", + "command": "./bin/brew lgtm >&2 && printf '{\"continue\":true}'",
bad
review
Homebrew/brew
31face5ea1a55d70f20e568a04eebd450c557730
diff --git a/.codex/hooks.json b/.codex/hooks.json index 75c947cdca1ca..5374b0e628cce 100644 --- a/.codex/hooks.json +++ b/.codex/hooks.json @@ -5,7 +5,7 @@ "hooks": [ { "type": "command", - "command": "./bin/brew lgtm", + "command": "./bin/brew lgtm >&2 && printf ...
good
review_fixed
Homebrew/brew
31face5ea1a55d70f20e568a04eebd450c557730
@@ -148,6 +148,34 @@ class #{Formulary.class_s(name)} < Formula ).to_stderr end + it "does not summarize dry-run formula upgrades blocked by pinned dependencies" do + write_formula "pinned-dep", <<~RUBY + url "https://brew.sh/pinned-dep-2.0" + RUBY + install_formula_version "pinned-dep", "1.0...
bad
review
ruby
Homebrew/brew
7d153019827a70e4d9d238084cb1d505c31889d0
diff --git a/Library/Homebrew/test/cmd/upgrade_spec.rb b/Library/Homebrew/test/cmd/upgrade_spec.rb index 1b16fbe0a38e4..16af6dd2625af 100644 --- a/Library/Homebrew/test/cmd/upgrade_spec.rb +++ b/Library/Homebrew/test/cmd/upgrade_spec.rb @@ -48,6 +48,20 @@ class #{Formulary.class_s(name)} < Formula end end + ...
good
review_fixed
ruby
Homebrew/brew
7d153019827a70e4d9d238084cb1d505c31889d0
@@ -112,17 +112,28 @@ def formula_installers( installers.filter_map do |fi| fi.determine_bottle_tab_attributes - all_runtime_deps_installed = fi.bottle_tab_runtime_dependencies.presence&.all? do |dependency, hash| - minimum_version = if (version = hash["version"]) - ...
bad
review
ruby
Homebrew/brew
7d153019827a70e4d9d238084cb1d505c31889d0
diff --git a/Library/Homebrew/upgrade.rb b/Library/Homebrew/upgrade.rb index 6ae19233e6c53..1014f5afa093e 100644 --- a/Library/Homebrew/upgrade.rb +++ b/Library/Homebrew/upgrade.rb @@ -112,17 +112,28 @@ def formula_installers( installers.filter_map do |fi| fi.determine_bottle_tab_attributes - ...
good
review_fixed
ruby
Homebrew/brew
7d153019827a70e4d9d238084cb1d505c31889d0
@@ -455,6 +455,113 @@ def audit_formula(formula_nodes) EOS end + # This cop makes sure that Java versions are consistent. + class JavaVersions < FormulaCop + extend AutoCorrector + + sig { override.params(formula_nodes: FormulaNodes).void } + def audit_formula(formula_no...
bad
review
ruby
Homebrew/brew
1e8a93f20cd939263cd0c892f181f688cdb36899
diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index eacd0fee9d3f0..ebaa42871c75c 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -455,6 +455,127 @@ def audit_formula(formula_nodes) EOS end + # This cop makes sure t...
good
review_fixed
ruby
Homebrew/brew
1e8a93f20cd939263cd0c892f181f688cdb36899
@@ -455,6 +455,113 @@ def audit_formula(formula_nodes) EOS end + # This cop makes sure that Java versions are consistent. + class JavaVersions < FormulaCop + extend AutoCorrector + + sig { override.params(formula_nodes: FormulaNodes).void } + def audit_formula(formula_no...
bad
review
ruby
Homebrew/brew
1e8a93f20cd939263cd0c892f181f688cdb36899
diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index eacd0fee9d3f0..ebaa42871c75c 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -455,6 +455,127 @@ def audit_formula(formula_nodes) EOS end + # This cop makes sure t...
good
review_fixed
ruby
Homebrew/brew
1e8a93f20cd939263cd0c892f181f688cdb36899
@@ -455,6 +455,113 @@ def audit_formula(formula_nodes) EOS end + # This cop makes sure that Java versions are consistent. + class JavaVersions < FormulaCop + extend AutoCorrector + + sig { override.params(formula_nodes: FormulaNodes).void } + def audit_formula(formula_no...
bad
review
ruby
Homebrew/brew
1e8a93f20cd939263cd0c892f181f688cdb36899
diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index eacd0fee9d3f0..ebaa42871c75c 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -455,6 +455,127 @@ def audit_formula(formula_nodes) EOS end + # This cop makes sure t...
good
review_fixed
ruby
Homebrew/brew
1e8a93f20cd939263cd0c892f181f688cdb36899