language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/mac/system_config.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class SystemConfig
class << self
undef describe_java, describe_homebrew_ruby | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module UnpackStrategy
class Zip
prepend Module.new { | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/mac/utils/analytics.rb | @@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
module Utils
module Analytics
class << self
def custom_prefix_label
- "non-/usr/local".freeze
+ "non-/usr/local"
end
end
end | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/mac/utils/bottles.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Utils
class Bottles
class << self | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/missing_formula.rb | @@ -1 +1,3 @@
+# frozen_string_literal: true
+
require "extend/os/mac/missing_formula" if OS.mac? | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/pathname.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
if OS.mac?
require "extend/os/mac/extend/pathname"
elsif OS.linux? | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/requirements/java_requirement.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
if OS.mac?
require "extend/os/mac/requirements/java_requirement"
elsif OS.linux? | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/requirements/osxfuse_requirement.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
if OS.mac?
require "extend/os/mac/requirements/osxfuse_requirement"
elsif OS.linux? | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/requirements/x11_requirement.rb | @@ -1 +1,3 @@
+# frozen_string_literal: true
+
require "extend/os/mac/requirements/x11_requirement" if OS.mac? | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/search.rb | @@ -1 +1,3 @@
+# frozen_string_literal: true
+
require "extend/os/mac/search" if OS.mac? | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/software_spec.rb | @@ -1 +1,3 @@
+# frozen_string_literal: true
+
require "extend/os/linux/software_spec" if OS.linux? | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/system_config.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
if OS.mac?
require "extend/os/mac/system_config"
elsif OS.linux? | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/os/tap.rb | @@ -1 +1,3 @@
+# frozen_string_literal: true
+
require "extend/os/linux/tap" if OS.linux? | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/pathname.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "resource"
require "metafiles"
| true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/predicable.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Predicable
def attr_predicate(*attrs)
attrs.each do |attr| | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/extend/string.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Contains backports from newer versions of Ruby
require "backports/2.4.0/string/match"
require "backports/2.5.0/string/delete_prefix" | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/fetch.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Homebrew
module Fetch
module_function | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/formula.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "cache_store"
require "formula_support"
require "lock_file" | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/formula_assertions.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Homebrew
module Assertions
require "rubygems" | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/formula_cellar_checks.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "utils/shell"
module FormulaCellarChecks | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/formula_creator.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "digest"
require "erb"
| true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/formula_installer.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "cxxstdlib"
require "formula"
require "keg" | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/formula_pin.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "keg"
class FormulaPin | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/formula_support.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Used to track formulae that cannot be installed at the same time.
FormulaConflict = Struct.new(:name, :reason)
| true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/formula_versions.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "formula"
class FormulaVersions | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/formulary.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "digest/md5"
require "extend/cachable"
| true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/global.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "English"
require "json"
require "json/add/exception"
@@ -33,7 +35,7 @@
HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"]
HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"]
-HOMEBREW_WWW = "https://brew.sh".freeze
+HOMEBREW_WWW = "https://brew.sh"
require "rbconfig"
@@ -42,10 +44,10 @@
HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"]
HOMEBREW_USER_AGENT_RUBY =
- "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".freeze
+ "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
HOMEBREW_USER_AGENT_FAKE_SAFARI =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 " \
- "(KHTML, like Gecko) Version/10.0.3 Safari/602.4.8".freeze
+ "(KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"]
HOMEBREW_BOTTLE_DOMAIN = ENV["HOMEBREW_BOTTLE_DOMAIN"]
@@ -57,9 +59,9 @@
module Homebrew
extend FileUtils
- DEFAULT_PREFIX ||= "/usr/local".freeze
- DEFAULT_CELLAR = "#{DEFAULT_PREFIX}/Cellar".freeze
- DEFAULT_REPOSITORY = "#{DEFAULT_PREFIX}/Homebrew".freeze
+ DEFAULT_PREFIX ||= "/usr/local"
+ DEFAULT_CELLAR = "#{DEFAULT_PREFIX}/Cellar"
+ DEFAULT_REPOSITORY = "#{DEFAULT_PREFIX}/Homebrew"
class << self
attr_writer :failed, :raise_deprecation_exceptions, :auditing, :args | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/hardware.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Hardware
class CPU
INTEL_32BIT_ARCHS = [:i386].freeze | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/help.rb | @@ -1,4 +1,6 @@
-HOMEBREW_HELP = <<~EOS.freeze
+# frozen_string_literal: true
+
+HOMEBREW_HELP = <<~EOS
Example usage:
brew search [TEXT|/REGEX/]
brew info [FORMULA...] | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/install.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "diagnostic"
require "fileutils"
require "hardware" | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/install_renamed.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module InstallRenamed
def install_p(_, new_basename)
super do |src, dst| | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/keg.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "keg_relocate"
require "language/python"
require "lock_file" | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/keg_relocate.rb | @@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class Keg
- PREFIX_PLACEHOLDER = "@@HOMEBREW_PREFIX@@".freeze
- CELLAR_PLACEHOLDER = "@@HOMEBREW_CELLAR@@".freeze
- REPOSITORY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@".freeze
+ PREFIX_PLACEHOLDER = "@@HOMEBREW_PREFIX@@"
+ CELLAR_PLACEHOLDER = "@@HOMEBREW_CELLAR@@"
+ REPOSITORY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@"
Relocation = Struct.new(:old_prefix, :old_cellar, :old_repository,
:new_prefix, :new_cellar, :new_repository) do | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/language/go.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "resource"
module Language | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/language/haskell.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Language
module Haskell
module Cabal | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/language/java.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Language
module Java
def self.java_home_cmd(_ = nil) | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/language/node.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Language
module Node
def self.npm_cache_config | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/language/python.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "language/python_virtualenv_constants"
module Language | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/language/python_virtualenv_constants.rb | @@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
PYTHON_VIRTUALENV_URL =
"https://files.pythonhosted.org/packages/37/db" \
"/89d6b043b22052109da35416abc3c397655e4bd3cff031446ba02b9654fa" \
- "/virtualenv-16.4.3.tar.gz".freeze
+ "/virtualenv-16.4.3.tar.gz"
PYTHON_VIRTUALENV_SHA256 =
- "984d7e607b0a5d1329425dd8845bd971b957424b5ba664729fab51ab8c11bc39".freeze
+ "984d7e607b0a5d1329425dd8845bd971b957424b5ba664729fab51ab8c11bc39" | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/lazy_object.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class LazyObject < Delegator
def initialize(&callable)
super(callable) | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/linkage_cache_store.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "set"
require "cache_store"
| true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/linkage_checker.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "keg"
require "formula"
require "linkage_cache_store" | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/load_path.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "pathname"
HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath.freeze | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/locale.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Locale
class ParserError < StandardError
end | true |
Other | Homebrew | brew | 36dbad3922ad984f7c396a9757fe8ae9750c44b0.json | Add frozen_string_literal to all files. | Library/Homebrew/lock_file.rb | @@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "fcntl"
class LockFile | true |
Other | Homebrew | brew | f76b083b919cccdb7ff9578575e957c4b8b4a63f.json | Use FrozenStringLiteralComment instead of flag.
Unfortunately we cannot use `--frozen-string-literal` with Ruby 2.3 due
to https://bugs.ruby-lang.org/issues/12031 and our usage of ERB. | Library/.rubocop.yml | @@ -93,8 +93,7 @@ Style/ConditionalAssignment:
Style/Documentation:
Enabled: false
-# we want to add this slowly and manually
-# TODO: add to more files
+# don't want this for formulae but re-enabled for Library/Homebrew
Style/FrozenStringLiteralComment:
Enabled: false
| true |
Other | Homebrew | brew | f76b083b919cccdb7ff9578575e957c4b8b4a63f.json | Use FrozenStringLiteralComment instead of flag.
Unfortunately we cannot use `--frozen-string-literal` with Ruby 2.3 due
to https://bugs.ruby-lang.org/issues/12031 and our usage of ERB. | Library/Homebrew/.rubocop.yml | @@ -117,6 +117,11 @@ Style/DocumentationMethod:
Include:
- 'Library/Homebrew/formula.rb'
+# don't want this for formulae but re-enabled for Library/Homebrew
+Style/FrozenStringLiteralComment:
+ Enabled: true
+ EnforcedStyle: always
+
# so many of these in formulae but none in here
Style/GuardClause:
Enabled: true | true |
Other | Homebrew | brew | f76b083b919cccdb7ff9578575e957c4b8b4a63f.json | Use FrozenStringLiteralComment instead of flag.
Unfortunately we cannot use `--frozen-string-literal` with Ruby 2.3 due
to https://bugs.ruby-lang.org/issues/12031 and our usage of ERB. | Library/Homebrew/brew.sh | @@ -348,9 +348,6 @@ else
RUBY_DISABLE_OPTIONS="--disable=gems,rubyopt"
fi
-# Don't set this for anyone (yet)
-unset HOMEBREW_FROZEN_STRING_LITERAL
-
if [[ -z "$HOMEBREW_RUBY_WARNINGS" ]]
then
export HOMEBREW_RUBY_WARNINGS="-W0"
@@ -502,5 +499,5 @@ else
# Unshift command back into argument list (unless argument list was empty).
[[ "$HOMEBREW_ARG_COUNT" -gt 0 ]] && set -- "$HOMEBREW_COMMAND" "$@"
- { update-preinstall "$@"; exec "$HOMEBREW_RUBY_PATH" $HOMEBREW_FROZEN_STRING_LITERAL $HOMEBREW_RUBY_WARNINGS "$RUBY_DISABLE_OPTIONS" "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; }
+ { update-preinstall "$@"; exec "$HOMEBREW_RUBY_PATH" $HOMEBREW_RUBY_WARNINGS "$RUBY_DISABLE_OPTIONS" "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; }
fi | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/cask/artifact/installer.rb | @@ -6,10 +6,10 @@
module Cask
module Artifact
class Installer < AbstractArtifact
- VALID_KEYS = Set.new [
- :manual,
- :script,
- ]
+ VALID_KEYS = Set.new([
+ :manual,
+ :script,
+ ]).freeze
module ManualInstaller
def install_phase(**) | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/cask/cmd/internal_stanza.rb | @@ -22,8 +22,8 @@ class InternalStanza < AbstractInternalCommand
#
ARTIFACTS =
- DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) +
- DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key)
+ (DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) +
+ DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key)).freeze
option "--table", :table, false
option "--quiet", :quiet, false | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/cask/dsl.rb | @@ -46,34 +46,34 @@ class DSL
Artifact::Zap,
].freeze
- ACTIVATABLE_ARTIFACT_CLASSES = ORDINARY_ARTIFACT_CLASSES - [Artifact::StageOnly]
+ ACTIVATABLE_ARTIFACT_CLASSES = (ORDINARY_ARTIFACT_CLASSES - [Artifact::StageOnly]).freeze
ARTIFACT_BLOCK_CLASSES = [
Artifact::PreflightBlock,
Artifact::PostflightBlock,
].freeze
- DSL_METHODS = Set.new [
- :appcast,
- :artifacts,
- :auto_updates,
- :caveats,
- :conflicts_with,
- :container,
- :depends_on,
- :homepage,
- :language,
- :languages,
- :name,
- :sha256,
- :staged_path,
- :url,
- :version,
- :appdir,
- *ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key),
- *ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key),
- *ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] },
- ].freeze
+ DSL_METHODS = Set.new([
+ :appcast,
+ :artifacts,
+ :auto_updates,
+ :caveats,
+ :conflicts_with,
+ :container,
+ :depends_on,
+ :homepage,
+ :language,
+ :languages,
+ :name,
+ :sha256,
+ :staged_path,
+ :url,
+ :version,
+ :appdir,
+ *ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key),
+ *ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key),
+ *ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] },
+ ]).freeze
attr_reader :cask, :token
| true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/cask/dsl/container.rb | @@ -3,10 +3,10 @@
module Cask
class DSL
class Container
- VALID_KEYS = Set.new [
- :type,
- :nested,
- ]
+ VALID_KEYS = Set.new([
+ :type,
+ :nested,
+ ]).freeze
attr_accessor(*VALID_KEYS)
attr_accessor :pairs | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/cask/dsl/depends_on.rb | @@ -3,14 +3,14 @@
module Cask
class DSL
class DependsOn < DelegateClass(Hash)
- VALID_KEYS = Set.new [
- :formula,
- :cask,
- :macos,
- :arch,
- :x11,
- :java,
- ].freeze
+ VALID_KEYS = Set.new([
+ :formula,
+ :cask,
+ :macos,
+ :arch,
+ :x11,
+ :java,
+ ]).freeze
VALID_ARCHES = {
intel: { type: :intel, bits: 64 }, | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/cleanup.rb | @@ -119,7 +119,7 @@ module Homebrew
class Cleanup
extend Predicable
- PERIODIC_CLEAN_FILE = HOMEBREW_CACHE/".cleaned"
+ PERIODIC_CLEAN_FILE = (HOMEBREW_CACHE/".cleaned").freeze
attr_predicate :dry_run?, :scrub?
attr_reader :args, :days, :cache | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/compilers.rb | @@ -8,8 +8,8 @@ module CompilerConstants
"llvm_clang" => :llvm_clang,
}.freeze
- COMPILERS = COMPILER_SYMBOL_MAP.values +
- GNU_GCC_VERSIONS.map { |n| "gcc-#{n}" }
+ COMPILERS = (COMPILER_SYMBOL_MAP.values +
+ GNU_GCC_VERSIONS.map { |n| "gcc-#{n}" }).freeze
end
class CompilerFailure | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/config.rb | @@ -1,7 +1,7 @@
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
# Path to `bin/brew` main executable in `HOMEBREW_PREFIX`
-HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
+HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"]).freeze
class MissingEnvironmentVariables < RuntimeError; end
@@ -11,42 +11,46 @@ def get_env_or_raise(env)
ENV[env]
end
+require "extend/git_repository"
+
# Where we link under
-HOMEBREW_PREFIX = Pathname.new(get_env_or_raise("HOMEBREW_PREFIX"))
+HOMEBREW_PREFIX = Pathname.new(get_env_or_raise("HOMEBREW_PREFIX")).freeze
# Where `.git` is found
HOMEBREW_REPOSITORY = Pathname.new(get_env_or_raise("HOMEBREW_REPOSITORY"))
+ .extend(GitRepositoryExtension)
+ .freeze
# Where we store most of Homebrew, taps, and various metadata
-HOMEBREW_LIBRARY = Pathname.new(get_env_or_raise("HOMEBREW_LIBRARY"))
+HOMEBREW_LIBRARY = Pathname.new(get_env_or_raise("HOMEBREW_LIBRARY")).freeze
# Where shim scripts for various build and SCM tools are stored
-HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY/"Homebrew/shims"
+HOMEBREW_SHIMS_PATH = (HOMEBREW_LIBRARY/"Homebrew/shims").freeze
# Where we store symlinks to currently linked kegs
-HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX/"var/homebrew/linked"
+HOMEBREW_LINKED_KEGS = (HOMEBREW_PREFIX/"var/homebrew/linked").freeze
# Where we store symlinks to currently version-pinned kegs
-HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX/"var/homebrew/pinned"
+HOMEBREW_PINNED_KEGS = (HOMEBREW_PREFIX/"var/homebrew/pinned").freeze
# Where we store lock files
-HOMEBREW_LOCKS = HOMEBREW_PREFIX/"var/homebrew/locks"
+HOMEBREW_LOCKS = (HOMEBREW_PREFIX/"var/homebrew/locks").freeze
# Where we store built products
-HOMEBREW_CELLAR = Pathname.new(get_env_or_raise("HOMEBREW_CELLAR"))
+HOMEBREW_CELLAR = Pathname.new(get_env_or_raise("HOMEBREW_CELLAR")).freeze
# Where downloads (bottles, source tarballs, etc.) are cached
-HOMEBREW_CACHE = Pathname.new(get_env_or_raise("HOMEBREW_CACHE"))
+HOMEBREW_CACHE = Pathname.new(get_env_or_raise("HOMEBREW_CACHE")).freeze
# Where brews installed via URL are cached
-HOMEBREW_CACHE_FORMULA = HOMEBREW_CACHE/"Formula"
+HOMEBREW_CACHE_FORMULA = (HOMEBREW_CACHE/"Formula").freeze
# Where build, postinstall, and test logs of formulae are written to
-HOMEBREW_LOGS = Pathname.new(get_env_or_raise("HOMEBREW_LOGS")).expand_path
+HOMEBREW_LOGS = Pathname.new(get_env_or_raise("HOMEBREW_LOGS")).expand_path.freeze
# Must use `/tmp` instead of `TMPDIR` because long paths break Unix domain sockets
HOMEBREW_TEMP = begin
tmp = Pathname.new(get_env_or_raise("HOMEBREW_TEMP"))
tmp.mkpath unless tmp.exist?
tmp.realpath
-end
+end.freeze | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/debrew.rb | @@ -4,7 +4,7 @@
module Debrew
extend Mutex_m
- Ignorable = Module.new
+ Ignorable = Module.new.freeze
module Raise
def raise(*) | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/dependency.rb | @@ -7,7 +7,7 @@ class Dependency
attr_reader :name, :tags, :env_proc, :option_names
- DEFAULT_ENV_PROC = proc {}
+ DEFAULT_ENV_PROC = proc {}.freeze
def initialize(name, tags = [], env_proc = DEFAULT_ENV_PROC, option_names = [name])
raise ArgumentError, "Dependency must have a name!" unless name | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/dev-cmd/man.rb | @@ -8,9 +8,9 @@
module Homebrew
module_function
- SOURCE_PATH = HOMEBREW_LIBRARY_PATH/"manpages"
- TARGET_MAN_PATH = HOMEBREW_REPOSITORY/"manpages"
- TARGET_DOC_PATH = HOMEBREW_REPOSITORY/"docs"
+ SOURCE_PATH = (HOMEBREW_LIBRARY_PATH/"manpages").freeze
+ TARGET_MAN_PATH = (HOMEBREW_REPOSITORY/"manpages").freeze
+ TARGET_DOC_PATH = (HOMEBREW_REPOSITORY/"docs").freeze
def man_args
Homebrew::CLI::Parser.new do | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/extend/os/mac/keg.rb | @@ -1,4 +1,4 @@
class Keg
- GENERIC_KEG_LINK_DIRECTORIES = remove_const :KEG_LINK_DIRECTORIES
+ GENERIC_KEG_LINK_DIRECTORIES = (remove_const :KEG_LINK_DIRECTORIES).freeze
KEG_LINK_DIRECTORIES = (GENERIC_KEG_LINK_DIRECTORIES + ["Frameworks"]).freeze
end | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/global.rb | @@ -28,21 +28,17 @@
require "messages"
require "system_command"
-ARGV_WITHOUT_MONKEY_PATCHING = ARGV.dup
+ARGV_WITHOUT_MONKEY_PATCHING = ARGV.dup.freeze
ARGV.extend(HomebrewArgvExtension)
HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"]
HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"]
HOMEBREW_WWW = "https://brew.sh".freeze
-require "extend/git_repository"
-
-HOMEBREW_REPOSITORY.extend(GitRepositoryExtension)
-
require "rbconfig"
-RUBY_PATH = Pathname.new(RbConfig.ruby)
-RUBY_BIN = RUBY_PATH.dirname
+RUBY_PATH = Pathname.new(RbConfig.ruby).freeze
+RUBY_BIN = RUBY_PATH.dirname.freeze
HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"]
HOMEBREW_USER_AGENT_RUBY = | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/keg.rb | @@ -77,9 +77,9 @@ def to_s
# Keep relatively in sync with
# https://github.com/Homebrew/install/blob/master/install
- MUST_EXIST_DIRECTORIES = MUST_EXIST_SUBDIRECTORIES + [
+ MUST_EXIST_DIRECTORIES = (MUST_EXIST_SUBDIRECTORIES + [
HOMEBREW_CELLAR,
- ].uniq.sort.freeze
+ ].sort.uniq).freeze
MUST_BE_WRITABLE_DIRECTORIES = (
%w[
etc/bash_completion.d lib/pkgconfig | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/load_path.rb | @@ -1,6 +1,6 @@
require "pathname"
-HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath
+HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath.freeze
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s) unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
| true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/metafiles.rb | @@ -1,13 +1,13 @@
module Metafiles
# https://github.com/github/markup#markups
- EXTENSIONS = Set.new %w[
- .adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
- .org .pod .rdoc .rst .rtf .textile .txt .wiki
- ].freeze
- BASENAMES = Set.new %w[
- about authors changelog changes copying copyright history license licence
- news notes notice readme todo
- ].freeze
+ EXTENSIONS = Set.new(%w[
+ .adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
+ .org .pod .rdoc .rst .rtf .textile .txt .wiki
+ ]).freeze
+ BASENAMES = Set.new(%w[
+ about authors changelog changes copying copyright history license licence
+ news notes notice readme todo
+ ]).freeze
module_function
| true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/os/linux.rb | @@ -3,7 +3,11 @@ module OS
module Mac
module_function
- ::MacOS = self # rubocop:disable Naming/ConstantName
+ # rubocop:disable Naming/ConstantName
+ # rubocop:disable Style/MutableConstant
+ ::MacOS = self
+ # rubocop:enable Naming/ConstantName
+ # rubocop:enable Style/MutableConstant
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
| true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/os/linux/global.rb | @@ -3,5 +3,5 @@ module Homebrew
"/usr/local".freeze
else
"/home/linuxbrew/.linuxbrew".freeze
- end
+ end.freeze
end | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/os/mac.rb | @@ -8,7 +8,11 @@ module OS
module Mac
module_function
- ::MacOS = self # rubocop:disable Naming/ConstantName
+ # rubocop:disable Naming/ConstantName
+ # rubocop:disable Style/MutableConstant
+ ::MacOS = self
+ # rubocop:enable Naming/ConstantName
+ # rubocop:enable Style/MutableConstant
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
| true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/os/mac/xquartz.rb | @@ -1,6 +1,6 @@
module OS
module Mac
- X11 = XQuartz = Module.new
+ X11 = XQuartz = Module.new # rubocop:disable Style/MutableConstant
module XQuartz
module_function | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/rubocops/cask/homepage_matches_url.rb | @@ -19,11 +19,11 @@ class HomepageMatchesUrl < Cop # rubocop:disable Metrics/ClassLength
MSG_NO_MATCH = "`%{url}` does not match `%{full_url}`".freeze
- MSG_MISSING = "`%{domain}` does not match `%{homepage}`, a comment has to be added " \
- "above the `url` stanza. For details, see " + REFERENCE_URL
+ MSG_MISSING = ("`%{domain}` does not match `%{homepage}`, a comment has to be added " \
+ "above the `url` stanza. For details, see " + REFERENCE_URL).freeze
- MSG_WRONG_FORMAT = "`%{comment}` does not match the expected comment format. " \
- "For details, see " + REFERENCE_URL
+ MSG_WRONG_FORMAT = ("`%{comment}` does not match the expected comment format. " \
+ "For details, see " + REFERENCE_URL).freeze
MSG_UNNECESSARY = "The URL's domain `%{domain}` matches the homepage `%{homepage}`, " \
"the comment above the `url` stanza is unnecessary".freeze | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/tap.rb | @@ -11,7 +11,7 @@
class Tap
extend Cachable
- TAP_DIRECTORY = HOMEBREW_LIBRARY/"Taps"
+ TAP_DIRECTORY = (HOMEBREW_LIBRARY/"Taps").freeze
def self.fetch(*args)
case args.length | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/tap_constants.rb | @@ -5,7 +5,7 @@
# match taps' directory paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap
HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}.freeze
# match taps' formula paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula
-HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source)
+HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source).freeze
# match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze
HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = /^(home|linux)brew-/.freeze | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/test/patching_spec.rb | @@ -5,8 +5,8 @@
TESTBALL_PATCHES_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1-patches.tgz".freeze
PATCH_URL_A = "file://#{TEST_FIXTURE_DIR}/patches/noop-a.diff".freeze
PATCH_URL_B = "file://#{TEST_FIXTURE_DIR}/patches/noop-b.diff".freeze
- PATCH_A_CONTENTS = File.read "#{TEST_FIXTURE_DIR}/patches/noop-a.diff"
- PATCH_B_CONTENTS = File.read "#{TEST_FIXTURE_DIR}/patches/noop-b.diff"
+ PATCH_A_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-a.diff").freeze
+ PATCH_B_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-b.diff").freeze
APPLY_A = "noop-a.diff".freeze
APPLY_B = "noop-b.diff".freeze
APPLY_C = "noop-c.diff".freeze | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/test/support/lib/config.rb | @@ -2,7 +2,7 @@
require "pathname"
-HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
+HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"]).freeze
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k|
dir = Dir.mktmpdir("homebrew-tests-", ENV["HOMEBREW_TEMP"] || "/tmp")
@@ -12,25 +12,27 @@
FileUtils.remove_entry(dir) unless ENV["HOMEBREW_TEST_NO_EXIT_CLEANUP"]
end
ENV[k] = dir
-end
+end.freeze
# Paths pointing into the Homebrew code base that persist across test runs
-HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY_PATH.parent/"Homebrew/shims"
+HOMEBREW_SHIMS_PATH = (HOMEBREW_LIBRARY_PATH.parent/"Homebrew/shims").freeze
+
+require "extend/git_repository"
# Paths redirected to a temporary directory and wiped at the end of the test run
-HOMEBREW_PREFIX = Pathname(TEST_TMPDIR)/"prefix"
-HOMEBREW_REPOSITORY = HOMEBREW_PREFIX
-HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY/"Library"
-HOMEBREW_CACHE = HOMEBREW_PREFIX.parent/"cache"
-HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent/"formula_cache"
-HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX.parent/"linked"
-HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX.parent/"pinned"
-HOMEBREW_LOCKS = HOMEBREW_PREFIX.parent/"locks"
-HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent/"cellar"
-HOMEBREW_LOGS = HOMEBREW_PREFIX.parent/"logs"
-HOMEBREW_TEMP = HOMEBREW_PREFIX.parent/"temp"
-
-TEST_FIXTURE_DIR = HOMEBREW_LIBRARY_PATH/"test/support/fixtures"
+HOMEBREW_PREFIX = (Pathname(TEST_TMPDIR)/"prefix").freeze
+HOMEBREW_REPOSITORY = HOMEBREW_PREFIX.dup.extend(GitRepositoryExtension).freeze
+HOMEBREW_LIBRARY = (HOMEBREW_REPOSITORY/"Library").freeze
+HOMEBREW_CACHE = (HOMEBREW_PREFIX.parent/"cache").freeze
+HOMEBREW_CACHE_FORMULA = (HOMEBREW_PREFIX.parent/"formula_cache").freeze
+HOMEBREW_LINKED_KEGS = (HOMEBREW_PREFIX.parent/"linked").freeze
+HOMEBREW_PINNED_KEGS = (HOMEBREW_PREFIX.parent/"pinned").freeze
+HOMEBREW_LOCKS = (HOMEBREW_PREFIX.parent/"locks").freeze
+HOMEBREW_CELLAR = (HOMEBREW_PREFIX.parent/"cellar").freeze
+HOMEBREW_LOGS = (HOMEBREW_PREFIX.parent/"logs").freeze
+HOMEBREW_TEMP = (HOMEBREW_PREFIX.parent/"temp").freeze
+
+TEST_FIXTURE_DIR = (HOMEBREW_LIBRARY_PATH/"test/support/fixtures").freeze
TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b".freeze
TESTBALL_PATCHES_SHA256 = "799c2d551ac5c3a5759bea7796631a7906a6a24435b52261a317133a0bfb34d9".freeze | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/unpack_strategy/dmg.rb | @@ -5,19 +5,19 @@ class Dmg
include UnpackStrategy
module Bom
- DMG_METADATA = Set.new %w[
- .background
- .com.apple.timemachine.donotpresent
- .com.apple.timemachine.supported
- .DocumentRevisions-V100
- .DS_Store
- .fseventsd
- .MobileBackups
- .Spotlight-V100
- .TemporaryItems
- .Trashes
- .VolumeIcon.icns
- ].freeze
+ DMG_METADATA = Set.new(%w[
+ .background
+ .com.apple.timemachine.donotpresent
+ .com.apple.timemachine.supported
+ .DocumentRevisions-V100
+ .DS_Store
+ .fseventsd
+ .MobileBackups
+ .Spotlight-V100
+ .TemporaryItems
+ .Trashes
+ .VolumeIcon.icns
+ ]).freeze
private_constant :DMG_METADATA
refine Pathname do | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/version.rb | @@ -52,7 +52,7 @@ def inspect
end
end
- NULL_TOKEN = NullToken.new
+ NULL_TOKEN = NullToken.new.freeze
class StringToken < Token
PATTERN = /[a-z]+[0-9]*/i.freeze
@@ -189,7 +189,7 @@ def <=>(other)
PatchToken::PATTERN,
NumericToken::PATTERN,
StringToken::PATTERN,
- )
+ ).freeze
class FromURL < Version
def detected_from_url? | true |
Other | Homebrew | brew | d1ea6f38d3ea1ad8d1665ad18267ed1a2ad08b8c.json | Fix mutable constants violations. | Library/Homebrew/version/null.rb | @@ -51,5 +51,5 @@ def to_s
def inspect
"#<Version::NULL>".freeze
end
- end.new
+ end.new.freeze
end | true |
Other | Homebrew | brew | 8374c3713a37385acb1894facbcfe01fd7470da9.json | extract: Replace ARGV.named with args.remaining | Library/Homebrew/dev-cmd/extract.rb | @@ -96,18 +96,18 @@ def extract
extract_args.parse
# Expect exactly two named arguments: formula and tap
- raise UsageError if ARGV.named.length != 2
+ raise UsageError if args.remaining.length != 2
- if ARGV.named.first !~ HOMEBREW_TAP_FORMULA_REGEX
- name = ARGV.named.first.downcase
+ if args.remaining.first !~ HOMEBREW_TAP_FORMULA_REGEX
+ name = args.remaining.first.downcase
source_tap = CoreTap.instance
else
name = Regexp.last_match(3).downcase
source_tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
raise TapFormulaUnavailableError.new(source_tap, name) unless source_tap.installed?
end
- destination_tap = Tap.fetch(ARGV.named.second)
+ destination_tap = Tap.fetch(args.remaining.second)
odie "Cannot extract formula to homebrew/core!" if destination_tap.core_tap?
odie "Cannot extract formula to the same tap!" if destination_tap == source_tap
destination_tap.install unless destination_tap.installed? | false |
Other | Homebrew | brew | 4b369962d303ac832cbda43fbe40562375a23896.json | test: kill all subprocesses on timeout.
Fixes #5885. | Library/Homebrew/test.rb | @@ -30,5 +30,12 @@
rescue Exception => e # rubocop:disable Lint/RescueException
error_pipe.puts e.to_json
error_pipe.close
+ pid = Process.pid.to_s
+ if which("pgrep") && which("pkill") && system("pgrep", "-qP", pid)
+ $stderr.puts "Killing child processes..."
+ system "pkill", "-P", pid
+ sleep 1
+ system "pkill", "-9", "-P", pid
+ end
exit! 1
end | false |
Other | Homebrew | brew | 7fbfb02625cb979ec3a82ff3bf04f8efcf6e1ace.json | Remove usage of Thread.new
I benchmarked these both locally and neither use of `Thread.new`
provides any measurable speedup (and in the `readall` case appears to
slow things down) on my 8 core machine. | Library/Homebrew/cleanup.rb | @@ -8,30 +8,6 @@
CLEANUP_MAX_AGE_DAYS = 120
module CleanupRefinement
- refine Enumerator do
- def parallel
- queue = Queue.new
-
- each do |element|
- queue.enq(element)
- end
-
- workers = (0...Hardware::CPU.cores).map do
- Thread.new do
- Kernel.loop do
- begin
- yield queue.deq(true)
- rescue ThreadError
- break # if queue is empty
- end
- end
- end
- end
-
- workers.each(&:join)
- end
- end
-
refine Pathname do
def incomplete?
extname.end_with?(".incomplete")
@@ -403,7 +379,7 @@ def rm_ds_store(dirs = nil)
HOMEBREW_PREFIX/"Caskroom",
]
end
- dirs.select(&:directory?).each.parallel do |dir|
+ dirs.select(&:directory?).each do |dir|
system_command "find",
args: [dir, "-name", ".DS_Store", "-delete"],
print_stderr: false | true |
Other | Homebrew | brew | 7fbfb02625cb979ec3a82ff3bf04f8efcf6e1ace.json | Remove usage of Thread.new
I benchmarked these both locally and neither use of `Thread.new`
provides any measurable speedup (and in the `readall` case appears to
slow things down) on my 8 core machine. | Library/Homebrew/readall.rb | @@ -3,22 +3,11 @@
module Readall
class << self
def valid_ruby_syntax?(ruby_files)
- ruby_files_queue = Queue.new
- ruby_files.each { |f| ruby_files_queue << f }
failed = false
- workers = (0...Hardware::CPU.cores).map do
- Thread.new do
- Kernel.loop do
- begin
- # As a side effect, print syntax errors/warnings to `$stderr`.
- failed = true if syntax_errors_or_warnings?(ruby_files_queue.deq(true))
- rescue ThreadError
- break
- end
- end
- end
+ ruby_files.each do |ruby_file|
+ # As a side effect, print syntax errors/warnings to `$stderr`.
+ failed = true if syntax_errors_or_warnings?(ruby_file)
end
- workers.each(&:join)
!failed
end
| true |
Other | Homebrew | brew | ae63381bd979cccaf0f8f4234c6278a6b3b18634.json | cli/parser: use cli/args and tweak freeze behaviour. | Library/Homebrew/cli/parser.rb | @@ -1,5 +1,5 @@
+require "cli/args"
require "optparse"
-require "ostruct"
require "set"
COMMAND_DESC_WIDTH = 80
@@ -25,9 +25,7 @@ def self.global_options
def initialize(&block)
@parser = OptionParser.new
- Homebrew.args = OpenStruct.new
- # undefine tap to allow --tap argument
- Homebrew.args.instance_eval { undef tap }
+ @args = Homebrew::CLI::Args.new(argv: ARGV_WITHOUT_MONKEY_PATCHING)
@constraints = []
@conflicts = []
@switch_sources = {}
@@ -77,7 +75,7 @@ def comma_array(name, description: nil)
description = option_to_description(name) if description.nil?
process_option(name, description)
@parser.on(name, OptionParser::REQUIRED_ARGUMENT, Array, *wrap_option_desc(description)) do |list|
- Homebrew.args[option_to_name(name)] = list
+ @args[option_to_name(name)] = list
end
end
@@ -92,7 +90,7 @@ def flag(*names, description: nil, required_for: nil, depends_on: nil)
process_option(*names, description)
@parser.on(*names, *wrap_option_desc(description), required) do |option_value|
names.each do |name|
- Homebrew.args[option_to_name(name)] = option_value
+ @args[option_to_name(name)] = option_value
end
end
@@ -128,15 +126,18 @@ def summary
end
def parse(cmdline_args = ARGV)
+ raise "Arguments were already parsed!" if @args_parsed
+
begin
remaining_args = @parser.parse(cmdline_args)
rescue OptionParser::InvalidOption => e
$stderr.puts generate_help_text
raise e
end
check_constraint_violations
- Homebrew.args[:remaining] = remaining_args
- Homebrew.args.freeze
+ @args[:remaining] = remaining_args
+ @args_parsed = true
+ Homebrew.args = @args
cmdline_args.freeze
@parser
end
@@ -180,13 +181,13 @@ def hide_from_man_page!
def enable_switch(*names, from:)
names.each do |name|
@switch_sources[option_to_name(name)] = from
- Homebrew.args["#{option_to_name(name)}?"] = true
+ @args["#{option_to_name(name)}?"] = true
end
end
def disable_switch(*names)
names.each do |name|
- Homebrew.args.delete_field("#{option_to_name(name)}?")
+ @args.delete_field("#{option_to_name(name)}?")
end
end
@@ -196,7 +197,7 @@ def common_switch(name)
end
def option_passed?(name)
- Homebrew.args.respond_to?(name) || Homebrew.args.respond_to?("#{name}?")
+ @args.respond_to?(name) || @args.respond_to?("#{name}?")
end
def wrap_option_desc(desc) | true |
Other | Homebrew | brew | ae63381bd979cccaf0f8f4234c6278a6b3b18634.json | cli/parser: use cli/args and tweak freeze behaviour. | Library/Homebrew/test/cli/parser_spec.rb | @@ -205,7 +205,7 @@
it "raises exception upon Homebrew.args mutation" do
parser.parse(["--switch-a"])
- expect { parser.parse(["--switch-b"]) }.to raise_error(RuntimeError, /can't modify frozen OpenStruct/)
+ expect { parser.parse(["--switch-b"]) }.to raise_error(RuntimeError, /Arguments were already parsed!/)
end
end
end | true |
Other | Homebrew | brew | e9806b6b55afa5102b253c628c0d1c90297c5e23.json | cli/args: add class to handle arguments. | Library/Homebrew/cli/args.rb | @@ -0,0 +1,15 @@
+require "ostruct"
+
+module Homebrew
+ module CLI
+ class Args < OpenStruct
+ # undefine tap to allow --tap argument
+ undef tap
+
+ def initialize(argv:)
+ super
+ @argv = argv
+ end
+ end
+ end
+end | false |
Other | Homebrew | brew | 34a8ab74af5e7687e92a8a9641be1aabc14cb54d.json | global: provide unpatched ARGV. | Library/Homebrew/global.rb | @@ -28,6 +28,7 @@
require "messages"
require "system_command"
+ARGV_WITHOUT_MONKEY_PATCHING = ARGV.dup
ARGV.extend(HomebrewArgvExtension)
HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"] | false |
Other | Homebrew | brew | 18630c70322e34f0a629c5461768a4ff1693867e.json | extend/ARGV: remove unused methods. | Library/Homebrew/extend/ARGV.rb | @@ -1,34 +1,4 @@
module HomebrewArgvExtension
- def formula_install_option_names
- %w[
- --debug
- --env=
- --ignore-dependencies
- --cc=
- --build-from-source
- --devel
- --HEAD
- --keep-tmp
- --interactive
- --git
- --sandbox
- --no-sandbox
- --build-bottle
- --force-bottle
- --bottle-arch=
- --include-test
- --verbose
- --force
- --display-times
- -i
- -v
- -d
- -g
- -s
- -f
- ].freeze
- end
-
def named
# TODO: use @instance variable to ||= cache when moving to CLI::Parser
self - options_only
@@ -113,28 +83,12 @@ def kegs
end
end
- def include?(arg)
- !index(arg).nil?
- end
-
- def next
- at(@n + 1) || raise(UsageError)
- end
-
def value(name)
arg_prefix = "--#{name}="
flag_with_value = find { |arg| arg.start_with?(arg_prefix) }
flag_with_value&.delete_prefix(arg_prefix)
end
- # Returns an array of values that were given as a comma-separated list.
- # @see value
- def values(name)
- return unless val = value(name)
-
- val.split(",")
- end
-
def force?
flag? "--force"
end
@@ -155,14 +109,6 @@ def interactive?
flag? "--interactive"
end
- def one?
- flag? "--1"
- end
-
- def dry_run?
- include?("--dry-run") || switch?("n")
- end
-
def keep_tmp?
include? "--keep-tmp"
end
@@ -175,10 +121,6 @@ def homebrew_developer?
!ENV["HOMEBREW_DEVELOPER"].nil?
end
- def sandbox?
- include?("--sandbox") || !ENV["HOMEBREW_SANDBOX"].nil?
- end
-
def no_sandbox?
include?("--no-sandbox") || !ENV["HOMEBREW_NO_SANDBOX"].nil?
end
@@ -187,24 +129,8 @@ def ignore_deps?
include? "--ignore-dependencies"
end
- def only_deps?
- include? "--only-dependencies"
- end
-
- def json
- value "json"
- end
-
- def build_head?
- include? "--HEAD"
- end
-
- def build_devel?
- include? "--devel"
- end
-
def build_stable?
- !(build_head? || build_devel?)
+ !(include?("--HEAD") || include?("--devel"))
end
def build_universal?
@@ -244,13 +170,6 @@ def fetch_head?
include? "--fetch-HEAD"
end
- # e.g. `foo -ns -i --bar` has three switches: `n`, `s` and `i`
- def switch?(char)
- return false if char.length > 1
-
- options_only.any? { |arg| arg.scan("-").size == 1 && arg.include?(char) }
- end
-
def cc
value "cc"
end
@@ -274,6 +193,13 @@ def collect_build_flags
private
+ # e.g. `foo -ns -i --bar` has three switches: `n`, `s` and `i`
+ def switch?(char)
+ return false if char.length > 1
+
+ options_only.any? { |arg| arg.scan("-").size == 1 && arg.include?(char) }
+ end
+
def spec(default = :stable)
if include?("--HEAD")
:head | true |
Other | Homebrew | brew | 18630c70322e34f0a629c5461768a4ff1693867e.json | extend/ARGV: remove unused methods. | Library/Homebrew/test/ARGV_spec.rb | @@ -91,13 +91,13 @@
it "returns true if the given string is a switch" do
%w[n s i].each do |s|
- expect(subject.switch?(s)).to be true
+ expect(subject.send("switch?", s)).to be true
end
end
it "returns false if the given string is not a switch" do
%w[b ns bar --bar -n a bad arg].each do |s|
- expect(subject.switch?(s)).to be false
+ expect(subject.send("switch?", s)).to be false
end
end
end
@@ -133,18 +133,4 @@
expect(subject.value("baz")).to be nil
end
end
-
- describe "#values" do
- let(:argv) { ["--foo=", "--bar=a", "--baz=b,c"] }
-
- it "returns the value for a given argument" do
- expect(subject.values("foo")).to eq []
- expect(subject.values("bar")).to eq ["a"]
- expect(subject.values("baz")).to eq ["b", "c"]
- end
-
- it "returns nil if there is no matching argument" do
- expect(subject.values("qux")).to be nil
- end
- end
end | true |
Other | Homebrew | brew | 888c38480188ac8b1772e85e636ee33c8c9ed252.json | release-notes: use stderr for header output.
This makes the use of `brew release-notes | pbcopy` a bit easier. | Library/Homebrew/dev-cmd/release-notes.rb | @@ -49,7 +49,7 @@ def release_notes
end
end
- puts "Release notes between #{previous_tag} and #{end_ref}:"
+ $stderr.puts "Release notes between #{previous_tag} and #{end_ref}:"
puts output
end
end | false |
Other | Homebrew | brew | 6748b1ee84fd7c3381cf2a9918e3530c4ed9693f.json | docs: update Acceptable Formula for options/guis | docs/Acceptable-Formulae.md | @@ -60,7 +60,7 @@ Don’t make your formula build an `.app` (native macOS Application); we
don’t want those things in Homebrew. Encourage upstream projects to build and support a `.app` that can be distributed by [homebrew/cask](https://github.com/Homebrew/homebrew-cask) (and used without it, too).
### Stuff that builds a GUI by default (but doesn't have to)
-Make it build a command-line tool or a library by default and, if the GUI is useful and would be widely used, add an option to build the GUI. Don't offer an option for multiple GUI backends, e.g. X11 is a bad user experience for GUIs on macOS.
+Make it build a command-line tool or a library by default and, if the GUI is useful and would be widely used, also build the GUI. But don't build X11/XQuartz GUIs as they are a bad user experience on macOS.
### Stuff that doesn't build with the latest, stable Xcode's Clang
Clang is the default C/C++ compiler on macOS (and has been for a long time). Software that doesn't build with it hasn't been adequately ported to macOS. | false |
Other | Homebrew | brew | e0558dc7c71fd3e2d08eef876a987212c41c4f69.json | trim line breaks | Library/Homebrew/cask/artifact/installer.rb | @@ -16,7 +16,6 @@ def install_phase(**)
puts <<~EOS
To complete the installation of Cask #{cask}, you must also
run the installer at:
-
'#{cask.staged_path.join(path)}'
EOS
end | true |
Other | Homebrew | brew | e0558dc7c71fd3e2d08eef876a987212c41c4f69.json | trim line breaks | Library/Homebrew/cask/dsl/caveats.rb | @@ -48,11 +48,8 @@ def eval_caveats(&block)
<<~EOS
To install and/or use #{@cask} you may need to enable its kernel extension in:
-
System Preferences → Security & Privacy → General
-
For more information refer to vendor documentation or this Apple Technical Note:
-
#{Formatter.url("https://developer.apple.com/library/content/technotes/tn2459/_index.html")}
EOS
end
@@ -61,7 +58,6 @@ def eval_caveats(&block)
<<~EOS
To use #{@cask}, you may need to add the #{path} directory
to your PATH environment variable, e.g. (for bash shell):
-
export PATH=#{path}:"$PATH"
EOS
end
@@ -71,7 +67,6 @@ def eval_caveats(&block)
To use #{@cask}, zsh users may need to add the following line to their
~/.zprofile. (Among other effects, #{path} will be added to the
PATH environment variable):
-
eval `/usr/libexec/path_helper -s`
EOS
end
@@ -90,19 +85,16 @@ def eval_caveats(&block)
if java_version == :any
<<~EOS
#{@cask} requires Java. You can install the latest version with:
-
brew cask install java
EOS
elsif java_version.include?("11") || java_version.include?("+")
<<~EOS
#{@cask} requires Java #{java_version}. You can install the latest version with:
-
brew cask install java
EOS
else
<<~EOS
#{@cask} requires Java #{java_version}. You can install it with:
-
brew cask install homebrew/cask-versions/java#{java_version}
EOS
end | true |
Other | Homebrew | brew | e0558dc7c71fd3e2d08eef876a987212c41c4f69.json | trim line breaks | Library/Homebrew/cask/exceptions.rb | @@ -131,13 +131,11 @@ def initialize(token, expected, actual, path)
def to_s
<<~EOS
Checksum for Cask '#{token}' does not match.
-
Expected: #{Formatter.success(expected.to_s)}
Actual: #{Formatter.error(actual.to_s)}
File: #{path}
-
- To retry an incomplete download, remove the file above. If the issue persists, visit:
-
+ To retry an incomplete download, remove the file above.
+ If the issue persists, visit:
#{Formatter.url("https://github.com/Homebrew/homebrew-cask/blob/master/doc/reporting_bugs/checksum_does_not_match_error.md")}
EOS
end | true |
Other | Homebrew | brew | e0558dc7c71fd3e2d08eef876a987212c41c4f69.json | trim line breaks | Library/Homebrew/test/cask/cmd/info_spec.rb | @@ -84,7 +84,6 @@
Custom text via puts followed by DSL-generated text:
To use with-caveats, you may need to add the /custom/path/bin directory
to your PATH environment variable, e.g. (for bash shell):
-
export PATH=/custom/path/bin:"$PATH"
EOS | true |
Other | Homebrew | brew | e0558dc7c71fd3e2d08eef876a987212c41c4f69.json | trim line breaks | Library/Homebrew/test/cask/installer_spec.rb | @@ -118,7 +118,6 @@
==> Installing Cask with-installer-manual
To complete the installation of Cask with-installer-manual, you must also
run the installer at:
-
'#{with_installer_manual.staged_path.join("Caffeine.app")}'
🍺 with-installer-manual was successfully installed!
EOS | true |
Other | Homebrew | brew | f9a67019d62c26d60081479934eb1f71a3d8a905.json | Improve error message on cask doctor
Add fix command on brew cask doctor in case staging directory is not writable. | Library/Homebrew/cask/cmd/doctor.rb | @@ -65,6 +65,7 @@ def check_staging_location
if path.exist? && !path.writable?
add_error "The staging path #{user_tilde(path.to_s)} is not writable by the current user."
+ add_error "To fix, run \'sudo chown -R ${USER}:staff #{user_tilde(path.to_s)}'"
end
puts user_tilde(path.to_s) | false |
Other | Homebrew | brew | 426c6e2c3f24ec48c33c3937c96ae76ca786a495.json | xcode_requirement: fix Swift compatability check.
Ensure we're using the full macOS version so that
`MacOS::Xcode.version >= "10.14.4"` can ever be true. | Library/Homebrew/requirements/xcode_requirement.rb | @@ -12,8 +12,8 @@ def initialize(tags = [])
def xcode_installed_version
return false unless MacOS::Xcode.installed?
+ return false unless xcode_swift_compatability?
return true unless @version
- return true if xcode_swift_compatability?
MacOS::Xcode.version >= @version
end
@@ -54,8 +54,8 @@ def inspect
# method in favour of requiring 10.14.4 and 10.2.
def xcode_swift_compatability?
return true if MacOS::Xcode.version < "10.2"
- return true if MacOS::Xcode.version >= "10.14.4"
+ return true if MacOS.full_version >= "10.14.4"
- MacOS.version < "10.14"
+ MacOS.full_version < "10.14"
end
end | false |
Other | Homebrew | brew | 8457fa5af5770cd940e83b804567a3cf5d7b05a9.json | Fix 2nd typo in cleaner.rb | Library/Homebrew/cleaner.rb | @@ -37,7 +37,7 @@ def observe_file_removal(path)
end
# Removes any empty directories in the formula's prefix subtree
- # Keeps any empty directions protected by skip_clean
+ # Keeps any empty directories protected by skip_clean
# Removes any unresolved symlinks
def prune
dirs = [] | false |
Other | Homebrew | brew | 4f8489faa109d03fbf4b4529e295bd9e7fd48920.json | Fix typo in cleaner.rb
Seems like auto-correct was a bit too eager to fix things :) ? | Library/Homebrew/cleaner.rb | @@ -37,7 +37,7 @@ def observe_file_removal(path)
end
# Removes any empty directories in the formula's prefix subtree
- # Keeps any empty directions projected by skip_clean
+ # Keeps any empty directions protected by skip_clean
# Removes any unresolved symlinks
def prune
dirs = [] | false |
Other | Homebrew | brew | deffe8d403ff092c04b92094635eb8006c8f3bdf.json | Redirect docs.brew.sh/linux to Homebrew on Linux | docs/Homebrew-on-Linux.md | @@ -3,6 +3,7 @@ title: Homebrew on Linux
logo: https://brew.sh/assets/img/linuxbrew.png
image: https://brew.sh/assets/img/linuxbrew.png
redirect_from:
+ - /linux
- /Linux
- /Linuxbrew
--- | false |
Other | Homebrew | brew | da392cd9e836cf7955e9217d7e06b7a411dab107.json | xcode_requirement: require macOS 10.14.4 for Xcode 10.2.
See discussion in https://github.com/Homebrew/brew/pull/5940. | Library/Homebrew/requirements/xcode_requirement.rb | @@ -13,23 +13,32 @@ def initialize(tags = [])
def xcode_installed_version
return false unless MacOS::Xcode.installed?
return true unless @version
+ return true if xcode_swift_compatability?
MacOS::Xcode.version >= @version
end
def message
version = " #{@version}" if @version
message = <<~EOS
- A full installation of Xcode.app#{version} is required to compile this software.
- Installing just the Command Line Tools is not sufficient.
+ A full installation of Xcode.app#{version} is required to compile
+ this software. Installing just the Command Line Tools is not sufficient.
EOS
+ unless xcode_swift_compatability?
+ message += <<~EOS
+
+ Xcode >=10.2 requires macOS >=10.14.4 to build many formulae.
+ EOS
+ end
if @version && Version.new(MacOS::Xcode.latest_version) < Version.new(@version)
message + <<~EOS
+
Xcode#{version} cannot be installed on macOS #{MacOS.version}.
You must upgrade your version of macOS.
EOS
else
message + <<~EOS
+
Xcode can be installed from the App Store.
EOS
end
@@ -38,4 +47,15 @@ def message
def inspect
"#<#{self.class.name}: #{tags.inspect} version=#{@version.inspect}>"
end
+
+ private
+
+ # TODO: when 10.14.4 and 10.2 have been around for long enough remove this
+ # method in favour of requiring 10.14.4 and 10.2.
+ def xcode_swift_compatability?
+ return true if MacOS::Xcode.version < "10.2"
+ return true if MacOS::Xcode.version >= "10.14.4"
+
+ MacOS.version < "10.14"
+ end
end | false |
Other | Homebrew | brew | 75aa369102b882e916f35821e57bd4ba1045604d.json | Fix support for `HOMEBREW_EDITOR` with args. | Library/Homebrew/utils.rb | @@ -321,7 +321,7 @@ def which_editor
def exec_editor(*args)
puts "Editing #{args.join "\n"}"
- with_homebrew_path { safe_system(which_editor, *args) }
+ with_homebrew_path { safe_system(*which_editor.shellsplit, *args) }
end
def exec_browser(*args) | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.