source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/extend/os/linux/cask/utils/trash.rb | Ruby | bsd-2-clause | 47,751 | main | 581 | # typed: strict
# frozen_string_literal: true
module OS
module Linux
module Cask
module Utils
module Trash
module ClassMethods
sig {
params(paths: Pathname, command: T.nilable(T.class_of(SystemCommand)))
.returns([T::Array[String], T::Array[String... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/extend/os/linux/cask/artifact/relocated.rb | Ruby | bsd-2-clause | 47,751 | main | 655 | # typed: strict
# frozen_string_literal: true
module OS
module Linux
module Cask
module Artifact
module Relocated
extend T::Helpers
requires_ancestor { ::Cask::Artifact::Relocated }
sig { params(file: ::Pathname, altname: ::Pathname, command: T.class_of(SystemCommand... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/extend/os/linux/bundle/bundle.rb | Ruby | bsd-2-clause | 47,751 | main | 592 | # typed: strict
# frozen_string_literal: true
module OS
module Linux
module Bundle
module ClassMethods
# Setup pkg-config, if present, to help locate packages
# Only need this on Linux as Homebrew provides a shim on macOS
sig { void }
def prepend_pkgconf_path_if_needed!
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/extend/os/linux/bundle/skipper.rb | Ruby | bsd-2-clause | 47,751 | main | 1,401 | # typed: strict
# frozen_string_literal: true
require "cask/cask_loader"
module OS
module Linux
module Bundle
module Skipper
module ClassMethods
sig { params(entry: Homebrew::Bundle::Dsl::Entry).returns(T::Boolean) }
def requires_macos?(entry)
case entry.type
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/extend/os/linux/bundle/brew_services.rb | Ruby | bsd-2-clause | 47,751 | main | 523 | # typed: strict
# frozen_string_literal: true
module OS
module Linux
module Bundle
module BrewServices
module ClassMethods
sig { returns(T::Array[String]) }
def started_services_without_daemon_manager
Homebrew::Bundle::Brew::Services.opoo "Skipping `brew services lis... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/resource_requires_dependencies.rb | Ruby | bsd-2-clause | 47,751 | main | 2,311 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop audits Python formulae that include certain resources
# to ensure that they also have the correct `uses_from_macos`
# dependencies.
class ResourceR... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/non_public_api_usage.rb | Ruby | bsd-2-clause | 47,751 | main | 3,293 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
require "rubocops/shared/api_annotation_helper"
module RuboCop
module Cop
module FormulaAudit
# Ensures that formulae in official taps (homebrew-core, homebrew-cask)
# only use methods that are part of the public API... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/urls.rb | Ruby | bsd-2-clause | 47,751 | main | 6,625 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
require "rubocops/shared/url_helper"
module RuboCop
module Cop
module FormulaAudit
# This cop audits `url`s and `mirror`s in formulae.
class Urls < FormulaCop
include UrlHelper
extend AutoCorrector
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/shell_command_stub.rb | Ruby | bsd-2-clause | 47,751 | main | 654 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
class ShellCommandStub < Base
MSG = "Shell command stubs must have a `.sh` counterpart."
RESTRICT_ON_SEND = [:include].freeze
sig { params(node: AST::SendNode).void }
def on_send(node)
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/homepage.rb | Ruby | bsd-2-clause | 47,751 | main | 1,055 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
require "rubocops/shared/homepage_helper"
module RuboCop
module Cop
module FormulaAudit
# This cop audits the `homepage` URL in formulae.
class Homepage < FormulaCop
include HomepageHelper
extend Auto... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/checksum.rb | Ruby | bsd-2-clause | 47,751 | main | 2,398 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop makes sure that deprecated checksums are not used.
class Checksum < FormulaCop
sig { override.params(formula_nodes: FormulaNodes).void }
def au... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/install_bundler_gems.rb | Ruby | bsd-2-clause | 47,751 | main | 629 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Enforces the use of `Homebrew.install_bundler_gems!` in dev-cmd.
class InstallBundlerGems < Base
MSG = "Only use `Homebrew.install_bundler_gems!` in dev-cmd."
RESTRICT_ON_SEND = [:install_bundler... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/io_read.rb | Ruby | bsd-2-clause | 47,751 | main | 1,041 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# This cop restricts usage of `IO.read` functions for security reasons.
class IORead < Base
MSG = "The use of `IO.%<method>s` is a security risk."
RESTRICT_ON_SEND = [:read, :readlines].freeze
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/safe_navigation_with_blank.rb | Ruby | bsd-2-clause | 47,751 | main | 1,426 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks to make sure safe navigation isn't used with `blank?` in
# a conditional.
#
# NOTE: While the safe navigation operator is generally a good idea, when
# checking `foo&.blank?` in a ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/class.rb | Ruby | bsd-2-clause | 47,751 | main | 3,033 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop makes sure that {Formula} is used as superclass.
class ClassName < FormulaCop
extend AutoCorrector
DEPRECATED_CLASSES = %w[
GithubGi... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/negate_include.rb | Ruby | bsd-2-clause | 47,751 | main | 1,192 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Enforces the use of `collection.exclude?(obj)`
# over `!collection.include?(obj)`.
#
# NOTE: This cop is unsafe because false positives will occur for
# receiver objects that do not have ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/zero_zero_zero_zero.rb | Ruby | bsd-2-clause | 47,751 | main | 1,607 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop audits the use of 0.0.0.0 in formulae.
# 0.0.0.0 should not be used outside of test do blocks as it can be a security risk.
class ZeroZeroZeroZero < Form... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/shell_commands.rb | Ruby | bsd-2-clause | 47,751 | main | 4,365 | # typed: strict
# frozen_string_literal: true
require "extend/array"
require "rubocops/shared/helper_functions"
require "shellwords"
module RuboCop
module Cop
module Homebrew
# https://github.com/ruby/ruby/blob/v2_6_3/process.c#L2430-L2460
SHELL_BUILTINS = %w[
!
.
:
b... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/livecheck.rb | Ruby | bsd-2-clause | 47,751 | main | 9,523 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop ensures that no other livecheck information is provided for
# skipped formulae.
class LivecheckSkip < FormulaCop
extend AutoCorrector
si... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/blank.rb | Ruby | bsd-2-clause | 47,751 | main | 2,238 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks for code that can be simplified using `Object#blank?`.
#
# NOTE: Auto-correction for this cop is unsafe because `' '.empty?` returns `false`,
# but `' '.blank?` returns `true`. Therefore... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/patches.rb | Ruby | bsd-2-clause | 47,751 | main | 7,694 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop audits `patch`es in formulae.
class Patches < FormulaCop
extend AutoCorrector
sig { override.params(formula_nodes: FormulaNodes).void }
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/public_api_cookbook.rb | Ruby | bsd-2-clause | 47,751 | main | 4,410 | # typed: strict
# frozen_string_literal: true
require "rubocops/shared/api_annotation_helper"
module RuboCop
module Cop
module Homebrew
# Ensures that methods and DSL calls documented in the Formula Cookbook
# or Cask Cookbook are annotated with `@api public` in their source
# definitions.
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/rubocop-cask.rb | Ruby | bsd-2-clause | 47,751 | main | 1,010 | # typed: strict
# frozen_string_literal: true
require "rubocop"
require_relative "cask/constants/stanza"
require_relative "cask/ast/stanza"
require_relative "cask/ast/cask_header"
require_relative "cask/ast/cask_block"
require_relative "cask/extend/node"
require_relative "cask/mixin/cask_help"
require_relative "cask... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/dependency_order.rb | Ruby | bsd-2-clause | 47,751 | main | 7,650 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop checks for correct order of `depends_on` in formulae.
#
# precedence order:
# build-time > test > normal > recommended > optional
class Depen... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/presence.rb | Ruby | bsd-2-clause | 47,751 | main | 5,034 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks code that can be written more easily using
# `Object#presence` defined by Active Support.
#
# ### Examples
#
# ```ruby
# # bad
# a.present? ? a : nil
#
# # ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/move_to_extend_os.rb | Ruby | bsd-2-clause | 47,751 | main | 1,698 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# This cop ensures that platform specific code ends up in `extend/os`, and
# that `extend/os` doesn't contain incorrect or redundant OS checks.
class MoveToExtendOS < Base
NON_EXTEND_OS_MSG = "Move `... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/disable_comment.rb | Ruby | bsd-2-clause | 47,751 | main | 921 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
# Checks if rubocop disable comments have a clarifying comment preceding them.
class DisableComment < Base
MSG = "Add a clarifying comment to the RuboCop disable comment"
sig { void }
def on_new_investigation
s... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/no_autobump.rb | Ruby | bsd-2-clause | 47,751 | main | 1,179 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
require "rubocops/shared/no_autobump_helper"
module RuboCop
module Cop
module FormulaAudit
# This cop audits `no_autobump!` reason.
# See the {NoAutobumpHelper} module for details of the checks.
class NoAutobum... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/options.rb | Ruby | bsd-2-clause | 47,751 | main | 1,580 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop audits `option`s in formulae.
class Options < FormulaCop
DEP_OPTION = "Formulae in homebrew/core should not use `deprecated_option`."
OPTION = ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/caveats.rb | Ruby | bsd-2-clause | 47,751 | main | 1,867 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop ensures that caveats don't have problematic text or logic.
#
# ### Example
#
# ```ruby
# # bad
# def caveats
# if File.ex... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/present.rb | Ruby | bsd-2-clause | 47,751 | main | 2,095 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks for code that can be simplified using `Object#present?`.
#
# ### Example
#
# ```ruby
# # bad
# !foo.nil? && !foo.empty?
#
# # bad
# foo != nil && !foo.empty... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/version.rb | Ruby | bsd-2-clause | 47,751 | main | 888 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop makes sure that a `version` is in the correct format.
class Version < FormulaCop
sig { override.params(formula_nodes: FormulaNodes).void }
def ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/keg_only.rb | Ruby | bsd-2-clause | 47,751 | main | 2,111 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop makes sure that a `keg_only` reason has the correct format.
class KegOnly < FormulaCop
extend AutoCorrector
sig { override.params(formula_node... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/all.rb | Ruby | bsd-2-clause | 47,751 | main | 1,554 | # typed: strict
# frozen_string_literal: true
require_relative "../extend/array"
require_relative "../extend/blank"
require_relative "blank"
require_relative "compact_blank"
require_relative "disable_comment"
require_relative "extend/mutable_constant_exclude_unfreezable"
require_relative "io_read"
require_relative "mo... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/public_api_documentation.rb | Ruby | bsd-2-clause | 47,751 | main | 2,009 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Ensures that methods/attributes annotated with `@api public` have
# proper YARD documentation beyond just the annotation itself.
# A bare `# @api public` with no preceding description is not sufficient
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/compact_blank.rb | Ruby | bsd-2-clause | 47,751 | main | 4,490 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks if collection can be blank-compacted with `compact_blank`.
#
# NOTE: It is unsafe by default because false positives may occur in the
# blank check of block arguments to the receiver obj... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/components_order.rb | Ruby | bsd-2-clause | 47,751 | main | 12,521 | # typed: strict
# frozen_string_literal: true
require "ast_constants"
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop checks for correct order of components in formulae.
#
# - `component_precedence_list` has component hierarchy in a nested list
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/lines.rb | Ruby | bsd-2-clause | 47,751 | main | 43,233 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
require "rubocops/shared/on_system_conditionals_helper"
module RuboCop
module Cop
module FormulaAudit
# This cop checks for various miscellaneous Homebrew coding styles.
class Lines < FormulaCop
sig { overrid... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/files.rb | Ruby | bsd-2-clause | 47,751 | main | 1,707 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop makes sure that a formula's file permissions are correct.
class Files < FormulaCop
sig { override.params(formula_nodes: FormulaNodes).void }
de... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/desc.rb | Ruby | bsd-2-clause | 47,751 | main | 805 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
require "rubocops/shared/desc_helper"
module RuboCop
module Cop
module FormulaAudit
# This cop audits `desc` in formulae.
# See the {DescHelper} module for details of the checks.
class Desc < FormulaCop
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/no_fileutils_rmrf.rb | Ruby | bsd-2-clause | 47,751 | main | 2,005 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# This cop checks for the use of `FileUtils.rm_f`, `FileUtils.rm_rf`, or `{FileUtils,instance}.rmtree`
# and recommends the safer versions.
class NoFileutilsRmrf < Base
extend AutoCorrector
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/uses_from_macos.rb | Ruby | bsd-2-clause | 47,751 | main | 3,405 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop audits formulae that are keg-only because they are provided by macos.
class ProvidedByMacos < FormulaCop
PROVIDED_BY_MACOS_FORMULAE = %w[
apr... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/conflicts.rb | Ruby | bsd-2-clause | 47,751 | main | 2,184 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop audits versioned formulae for `conflicts_with`.
class Conflicts < FormulaCop
extend AutoCorrector
MSG = "Versioned formulae should not use `co... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/components_redundancy.rb | Ruby | bsd-2-clause | 47,751 | main | 3,334 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop checks if redundant components are present and for other component errors.
#
# - `url|checksum|mirror|version` should be inside `stable` block
# - ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/deprecate_disable.rb | Ruby | bsd-2-clause | 47,751 | main | 2,914 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop audits `deprecate!` and `disable!` dates.
class DeprecateDisableDate < FormulaCop
extend AutoCorrector
sig { override.params(formula_nodes: Fo... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/bottle.rb | Ruby | bsd-2-clause | 47,751 | main | 7,679 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop audits the `bottle` block in formulae.
class BottleFormat < FormulaCop
extend AutoCorrector
sig { override.params(formula_nodes: FormulaNodes)... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/text.rb | Ruby | bsd-2-clause | 47,751 | main | 8,107 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop checks for various problems in a formula's source code.
class Text < FormulaCop
extend AutoCorrector
sig { override.params(formula_nodes: Form... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/service.rb | Ruby | bsd-2-clause | 47,751 | main | 2,328 | # typed: strict
# frozen_string_literal: true
require "rubocops/extend/formula_cop"
module RuboCop
module Cop
module FormulaAudit
# This cop audits the service block.
class Service < FormulaCop
extend AutoCorrector
CELLAR_PATH_AUDIT_CORRECTIONS = T.let(
{
bin: ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/no_autobump.rb | Ruby | bsd-2-clause | 47,751 | main | 1,393 | # typed: strict
# frozen_string_literal: true
require "forwardable"
require "rubocops/shared/no_autobump_helper"
module RuboCop
module Cop
module Cask
# This cop audits `no_autobump!` reason.
# See the {NoAutobumpHelper} module for details of the checks.
class NoAutobump < Base
extend ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/stanza_order.rb | Ruby | bsd-2-clause | 47,751 | main | 2,242 | # typed: strict
# frozen_string_literal: true
require "forwardable"
module RuboCop
module Cop
module Cask
# This cop checks that a cask's stanzas are ordered correctly, including nested within `on_*` blocks.
# @see https://docs.brew.sh/Cask-Cookbook#stanza-order
class StanzaOrder < Base
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/desc.rb | Ruby | bsd-2-clause | 47,751 | main | 690 | # typed: strict
# frozen_string_literal: true
require "rubocops/cask/mixin/on_desc_stanza"
require "rubocops/shared/desc_helper"
module RuboCop
module Cop
module Cask
# This cop audits `desc` in casks.
# See the {DescHelper} module for details of the checks.
class Desc < Base
include O... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/homepage_url_styling.rb | Ruby | bsd-2-clause | 47,751 | main | 1,601 | # typed: strict
# frozen_string_literal: true
require "forwardable"
require "uri"
require "rubocops/shared/homepage_helper"
module RuboCop
module Cop
module Cask
# This cop audits the `homepage` URL in casks.
class HomepageUrlStyling < Base
include OnHomepageStanza
include HelperFunc... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/on_system_conditionals.rb | Ruby | bsd-2-clause | 47,751 | main | 7,101 | # typed: strict
# frozen_string_literal: true
require "forwardable"
require "rubocops/shared/on_system_conditionals_helper"
module RuboCop
module Cop
module Cask
# This cop makes sure that OS conditionals are consistent.
#
# ### Example
#
# ```ruby
# # bad
# cask 'foo' ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/stanza_grouping.rb | Ruby | bsd-2-clause | 47,751 | main | 4,337 | # typed: strict
# frozen_string_literal: true
require "forwardable"
module RuboCop
module Cop
module Cask
# This cop checks that a cask's stanzas are grouped correctly, including nested within `on_*` blocks.
# @see https://docs.brew.sh/Cask-Cookbook#stanza-order
class StanzaGrouping < Base
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/url.rb | Ruby | bsd-2-clause | 47,751 | main | 3,723 | # typed: strict
# frozen_string_literal: true
require "rubocops/shared/url_helper"
module RuboCop
module Cop
module Cask
# This cop checks that a cask's `url` stanza is formatted correctly.
#
# ### Example
#
# ```ruby
# # bad
# url "https://example.com/download/foo.dmg"... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/no_overrides.rb | Ruby | bsd-2-clause | 47,751 | main | 4,927 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
class NoOverrides < Base
include CaskHelp
# These stanzas can be overridden by `on_*` blocks, so take them into account.
# TODO: Update this list if new stanzas are added to `Cask::DSL` that call `s... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/discontinued.rb | Ruby | bsd-2-clause | 47,751 | main | 1,378 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# This cop corrects `caveats { discontinued }` to `deprecate!`.
class Discontinued < Base
include CaskHelp
extend AutoCorrector
MESSAGE = "Use `deprecate!` instead of `caveats { discontinued }... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/url_legacy_comma_separators.rb | Ruby | bsd-2-clause | 47,751 | main | 1,169 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# This cop checks for `version.before_comma` and `version.after_comma`.
class UrlLegacyCommaSeparators < Url
include OnUrlStanza
extend AutoCorrector
MSG_CSV = "Use `version.csv.first` instead... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/deprecate_disable_unsigned_reason.rb | Ruby | bsd-2-clause | 47,751 | main | 1,778 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# This cop checks for use of `because: :unsigned` in `deprecate!`/`disable!`
# and replaces it with the preferred `:fails_gatekeeper_check` reason.
#
# Example
# # bad
# deprecate! date: "2... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/shared_filelist_glob.rb | Ruby | bsd-2-clause | 47,751 | main | 1,094 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
class SharedFilelistGlob < Base
extend AutoCorrector
sig { params(node: RuboCop::AST::SendNode).void }
def on_send(node)
return if node.method_name != :zap
node.each_descendant(... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/variables.rb | Ruby | bsd-2-clause | 47,751 | main | 2,313 | # typed: strict
# frozen_string_literal: true
require "forwardable"
module RuboCop
module Cop
module Cask
# This cop audits variables in casks.
#
# ### Example
#
# ```ruby
# # bad
# cask do
# arch = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"
# end
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/array_alphabetization.rb | Ruby | bsd-2-clause | 47,751 | main | 3,108 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
class ArrayAlphabetization < Base
extend AutoCorrector
sig { params(node: RuboCop::AST::SendNode).void }
def on_send(node)
return unless [:conflicts_with, :uninstall, :zap].include?(node.m... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/uninstall_methods_order.rb | Ruby | bsd-2-clause | 47,751 | main | 7,261 | # typed: strict
# frozen_string_literal: true
require "rubocops/shared/helper_functions"
module RuboCop
module Cop
module Cask
# This cop checks for the correct order of methods within the
# 'uninstall' and 'zap' stanzas and validates related metadata.
class UninstallMethodsOrder < Base
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/mixin/on_url_stanza.rb | Ruby | bsd-2-clause | 47,751 | main | 773 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# Common functionality for checking url stanzas.
module OnUrlStanza
extend Forwardable
include CaskHelp
sig { override.params(cask_block: T.nilable(RuboCop::Cask::AST::CaskBlock)).void }
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/mixin/on_homepage_stanza.rb | Ruby | bsd-2-clause | 47,751 | main | 793 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# Common functionality for checking homepage stanzas.
module OnHomepageStanza
extend Forwardable
include CaskHelp
sig { override.params(cask_block: T.nilable(RuboCop::Cask::AST::CaskBlock)).vo... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/mixin/cask_help.rb | Ruby | bsd-2-clause | 47,751 | main | 2,287 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# Common functionality for cops checking casks.
module CaskHelp
prepend CommentsHelp # Update the rbi file if changing this: https://github.com/sorbet/sorbet/issues/259
sig { overridable.params(cask_b... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/mixin/on_desc_stanza.rb | Ruby | bsd-2-clause | 47,751 | main | 777 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
module Cask
# Common functionality for checking desc stanzas.
module OnDescStanza
extend Forwardable
include CaskHelp
sig { override.params(cask_block: T.nilable(RuboCop::Cask::AST::CaskBlock)).void }
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/constants/stanza.rb | Ruby | bsd-2-clause | 47,751 | main | 2,580 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cask
# Constants available globally for use in all cask cops.
module Constants
ON_SYSTEM_METHODS = T.let(
[:arm, :intel, *MacOSVersion::SYMBOLS.keys].map { |option| :"on_#{option}" }.freeze,
T::Array[Symbol],
)
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/ast/stanza.rb | Ruby | bsd-2-clause | 47,751 | main | 3,637 | # typed: strict
# frozen_string_literal: true
require "forwardable"
module RuboCop
module Cask
module AST
# This class wraps the AST send/block node that encapsulates the method
# call that comprises the stanza. It includes various helper methods to
# aid cops in their analysis.
class St... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/ast/cask_header.rb | Ruby | bsd-2-clause | 47,751 | main | 1,206 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cask
module AST
# This class wraps the AST method node that represents the cask header. It
# includes various helper methods to aid cops in their analysis.
class CaskHeader
sig { params(method_node: T.all(RuboCop::AST::... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/ast/cask_block.rb | Ruby | bsd-2-clause | 47,751 | main | 2,878 | # typed: strict
# frozen_string_literal: true
require "forwardable"
module RuboCop
module Cask
module AST
class StanzaBlock
extend T::Helpers
sig { returns(RuboCop::AST::BlockNode) }
attr_reader :block_node
sig { returns(T::Array[Parser::Source::Comment]) }
attr_r... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/cask/extend/node.rb | Ruby | bsd-2-clause | 47,751 | main | 1,516 | # typed: strict
# frozen_string_literal: true
module RuboCop
module AST
# Extensions for RuboCop's AST Node class.
class Node
include RuboCop::Cask::Constants
def_node_matcher :method_node, "{$(send ...) (block $(send ...) ...)}"
def_node_matcher :block_body, "(block _ _ $_)"
def_no... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/extend/mutable_constant_exclude_unfreezable.rb | Ruby | bsd-2-clause | 47,751 | main | 1,348 | # typed: strict
# frozen_string_literal: true
require "rubocop/cop/style/mutable_constant"
module RuboCop
module Cop
module Sorbet
# TODO: delete this file when https://github.com/Shopify/rubocop-sorbet/pull/256 is available
module MutableConstantExcludeUnfreezable
class << self
si... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/extend/formula_cop.rb | Ruby | bsd-2-clause | 47,751 | main | 9,595 | # typed: strict
# frozen_string_literal: true
require "rubocops/shared/helper_functions"
module RuboCop
module Cop
# Abstract base class for all formula cops.
class FormulaCop < Base
extend T::Helpers
include RangeHelp
include HelperFunctions
abstract!
exclude_from_registry
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/shared/no_autobump_helper.rb | Ruby | bsd-2-clause | 47,751 | main | 1,329 | # typed: strict
# frozen_string_literal: true
require "rubocops/shared/helper_functions"
module RuboCop
module Cop
# This cop audits `no_autobump!` reason.
module NoAutobumpHelper
include HelperFunctions
PUNCTUATION_MARKS = %w[. ! ?].freeze
DISALLOWED_NO_AUTOBUMP_REASONS = %w[extract_plis... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/shared/desc_helper.rb | Ruby | bsd-2-clause | 47,751 | main | 4,781 | # typed: strict
# frozen_string_literal: true
require "rubocops/shared/helper_functions"
module RuboCop
module Cop
# This module performs common checks the `desc` field in both formulae and casks.
module DescHelper
include HelperFunctions
MAX_DESC_LENGTH = 80
VALID_LOWERCASE_WORDS = %w[
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/shared/api_annotation_helper.rb | Ruby | bsd-2-clause | 47,751 | main | 7,279 | # typed: strict
# frozen_string_literal: true
module RuboCop
module Cop
# Shared helpers for reading `@api public/internal/private` annotations
# from source files at RuboCop runtime. Results are cached at the class
# level so each file is parsed at most once per RuboCop invocation.
module ApiAnnotat... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/shared/homepage_helper.rb | Ruby | bsd-2-clause | 47,751 | main | 4,822 | # typed: strict
# frozen_string_literal: true
require "rubocops/shared/helper_functions"
module RuboCop
module Cop
# This module performs common checks the `homepage` field in both formulae and casks.
module HomepageHelper
include HelperFunctions
sig {
params(
type: Symbol, co... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/shared/on_system_conditionals_helper.rb | Ruby | bsd-2-clause | 47,751 | main | 11,260 | # typed: strict
# frozen_string_literal: true
require "macos_version"
require "rubocops/shared/helper_functions"
module RuboCop
module Cop
# This module performs common checks on `on_{system}` blocks in both formulae and casks.
module OnSystemConditionalsHelper
extend NodePattern::Macros
include... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/shared/url_helper.rb | Ruby | bsd-2-clause | 47,751 | main | 13,750 | # typed: strict
# frozen_string_literal: true
require "rubocops/shared/helper_functions"
module RuboCop
module Cop
# This module performs common checks the `homepage` field in both formulae and casks.
module UrlHelper
include HelperFunctions
# Yields to block when there is a match.
#
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/rubocops/shared/helper_functions.rb | Ruby | bsd-2-clause | 47,751 | main | 18,060 | # typed: strict
# frozen_string_literal: true
require "rubocop"
require_relative "../../warnings"
Warnings.ignore :parser_syntax do
require "parser/current"
end
module RuboCop
module Cop
# Helper functions for cops.
module HelperFunctions
include RangeHelp
# Checks for regex match of pattern... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/formula-analytics/pycall-setup.rb | Ruby | bsd-2-clause | 47,751 | main | 352 | # typed: strict
# frozen_string_literal: true
require "pycall/import"
# This was a rewrite from `include(Module.new(...))`,
# to appease Sorbet, so let's keep the existing behaviour
# and silence RuboCop.
# rubocop:disable Style/MixinUsage
include PyCall::Import
# rubocop:enable Style/MixinUsage
pyfrom "influxdb_clie... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/standalone/init.rb | Ruby | bsd-2-clause | 47,751 | main | 3,870 | # typed: true
# frozen_string_literal: true
# This file is included before any other files.
# It intentionally has typing disabled and uses `Homebrew::FastBootRequire`
# or `require_relative` to load all files
# (except "rbconfig" which is needed by `Homebrew::FastBootRequire`)
required_ruby_major, required_ruby_mino... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/standalone/sorbet.rb | Ruby | bsd-2-clause | 47,751 | main | 2,492 | # typed: true
# frozen_string_literal: true
require "sorbet-runtime"
require "extend/module"
# Disable runtime checking unless enabled.
# In the future we should consider not doing this monkey patch,
# if assured that there is no performance hit from removing this.
# There are mechanisms to achieve a middle ground (`... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/requirements/macos_requirement.rb | Ruby | bsd-2-clause | 47,751 | main | 5,618 | # typed: strict
# frozen_string_literal: true
require "requirement"
# A requirement on macOS.
class MacOSRequirement < Requirement
# Sorbet type members are mutable by design and cannot be frozen.
# rubocop:disable Style/MutableConstant
Cache = type_template { { fixed: T::Hash[String, T.untyped] } }
# rubocop... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/requirements/linux_requirement.rb | Ruby | bsd-2-clause | 47,751 | main | 539 | # typed: strict
# frozen_string_literal: true
# A requirement on Linux.
class LinuxRequirement < Requirement
# Sorbet type members are mutable by design and cannot be frozen.
# rubocop:disable Style/MutableConstant
Cache = type_template { { fixed: T::Hash[String, T.untyped] } }
# rubocop:enable Style/MutableCo... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/requirements/codesign_requirement.rb | Ruby | bsd-2-clause | 47,751 | main | 1,399 | # typed: strict
# frozen_string_literal: true
# A requirement on a code-signing identity.
class CodesignRequirement < Requirement
# Sorbet type members are mutable by design and cannot be frozen.
# rubocop:disable Style/MutableConstant
Cache = type_template { { fixed: T::Hash[String, T.untyped] } }
# rubocop:e... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/requirements/arch_requirement.rb | Ruby | bsd-2-clause | 47,751 | main | 1,160 | # typed: strict
# frozen_string_literal: true
require "requirement"
# A requirement on a specific architecture.
class ArchRequirement < Requirement
# Sorbet type members are mutable by design and cannot be frozen.
# rubocop:disable Style/MutableConstant
Cache = type_template { { fixed: T::Hash[String, T.untyped... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/requirements/xcode_requirement.rb | Ruby | bsd-2-clause | 47,751 | main | 1,882 | # typed: strict
# frozen_string_literal: true
require "requirement"
# A requirement on Xcode.
class XcodeRequirement < Requirement
# Sorbet type members are mutable by design and cannot be frozen.
# rubocop:disable Style/MutableConstant
Cache = type_template { { fixed: T::Hash[String, T.untyped] } }
# rubocop... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/linux.rb | Ruby | bsd-2-clause | 47,751 | main | 2,504 | # typed: strict
# frozen_string_literal: true
require "utils"
module OS
# Helper module for querying system information on Linux.
module Linux
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
# This check is the only acceptable or necessary one in this file.
# rubocop:disabl... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/mac.rb | Ruby | bsd-2-clause | 47,751 | main | 6,931 | # typed: strict
# frozen_string_literal: true
require "macos_version"
require "os/mac/xcode"
require "os/mac/sdk"
module OS
# Helper module for querying system information on macOS.
module Mac
extend Utils::Output::Mixin
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
# Thi... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/linux/elf.rb | Ruby | bsd-2-clause | 47,751 | main | 10,143 | # typed: strict
# frozen_string_literal: true
require "os/linux/ld"
# {Pathname} extension for dealing with ELF files.
# @see https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
module ELFShim
extend T::Helpers
MAGIC_NUMBER_OFFSET = 0
private_constant :MAGIC_NUMBER_OFFSET
MAGIC_NUMBER_AS... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/linux/kernel.rb | Ruby | bsd-2-clause | 47,751 | main | 408 | # typed: strict
# frozen_string_literal: true
module OS
module Linux
# Helper functions for querying Linux kernel information.
module Kernel
module_function
sig { returns(Version) }
def minimum_version
Version.new "3.2"
end
sig { returns(T::Boolean) }
def below_m... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/linux/libstdcxx.rb | Ruby | bsd-2-clause | 47,751 | main | 1,454 | # typed: strict
# frozen_string_literal: true
require "os/linux/ld"
module OS
module Linux
# Helper functions for querying `libstdc++` information.
module Libstdcxx
SOVERSION = 6
SONAME = T.let("libstdc++.so.#{SOVERSION}".freeze, String)
sig { returns(T::Boolean) }
def self.below_ci... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/linux/ld.rb | Ruby | bsd-2-clause | 47,751 | main | 3,774 | # typed: strict
# frozen_string_literal: true
module OS
module Linux
# Helper functions for querying `ld` information.
module Ld
# This is a list of known paths to the host dynamic linker on Linux if
# the host glibc is new enough. Brew will fail to create a symlink for
# ld.so if the host ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/linux/glibc.rb | Ruby | bsd-2-clause | 47,751 | main | 1,294 | # typed: strict
# frozen_string_literal: true
module OS
module Linux
# Helper functions for querying `glibc` information.
module Glibc
module_function
sig { returns(Version) }
def system_version
@system_version ||= T.let(nil, T.nilable(Version))
@system_version ||= begin
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/mac/mach.rb | Ruby | bsd-2-clause | 47,751 | main | 5,403 | # typed: strict
# frozen_string_literal: true
require "macho"
# {Pathname} extension for dealing with Mach-O files.
module MachOShim
extend Forwardable
extend T::Helpers
requires_ancestor { Pathname }
delegate [:dylib_id] => :macho
sig { params(args: T.untyped).void }
def initialize(*args)
@macho =... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/mac/sdk.rb | Ruby | bsd-2-clause | 47,751 | main | 5,031 | # typed: strict
# frozen_string_literal: true
require "system_command"
module OS
module Mac
# Class representing a macOS SDK.
class SDK
# 11.x SDKs are explicitly excluded - we want the MacOSX11.sdk symlink instead.
VERSIONED_SDK_REGEX = /MacOSX(10\.\d+|\d+)\.sdk$/
sig { returns(MacOSVers... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os/mac/xcode.rb | Ruby | bsd-2-clause | 47,751 | main | 13,001 | # typed: strict
# frozen_string_literal: true
module OS
module Mac
# Helper module for querying Xcode information.
module Xcode
DEFAULT_BUNDLE_PATH = T.let(Pathname("/Applications/Xcode.app").freeze, ::Pathname)
BUNDLE_ID = "com.apple.dt.Xcode"
OLD_BUNDLE_ID = "com.apple.Xcode"
APPLE_... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/startup/bootsnap.rb | Ruby | bsd-2-clause | 47,751 | main | 2,111 | # typed: true
# frozen_string_literal: true
module Homebrew
module Bootsnap
def self.key
@key ||= begin
require "digest/sha2"
checksum = Digest::SHA256.new
checksum << RUBY_VERSION
checksum << RUBY_PLATFORM
checksum << Dir.children(File.join(Gem.paths.path, "gems"))... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.