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 | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/match_var.rb | @@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for in pattern nodes
- class MatchVar < self
-
- handle :match_var
-
- children :name
-
- private
-
- def dispatch
- write(name.to_s)
- end
- end # MatchVar
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/mlhs.rb | @@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for multiple assignment left hand side
- class MLHS < self
- handle :mlhs
-
- NO_COMMA = %i[arg splat mlhs restarg].freeze
-
- private_constant(*constants(false))
-
- private
-
- def dispatch
- if children.one?
- emit_one_child_mlhs
- else
- emit_many
- end
- end
-
- def emit_one_child_mlhs
- child = children.first
- parentheses do
- emitter(child).emit_mlhs
- write(',') unless NO_COMMA.include?(child.type)
- end
- end
-
- def emit_many
- parentheses do
- delimited(children) do |node|
- emitter(node).emit_mlhs
- end
- end
- end
- end # MLHS
- end # Emitter
-end # Unaprser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/module.rb | @@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for module nodes
- class Module < self
- include LocalVariableRoot
-
- handle :module
-
- children :name, :body
-
- private
-
- def dispatch
- write('module ')
- visit(name)
- emit_optional_body(body)
- k_end
- end
-
- end # Module
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/op_assign.rb | @@ -1,52 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
-
- # Base class for and and or op-assign
- class BinaryAssign < self
- children :target, :expression
-
- MAP = {
- and_asgn: '&&=',
- or_asgn: '||='
- }.freeze
-
- handle(*MAP.keys)
-
- def emit_heredoc_reminders
- emitter(target).emit_heredoc_reminders
- emitter(expression).emit_heredoc_reminders
- end
-
- private
-
- def dispatch
- emitter(target).emit_mlhs
- write(' ', MAP.fetch(node.type), ' ')
- visit(expression)
- end
-
- end # BinaryAssign
-
- # Emitter for op assign
- class OpAssign < self
- handle :op_asgn
-
- children :target, :operator, :value
-
- private
-
- def dispatch
- emitter(first_child).emit_mlhs
- emit_operator
- visit(value)
- end
-
- def emit_operator
- write(' ', operator.to_s, '= ')
- end
-
- end # OpAssign
- end # Emitte
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/pair.rb | @@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for key value pairs in hash literals or kwargs
- class Pair < self
- BAREWORD = /\A[A-Za-z_][A-Za-z_0-9]*[?!]?\z/.freeze
-
- private_constant(*constants(false))
-
- handle :pair
-
- children :key, :value
-
- private
-
- def dispatch
- if colon?(key)
- write(key.children.first.to_s, ': ')
- else
- visit(key)
- write(' => ')
- end
-
- visit(value)
- end
-
- def colon?(key)
- n_sym?(key) && BAREWORD.match?(key.children.first)
- end
- end
- end
-end | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/pin.rb | @@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for pin nodes
- class Pin < self
- handle :pin
-
- children :target
-
- private
-
- def dispatch
- write('^')
- visit(target)
- end
- end # Pin
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/primitive.rb | @@ -1,93 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Base class for primitive emitters
- class Primitive < self
-
- children :value
-
- # Emitter for primitives based on Object#inspect
- class Inspect < self
-
- handle :sym, :str
-
- private
-
- def dispatch
- write(value.inspect)
- end
-
- end # Inspect
-
- # Emitter for complex literals
- class Complex < self
-
- handle :complex
-
- RATIONAL_FORMAT = 'i'.freeze
-
- MAP =
- {
- ::Float => :float,
- ::Rational => :rational,
- ::Integer => :int
- }.freeze
-
- private
-
- def dispatch
- emit_imaginary
- write(RATIONAL_FORMAT)
- end
-
- def emit_imaginary
- visit(imaginary_node)
- end
-
- def imaginary_node
- imaginary = value.imaginary
- s(MAP.fetch(imaginary.class), imaginary)
- end
-
- end # Rational
-
- # Emitter for rational literals
- class Rational < self
-
- handle :rational
-
- RATIONAL_FORMAT = 'r'.freeze
-
- private
-
- # rubocop:disable Lint/FloatComparison
- def dispatch
- integer = Integer(value)
- float = value.to_f
-
- write_rational(integer.to_f.equal?(float) ? integer : float)
- end
- # rubocop:enable Lint/FloatComparison
-
- def write_rational(value)
- write(value.to_s, RATIONAL_FORMAT)
- end
-
- end # Rational
-
- # Emiter for numeric literals
- class Numeric < self
-
- handle :int
-
- private
-
- def dispatch
- write(value.inspect)
- end
-
- end # Numeric
- end # Primitive
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/range.rb | @@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Range emitters
- class Range < self
- TOKENS = {
- irange: '..',
- erange: '...'
- }.freeze
-
- SYMBOLS = {
- erange: :tDOT3,
- irange: :tDOT2
- }.freeze
-
- def symbol_name
- true
- end
-
- handle(*TOKENS.keys)
-
- children :begin_node, :end_node
-
- private
-
- def dispatch
- visit(begin_node) if begin_node
- write(TOKENS.fetch(node.type))
- visit(end_node) if end_node
- end
-
- end # Range
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/regexp.rb | @@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for regexp literals
- class Regexp < self
- handle :regexp
-
- define_group(:body, 0..-2)
-
- private
-
- def dispatch
- parentheses('/', '/') do
- body.each(&method(:emit_body))
- end
- emit_options
- end
-
- def emit_options
- write(children.last.children.join)
- end
-
- def emit_body(node)
- if n_begin?(node)
- write('#{')
- node.children.each(&method(:visit))
- write('}')
- else
- buffer.append_without_prefix(node.children.first.gsub('/', '\/'))
- end
- end
- end # Regexp
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/repetition.rb | @@ -1,75 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
-
- # Emitter for postconditions
- class Post < self
- children :condition, :body
-
- MAP = {
- while_post: 'while',
- until_post: 'until'
- }.freeze
-
- handle(*MAP.keys)
-
- private
-
- def dispatch
- visit(body)
- write(' ', MAP.fetch(node.type), ' ')
- visit(condition)
- end
- end
-
- # Emitter for while and until nodes
- class Repetition < self
- MAP = {
- while: 'while',
- until: 'until'
- }.freeze
-
- handle(*MAP.keys)
-
- children :condition, :body
-
- private
-
- def dispatch
- if postcontrol?
- emit_postcontrol
- else
- emit_normal
- end
- end
-
- def postcontrol?
- body && local_variable_scope.first_assignment_in?(body, condition)
- end
-
- def emit_keyword
- write(MAP.fetch(node.type), ' ')
- end
-
- def emit_normal
- emit_keyword
- visit(condition)
- if body
- emit_body(body)
- else
- nl
- end
- k_end
- end
-
- def emit_postcontrol
- visit(body)
- ws
- emit_keyword
- visit(condition)
- end
-
- end # Repetition
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/rescue.rb | @@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for rescue nodes
- class Rescue < self
- handle :rescue
-
- private
-
- def dispatch
- emit_rescue_postcontrol(node)
- end
- end # Rescue
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/root.rb | @@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Root emitter a special case
- class Root < self
- include Concord::Public.new(:buffer, :node, :comments)
- include LocalVariableRoot
-
- END_NL = %i[class sclass module begin].freeze
-
- private_constant(*constants(false))
-
- def dispatch
- if children.any?
- emit_body(node, indent: false)
- else
- visit_deep(node)
- end
-
- emit_eof_comments
-
- nl if END_NL.include?(node.type) && !buffer.fresh_line?
- end
- end # Root
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/send.rb | @@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for send
- class Send < self
- handle :csend, :send
-
- def emit_mlhs
- writer.emit_mlhs
- end
-
- def emit_heredoc_reminders
- writer.emit_heredoc_reminders
- end
-
- private
-
- def dispatch
- writer.dispatch
- end
-
- def writer
- writer_with(Writer::Send, node)
- end
- memoize :writer
- end # Send
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/simple.rb | @@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for simple nodes that generate a single token
- class Simple < self
- MAP = {
- __ENCODING__: '__ENCODING__',
- __FILE__: '__FILE__',
- __LINE__: '__LINE__',
- false: 'false',
- forward_arg: '...',
- forwarded_args: '...',
- kwnilarg: '**nil',
- match_nil_pattern: '**nil',
- nil: 'nil',
- redo: 'redo',
- retry: 'retry',
- self: 'self',
- true: 'true',
- zsuper: 'super'
- }.freeze
-
- handle(*MAP.keys)
-
- private
-
- def dispatch
- write(MAP.fetch(node_type))
- end
- end # Simple
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/splat.rb | @@ -1,43 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for splats
- class KwSplat < self
- handle :kwsplat
-
- children :subject
-
- private
-
- def dispatch
- write('**')
- visit(subject)
- end
- end
-
- # Emitter for splats
- class Splat < self
- handle :splat
-
- children :subject
-
- def emit_mlhs
- write('*')
- subject_emitter.emit_mlhs if subject
- end
-
- private
-
- def dispatch
- write('*')
- subject_emitter.write_to_buffer
- end
-
- def subject_emitter
- emitter(subject)
- end
- memoize :subject_emitter
- end
- end
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/super.rb | @@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
-
- # Emitter for super nodes
- class Super < self
- handle :super
-
- private
-
- def dispatch
- write('super')
- parentheses do
- delimited(children)
- end
- end
-
- end # Super
-
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/undef.rb | @@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Emitter for undef nodes
- class Undef < self
- handle :undef
-
- private
-
- def dispatch
- write('undef ')
- delimited(children)
- end
-
- end # Undef
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/variable.rb | @@ -1,58 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
-
- # Emitter for various variable accesses
- class Variable < self
- handle :ivar, :lvar, :cvar, :gvar, :back_ref
-
- children :name
-
- private
-
- def dispatch
- write(name.to_s)
- end
-
- end # Access
-
- # Emitter for constant access
- class Const < self
- handle :const
-
- children :scope, :name
-
- private
-
- def dispatch
- emit_scope
- write(name.to_s)
- end
-
- def emit_scope
- return unless scope
-
- visit(scope)
- write('::') unless n_cbase?(scope)
- end
- end
-
- # Emitter for nth_ref nodes (regexp captures)
- class NthRef < self
- PREFIX = '$'.freeze
- handle :nth_ref
-
- children :name
-
- private
-
- def dispatch
- write(PREFIX)
- write(name.to_s)
- end
-
- end # NthRef
-
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/xstr.rb | @@ -1,72 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
- # Dynamic execute string literal emitter
- class XStr < self
-
- handle :xstr
-
- private
-
- def dispatch
- if heredoc?
- emit_heredoc
- else
- emit_xstr
- end
- end
-
- def heredoc?
- children.any? { |node| node.eql?(s(:str, '')) }
- end
-
- def emit_heredoc
- write(%(<<~`HEREDOC`))
- buffer.indent
- nl
- children.each do |child|
- if n_str?(child)
- write(child.children.first)
- else
- emit_begin(child)
- end
- end
- buffer.unindent
- write("HEREDOC\n")
- end
-
- def emit_xstr
- write('`')
- children.each do |child|
- if n_begin?(child)
- emit_begin(child)
- else
- emit_string(child)
- end
- end
- write('`')
- end
-
- def emit_string(value)
- write(escape_xstr(value.children.first))
- end
-
- def escape_xstr(input)
- input.chars.map do |char|
- if char.eql?('`')
- '\\`'
- else
- char
- end
- end.join
- end
-
- def emit_begin(component)
- write('#{')
- visit(unwrap_single_begin(component))
- write('}')
- end
- end # XStr
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/emitter/yield.rb | @@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- class Emitter
-
- # Emitter for yield node
- class Yield < self
- handle :yield
-
- private
-
- def dispatch
- write('yield')
- return if children.empty?
-
- parentheses do
- delimited(children)
- end
- end
-
- end # Yield
-
- end # Emitter
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/equalizer.rb | @@ -1,98 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- # Define equality, equivalence and inspection methods
- #
- # Original code before vendoring and reduction from: https://github.com/dkubb/equalizer.
- class Equalizer < Module
- # Initialize an Equalizer with the given keys
- #
- # Will use the keys with which it is initialized to define #cmp?,
- # #hash, and #inspect
- #
- # @param [Array<Symbol>] keys
- #
- # @return [undefined]
- #
- # @api private
- #
- # rubocop:disable Lint/MissingSuper
- def initialize(*keys)
- @keys = keys
- define_methods
- freeze
- end
- # rubocop:enable Lint/MissingSuper
-
- private
-
- def included(descendant)
- descendant.include(Methods)
- end
-
- def define_methods
- define_cmp_method
- define_hash_method
- define_inspect_method
- end
-
- def define_cmp_method
- keys = @keys
- define_method(:cmp?) do |comparator, other|
- keys.all? do |key|
- __send__(key).public_send(comparator, other.__send__(key))
- end
- end
- private :cmp?
- end
-
- def define_hash_method
- keys = @keys
- define_method(:hash) do
- keys.map(&public_method(:__send__)).push(self.class).hash
- end
- end
-
- def define_inspect_method
- keys = @keys
- define_method(:inspect) do
- klass = self.class
- name = klass.name || klass.inspect
- "#<#{name}#{keys.map { |key| " #{key}=#{__send__(key).inspect}" }.join}>"
- end
- end
-
- # The comparison methods
- module Methods
- # Compare the object with other object for equality
- #
- # @example
- # object.eql?(other) # => true or false
- #
- # @param [Object] other
- # the other object to compare with
- #
- # @return [Boolean]
- #
- # @api public
- def eql?(other)
- instance_of?(other.class) && cmp?(__method__, other)
- end
-
- # Compare the object with other object for equivalency
- #
- # @example
- # object == other # => true or false
- #
- # @param [Object] other
- # the other object to compare with
- #
- # @return [Boolean]
- #
- # @api public
- def ==(other)
- instance_of?(other.class) && cmp?(__method__, other)
- end
- end # module Methods
- end # class Equalizer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/finalize.rb | @@ -1,3 +0,0 @@
-# frozen_string_literal: true
-
-Unparser::Emitter::REGISTRY.freeze | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/generation.rb | @@ -1,252 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- # rubocop:disable Metrics/ModuleLength
- module Generation
- EXTRA_NL = %i[kwbegin def defs module class sclass].freeze
-
- private_constant(*constants(false))
-
- def emit_heredoc_reminders; end
-
- def symbol_name; end
-
- def write_to_buffer
- with_comments { dispatch }
- self
- end
-
- private
-
- def delimited(nodes, delimiter = ', ', &block)
- return if nodes.empty?
-
- emit_join(nodes, block || method(:visit), -> { write(delimiter) })
- end
-
- def emit_join(nodes, emit_node, emit_delimiter)
- return if nodes.empty?
-
- head, *tail = nodes
- emit_node.call(head)
-
- tail.each do |node|
- emit_delimiter.call
- emit_node.call(node)
- end
- end
-
- def nl
- emit_eol_comments
- buffer.nl
- end
-
- def with_comments
- emit_comments_before if buffer.fresh_line?
- yield
- comments.consume(node)
- end
-
- def ws
- write(' ')
- end
-
- def emit_eol_comments
- comments.take_eol_comments.each do |comment|
- write(' ', comment.text)
- end
- end
-
- def emit_eof_comments
- emit_eol_comments
- comments_left = comments.take_all
- return if comments_left.empty?
-
- buffer.nl
- emit_comments(comments_left)
- end
-
- def emit_comments_before(source_part = :expression)
- comments_before = comments.take_before(node, source_part)
- return if comments_before.empty?
-
- emit_comments(comments_before)
- buffer.nl
- end
-
- def emit_comments(comments)
- max = comments.size - 1
- comments.each_with_index do |comment, index|
- if comment.type.equal?(:document)
- buffer.append_without_prefix(comment.text.chomp)
- else
- write(comment.text)
- end
- buffer.nl if index < max
- end
- end
-
- def write(*strings)
- strings.each(&buffer.method(:append))
- end
-
- def k_end
- buffer.indent
- emit_comments_before(:end)
- buffer.unindent
- write('end')
- end
-
- def parentheses(open = '(', close = ')')
- write(open)
- yield
- write(close)
- end
-
- def indented
- buffer = buffer()
- buffer.indent
- nl
- yield
- nl
- buffer.unindent
- end
-
- def emit_optional_body(node, indent: true)
- if node
- emit_body(node, indent: indent)
- else
- nl
- end
- end
-
- def emit_body(node, indent: true)
- if indent
- buffer.indent
- nl
- end
-
- if n_begin?(node)
- if node.children.one?
- visit_deep(node)
- else
- emit_body_inner(node)
- end
- else
- visit_deep(node)
- end
-
- if indent
- buffer.unindent
- nl
- end
- end
-
- def emit_body_inner(node)
- head, *tail = node.children
- emit_body_member(head)
-
- tail.each do |child|
- nl
-
- nl if EXTRA_NL.include?(child.type)
-
- emit_body_member(child)
- end
- end
-
- def emit_body_member(node)
- if n_rescue?(node)
- emit_rescue_postcontrol(node)
- else
- visit_deep(node)
- end
- end
-
- def emit_ensure(node)
- body, ensure_body = node.children
-
- if body
- emit_body_rescue(body)
- else
- nl
- end
-
- write('ensure')
-
- emit_optional_body(ensure_body)
- end
-
- def emit_body_rescue(node)
- if n_rescue?(node)
- emit_rescue_regular(node)
- else
- emit_body(node)
- end
- end
-
- def emit_optional_body_ensure_rescue(node)
- if node
- emit_body_ensure_rescue(node)
- else
- nl
- end
- end
-
- def emit_body_ensure_rescue(node)
- if n_ensure?(node)
- emit_ensure(node)
- elsif n_rescue?(node)
- emit_rescue_regular(node)
- else
- emit_body(node)
- end
- end
-
- def emit_rescue_postcontrol(node)
- writer = writer_with(Writer::Rescue, node)
- writer.emit_postcontrol
- writer.emit_heredoc_reminders
- end
-
- def emit_rescue_regular(node)
- writer_with(Writer::Rescue, node).emit_regular
- end
-
- def writer_with(klass, node)
- klass.new(to_h.merge(node: node))
- end
-
- def emitter(node)
- Emitter.emitter(**to_h.merge(node: node))
- end
-
- def visit(node)
- emitter(node).write_to_buffer
- end
-
- def visit_deep(node)
- emitter(node).tap do |emitter|
- emitter.write_to_buffer
- emitter.emit_heredoc_reminders
- end
- end
-
- def first_child
- children.first
- end
-
- def conditional_parentheses(flag, &block)
- if flag
- parentheses(&block)
- else
- block.call
- end
- end
-
- def children
- node.children
- end
- end # Generation
- # rubocop:enable Metrics/ModuleLength
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/node_details.rb | @@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module NodeDetails
- include Constants, NodeHelpers
-
- def self.included(descendant)
- descendant.class_eval do
- include Adamantium, Concord.new(:node)
-
- extend DSL
- end
- end
-
- private
-
- def children
- node.children
- end
- end # NodeDetails
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/node_details/send.rb | @@ -1,62 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module NodeDetails
- class Send
- include NodeDetails
-
- ASSIGN_SUFFIX = '='.freeze
- NON_ASSIGN_RANGE = (0..-2).freeze
-
- private_constant(*constants(false))
-
- children :receiver, :selector
-
- public :receiver, :selector
-
- def selector_binary_operator?
- BINARY_OPERATORS.include?(selector)
- end
-
- def binary_syntax_allowed?
- selector_binary_operator? && arguments.one? && !n_splat?(arguments.first)
- end
-
- def selector_unary_operator?
- UNARY_OPERATORS.include?(selector)
- end
-
- def assignment_operator?
- assignment? && !selector_binary_operator? && !selector_unary_operator?
- end
-
- def arguments?
- arguments.any?
- end
-
- def non_assignment_selector
- if assignment?
- string_selector[NON_ASSIGN_RANGE]
- else
- string_selector
- end
- end
-
- def assignment?
- string_selector[-1].eql?(ASSIGN_SUFFIX)
- end
- memoize :assignment?
-
- def arguments
- children[2..-1]
- end
- memoize :arguments
-
- def string_selector
- selector.to_s
- end
- memoize :string_selector
-
- end # Send
- end # NodeDetails
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/node_helpers.rb | @@ -1,77 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module NodeHelpers
-
- # Helper for building nodes
- #
- # @param [Symbol] type
- # @param [Parser::AST::Node] children
- #
- # @return [Parser::AST::Node]
- #
- # @api private
- def s(type, *children)
- Parser::AST::Node.new(type, children)
- end
-
- # Helper for building nodes
- #
- # @param [Symbol] type
- #
- # @return [Parser::AST::Node]
- # @param [Array] children
- #
- # @api private
- def n(type, children = [])
- Parser::AST::Node.new(type, children)
- end
-
- def n?(type, node)
- node.type.equal?(type)
- end
-
- %i[
- arg
- args
- array
- array_pattern
- empty_else
- begin
- block
- cbase
- const
- dstr
- ensure
- hash
- hash_pattern
- if
- in_pattern
- int
- kwsplat
- lambda
- match_rest
- pair
- rescue
- send
- shadowarg
- splat
- str
- sym
- ].each do |type|
- name = "n_#{type}?"
- define_method(name) do |node|
- n?(type, node)
- end
- private(name)
- end
-
- def unwrap_single_begin(node)
- if n_begin?(node) && node.children.one?
- node.children.first
- else
- node
- end
- end
- end # NodeHelpers
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/validation.rb | @@ -1,172 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- # Validation of unparser results
- class Validation
- include Adamantium, Anima.new(
- :generated_node,
- :generated_source,
- :identification,
- :original_node,
- :original_source
- )
-
- # Test if source could be unparsed successfully
- #
- # @return [Boolean]
- #
- # @api private
- #
- def success?
- [
- original_source,
- original_node,
- generated_source,
- generated_node
- ].all?(&:right?) && generated_node.from_right.==(original_node.from_right)
- end
-
- # Return error report
- #
- # @return [String]
- #
- # @api private
- #
- def report
- message = [identification]
-
- message.concat(make_report('Original-Source', :original_source))
- message.concat(make_report('Generated-Source', :generated_source))
- message.concat(make_report('Original-Node', :original_node))
- message.concat(make_report('Generated-Node', :generated_node))
- message.concat(node_diff_report)
-
- message.join("\n")
- end
- memoize :report
-
- # Create validator from string
- #
- # @param [String] original_source
- #
- # @return [Validator]
- def self.from_string(original_source)
- original_node = Unparser
- .parse_either(original_source)
-
- generated_source = original_node
- .lmap(&method(:const_unit))
- .bind(&Unparser.method(:unparse_either))
-
- generated_node = generated_source
- .lmap(&method(:const_unit))
- .bind(&Unparser.method(:parse_either))
-
- new(
- identification: '(string)',
- original_source: Either::Right.new(original_source),
- original_node: original_node,
- generated_source: generated_source,
- generated_node: generated_node
- )
- end
-
- # Create validator from node
- #
- # @param [Parser::AST::Node] original_node
- #
- # @return [Validator]
- def self.from_node(original_node)
- generated_source = Unparser.unparse_either(original_node)
-
- generated_node = generated_source
- .lmap(&method(:const_unit))
- .bind(&Unparser.public_method(:parse_either))
-
- new(
- identification: '(string)',
- original_source: generated_source,
- original_node: Either::Right.new(original_node),
- generated_source: generated_source,
- generated_node: generated_node
- )
- end
-
- # Create validator from file
- #
- # @param [Pathname] path
- #
- # @return [Validator]
- def self.from_path(path)
- from_string(path.read).with(identification: path.to_s)
- end
-
- private
-
- def make_report(label, attribute_name)
- ["#{label}:"].concat(public_send(attribute_name).either(method(:report_exception), ->(value) { [value] }))
- end
-
- def report_exception(exception)
- if exception
- [exception.inspect].concat(exception.backtrace.take(20))
- else
- ['undefined']
- end
- end
-
- def node_diff_report
- diff = nil
-
- original_node.fmap do |original|
- generated_node.fmap do |generated|
- diff = Diff.new(
- original.to_s.lines.map(&:chomp),
- generated.to_s.lines.map(&:chomp)
- ).colorized_diff
- end
- end
-
- diff ? ['Node-Diff:', diff] : []
- end
-
- def self.const_unit(_value); end
- private_class_method :const_unit
-
- class Literal < self
- def success?
- original_source.eql?(generated_source)
- end
-
- def report
- message = [identification]
-
- message.concat(make_report('Original-Source', :original_source))
- message.concat(make_report('Generated-Source', :generated_source))
- message.concat(make_report('Original-Node', :original_node))
- message.concat(make_report('Generated-Node', :generated_node))
- message.concat(node_diff_report)
- message.concat(source_diff_report)
-
- message.join("\n")
- end
-
- private
-
- def source_diff_report
- diff = nil
-
- original_source.fmap do |original|
- generated_source.fmap do |generated|
- diff = Diff.new(
- original.split("\n", -1),
- generated.split("\n", -1)
- ).colorized_diff
- end
- end
-
- diff ? ['Source-Diff:', diff] : []
- end
- end # Literal
- end # Validation
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer.rb | @@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- include Generation, NodeHelpers
-
- def self.included(descendant)
- descendant.class_eval do
- include Anima.new(:buffer, :comments, :node, :local_variable_scope)
-
- extend DSL
- end
- end
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/binary.rb | @@ -1,99 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- class Binary
- include Writer, Adamantium
-
- children :left, :right
-
- OPERATOR_TOKENS =
- {
- and: '&&',
- or: '||'
- }.freeze
-
- KEYWORD_TOKENS =
- {
- and: 'and',
- or: 'or'
- }.freeze
-
- KEYWORD_SYMBOLS =
- {
- and: :kAND,
- or: :kOR
- }.freeze
-
- OPERATOR_SYMBOLS =
- {
- and: :tANDOP,
- or: :tOROP
- }.freeze
-
- MAP =
- {
- kAND: 'and',
- kOR: 'or',
- tOROP: '||',
- tANDOP: '&&'
- }.freeze
-
- NEED_KEYWORD = %i[return break next].freeze
-
- private_constant(*constants(false))
-
- def emit_operator
- emit_with(OPERATOR_TOKENS)
- end
-
- def symbol_name
- true
- end
-
- def dispatch
- left_emitter.write_to_buffer
- write(' ', MAP.fetch(effective_symbol), ' ')
- visit(right)
- end
-
- private
-
- def effective_symbol
- if NEED_KEYWORD.include?(right.type) || NEED_KEYWORD.include?(left.type)
- return keyword_symbol
- end
-
- unless left_emitter.symbol_name
- return operator_symbol
- end
-
- keyword_symbol
- end
-
- def emit_with(map)
- visit(left)
- write(' ', map.fetch(node.type), ' ')
- visit(right)
- end
-
- def keyword_symbol
- KEYWORD_SYMBOLS.fetch(node.type)
- end
-
- def operator_symbol
- OPERATOR_SYMBOLS.fetch(node.type)
- end
-
- def left_emitter
- emitter(left)
- end
- memoize :left_emitter
-
- def right_emitter
- emitter(right)
- end
- memoize :right_emitter
- end # Binary
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/dynamic_string.rb | @@ -1,223 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- class DynamicString
- include Writer, Adamantium
-
- PATTERNS_2 =
- [
- %i[str_empty begin].freeze,
- %i[begin str_nl].freeze
- ].freeze
-
- PATTERNS_3 =
- [
- %i[begin str_nl_eol str_nl_eol].freeze,
- %i[str_nl_eol begin str_nl_eol].freeze,
- %i[str_ws begin str_nl_eol].freeze
- ].freeze
-
- FLAT_INTERPOLATION = %i[ivar cvar gvar nth_ref].to_set.freeze
-
- private_constant(*constants(false))
-
- def emit_heredoc_reminder
- return unless heredoc?
-
- emit_heredoc_body
- emit_heredoc_footer
- end
-
- def dispatch
- if heredoc?
- emit_heredoc_header
- else
- emit_dstr
- end
- end
-
- private
-
- def heredoc_header
- '<<-HEREDOC'
- end
-
- def heredoc?
- !children.empty? && (nl_last_child? && heredoc_pattern?)
- end
-
- def emit_heredoc_header
- write(heredoc_header)
- end
-
- def emit_heredoc_body
- nl
- emit_normal_heredoc_body
- end
-
- def emit_heredoc_footer
- write('HEREDOC')
- end
-
- def classify(node)
- if n_str?(node)
- classify_str(node)
- else
- node.type
- end
- end
-
- def classify_str(node)
- if str_nl?(node)
- :str_nl
- elsif node.children.first.end_with?("\n")
- :str_nl_eol
- elsif str_ws?(node)
- :str_ws
- elsif str_empty?(node)
- :str_empty
- end
- end
-
- def str_nl?(node)
- node.eql?(s(:str, "\n"))
- end
-
- def str_empty?(node)
- node.eql?(s(:str, ''))
- end
-
- def str_ws?(node)
- /\A( |\t)+\z/.match?(node.children.first)
- end
-
- def heredoc_pattern?
- heredoc_pattern_2? || heredoc_pattern_3?
- end
-
- def heredoc_pattern_3?
- children.each_cons(3).any? do |group|
- PATTERNS_3.include?(group.map(&method(:classify)))
- end
- end
-
- def heredoc_pattern_2?
- children.each_cons(2).any? do |group|
- PATTERNS_2.include?(group.map(&method(:classify)))
- end
- end
-
- def nl_last_child?
- last = children.last
- n_str?(last) && last.children.first[-1].eql?("\n")
- end
-
- def emit_squiggly_heredoc_body
- buffer.indent
- children.each do |child|
- if n_str?(child)
- write(escape_dynamic(child.children.first))
- else
- emit_dynamic(child)
- end
- end
- buffer.unindent
- end
-
- def emit_normal_heredoc_body
- buffer.root_indent do
- children.each do |child|
- if n_str?(child)
- write(escape_dynamic(child.children.first))
- else
- emit_dynamic(child)
- end
- end
- end
- end
-
- def escape_dynamic(string)
- string.gsub('#', '\#')
- end
-
- def emit_dynamic(child)
- if FLAT_INTERPOLATION.include?(child.type)
- write('#')
- visit(child)
- elsif n_dstr?(child)
- emit_body(child.children)
- else
- write('#{')
- emit_dynamic_component(child.children.first)
- write('}')
- end
- end
-
- def emit_dynamic_component(node)
- visit(node) if node
- end
-
- def emit_dstr
- if children.empty?
- write('%()')
- else
- segments.each_with_index do |children, index|
- emit_segment(children, index)
- end
- end
- end
-
- def breakpoint?(child, current)
- last_type = current.last&.type
-
- [
- n_str?(child) && last_type.equal?(:str) && current.none?(&method(:n_begin?)),
- last_type.equal?(:dstr),
- n_dstr?(child) && last_type
- ].any?
- end
-
- def segments
- segments = []
-
- segments << current = []
-
- children.each do |child|
- if breakpoint?(child, current)
- segments << current = []
- end
-
- current << child
- end
-
- segments
- end
-
- def emit_segment(children, index)
- write(' ') unless index.zero?
-
- write('"')
- emit_body(children)
- write('"')
- end
-
- def emit_body(children)
- buffer.root_indent do
- children.each_with_index do |child, index|
- if n_str?(child)
- string = child.children.first
- if string.eql?("\n") && children.fetch(index.pred).type.equal?(:begin)
- write("\n")
- else
- write(string.inspect[1..-2])
- end
- else
- emit_dynamic(child)
- end
- end
- end
- end
- end # DynamicString
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/resbody.rb | @@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- # Writer for rescue bodies
- class Resbody
- include Writer
-
- children :exception, :assignment, :body
-
- def emit_postcontrol
- write(' rescue ')
- visit(body)
- end
-
- def emit_regular
- write('rescue')
- emit_exception
- emit_assignment
- emit_optional_body(body)
- end
-
- private
-
- def emit_exception
- return unless exception
-
- ws
- delimited(exception.children)
- end
-
- def emit_assignment
- return unless assignment
-
- write(' => ')
- visit(assignment)
- end
- end # Resbody
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/rescue.rb | @@ -1,43 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- class Rescue
- include Writer, Adamantium
-
- children :body, :rescue_body
-
- define_group :rescue_bodies, 1..-2
-
- def emit_regular
- emit_optional_body(body)
-
- rescue_bodies.each(&method(:emit_rescue_body))
-
- if else_node
- write('else')
- emit_body(else_node)
- end
- end
-
- def emit_heredoc_reminders
- emitter(body).emit_heredoc_reminders
- end
-
- def emit_postcontrol
- visit(body)
- writer_with(Resbody, rescue_body).emit_postcontrol
- end
-
- private
-
- def else_node
- children.last
- end
-
- def emit_rescue_body(node)
- writer_with(Resbody, node).emit_regular
- end
- end # Rescue
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/send.rb | @@ -1,115 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- # Writer for send
- class Send
- include Writer, Adamantium, Constants, Generation
-
- INDEX_ASSIGN = :'[]='
- INDEX_REFERENCE = :'[]'
-
- OPERATORS = {
- csend: '&.',
- send: '.'
- }.freeze
-
- private_constant(*constants(false))
-
- children :receiver, :selector
-
- def dispatch
- effective_writer.dispatch
- end
-
- def emit_mlhs
- effective_writer.emit_send_mlhs
- end
-
- def emit_selector
- write(details.string_selector)
- end
-
- def emit_heredoc_reminders
- emitter(receiver).emit_heredoc_reminders if receiver
- arguments.each(&method(:emit_heredoc_reminder))
- end
-
- private
-
- def effective_writer
- writer_with(effective_writer_class, node)
- end
- memoize :effective_writer
-
- def effective_writer_class
- if details.binary_syntax_allowed?
- Binary
- elsif details.selector_unary_operator? && n_send?(node)
- Unary
- elsif write_as_attribute_assignment?
- AttributeAssignment
- else
- Regular
- end
- end
-
- def write_as_attribute_assignment?
- details.assignment_operator?
- end
-
- def emit_operator
- write(OPERATORS.fetch(node.type))
- end
-
- def emit_arguments
- if arguments.empty?
- write('()') if receiver.nil? && avoid_clash?
- else
- emit_normal_arguments
- end
- end
-
- def arguments
- details.arguments
- end
-
- def emit_normal_arguments
- parentheses { delimited(arguments) }
- end
-
- def emit_heredoc_reminder(argument)
- emitter(argument).emit_heredoc_reminders
- end
-
- def avoid_clash?
- local_variable_clash? || parses_as_constant?
- end
-
- def local_variable_clash?
- local_variable_scope.local_variable_defined_for_node?(node, selector)
- end
-
- def parses_as_constant?
- test = Unparser.parse_either(selector.to_s).from_right do
- fail InvalidNodeError.new("Invalid selector for send node: #{selector.inspect}", node)
- end
-
- n_const?(test)
- end
-
- def details
- NodeDetails::Send.new(node)
- end
- memoize :details
-
- def emit_send_regular(node)
- if n_send?(node)
- writer_with(Regular, node).dispatch
- else
- visit(node)
- end
- end
- end # Send
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/send/attribute_assignment.rb | @@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- class Send
- # Writer for send as attribute assignment
- class AttributeAssignment < self
- children :receiver, :selector, :first_argument
-
- def dispatch
- emit_receiver
- emit_attribute
- write('=')
-
- if arguments.one?
- visit(first_argument)
- else
- parentheses { delimited(arguments) }
- end
- end
-
- def emit_send_mlhs
- emit_receiver
- write(details.non_assignment_selector)
- end
-
- private
-
- def emit_receiver
- visit(receiver)
- emit_operator
- end
-
- def emit_attribute
- write(details.non_assignment_selector)
- end
- end # AttributeAssignment
- end # Send
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/send/binary.rb | @@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- class Send
- # Writer for binary sends
- class Binary < self
- def dispatch
- visit(receiver)
- emit_operator
- emit_right
- end
-
- private
-
- def emit_operator
- write(' ', details.string_selector, ' ')
- end
-
- def emit_right
- emit_send_regular(children.fetch(2))
- end
-
- end # Binary
- end # Send
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/send/conditional.rb | @@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- class Send
- # Writer for "conditional" receiver&.selector(arguments...) case
- class Conditional < self
-
- private
-
- def dispatch
- emit_receiver
- emit_selector
- emit_arguments
- end
-
- def emit_receiver
- visit(receiver)
- write('&.')
- end
-
- end # Regular
- end # Send
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/send/regular.rb | @@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- class Send
- # Writer for "regular" receiver.selector(arguments...) case
- class Regular < self
- def dispatch
- emit_receiver
- emit_selector
- emit_arguments
- end
-
- def emit_send_mlhs
- dispatch
- end
-
- def emit_arguments_without_heredoc_body
- emit_normal_arguments if arguments.any?
- end
-
- def emit_receiver
- return unless receiver
-
- emit_send_regular(receiver)
-
- emit_operator
- end
-
- end # Regular
- end # Send
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 1537e2eccdede455de4c802da7510cc81d1bab52.json | Ignore new dependencies | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/unparser-0.6.0/lib/unparser/writer/send/unary.rb | @@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-module Unparser
- module Writer
- class Send
- # Writer for unary sends
- class Unary < self
- MAP = {
- '-@': '-',
- '+@': '+'
- }.freeze
-
- private_constant(*constants(false))
-
- def dispatch
- name = selector
-
- write(MAP.fetch(name, name).to_s)
-
- if n_int?(receiver) && selector.equal?(:'+@')
- write('+')
- end
-
- visit(receiver)
- end
- end # Unary
- end # Send
- end # Writer
-end # Unparser | true |
Other | Homebrew | brew | 9dee4606fca4b6531695b2bf271cca12c58837f1.json | Update RBI files for tapioca. | Library/Homebrew/sorbet/rbi/gems/rbi@0.0.4.rbi | @@ -0,0 +1,1396 @@
+# DO NOT EDIT MANUALLY
+# This is an autogenerated file for types exported from the `rbi` gem.
+# Please instead update this file by running `bin/tapioca gem rbi`.
+
+# typed: true
+
+module RBI; end
+
+class RBI::ASTVisitor
+ abstract!
+
+ def initialize(*args, &blk); end
+
+ sig { abstract.params(node: T.nilable(AST::Node)).void }
+ def visit(node); end
+
+ sig { params(nodes: T::Array[AST::Node]).void }
+ def visit_all(nodes); end
+
+ private
+
+ sig { params(node: AST::Node).returns(String) }
+ def parse_expr(node); end
+
+ sig { params(node: AST::Node).returns(String) }
+ def parse_name(node); end
+end
+
+class RBI::Attr < ::RBI::NodeWithComments
+ include ::RBI::Indexable
+
+ abstract!
+
+ sig { params(name: Symbol, names: T::Array[Symbol], visibility: RBI::Visibility, sigs: T::Array[RBI::Sig], loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment]).void }
+ def initialize(name, names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil)); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { abstract.returns(T::Array[String]) }
+ def fully_qualified_names; end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { override.params(other: RBI::Node).void }
+ def merge_with(other); end
+
+ sig { returns(T::Array[Symbol]) }
+ def names; end
+
+ def names=(_arg0); end
+
+ sig { override.returns(T::Boolean) }
+ def oneline?; end
+
+ sig { returns(T::Array[RBI::Sig]) }
+ def sigs; end
+
+ sig { returns(RBI::Visibility) }
+ def visibility; end
+
+ def visibility=(_arg0); end
+end
+
+class RBI::AttrAccessor < ::RBI::Attr
+ sig { params(name: Symbol, names: Symbol, visibility: RBI::Visibility, sigs: T::Array[RBI::Sig], loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::AttrAccessor).void)).void }
+ def initialize(name, *names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(T::Array[String]) }
+ def fully_qualified_names; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::AttrReader < ::RBI::Attr
+ sig { params(name: Symbol, names: Symbol, visibility: RBI::Visibility, sigs: T::Array[RBI::Sig], loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::AttrReader).void)).void }
+ def initialize(name, *names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(T::Array[String]) }
+ def fully_qualified_names; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::AttrWriter < ::RBI::Attr
+ sig { params(name: Symbol, names: Symbol, visibility: RBI::Visibility, sigs: T::Array[RBI::Sig], loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::AttrWriter).void)).void }
+ def initialize(name, *names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(T::Array[String]) }
+ def fully_qualified_names; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::BlockParam < ::RBI::Param
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::BlockParam).void)).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(other: T.nilable(Object)).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(v: RBI::Printer, last: T::Boolean).void }
+ def print_comment_leading_space(v, last:); end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::Class < ::RBI::Scope
+ sig { params(name: String, superclass_name: T.nilable(String), loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Class).void)).void }
+ def initialize(name, superclass_name: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(String) }
+ def fully_qualified_name; end
+
+ sig { returns(String) }
+ def name; end
+
+ def name=(_arg0); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def print_header(v); end
+
+ sig { returns(T.nilable(String)) }
+ def superclass_name; end
+
+ def superclass_name=(_arg0); end
+end
+
+class RBI::Comment < ::RBI::Node
+ sig { params(text: String, loc: T.nilable(RBI::Loc)).void }
+ def initialize(text, loc: T.unsafe(nil)); end
+
+ sig { params(other: Object).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(String) }
+ def text; end
+
+ def text=(_arg0); end
+end
+
+class RBI::ConflictTree < ::RBI::Tree
+ sig { params(left_name: String, right_name: String).void }
+ def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(RBI::Tree) }
+ def left; end
+
+ def right; end
+end
+
+class RBI::Const < ::RBI::NodeWithComments
+ include ::RBI::Indexable
+
+ sig { params(name: String, value: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Const).void)).void }
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { returns(String) }
+ def fully_qualified_name; end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { returns(String) }
+ def name; end
+
+ sig { override.returns(String) }
+ def to_s; end
+
+ def value; end
+end
+
+class RBI::ConstBuilder < ::RBI::ASTVisitor
+ sig { void }
+ def initialize; end
+
+ sig { returns(T::Array[String]) }
+ def names; end
+
+ def names=(_arg0); end
+
+ sig { override.params(node: T.nilable(AST::Node)).void }
+ def visit(node); end
+
+ class << self
+ sig { params(node: T.nilable(AST::Node)).returns(T.nilable(String)) }
+ def visit(node); end
+ end
+end
+
+class RBI::EmptyComment < ::RBI::Comment
+ sig { params(loc: T.nilable(RBI::Loc)).void }
+ def initialize(loc: T.unsafe(nil)); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+end
+
+class RBI::Error < ::StandardError; end
+
+class RBI::Extend < ::RBI::Mixin
+ include ::RBI::Indexable
+
+ sig { params(name: String, names: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Extend).void)).void }
+ def initialize(name, *names, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::File
+ sig { params(strictness: T.nilable(String), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(file: RBI::File).void)).void }
+ def initialize(strictness: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(node: RBI::Node).void }
+ def <<(node); end
+
+ sig { params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(T::Array[RBI::Comment]) }
+ def comments; end
+
+ def comments=(_arg0); end
+
+ sig { params(out: T.any(IO, StringIO), indent: Integer, print_locs: T::Boolean).void }
+ def print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end
+
+ sig { returns(RBI::Tree) }
+ def root; end
+
+ sig { returns(T.nilable(String)) }
+ def strictness; end
+
+ sig { params(indent: Integer, print_locs: T::Boolean).returns(String) }
+ def string(indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end
+end
+
+class RBI::Group < ::RBI::Tree
+ sig { params(kind: RBI::Group::Kind).void }
+ def initialize(kind); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(RBI::Group::Kind) }
+ def kind; end
+end
+
+class RBI::Group::Kind < ::T::Enum
+ enums do
+ Mixins = new
+ Helpers = new
+ TypeMembers = new
+ MixesInClassMethods = new
+ TStructFields = new
+ TEnums = new
+ Inits = new
+ Methods = new
+ Consts = new
+ end
+end
+
+class RBI::Helper < ::RBI::NodeWithComments
+ include ::RBI::Indexable
+
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Helper).void)).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { returns(String) }
+ def name; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::Include < ::RBI::Mixin
+ include ::RBI::Indexable
+
+ sig { params(name: String, names: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Include).void)).void }
+ def initialize(name, *names, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::Index < ::RBI::Visitor
+ sig { void }
+ def initialize; end
+
+ sig { params(id: String).returns(T::Array[RBI::Node]) }
+ def [](id); end
+
+ sig { params(node: T.all(RBI::Indexable, RBI::Node)).void }
+ def index(node); end
+
+ sig { returns(T::Array[String]) }
+ def keys; end
+
+ sig { override.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+
+ class << self
+ sig { params(node: RBI::Node).returns(RBI::Index) }
+ def index(*node); end
+ end
+end
+
+module RBI::Indexable
+ interface!
+
+ sig { abstract.returns(T::Array[String]) }
+ def index_ids; end
+end
+
+class RBI::KwOptParam < ::RBI::Param
+ sig { params(name: String, value: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::KwOptParam).void)).void }
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(other: T.nilable(Object)).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(v: RBI::Printer, last: T::Boolean).void }
+ def print_comment_leading_space(v, last:); end
+
+ sig { override.returns(String) }
+ def to_s; end
+
+ sig { returns(String) }
+ def value; end
+end
+
+class RBI::KwParam < ::RBI::Param
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::KwParam).void)).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(other: T.nilable(Object)).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(v: RBI::Printer, last: T::Boolean).void }
+ def print_comment_leading_space(v, last:); end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::KwRestParam < ::RBI::Param
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::KwRestParam).void)).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(other: T.nilable(Object)).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(v: RBI::Printer, last: T::Boolean).void }
+ def print_comment_leading_space(v, last:); end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::Loc
+ sig { params(file: T.nilable(String), begin_line: T.nilable(Integer), end_line: T.nilable(Integer), begin_column: T.nilable(Integer), end_column: T.nilable(Integer)).void }
+ def initialize(file: T.unsafe(nil), begin_line: T.unsafe(nil), end_line: T.unsafe(nil), begin_column: T.unsafe(nil), end_column: T.unsafe(nil)); end
+
+ def begin_column; end
+
+ sig { returns(T.nilable(Integer)) }
+ def begin_line; end
+
+ def end_column; end
+ def end_line; end
+
+ sig { returns(T.nilable(String)) }
+ def file; end
+
+ sig { returns(String) }
+ def to_s; end
+
+ class << self
+ sig { params(file: String, ast_loc: T.any(Parser::Source::Map, Parser::Source::Range)).returns(RBI::Loc) }
+ def from_ast_loc(file, ast_loc); end
+ end
+end
+
+class RBI::Method < ::RBI::NodeWithComments
+ include ::RBI::Indexable
+
+ sig { params(name: String, params: T::Array[RBI::Param], is_singleton: T::Boolean, visibility: RBI::Visibility, sigs: T::Array[RBI::Sig], loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Method).void)).void }
+ def initialize(name, params: T.unsafe(nil), is_singleton: T.unsafe(nil), visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(param: RBI::Param).void }
+ def <<(param); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { returns(String) }
+ def fully_qualified_name; end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { returns(T::Boolean) }
+ def inline_params?; end
+
+ sig { returns(T::Boolean) }
+ def is_singleton; end
+
+ def is_singleton=(_arg0); end
+
+ sig { override.params(other: RBI::Node).void }
+ def merge_with(other); end
+
+ sig { returns(String) }
+ def name; end
+
+ def name=(_arg0); end
+
+ sig { override.returns(T::Boolean) }
+ def oneline?; end
+
+ sig { returns(T::Array[RBI::Param]) }
+ def params; end
+
+ sig { returns(T::Array[RBI::Sig]) }
+ def sigs; end
+
+ def sigs=(_arg0); end
+
+ sig { override.returns(String) }
+ def to_s; end
+
+ sig { returns(RBI::Visibility) }
+ def visibility; end
+
+ def visibility=(_arg0); end
+end
+
+class RBI::MixesInClassMethods < ::RBI::Mixin
+ include ::RBI::Indexable
+
+ sig { params(name: String, names: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::MixesInClassMethods).void)).void }
+ def initialize(name, *names, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::Mixin < ::RBI::NodeWithComments
+ abstract!
+
+ sig { params(name: String, names: T::Array[String], loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment]).void }
+ def initialize(name, names, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { returns(T::Array[String]) }
+ def names; end
+
+ def names=(_arg0); end
+end
+
+class RBI::Module < ::RBI::Scope
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Module).void)).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(String) }
+ def fully_qualified_name; end
+
+ sig { returns(String) }
+ def name; end
+
+ def name=(_arg0); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def print_header(v); end
+end
+
+class RBI::Node
+ abstract!
+
+ sig { params(loc: T.nilable(RBI::Loc)).void }
+ def initialize(loc: T.unsafe(nil)); end
+
+ sig { abstract.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { params(_other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(_other); end
+
+ sig { void }
+ def detach; end
+
+ sig { returns(RBI::Group::Kind) }
+ def group_kind; end
+
+ sig { returns(T.nilable(RBI::Loc)) }
+ def loc; end
+
+ def loc=(_arg0); end
+
+ sig { params(other: RBI::Node).void }
+ def merge_with(other); end
+
+ sig { returns(T::Boolean) }
+ def oneline?; end
+
+ sig { returns(T.nilable(RBI::ConflictTree)) }
+ def parent_conflict_tree; end
+
+ sig { returns(T.nilable(RBI::Scope)) }
+ def parent_scope; end
+
+ sig { returns(T.nilable(RBI::Tree)) }
+ def parent_tree; end
+
+ def parent_tree=(_arg0); end
+
+ sig { params(out: T.any(IO, StringIO), indent: Integer, print_locs: T::Boolean).void }
+ def print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end
+
+ sig { params(node: RBI::Node).void }
+ def replace(node); end
+
+ sig { params(indent: Integer, print_locs: T::Boolean).returns(String) }
+ def string(indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end
+end
+
+class RBI::NodeWithComments < ::RBI::Node
+ abstract!
+
+ sig { params(loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment]).void }
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil)); end
+
+ sig { returns(T::Array[RBI::Comment]) }
+ def comments; end
+
+ def comments=(_arg0); end
+
+ sig { override.params(other: RBI::Node).void }
+ def merge_with(other); end
+
+ sig { override.returns(T::Boolean) }
+ def oneline?; end
+end
+
+class RBI::OptParam < ::RBI::Param
+ sig { params(name: String, value: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::OptParam).void)).void }
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(other: T.nilable(Object)).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(v: RBI::Printer, last: T::Boolean).void }
+ def print_comment_leading_space(v, last:); end
+
+ sig { returns(String) }
+ def value; end
+end
+
+class RBI::Param < ::RBI::NodeWithComments
+ abstract!
+
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment]).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(String) }
+ def name; end
+
+ sig { params(v: RBI::Printer, last: T::Boolean).void }
+ def print_comment_leading_space(v, last:); end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::ParseError < ::StandardError
+ sig { params(message: String, location: RBI::Loc).void }
+ def initialize(message, location); end
+
+ sig { returns(RBI::Loc) }
+ def location; end
+end
+
+class RBI::Parser
+ sig { params(path: String).returns(RBI::Tree) }
+ def parse_file(path); end
+
+ sig { params(string: String).returns(RBI::Tree) }
+ def parse_string(string); end
+
+ private
+
+ sig { params(content: String, file: String).returns(RBI::Tree) }
+ def parse(content, file:); end
+
+ class << self
+ sig { params(path: String).returns(RBI::Tree) }
+ def parse_file(path); end
+
+ sig { params(string: String).returns(RBI::Tree) }
+ def parse_string(string); end
+ end
+end
+
+class RBI::Printer < ::RBI::Visitor
+ sig { params(out: T.any(IO, StringIO), indent: Integer, print_locs: T::Boolean).void }
+ def initialize(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end
+
+ sig { void }
+ def dedent; end
+
+ def in_visibility_group; end
+ def in_visibility_group=(_arg0); end
+
+ sig { void }
+ def indent; end
+
+ sig { returns(T.nilable(RBI::Node)) }
+ def previous_node; end
+
+ sig { params(string: String).void }
+ def print(string); end
+
+ sig { returns(T::Boolean) }
+ def print_locs; end
+
+ def print_locs=(_arg0); end
+
+ sig { params(string: String).void }
+ def printl(string); end
+
+ sig { params(string: T.nilable(String)).void }
+ def printn(string = T.unsafe(nil)); end
+
+ sig { params(string: T.nilable(String)).void }
+ def printt(string = T.unsafe(nil)); end
+
+ sig { override.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+
+ sig { override.params(nodes: T::Array[RBI::Node]).void }
+ def visit_all(nodes); end
+
+ sig { params(file: RBI::File).void }
+ def visit_file(file); end
+end
+
+class RBI::Private < ::RBI::Visibility
+ sig { params(loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Private).void)).void }
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+end
+
+class RBI::Protected < ::RBI::Visibility
+ sig { params(loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Protected).void)).void }
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+end
+
+class RBI::Public < ::RBI::Visibility
+ sig { params(loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Public).void)).void }
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+end
+
+class RBI::ReqParam < ::RBI::Param
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::ReqParam).void)).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(other: T.nilable(Object)).returns(T::Boolean) }
+ def ==(other); end
+end
+
+class RBI::RestParam < ::RBI::Param
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::RestParam).void)).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(other: T.nilable(Object)).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(v: RBI::Printer, last: T::Boolean).void }
+ def print_comment_leading_space(v, last:); end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+module RBI::Rewriters; end
+
+class RBI::Rewriters::AddSigTemplates < ::RBI::Visitor
+ sig { params(with_todo_comment: T::Boolean).void }
+ def initialize(with_todo_comment: T.unsafe(nil)); end
+
+ sig { override.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+
+ private
+
+ sig { params(attr: RBI::Attr).void }
+ def add_attr_sig(attr); end
+
+ sig { params(method: RBI::Method).void }
+ def add_method_sig(method); end
+
+ sig { params(node: RBI::NodeWithComments).void }
+ def add_todo_comment(node); end
+end
+
+class RBI::Rewriters::GroupNodes < ::RBI::Visitor
+ sig { override.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+end
+
+class RBI::Rewriters::Merge
+ sig { params(left_name: String, right_name: String, keep: RBI::Rewriters::Merge::Keep).void }
+ def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
+
+ sig { params(tree: RBI::Tree).returns(T::Array[RBI::Rewriters::Merge::Conflict]) }
+ def merge(tree); end
+
+ sig { returns(RBI::Tree) }
+ def tree; end
+
+ class << self
+ sig { params(left: RBI::Tree, right: RBI::Tree, left_name: String, right_name: String, keep: RBI::Rewriters::Merge::Keep).returns(RBI::Tree) }
+ def merge_trees(left, right, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
+ end
+end
+
+class RBI::Rewriters::Merge::Conflict < ::T::Struct
+ const :left, RBI::Node
+ const :left_name, String
+ const :right, RBI::Node
+ const :right_name, String
+
+ sig { returns(String) }
+ def to_s; end
+
+ class << self
+ def inherited(s); end
+ end
+end
+
+class RBI::Rewriters::Merge::ConflictTreeMerger < ::RBI::Visitor
+ sig { override.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+
+ sig { override.params(nodes: T::Array[RBI::Node]).void }
+ def visit_all(nodes); end
+
+ private
+
+ sig { params(left: RBI::Tree, right: RBI::Tree).void }
+ def merge_conflict_trees(left, right); end
+end
+
+class RBI::Rewriters::Merge::Keep < ::T::Enum
+ enums do
+ NONE = new
+ LEFT = new
+ RIGHT = new
+ end
+end
+
+class RBI::Rewriters::Merge::TreeMerger < ::RBI::Visitor
+ sig { params(output: RBI::Tree, left_name: String, right_name: String, keep: RBI::Rewriters::Merge::Keep).void }
+ def initialize(output, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
+
+ sig { returns(T::Array[RBI::Rewriters::Merge::Conflict]) }
+ def conflicts; end
+
+ sig { override.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+
+ private
+
+ sig { returns(RBI::Tree) }
+ def current_scope; end
+
+ sig { params(left: RBI::Scope, right: RBI::Scope).void }
+ def make_conflict_scope(left, right); end
+
+ sig { params(left: RBI::Node, right: RBI::Node).void }
+ def make_conflict_tree(left, right); end
+
+ sig { params(node: RBI::Node).returns(T.nilable(RBI::Node)) }
+ def previous_definition(node); end
+
+ sig { params(left: RBI::Scope, right: RBI::Scope).returns(RBI::Scope) }
+ def replace_scope_header(left, right); end
+end
+
+class RBI::Rewriters::NestNonPublicMethods < ::RBI::Visitor
+ sig { override.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+end
+
+class RBI::Rewriters::NestSingletonMethods < ::RBI::Visitor
+ sig { override.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+end
+
+class RBI::Rewriters::SortNodes < ::RBI::Visitor
+ sig { override.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+
+ private
+
+ sig { params(kind: RBI::Group::Kind).returns(Integer) }
+ def group_rank(kind); end
+
+ sig { params(node: RBI::Node).returns(T.nilable(String)) }
+ def node_name(node); end
+
+ sig { params(node: RBI::Node).returns(Integer) }
+ def node_rank(node); end
+end
+
+class RBI::Scope < ::RBI::Tree
+ include ::RBI::Indexable
+
+ abstract!
+
+ def initialize(*args, &blk); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(T.self_type) }
+ def dup_empty; end
+
+ sig { abstract.returns(String) }
+ def fully_qualified_name; end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { params(v: RBI::Printer).void }
+ def print_body(v); end
+
+ sig { abstract.params(v: RBI::Printer).void }
+ def print_header(v); end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::ScopeConflict < ::RBI::Tree
+ sig { params(left: RBI::Scope, right: RBI::Scope, left_name: String, right_name: String).void }
+ def initialize(left:, right:, left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(RBI::Scope) }
+ def left; end
+
+ sig { override.returns(T::Boolean) }
+ def oneline?; end
+
+ def right; end
+end
+
+class RBI::Sig < ::RBI::Node
+ sig { params(params: T::Array[RBI::SigParam], return_type: T.nilable(String), is_abstract: T::Boolean, is_override: T::Boolean, is_overridable: T::Boolean, type_params: T::Array[String], checked: T.nilable(Symbol), loc: T.nilable(RBI::Loc), block: T.nilable(T.proc.params(node: RBI::Sig).void)).void }
+ def initialize(params: T.unsafe(nil), return_type: T.unsafe(nil), is_abstract: T.unsafe(nil), is_override: T.unsafe(nil), is_overridable: T.unsafe(nil), type_params: T.unsafe(nil), checked: T.unsafe(nil), loc: T.unsafe(nil), &block); end
+
+ sig { params(param: RBI::SigParam).void }
+ def <<(param); end
+
+ sig { params(other: Object).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(T.nilable(Symbol)) }
+ def checked; end
+
+ def checked=(_arg0); end
+
+ sig { returns(T::Boolean) }
+ def inline_params?; end
+
+ sig { returns(T::Boolean) }
+ def is_abstract; end
+
+ def is_abstract=(_arg0); end
+ def is_overridable; end
+ def is_overridable=(_arg0); end
+ def is_override; end
+ def is_override=(_arg0); end
+
+ sig { override.returns(T::Boolean) }
+ def oneline?; end
+
+ sig { returns(T::Array[RBI::SigParam]) }
+ def params; end
+
+ sig { returns(T.nilable(String)) }
+ def return_type; end
+
+ def return_type=(_arg0); end
+
+ sig { returns(T::Array[String]) }
+ def type_params; end
+end
+
+class RBI::SigBuilder < ::RBI::ASTVisitor
+ sig { void }
+ def initialize; end
+
+ sig { returns(RBI::Sig) }
+ def current; end
+
+ def current=(_arg0); end
+
+ sig { override.params(node: T.nilable(AST::Node)).void }
+ def visit(node); end
+
+ sig { params(node: AST::Node).void }
+ def visit_send(node); end
+
+ class << self
+ sig { params(node: AST::Node).returns(RBI::Sig) }
+ def build(node); end
+ end
+end
+
+class RBI::SigParam < ::RBI::NodeWithComments
+ sig { params(name: String, type: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::SigParam).void)).void }
+ def initialize(name, type, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(other: Object).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(String) }
+ def name; end
+
+ sig { params(v: RBI::Printer, last: T::Boolean).void }
+ def print_comment_leading_space(v, last:); end
+
+ def type; end
+end
+
+class RBI::SingletonClass < ::RBI::Scope
+ sig { params(loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::SingletonClass).void)).void }
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.returns(String) }
+ def fully_qualified_name; end
+
+ sig { override.params(v: RBI::Printer).void }
+ def print_header(v); end
+end
+
+class RBI::Struct < ::RBI::Scope
+ sig { params(name: String, members: T::Array[Symbol], keyword_init: T::Boolean, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(struct: RBI::Struct).void)).void }
+ def initialize(name, members: T.unsafe(nil), keyword_init: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(String) }
+ def fully_qualified_name; end
+
+ sig { returns(T::Boolean) }
+ def keyword_init; end
+
+ def keyword_init=(_arg0); end
+
+ sig { returns(T::Array[Symbol]) }
+ def members; end
+
+ def members=(_arg0); end
+
+ sig { returns(String) }
+ def name; end
+
+ def name=(_arg0); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def print_header(v); end
+end
+
+class RBI::TEnum < ::RBI::Class
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(klass: RBI::TEnum).void)).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+end
+
+class RBI::TEnumBlock < ::RBI::NodeWithComments
+ include ::RBI::Indexable
+
+ sig { params(names: T::Array[String], loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::TEnumBlock).void)).void }
+ def initialize(names = T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(name: String).void }
+ def <<(name); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(T::Boolean) }
+ def empty?; end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { override.params(other: RBI::Node).void }
+ def merge_with(other); end
+
+ sig { returns(T::Array[String]) }
+ def names; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::TStruct < ::RBI::Class
+ sig { params(name: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(klass: RBI::TStruct).void)).void }
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+end
+
+class RBI::TStructConst < ::RBI::TStructField
+ include ::RBI::Indexable
+
+ sig { params(name: String, type: String, default: T.nilable(String), loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::TStructConst).void)).void }
+ def initialize(name, type, default: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(T::Array[String]) }
+ def fully_qualified_names; end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::TStructField < ::RBI::NodeWithComments
+ abstract!
+
+ sig { params(name: String, type: String, default: T.nilable(String), loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment]).void }
+ def initialize(name, type, default: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil)); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { returns(T.nilable(String)) }
+ def default; end
+
+ def default=(_arg0); end
+
+ sig { abstract.returns(T::Array[String]) }
+ def fully_qualified_names; end
+
+ sig { returns(String) }
+ def name; end
+
+ def name=(_arg0); end
+ def type; end
+ def type=(_arg0); end
+end
+
+class RBI::TStructProp < ::RBI::TStructField
+ include ::RBI::Indexable
+
+ sig { params(name: String, type: String, default: T.nilable(String), loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::TStructProp).void)).void }
+ def initialize(name, type, default: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(other: RBI::Node).returns(T::Boolean) }
+ def compatible_with?(other); end
+
+ sig { override.returns(T::Array[String]) }
+ def fully_qualified_names; end
+
+ sig { override.returns(T::Array[String]) }
+ def index_ids; end
+
+ sig { override.returns(String) }
+ def to_s; end
+end
+
+class RBI::Tree < ::RBI::NodeWithComments
+ sig { params(loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Tree).void)).void }
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(node: RBI::Node).void }
+ def <<(node); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { params(with_todo_comment: T::Boolean).void }
+ def add_sig_templates!(with_todo_comment: T.unsafe(nil)); end
+
+ sig { params(name: String, superclass_name: T.nilable(String), block: T.nilable(T.proc.params(scope: RBI::Scope).void)).void }
+ def create_class(name, superclass_name: T.unsafe(nil), &block); end
+
+ sig { params(name: String, value: String).void }
+ def create_constant(name, value:); end
+
+ sig { params(name: String).void }
+ def create_extend(name); end
+
+ sig { params(name: String).void }
+ def create_include(name); end
+
+ sig { params(name: String, parameters: T::Array[RBI::TypedParam], return_type: String, class_method: T::Boolean).void }
+ def create_method(name, parameters: T.unsafe(nil), return_type: T.unsafe(nil), class_method: T.unsafe(nil)); end
+
+ sig { params(name: String).void }
+ def create_mixes_in_class_methods(name); end
+
+ sig { params(name: String, block: T.nilable(T.proc.params(scope: RBI::Scope).void)).void }
+ def create_module(name, &block); end
+
+ sig { params(constant: Module, block: T.nilable(T.proc.params(scope: RBI::Scope).void)).void }
+ def create_path(constant, &block); end
+
+ sig { params(name: String, value: String).void }
+ def create_type_member(name, value: T.unsafe(nil)); end
+
+ sig { returns(T::Boolean) }
+ def empty?; end
+
+ sig { void }
+ def group_nodes!; end
+
+ sig { returns(RBI::Index) }
+ def index; end
+
+ sig { params(other: RBI::Tree).returns(RBI::Tree) }
+ def merge(other); end
+
+ sig { void }
+ def nest_non_public_methods!; end
+
+ sig { void }
+ def nest_singleton_methods!; end
+
+ sig { returns(T::Array[RBI::Node]) }
+ def nodes; end
+
+ sig { override.returns(T::Boolean) }
+ def oneline?; end
+
+ sig { void }
+ def sort_nodes!; end
+
+ private
+
+ sig { params(node: RBI::Node).returns(RBI::Node) }
+ def create_node(node); end
+
+ sig { returns(T::Hash[String, RBI::Node]) }
+ def nodes_cache; end
+
+ sig { params(name: String).returns(T::Boolean) }
+ def valid_method_name?(name); end
+end
+
+RBI::Tree::SPECIAL_METHOD_NAMES = T.let(T.unsafe(nil), Array)
+
+class RBI::TreeBuilder < ::RBI::ASTVisitor
+ sig { params(file: String, comments: T::Hash[Parser::Source::Map, T::Array[Parser::Source::Comment]]).void }
+ def initialize(file:, comments: T.unsafe(nil)); end
+
+ sig { params(comments: T::Array[Parser::Source::Comment]).void }
+ def assoc_dangling_comments(comments); end
+
+ sig { void }
+ def separate_header_comments; end
+
+ sig { returns(RBI::Tree) }
+ def tree; end
+
+ sig { override.params(node: T.nilable(Object)).void }
+ def visit(node); end
+
+ private
+
+ sig { returns(RBI::Tree) }
+ def current_scope; end
+
+ sig { returns(T::Array[RBI::Sig]) }
+ def current_sigs; end
+
+ sig { params(node: AST::Node).returns(T::Array[RBI::Comment]) }
+ def node_comments(node); end
+
+ sig { params(node: AST::Node).returns(RBI::Loc) }
+ def node_loc(node); end
+
+ sig { params(node: AST::Node).returns(T.nilable(RBI::Node)) }
+ def parse_block(node); end
+
+ sig { params(node: AST::Node).returns(RBI::Node) }
+ def parse_const_assign(node); end
+
+ sig { params(node: AST::Node).returns(RBI::Method) }
+ def parse_def(node); end
+
+ sig { params(node: AST::Node).returns(RBI::TEnumBlock) }
+ def parse_enum(node); end
+
+ sig { params(node: AST::Node).returns(RBI::Param) }
+ def parse_param(node); end
+
+ sig { params(node: AST::Node).returns(RBI::Scope) }
+ def parse_scope(node); end
+
+ sig { params(node: AST::Node).returns(T.nilable(RBI::Node)) }
+ def parse_send(node); end
+
+ sig { params(node: AST::Node).returns(RBI::Sig) }
+ def parse_sig(node); end
+
+ sig { params(node: AST::Node).returns(RBI::Struct) }
+ def parse_struct(node); end
+
+ sig { params(node: AST::Node).returns([String, String, T.nilable(String)]) }
+ def parse_tstruct_prop(node); end
+
+ sig { params(node: AST::Node).returns(T::Boolean) }
+ def struct_definition?(node); end
+end
+
+class RBI::TypeMember < ::RBI::NodeWithComments
+ sig { params(name: String, value: String, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::TypeMember).void)).void }
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(String) }
+ def fully_qualified_name; end
+
+ sig { returns(String) }
+ def name; end
+
+ sig { override.returns(String) }
+ def to_s; end
+
+ def value; end
+end
+
+RBI::VERSION = T.let(T.unsafe(nil), String)
+
+class RBI::Visibility < ::RBI::NodeWithComments
+ abstract!
+
+ sig { params(visibility: Symbol, loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment]).void }
+ def initialize(visibility, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
+
+ sig { params(other: RBI::Visibility).returns(T::Boolean) }
+ def ==(other); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { returns(T::Boolean) }
+ def private?; end
+
+ sig { returns(T::Boolean) }
+ def protected?; end
+
+ sig { returns(T::Boolean) }
+ def public?; end
+
+ sig { returns(Symbol) }
+ def visibility; end
+end
+
+class RBI::VisibilityGroup < ::RBI::Tree
+ sig { params(visibility: RBI::Visibility).void }
+ def initialize(visibility); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { override.returns(T::Boolean) }
+ def oneline?; end
+
+ sig { returns(RBI::Visibility) }
+ def visibility; end
+end
+
+class RBI::Visitor
+ abstract!
+
+ def initialize(*args, &blk); end
+
+ sig { abstract.params(node: T.nilable(RBI::Node)).void }
+ def visit(node); end
+
+ sig { params(nodes: T::Array[RBI::Node]).void }
+ def visit_all(nodes); end
+end | true |
Other | Homebrew | brew | 9dee4606fca4b6531695b2bf271cca12c58837f1.json | Update RBI files for tapioca. | Library/Homebrew/sorbet/rbi/gems/tapioca@0.5.2.rbi | @@ -1,23 +1,120 @@
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `tapioca` gem.
-# Please instead update this file by running `bin/tapioca sync`.
+# Please instead update this file by running `bin/tapioca gem tapioca`.
# typed: true
-class String
- include ::Comparable
- include ::JSON::Ext::Generator::GeneratorMethods::String
- include ::Colorize::InstanceMethods
- include ::MessagePack::CoreExt
- extend ::JSON::Ext::Generator::GeneratorMethods::String::Extend
- extend ::Colorize::ClassMethods
+class ActiveRecordColumnTypeHelper
+ def initialize(*args, &blk); end
- sig { returns(String) }
- def underscore; end
+ sig { params(column_name: String).returns([String, String]) }
+ def type_for(column_name); end
+
+ private
+
+ sig { params(constant: Module).returns(T::Boolean) }
+ def do_not_generate_strong_types?(constant); end
+
+ sig { params(column_type: Object).returns(String) }
+ def handle_unknown_type(column_type); end
+
+ def lookup_arg_type_of_method(*args, &blk); end
+ def lookup_return_type_of_method(*args, &blk); end
end
-String::BLANK_RE = T.let(T.unsafe(nil), Regexp)
-String::ENCODED_BLANKS = T.let(T.unsafe(nil), Concurrent::Map)
+module RBI; end
+
+class RBI::Tree < ::RBI::NodeWithComments
+ sig { params(loc: T.nilable(RBI::Loc), comments: T::Array[RBI::Comment], block: T.nilable(T.proc.params(node: RBI::Tree).void)).void }
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
+
+ sig { params(node: RBI::Node).void }
+ def <<(node); end
+
+ sig { override.params(v: RBI::Printer).void }
+ def accept_printer(v); end
+
+ sig { params(with_todo_comment: T::Boolean).void }
+ def add_sig_templates!(with_todo_comment: T.unsafe(nil)); end
+
+ sig { params(name: String, superclass_name: T.nilable(String), block: T.nilable(T.proc.params(scope: RBI::Scope).void)).void }
+ def create_class(name, superclass_name: T.unsafe(nil), &block); end
+
+ sig { params(name: String, value: String).void }
+ def create_constant(name, value:); end
+
+ sig { params(name: String).void }
+ def create_extend(name); end
+
+ sig { params(name: String).void }
+ def create_include(name); end
+
+ sig { params(name: String, parameters: T::Array[RBI::TypedParam], return_type: String, class_method: T::Boolean).void }
+ def create_method(name, parameters: T.unsafe(nil), return_type: T.unsafe(nil), class_method: T.unsafe(nil)); end
+
+ sig { params(name: String).void }
+ def create_mixes_in_class_methods(name); end
+
+ sig { params(name: String, block: T.nilable(T.proc.params(scope: RBI::Scope).void)).void }
+ def create_module(name, &block); end
+
+ sig { params(constant: Module, block: T.nilable(T.proc.params(scope: RBI::Scope).void)).void }
+ def create_path(constant, &block); end
+
+ sig { params(name: String, value: String).void }
+ def create_type_member(name, value: T.unsafe(nil)); end
+
+ sig { returns(T::Boolean) }
+ def empty?; end
+
+ sig { void }
+ def group_nodes!; end
+
+ sig { returns(RBI::Index) }
+ def index; end
+
+ sig { params(other: RBI::Tree).returns(RBI::Tree) }
+ def merge(other); end
+
+ sig { void }
+ def nest_non_public_methods!; end
+
+ sig { void }
+ def nest_singleton_methods!; end
+
+ sig { returns(T::Array[RBI::Node]) }
+ def nodes; end
+
+ sig { override.returns(T::Boolean) }
+ def oneline?; end
+
+ sig { void }
+ def sort_nodes!; end
+
+ private
+
+ sig { params(node: RBI::Node).returns(RBI::Node) }
+ def create_node(node); end
+
+ sig { returns(T::Hash[String, RBI::Node]) }
+ def nodes_cache; end
+
+ sig { params(name: String).returns(T::Boolean) }
+ def valid_method_name?(name); end
+end
+
+RBI::Tree::SPECIAL_METHOD_NAMES = T.let(T.unsafe(nil), Array)
+
+class RBI::TypedParam < ::T::Struct
+ const :param, RBI::Param
+ const :type, String
+
+ class << self
+ def inherited(s); end
+ end
+end
+
+RBI::VERSION = T.let(T.unsafe(nil), String)
module T::Generic::TypeStoragePatch
def [](*types); end
@@ -39,14 +136,13 @@ module Tapioca
end
end
-module Tapioca::Cli; end
-
-class Tapioca::Cli::Main < ::Thor
+class Tapioca::Cli < ::Thor
include ::Thor::Actions
extend ::Thor::Actions::ClassMethods
def __print_version; end
def dsl(*constants); end
+ def gem(*gems); end
def generate(*gems); end
def init; end
def require; end
@@ -69,13 +165,15 @@ module Tapioca::Compilers; end
module Tapioca::Compilers::Dsl; end
class Tapioca::Compilers::Dsl::Base
+ include ::Tapioca::Reflection
+
abstract!
sig { void }
def initialize; end
- sig { abstract.type_parameters(:T).params(root: Parlour::RbiGenerator::Namespace, constant: T.type_parameter(:T)).void }
- def decorate(root, constant); end
+ sig { abstract.type_parameters(:T).params(tree: RBI::Tree, constant: T.type_parameter(:T)).void }
+ def decorate(tree, constant); end
sig { abstract.returns(T::Enumerable[Module]) }
def gather_constants; end
@@ -88,30 +186,52 @@ class Tapioca::Compilers::Dsl::Base
private
- sig { params(method_def: T.any(Method, UnboundMethod)).returns(T::Array[Parlour::RbiGenerator::Parameter]) }
- def compile_method_parameters_to_parlour(method_def); end
+ sig { returns(T::Enumerable[Class]) }
+ def all_classes; end
+
+ sig { returns(T::Enumerable[Module]) }
+ def all_modules; end
+
+ sig { params(method_def: T.any(Method, UnboundMethod)).returns(T::Array[RBI::TypedParam]) }
+ def compile_method_parameters_to_rbi(method_def); end
+
+ sig { params(method_def: T.any(Method, UnboundMethod)).returns(String) }
+ def compile_method_return_type_to_rbi(method_def); end
+
+ sig { params(name: String, type: String).returns(RBI::TypedParam) }
+ def create_block_param(name, type:); end
+
+ sig { params(name: String, type: String, default: String).returns(RBI::TypedParam) }
+ def create_kw_opt_param(name, type:, default:); end
+
+ sig { params(name: String, type: String).returns(RBI::TypedParam) }
+ def create_kw_param(name, type:); end
+
+ sig { params(name: String, type: String).returns(RBI::TypedParam) }
+ def create_kw_rest_param(name, type:); end
- sig { params(method_def: T.any(Method, UnboundMethod)).returns(T.nilable(String)) }
- def compile_method_return_type_to_parlour(method_def); end
+ sig { params(scope: RBI::Scope, method_def: T.any(Method, UnboundMethod), class_method: T::Boolean).void }
+ def create_method_from_def(scope, method_def, class_method: T.unsafe(nil)); end
- sig { params(namespace: Parlour::RbiGenerator::Namespace, name: String, options: T::Hash[T.untyped, T.untyped]).void }
- def create_method(namespace, name, options = T.unsafe(nil)); end
+ sig { params(name: String, type: String, default: String).returns(RBI::TypedParam) }
+ def create_opt_param(name, type:, default:); end
- sig { params(namespace: Parlour::RbiGenerator::Namespace, method_def: T.any(Method, UnboundMethod), class_method: T::Boolean).void }
- def create_method_from_def(namespace, method_def, class_method: T.unsafe(nil)); end
+ sig { params(name: String, type: String).returns(RBI::TypedParam) }
+ def create_param(name, type:); end
+
+ sig { params(name: String, type: String).returns(RBI::TypedParam) }
+ def create_rest_param(name, type:); end
+
+ sig { params(param: RBI::Param, type: String).returns(RBI::TypedParam) }
+ def create_typed_param(param, type); end
sig { params(method_def: T.any(Method, UnboundMethod), signature: T.untyped).returns(T::Array[String]) }
def parameters_types_from_signature(method_def, signature); end
-
- sig { params(name: String).returns(T::Boolean) }
- def valid_method_name?(name); end
end
-Tapioca::Compilers::Dsl::Base::SPECIAL_METHOD_NAMES = T.let(T.unsafe(nil), Array)
-
class Tapioca::Compilers::DslCompiler
- sig { params(requested_constants: T::Array[Module], requested_generators: T::Array[String], error_handler: T.nilable(T.proc.params(error: String).void)).void }
- def initialize(requested_constants:, requested_generators: T.unsafe(nil), error_handler: T.unsafe(nil)); end
+ sig { params(requested_constants: T::Array[Module], requested_generators: T::Array[T.class_of(Tapioca::Compilers::Dsl::Base)], excluded_generators: T::Array[T.class_of(Tapioca::Compilers::Dsl::Base)], error_handler: T.nilable(T.proc.params(error: String).void)).void }
+ def initialize(requested_constants:, requested_generators: T.unsafe(nil), excluded_generators: T.unsafe(nil), error_handler: T.unsafe(nil)); end
sig { returns(T.proc.params(error: String).void) }
def error_handler; end
@@ -130,20 +250,14 @@ class Tapioca::Compilers::DslCompiler
sig { params(requested_constants: T::Array[Module]).returns(T::Set[Module]) }
def gather_constants(requested_constants); end
- sig { params(requested_generators: T::Array[String]).returns(T::Enumerable[Tapioca::Compilers::Dsl::Base]) }
- def gather_generators(requested_generators); end
-
- sig { params(requested_generators: T::Array[String]).returns(T.proc.params(klass: Class).returns(T::Boolean)) }
- def generator_filter(requested_generators); end
+ sig { params(requested_generators: T::Array[T.class_of(Tapioca::Compilers::Dsl::Base)], excluded_generators: T::Array[T.class_of(Tapioca::Compilers::Dsl::Base)]).returns(T::Enumerable[Tapioca::Compilers::Dsl::Base]) }
+ def gather_generators(requested_generators, excluded_generators); end
sig { params(constant: Module).returns(T.nilable(String)) }
def rbi_for_constant(constant); end
sig { params(error: String).returns(T.noreturn) }
def report_error(error); end
-
- sig { params(parlour: Parlour::RbiGenerator).void }
- def resolve_conflicts(parlour); end
end
class Tapioca::Compilers::RequiresCompiler
@@ -178,14 +292,21 @@ module Tapioca::Compilers::Sorbet
sig { returns(String) }
def sorbet_path; end
+
+ sig { params(feature: Symbol, version: T.nilable(Gem::Version)).returns(T::Boolean) }
+ def supports?(feature, version: T.unsafe(nil)); end
end
end
Tapioca::Compilers::Sorbet::EXE_PATH_ENV_VAR = T.let(T.unsafe(nil), String)
+Tapioca::Compilers::Sorbet::FEATURE_REQUIREMENTS = T.let(T.unsafe(nil), Hash)
Tapioca::Compilers::Sorbet::SORBET = T.let(T.unsafe(nil), Pathname)
+Tapioca::Compilers::Sorbet::SORBET_GEM_SPEC = T.let(T.unsafe(nil), Gem::Specification)
module Tapioca::Compilers::SymbolTable; end
class Tapioca::Compilers::SymbolTable::SymbolGenerator
+ include ::Tapioca::Reflection
+
sig { params(gem: Tapioca::Gemfile::GemSpec, indent: Integer).void }
def initialize(gem, indent = T.unsafe(nil)); end
@@ -206,82 +327,76 @@ class Tapioca::Compilers::SymbolTable::SymbolGenerator
sig { params(name: String).returns(T::Boolean) }
def alias_namespaced?(name); end
- sig { params(constant: Module).returns(T::Array[Module]) }
- def ancestors_of(constant); end
-
- sig { params(constant: Module, other: BasicObject).returns(T::Boolean) }
- def are_equal?(constant, other); end
+ sig { params(constant: Module).returns([T::Array[Module], T::Array[Module]]) }
+ def collect_dynamic_mixins_of(constant); end
- sig { params(constant: BasicObject).returns(Class) }
- def class_of(constant); end
+ sig { params(constant: Module, dynamic_extends: T::Array[Module]).returns(T::Array[Module]) }
+ def collect_mixed_in_class_methods(constant, dynamic_extends); end
- sig { params(tree: Tapioca::RBI::Tree, name: T.nilable(String), constant: BasicObject).void }
+ sig { params(tree: RBI::Tree, name: T.nilable(String), constant: BasicObject).void }
def compile(tree, name, constant); end
- sig { params(tree: Tapioca::RBI::Tree, name: String, constant: Module).void }
+ sig { params(tree: RBI::Tree, name: String, constant: Module).void }
def compile_alias(tree, name, constant); end
- sig { params(tree: Tapioca::RBI::Tree, name: String, constant: Module).void }
+ sig { params(tree: RBI::Tree, name: String, constant: Module).void }
def compile_body(tree, name, constant); end
- sig { params(tree: Tapioca::RBI::Tree, name: String, constant: BasicObject).void }
+ sig { params(tree: RBI::Tree, name: String, constant: BasicObject).void }
def compile_constant(tree, name, constant); end
- sig { params(tree: Tapioca::RBI::Tree, module_name: String, mod: Module, for_visibility: T::Array[Symbol]).void }
+ sig { params(tree: RBI::Tree, module_name: String, mod: Module, for_visibility: T::Array[Symbol]).void }
def compile_directly_owned_methods(tree, module_name, mod, for_visibility = T.unsafe(nil)); end
- sig { params(tree: Tapioca::RBI::Tree, constant: Module).void }
+ sig { params(tree: RBI::Tree, constant: Module).void }
def compile_enums(tree, constant); end
- sig { params(tree: Tapioca::RBI::Tree, symbol_name: String, constant: Module, method: T.nilable(UnboundMethod), visibility: Tapioca::RBI::Visibility).void }
+ sig { params(tree: RBI::Tree, symbol_name: String, constant: Module, method: T.nilable(UnboundMethod), visibility: RBI::Visibility).void }
def compile_method(tree, symbol_name, constant, method, visibility = T.unsafe(nil)); end
- sig { params(tree: Tapioca::RBI::Tree, name: String, constant: Module).void }
+ sig { params(tree: RBI::Tree, name: String, constant: Module).void }
def compile_methods(tree, name, constant); end
- sig { params(tree: Tapioca::RBI::Tree, constant: Module).void }
+ sig { params(tree: RBI::Tree, constant: Module).void }
def compile_mixes_in_class_methods(tree, constant); end
- sig { params(tree: Tapioca::RBI::Tree, constant: Module).void }
+ sig { params(tree: RBI::Tree, constant: Module).void }
def compile_mixins(tree, constant); end
- sig { params(tree: Tapioca::RBI::Tree, name: String, constant: Module).void }
+ sig { params(tree: RBI::Tree, name: String, constant: Module).void }
def compile_module(tree, name, constant); end
- sig { params(tree: Tapioca::RBI::Tree, constant: Module).void }
+ sig { params(tree: RBI::Tree, constant: Module).void }
def compile_module_helpers(tree, constant); end
- sig { params(tree: Tapioca::RBI::Tree, name: String, value: BasicObject).void }
+ sig { params(tree: RBI::Tree, name: String, value: BasicObject).void }
def compile_object(tree, name, value); end
- sig { params(tree: Tapioca::RBI::Tree, constant: Module).void }
+ sig { params(tree: RBI::Tree, constant: Module).void }
def compile_props(tree, constant); end
- sig { params(signature: T.untyped, parameters: T::Array[[Symbol, String]]).returns(Tapioca::RBI::Sig) }
+ sig { params(signature: T.untyped, parameters: T::Array[[Symbol, String]]).returns(RBI::Sig) }
def compile_signature(signature, parameters); end
- sig { params(tree: Tapioca::RBI::Tree, name: String, constant: Module).void }
+ sig { params(tree: RBI::Tree, name: String, constant: Module).void }
def compile_subconstants(tree, name, constant); end
sig { params(constant: Class).returns(T.nilable(String)) }
def compile_superclass(constant); end
- sig { params(tree: Tapioca::RBI::Tree, constant: Module).void }
+ sig { params(tree: RBI::Tree, constant: Module).void }
def compile_type_variable_declarations(tree, constant); end
- sig { params(tree: Tapioca::RBI::Tree, constant: Module).void }
+ sig { params(tree: RBI::Tree, constant: Module).void }
def compile_type_variables(tree, constant); end
- sig { params(constant: Module).returns(T::Array[Symbol]) }
- def constants_of(constant); end
-
sig { params(constant: Module, strict: T::Boolean).returns(T::Boolean) }
def defined_in_gem?(constant, strict: T.unsafe(nil)); end
sig { params(symbols: T::Set[String]).returns(T::Set[String]) }
def engine_symbols(symbols); end
- sig { params(tree: Tapioca::RBI::Tree, symbol: String).void }
+ sig { params(tree: RBI::Tree, symbol: String).void }
def generate_from_symbol(tree, symbol); end
sig { params(constant: T.all(Module, T::Generic)).returns(String) }
@@ -290,9 +405,6 @@ class Tapioca::Compilers::SymbolTable::SymbolGenerator
sig { params(constant: Module).returns(T::Array[String]) }
def get_file_candidates(constant); end
- sig { params(constant: Module).returns(T::Array[Module]) }
- def inherited_ancestors_of(constant); end
-
def initialize_method_for(constant); end
sig { params(constant: Module).returns(T::Array[Module]) }
@@ -310,17 +422,8 @@ class Tapioca::Compilers::SymbolTable::SymbolGenerator
sig { params(constant: Module).returns(T.nilable(String)) }
def name_of(constant); end
- sig { params(constant: Module).returns(T.nilable(String)) }
- def name_of_proxy_target(constant); end
-
- sig { params(object: BasicObject).returns(Integer) }
- def object_id_of(object); end
-
- sig { params(constant: Module).returns(T.nilable(String)) }
- def qualified_name_of(constant); end
-
- sig { params(constant: Module).returns(T.nilable(String)) }
- def raw_name_of(constant); end
+ sig { params(constant: Module, class_name: T.nilable(String)).returns(T.nilable(String)) }
+ def name_of_proxy_target(constant, class_name); end
sig { params(symbol: String, inherit: T::Boolean, namespace: Module).returns(BasicObject) }
def resolve_constant(symbol, inherit: T.unsafe(nil), namespace: T.unsafe(nil)); end
@@ -331,27 +434,15 @@ class Tapioca::Compilers::SymbolTable::SymbolGenerator
sig { params(name: String).returns(T::Boolean) }
def seen?(name); end
- sig { params(method: T.any(Method, UnboundMethod)).returns(T.untyped) }
- def signature_of(method); end
-
- sig { params(constant: Module).returns(Class) }
- def singleton_class_of(constant); end
-
sig { params(constant: Module, method_name: String).returns(T::Boolean) }
def struct_method?(constant, method_name); end
- sig { params(constant: Class).returns(T.nilable(Class)) }
- def superclass_of(constant); end
-
sig { params(symbol_name: String).returns(T::Boolean) }
def symbol_ignored?(symbol_name); end
sig { returns(T::Set[String]) }
def symbols; end
- sig { params(constant: T::Types::Base).returns(String) }
- def type_of(constant); end
-
sig { params(name: String).returns(T::Boolean) }
def valid_method_name?(name); end
end
@@ -401,6 +492,8 @@ end
class Tapioca::Config < ::T::Struct
const :exclude, T::Array[String]
+ const :exclude_generators, T::Array[String]
+ const :file_header, T::Boolean, default: T.unsafe(nil)
const :generators, T::Array[String]
const :outdir, String
const :postrequire, String
@@ -449,16 +542,13 @@ end
Tapioca::ConfigBuilder::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
module Tapioca::ConstantLocator
- private
-
- def files_for(klass); end
+ extend ::Tapioca::Reflection
class << self
def files_for(klass); end
end
end
-Tapioca::ConstantLocator::NAME = T.let(T.unsafe(nil), UnboundMethod)
class Tapioca::Error < ::StandardError; end
class Tapioca::Gemfile
@@ -496,7 +586,7 @@ class Tapioca::Gemfile
def lockfile; end
- sig { returns([T::Array[Gem::Specification], T::Array[String]]) }
+ sig { returns([T::Enumerable[T.any(Gem::Specification, T.all(Bundler::RemoteSpecification, Bundler::StubSpecification))], T::Array[String]]) }
def materialize_deps; end
sig { returns(Bundler::Runtime) }
@@ -561,8 +651,8 @@ class Tapioca::Generator < ::Thor::Shell::Color
sig { params(config: Tapioca::Config).void }
def initialize(config); end
- sig { params(requested_constants: T::Array[String], should_verify: T::Boolean, quiet: T::Boolean).void }
- def build_dsl(requested_constants, should_verify: T.unsafe(nil), quiet: T.unsafe(nil)); end
+ sig { params(requested_constants: T::Array[String], should_verify: T::Boolean, quiet: T::Boolean, verbose: T::Boolean).void }
+ def build_dsl(requested_constants, should_verify: T.unsafe(nil), quiet: T.unsafe(nil), verbose: T.unsafe(nil)); end
sig { params(gem_names: T::Array[String]).void }
def build_gem_rbis(gem_names); end
@@ -576,11 +666,14 @@ class Tapioca::Generator < ::Thor::Shell::Color
sig { returns(Tapioca::Config) }
def config; end
- sig { void }
- def sync_rbis_with_gemfile; end
+ sig { params(should_verify: T::Boolean).void }
+ def sync_rbis_with_gemfile(should_verify: T.unsafe(nil)); end
private
+ sig { void }
+ def abort_if_pending_migrations!; end
+
sig { params(filename: Pathname).void }
def add(filename); end
@@ -605,6 +698,9 @@ class Tapioca::Generator < ::Thor::Shell::Color
sig { params(constant_names: T::Array[String]).returns(T::Array[Module]) }
def constantize(constant_names); end
+ sig { params(generator_names: T::Array[String]).returns(T::Array[T.class_of(Tapioca::Compilers::Dsl::Base)]) }
+ def constantize_generators(generator_names); end
+
sig { params(constant_name: String).returns(Pathname) }
def dsl_rbi_filename(constant_name); end
@@ -656,6 +752,9 @@ class Tapioca::Generator < ::Thor::Shell::Color
sig { void }
def perform_removals; end
+ sig { void }
+ def perform_sync_verification; end
+
sig { params(files: T::Set[Pathname]).void }
def purge_stale_dsl_rbi_files(files); end
@@ -671,12 +770,18 @@ class Tapioca::Generator < ::Thor::Shell::Color
sig { returns(T::Array[String]) }
def removed_rbis; end
+ sig { params(diff: T::Hash[String, Symbol], command: String).void }
+ def report_diff_and_exit_if_out_of_date(diff, command); end
+
sig { void }
def require_gem_file; end
sig { params(message: String, color: T.any(Symbol, T::Array[Symbol])).void }
def say_error(message = T.unsafe(nil), *color); end
+ sig { params(class_name: String).returns(String) }
+ def underscore(class_name); end
+
sig { params(tmp_dir: Pathname).returns(T::Hash[String, Symbol]) }
def verify_dsl_rbi(tmp_dir:); end
end
@@ -685,17 +790,14 @@ Tapioca::Generator::EMPTY_RBI_COMMENT = T.let(T.unsafe(nil), String)
module Tapioca::GenericTypeRegistry
class << self
- sig { params(constant: Module).returns(T.nilable(T::Hash[Integer, String])) }
+ sig { params(constant: Module).returns(T.nilable(T::Hash[T.any(Tapioca::TypeMember, Tapioca::TypeTemplate), String])) }
def lookup_type_variables(constant); end
sig { params(constant: T.untyped, types: T.untyped).returns(Module) }
def register_type(constant, types); end
- sig { params(constant: T.untyped, type_member: T::Types::TypeVariable, fixed: T.untyped, lower: T.untyped, upper: T.untyped).void }
- def register_type_member(constant, type_member, fixed, lower, upper); end
-
- sig { params(constant: T.untyped, type_template: T::Types::TypeVariable, fixed: T.untyped, lower: T.untyped, upper: T.untyped).void }
- def register_type_template(constant, type_template, fixed, lower, upper); end
+ sig { params(constant: T.untyped, type_variable: T.any(Tapioca::TypeMember, Tapioca::TypeTemplate)).void }
+ def register_type_variable(constant, type_variable); end
private
@@ -705,29 +807,16 @@ module Tapioca::GenericTypeRegistry
sig { params(constant: Class).returns(Class) }
def create_safe_subclass(constant); end
- sig { params(constant: Module).returns(T::Hash[Integer, String]) }
+ sig { params(constant: Module).returns(T::Hash[T.any(Tapioca::TypeMember, Tapioca::TypeTemplate), String]) }
def lookup_or_initialize_type_variables(constant); end
-
- sig { params(constant: Module).returns(T.nilable(String)) }
- def name_of(constant); end
-
- sig { params(object: BasicObject).returns(Integer) }
- def object_id_of(object); end
-
- sig { params(constant: T.untyped, type_variable_type: T.enum([:type_member, :type_template]), type_variable: T::Types::TypeVariable, fixed: T.untyped, lower: T.untyped, upper: T.untyped).void }
- def register_type_variable(constant, type_variable_type, type_variable, fixed, lower, upper); end
-
- sig { params(type_variable_type: Symbol, variance: Symbol, fixed: T.untyped, lower: T.untyped, upper: T.untyped).returns(String) }
- def serialize_type_variable(type_variable_type, variance, fixed, lower, upper); end
end
end
-class Tapioca::Loader
- sig { params(gemfile: Tapioca::Gemfile).void }
- def initialize(gemfile); end
+Tapioca::GenericTypeRegistry::TypeVariable = T.type_alias { T.any(Tapioca::TypeMember, Tapioca::TypeTemplate) }
- sig { params(initialize_file: T.nilable(String), require_file: T.nilable(String)).void }
- def load_bundle(initialize_file, require_file); end
+class Tapioca::Loader
+ sig { params(gemfile: Tapioca::Gemfile, initialize_file: T.nilable(String), require_file: T.nilable(String)).void }
+ def load_bundle(gemfile, initialize_file, require_file); end
sig { params(environment_load: T::Boolean, eager_load: T::Boolean).void }
def load_rails_application(environment_load: T.unsafe(nil), eager_load: T.unsafe(nil)); end
@@ -737,9 +826,6 @@ class Tapioca::Loader
sig { void }
def eager_load_rails_app; end
- sig { returns(Tapioca::Gemfile) }
- def gemfile; end
-
sig { void }
def load_rails_engines; end
@@ -756,479 +842,108 @@ class Tapioca::Loader
def silence_deprecations; end
end
-module Tapioca::RBI; end
-
-class Tapioca::RBI::BlockParam < ::Tapioca::RBI::Param
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-end
-
-class Tapioca::RBI::Class < ::Tapioca::RBI::Scope
- sig { params(name: String, superclass_name: T.nilable(String)).void }
- def initialize(name, superclass_name: T.unsafe(nil)); end
-
- sig { returns(String) }
- def name; end
-
- def name=(_arg0); end
-
- sig { returns(T.nilable(String)) }
- def superclass_name; end
-
- def superclass_name=(_arg0); end
-end
-
-class Tapioca::RBI::Const < ::Tapioca::RBI::Node
- sig { params(name: String, value: String).void }
- def initialize(name, value); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(String) }
- def name; end
-
- def value; end
-end
-
-class Tapioca::RBI::Extend < ::Tapioca::RBI::Mixin; end
-
-class Tapioca::RBI::Group < ::Tapioca::RBI::Tree
- sig { params(kind: Tapioca::RBI::Group::Kind).void }
- def initialize(kind); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(Tapioca::RBI::Group::Kind) }
- def kind; end
-end
-
-class Tapioca::RBI::Group::Kind < ::T::Enum
- enums do
- Mixins = new
- Helpers = new
- TypeMembers = new
- MixesInClassMethods = new
- TStructFields = new
- TEnums = new
- Inits = new
- Methods = new
- Consts = new
- end
-end
-
-class Tapioca::RBI::Helper < ::Tapioca::RBI::Node
- sig { params(name: String).void }
- def initialize(name); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(String) }
- def name; end
-end
-
-class Tapioca::RBI::Include < ::Tapioca::RBI::Mixin; end
+module Tapioca::Reflection
+ extend ::Tapioca::Reflection
-class Tapioca::RBI::KwOptParam < ::Tapioca::RBI::OptParam
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-end
+ sig { params(constant: Module).returns(T::Array[Module]) }
+ def ancestors_of(constant); end
-class Tapioca::RBI::KwParam < ::Tapioca::RBI::Param
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-end
+ sig { params(object: BasicObject, other: BasicObject).returns(T::Boolean) }
+ def are_equal?(object, other); end
-class Tapioca::RBI::KwRestParam < ::Tapioca::RBI::Param
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-end
+ sig { params(object: BasicObject).returns(Class) }
+ def class_of(object); end
-class Tapioca::RBI::Method < ::Tapioca::RBI::Node
- sig { params(name: String, params: T::Array[Tapioca::RBI::Param], is_singleton: T::Boolean, visibility: Tapioca::RBI::Visibility, sigs: T::Array[Tapioca::RBI::Sig]).void }
- def initialize(name, params: T.unsafe(nil), is_singleton: T.unsafe(nil), visibility: T.unsafe(nil), sigs: T.unsafe(nil)); end
+ sig { params(constant: Module).returns(T::Array[Symbol]) }
+ def constants_of(constant); end
- sig { params(param: Tapioca::RBI::Param).void }
- def <<(param); end
+ sig { type_parameters(:U).params(klass: T.type_parameter(:U)).returns(T::Array[T.type_parameter(:U)]) }
+ def descendants_of(klass); end
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
+ sig { params(constant: Module).returns(T::Array[Module]) }
+ def inherited_ancestors_of(constant); end
- sig { returns(T::Boolean) }
- def is_singleton; end
+ sig { params(constant: Module).returns(T.nilable(String)) }
+ def name_of(constant); end
- def is_singleton=(_arg0); end
+ sig { params(type: T::Types::Base).returns(String) }
+ def name_of_type(type); end
- sig { returns(String) }
- def name; end
+ sig { params(object: BasicObject).returns(Integer) }
+ def object_id_of(object); end
- def name=(_arg0); end
+ sig { params(constant: Module).returns(T::Array[Symbol]) }
+ def private_instance_methods_of(constant); end
- sig { override.returns(T::Boolean) }
- def oneline?; end
+ sig { params(constant: Module).returns(T::Array[Symbol]) }
+ def protected_instance_methods_of(constant); end
- sig { returns(T::Array[Tapioca::RBI::Param]) }
- def params; end
+ sig { params(constant: Module).returns(T::Array[Symbol]) }
+ def public_instance_methods_of(constant); end
- sig { returns(T::Array[Tapioca::RBI::Sig]) }
- def sigs; end
+ sig { params(constant: Module).returns(T.nilable(String)) }
+ def qualified_name_of(constant); end
- def sigs=(_arg0); end
+ sig { params(method: T.any(Method, UnboundMethod)).returns(T.untyped) }
+ def signature_of(method); end
- sig { returns(Tapioca::RBI::Visibility) }
- def visibility; end
+ sig { params(constant: Module).returns(Class) }
+ def singleton_class_of(constant); end
- def visibility=(_arg0); end
+ sig { params(constant: Class).returns(T.nilable(Class)) }
+ def superclass_of(constant); end
end
-class Tapioca::RBI::MixesInClassMethods < ::Tapioca::RBI::Mixin; end
+Tapioca::Reflection::ANCESTORS_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::CLASS_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::CONSTANTS_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::EQUAL_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::NAME_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::OBJECT_ID_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::PRIVATE_INSTANCE_METHODS_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::PROTECTED_INSTANCE_METHODS_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::PUBLIC_INSTANCE_METHODS_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::SINGLETON_CLASS_METHOD = T.let(T.unsafe(nil), UnboundMethod)
+Tapioca::Reflection::SUPERCLASS_METHOD = T.let(T.unsafe(nil), UnboundMethod)
-class Tapioca::RBI::Mixin < ::Tapioca::RBI::Node
- abstract!
+class Tapioca::TypeMember < ::T::Types::TypeMember
+ sig { params(variance: Symbol, fixed: T.untyped, lower: T.untyped, upper: T.untyped).void }
+ def initialize(variance, fixed, lower, upper); end
- sig { params(name: String).void }
- def initialize(name); end
+ sig { returns(T.untyped) }
+ def fixed; end
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
+ def lower; end
- sig { returns(String) }
- def name; end
-end
-
-class Tapioca::RBI::Module < ::Tapioca::RBI::Scope
- sig { params(name: String).void }
- def initialize(name); end
-
- sig { returns(String) }
+ sig { returns(T.nilable(String)) }
def name; end
def name=(_arg0); end
-end
-
-class Tapioca::RBI::Node
- abstract!
-
- sig { void }
- def initialize; end
-
- sig { abstract.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { void }
- def detach; end
-
- sig { returns(Tapioca::RBI::Group::Kind) }
- def group_kind; end
-
- sig { returns(T::Boolean) }
- def oneline?; end
-
- sig { returns(T.nilable(Tapioca::RBI::Tree)) }
- def parent_tree; end
-
- def parent_tree=(_arg0); end
-
- sig { params(out: T.any(IO, StringIO), indent: Integer).void }
- def print(out: T.unsafe(nil), indent: T.unsafe(nil)); end
-
- sig { params(indent: Integer).returns(String) }
- def string(indent: T.unsafe(nil)); end
-end
-
-class Tapioca::RBI::OptParam < ::Tapioca::RBI::Param
- sig { params(name: String, value: String).void }
- def initialize(name, value); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(String) }
- def value; end
-end
-
-class Tapioca::RBI::Param < ::Tapioca::RBI::Node
- sig { params(name: String).void }
- def initialize(name); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(String) }
- def name; end
-end
-
-class Tapioca::RBI::Printer < ::Tapioca::RBI::Visitor
- sig { params(out: T.any(IO, StringIO), indent: Integer).void }
- def initialize(out: T.unsafe(nil), indent: T.unsafe(nil)); end
-
- sig { void }
- def dedent; end
-
- sig { returns(T::Boolean) }
- def in_visibility_group; end
-
- def in_visibility_group=(_arg0); end
-
- sig { void }
- def indent; end
-
- sig { returns(T.nilable(Tapioca::RBI::Node)) }
- def previous_node; end
-
- sig { params(string: String).void }
- def print(string); end
-
- sig { params(string: String).void }
- def printl(string); end
-
- sig { params(string: T.nilable(String)).void }
- def printn(string = T.unsafe(nil)); end
-
- sig { params(string: T.nilable(String)).void }
- def printt(string = T.unsafe(nil)); end
-
- sig { override.params(node: T.nilable(Tapioca::RBI::Node)).void }
- def visit(node); end
-
- sig { override.params(nodes: T::Array[Tapioca::RBI::Node]).void }
- def visit_all(nodes); end
-end
-
-class Tapioca::RBI::RestParam < ::Tapioca::RBI::Param
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-end
-
-module Tapioca::RBI::Rewriters; end
-
-class Tapioca::RBI::Rewriters::GroupNodes < ::Tapioca::RBI::Visitor
- sig { override.params(node: T.nilable(Tapioca::RBI::Node)).void }
- def visit(node); end
-end
-
-class Tapioca::RBI::Rewriters::NestNonPublicMethods < ::Tapioca::RBI::Visitor
- sig { override.params(node: T.nilable(Tapioca::RBI::Node)).void }
- def visit(node); end
-end
-
-class Tapioca::RBI::Rewriters::NestSingletonMethods < ::Tapioca::RBI::Visitor
- sig { override.params(node: T.nilable(Tapioca::RBI::Node)).void }
- def visit(node); end
-end
-
-class Tapioca::RBI::Rewriters::SortNodes < ::Tapioca::RBI::Visitor
- sig { override.params(node: T.nilable(Tapioca::RBI::Node)).void }
- def visit(node); end
-
- private
-
- sig { params(kind: Tapioca::RBI::Group::Kind).returns(Integer) }
- def group_rank(kind); end
-
- sig { params(node: Tapioca::RBI::Node).returns(T.nilable(String)) }
- def node_name(node); end
-
- sig { params(node: Tapioca::RBI::Node).returns(Integer) }
- def node_rank(node); end
-end
-
-class Tapioca::RBI::Scope < ::Tapioca::RBI::Tree
- abstract!
-
- def initialize(*args, &blk); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-end
-
-class Tapioca::RBI::Sig < ::Tapioca::RBI::Node
- sig { params(params: T::Array[Tapioca::RBI::SigParam], return_type: T.nilable(String), is_abstract: T::Boolean, is_override: T::Boolean, is_overridable: T::Boolean, type_params: T::Array[String]).void }
- def initialize(params: T.unsafe(nil), return_type: T.unsafe(nil), is_abstract: T.unsafe(nil), is_override: T.unsafe(nil), is_overridable: T.unsafe(nil), type_params: T.unsafe(nil)); end
-
- sig { params(param: Tapioca::RBI::SigParam).void }
- def <<(param); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(T::Boolean) }
- def is_abstract; end
-
- def is_abstract=(_arg0); end
- def is_overridable; end
- def is_overridable=(_arg0); end
- def is_override; end
- def is_override=(_arg0); end
-
- sig { returns(T::Array[Tapioca::RBI::SigParam]) }
- def params; end
-
- sig { returns(T.nilable(String)) }
- def return_type; end
-
- def return_type=(_arg0); end
-
- sig { returns(T::Array[String]) }
- def type_params; end
-end
-
-class Tapioca::RBI::SigParam < ::Tapioca::RBI::Node
- sig { params(name: String, type: String).void }
- def initialize(name, type); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
sig { returns(String) }
- def name; end
+ def serialize; end
- def type; end
-end
-
-class Tapioca::RBI::SingletonClass < ::Tapioca::RBI::Scope
- sig { void }
- def initialize; end
+ def upper; end
end
-class Tapioca::RBI::TEnum < ::Tapioca::RBI::Class
- sig { params(name: String).void }
- def initialize(name); end
-end
+class Tapioca::TypeTemplate < ::T::Types::TypeTemplate
+ sig { params(variance: Symbol, fixed: T.untyped, lower: T.untyped, upper: T.untyped).void }
+ def initialize(variance, fixed, lower, upper); end
-class Tapioca::RBI::TEnumBlock < ::Tapioca::RBI::Node
- sig { params(names: T::Array[String]).void }
- def initialize(names = T.unsafe(nil)); end
+ sig { returns(T.untyped) }
+ def fixed; end
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(T::Boolean) }
- def empty?; end
-
- sig { returns(T::Array[String]) }
- def names; end
-end
-
-class Tapioca::RBI::TStruct < ::Tapioca::RBI::Class
- sig { params(name: String).void }
- def initialize(name); end
-end
-
-class Tapioca::RBI::TStructConst < ::Tapioca::RBI::TStructField; end
-
-class Tapioca::RBI::TStructField < ::Tapioca::RBI::Node
- abstract!
-
- sig { params(name: String, type: String, default: T.nilable(String)).void }
- def initialize(name, type, default: T.unsafe(nil)); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
+ def lower; end
sig { returns(T.nilable(String)) }
- def default; end
-
- def default=(_arg0); end
-
- sig { returns(String) }
def name; end
def name=(_arg0); end
- def type; end
- def type=(_arg0); end
-end
-
-class Tapioca::RBI::TStructProp < ::Tapioca::RBI::TStructField; end
-
-class Tapioca::RBI::Tree < ::Tapioca::RBI::Node
- sig { void }
- def initialize; end
-
- sig { params(node: Tapioca::RBI::Node).void }
- def <<(node); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(T::Boolean) }
- def empty?; end
-
- sig { void }
- def group_nodes!; end
-
- sig { void }
- def nest_non_public_methods!; end
-
- sig { void }
- def nest_singleton_methods!; end
-
- sig { returns(T::Array[Tapioca::RBI::Node]) }
- def nodes; end
-
- sig { override.returns(T::Boolean) }
- def oneline?; end
-
- sig { void }
- def sort_nodes!; end
-end
-
-class Tapioca::RBI::TypeMember < ::Tapioca::RBI::Node
- sig { params(name: String, value: String).void }
- def initialize(name, value); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
sig { returns(String) }
- def name; end
-
- def value; end
-end
-
-class Tapioca::RBI::Visibility < ::Tapioca::RBI::Node
- abstract!
-
- sig { params(visibility: Symbol).void }
- def initialize(visibility); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(T::Boolean) }
- def public?; end
-
- sig { returns(Symbol) }
- def visibility; end
-end
-
-Tapioca::RBI::Visibility::Private = T.let(T.unsafe(nil), Tapioca::RBI::Visibility)
-Tapioca::RBI::Visibility::Protected = T.let(T.unsafe(nil), Tapioca::RBI::Visibility)
-Tapioca::RBI::Visibility::Public = T.let(T.unsafe(nil), Tapioca::RBI::Visibility)
-
-class Tapioca::RBI::VisibilityGroup < ::Tapioca::RBI::Tree
- sig { params(visibility: Tapioca::RBI::Visibility).void }
- def initialize(visibility); end
-
- sig { override.params(v: Tapioca::RBI::Printer).void }
- def accept_printer(v); end
-
- sig { returns(Tapioca::RBI::Visibility) }
- def visibility; end
-end
-
-class Tapioca::RBI::Visitor
- abstract!
-
- def initialize(*args, &blk); end
-
- sig { abstract.params(node: T.nilable(Tapioca::RBI::Node)).void }
- def visit(node); end
+ def serialize; end
- sig { params(nodes: T::Array[Tapioca::RBI::Node]).void }
- def visit_all(nodes); end
+ def upper; end
end
Tapioca::VERSION = T.let(T.unsafe(nil), String) | true |
Other | Homebrew | brew | 9dee4606fca4b6531695b2bf271cca12c58837f1.json | Update RBI files for tapioca. | Library/Homebrew/sorbet/rbi/gems/unparser@0.6.0.rbi | @@ -0,0 +1,1814 @@
+# DO NOT EDIT MANUALLY
+# This is an autogenerated file for types exported from the `unparser` gem.
+# Please instead update this file by running `bin/tapioca gem unparser`.
+
+# typed: true
+
+module Unparser
+ class << self
+ def buffer(source, identification = T.unsafe(nil)); end
+ def parse(source); end
+ def parse_either(source); end
+ def parse_with_comments(source); end
+ def parser; end
+ def unparse(node, comment_array = T.unsafe(nil)); end
+ def unparse_either(node); end
+ def unparse_validate(node, comment_array = T.unsafe(nil)); end
+ end
+end
+
+module Unparser::AST
+ class << self
+ def local_variable_assignments(node); end
+ def local_variable_reads(node); end
+ def not_close_scope?(node); end
+ def not_reset_scope?(node); end
+ end
+end
+
+Unparser::AST::ASSIGN_NODES = T.let(T.unsafe(nil), Set)
+Unparser::AST::CLOSE_NODES = T.let(T.unsafe(nil), Array)
+
+class Unparser::AST::Enumerator
+ include ::Enumerable
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+
+ def each(&block); end
+ def type(type); end
+ def types(types); end
+
+ class << self
+ def new(node, controller = T.unsafe(nil)); end
+
+ private
+
+ def set(enumerable); end
+ def type(node, type); end
+ end
+end
+
+Unparser::AST::FIRST_CHILD = T.let(T.unsafe(nil), Proc)
+Unparser::AST::INHERIT_NODES = T.let(T.unsafe(nil), Array)
+
+class Unparser::AST::LocalVariableScope
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ include ::Enumerable
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+
+ def initialize(node); end
+
+ def first_assignment?(node); end
+ def first_assignment_in?(left, right); end
+ def local_variable_defined_for_node?(node, name); end
+
+ private
+
+ def match(needle); end
+end
+
+class Unparser::AST::LocalVariableScopeEnumerator
+ include ::Enumerable
+
+ def initialize; end
+
+ def each(node, &block); end
+
+ private
+
+ def current; end
+ def define(name); end
+ def enter(node); end
+ def leave(node); end
+ def pop; end
+ def push_inherit; end
+ def push_reset; end
+ def visit(node, &block); end
+
+ class << self
+ def each(node, &block); end
+ end
+end
+
+Unparser::AST::RESET_NODES = T.let(T.unsafe(nil), Array)
+Unparser::AST::TAUTOLOGY = T.let(T.unsafe(nil), Proc)
+
+class Unparser::AST::Walker
+ include ::Unparser::Equalizer::Methods
+
+ def call(node); end
+
+ class << self
+ def call(node, controller = T.unsafe(nil), &block); end
+ end
+end
+
+module Unparser::AbstractType
+ mixes_in_class_methods ::Unparser::AbstractType::AbstractMethodDeclarations
+
+ class << self
+ private
+
+ def create_new_method(abstract_class); end
+ def included(descendant); end
+ end
+end
+
+module Unparser::AbstractType::AbstractMethodDeclarations
+ def abstract_method(*names); end
+ def abstract_singleton_method(*names); end
+
+ private
+
+ def create_abstract_instance_method(name); end
+ def create_abstract_singleton_method(name); end
+end
+
+module Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+
+ mixes_in_class_methods ::Unparser::Adamantium::ModuleMethods
+ mixes_in_class_methods ::Unparser::Adamantium::ClassMethods
+
+ class << self
+ private
+
+ def included(descendant); end
+ end
+end
+
+module Unparser::Adamantium::ClassMethods
+ def new(*_arg0); end
+end
+
+module Unparser::Adamantium::InstanceMethods
+ def dup; end
+ def freeze; end
+
+ private
+
+ def memoized_method_cache; end
+end
+
+class Unparser::Adamantium::Memory
+ def initialize(values); end
+
+ def fetch(name); end
+end
+
+class Unparser::Adamantium::MethodBuilder
+ def initialize(descendant, method_name); end
+
+ def call; end
+
+ private
+
+ def assert_arity(arity); end
+ def create_memoized_method; end
+ def remove_original_method; end
+ def set_method_visibility; end
+ def visibility; end
+end
+
+class Unparser::Adamantium::MethodBuilder::BlockNotAllowedError < ::ArgumentError
+ def initialize(descendant, method); end
+end
+
+class Unparser::Adamantium::MethodBuilder::InvalidArityError < ::ArgumentError
+ def initialize(descendant, method, arity); end
+end
+
+module Unparser::Adamantium::ModuleMethods
+ def memoize(*methods); end
+ def memoized?(method_name); end
+ def unmemoized_instance_method(method_name); end
+
+ private
+
+ def memoize_method(method_name); end
+ def memoized_methods; end
+end
+
+class Unparser::Anima < ::Module
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+
+ def initialize(*names); end
+
+ def add(*names); end
+ def attribute_names(&block); end
+ def attributes; end
+ def attributes_hash(object); end
+ def initialize_instance(object, attribute_hash); end
+ def remove(*names); end
+
+ private
+
+ def assert_known_attributes(klass, attribute_hash); end
+ def included(descendant); end
+ def new(attributes); end
+end
+
+class Unparser::Anima::Attribute
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+
+ def initialize(name); end
+
+ def get(object); end
+ def instance_variable_name; end
+ def load(object, attributes); end
+ def name; end
+ def set(object, value); end
+end
+
+class Unparser::Anima::Error < ::RuntimeError
+ def initialize(klass, missing, unknown); end
+end
+
+Unparser::Anima::Error::FORMAT = T.let(T.unsafe(nil), String)
+
+module Unparser::Anima::InstanceMethods
+ def initialize(attributes); end
+
+ def to_h; end
+ def with(attributes); end
+end
+
+class Unparser::Buffer
+ def initialize; end
+
+ def append(string); end
+ def append_without_prefix(string); end
+ def capture_content; end
+ def content; end
+ def fresh_line?; end
+ def indent; end
+ def nl; end
+ def root_indent; end
+ def unindent; end
+ def write(fragment); end
+
+ private
+
+ def prefix; end
+end
+
+Unparser::Buffer::INDENT_SPACE = T.let(T.unsafe(nil), String)
+Unparser::Buffer::NL = T.let(T.unsafe(nil), String)
+
+class Unparser::Builder < ::Parser::Builders::Default
+ def initialize; end
+end
+
+class Unparser::CLI
+ def initialize(arguments); end
+
+ def add_options(builder); end
+ def exit_status; end
+
+ private
+
+ def effective_targets; end
+ def process_target(target); end
+ def targets(file_name); end
+
+ class << self
+ def run(*arguments); end
+ end
+end
+
+Unparser::CLI::EXIT_FAILURE = T.let(T.unsafe(nil), Integer)
+Unparser::CLI::EXIT_SUCCESS = T.let(T.unsafe(nil), Integer)
+
+class Unparser::CLI::Target
+ include ::Unparser::AbstractType
+ extend ::Unparser::AbstractType::AbstractMethodDeclarations
+
+ class << self
+ def new(*args, &block); end
+ end
+end
+
+class Unparser::CLI::Target::Path < ::Unparser::CLI::Target
+ include ::Unparser::Equalizer::Methods
+
+ def literal_validation; end
+ def validation; end
+end
+
+class Unparser::CLI::Target::String
+ include ::Unparser::Equalizer::Methods
+
+ def literal_validation; end
+ def validation; end
+end
+
+class Unparser::Color
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+
+ def format(text); end
+end
+
+Unparser::Color::GREEN = T.let(T.unsafe(nil), Unparser::Color)
+Unparser::Color::NONE = T.let(T.unsafe(nil), T.untyped)
+Unparser::Color::RED = T.let(T.unsafe(nil), Unparser::Color)
+
+class Unparser::Comments
+ def initialize(comments); end
+
+ def consume(node, source_part = T.unsafe(nil)); end
+ def source_range(*arguments); end
+ def take_all; end
+ def take_before(node, source_part); end
+ def take_eol_comments; end
+
+ private
+
+ def take_up_to_line(line); end
+ def take_while; end
+ def unshift_documents(comments); end
+
+ class << self
+ def source_range(node, part); end
+ end
+end
+
+class Unparser::Concord < ::Module
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+
+ def initialize(*names); end
+
+ def names; end
+
+ private
+
+ def define_equalizer; end
+ def define_initialize; end
+ def define_readers; end
+ def instance_variable_names; end
+end
+
+Unparser::Concord::MAX_NR_OF_OBJECTS = T.let(T.unsafe(nil), Integer)
+
+class Unparser::Concord::Public < ::Unparser::Concord
+ def included(descendant); end
+end
+
+module Unparser::Constants; end
+Unparser::Constants::BINARY_OPERATORS = T.let(T.unsafe(nil), Set)
+Unparser::Constants::KEYWORDS = T.let(T.unsafe(nil), Set)
+Unparser::Constants::K_ALIAS = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_AND = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_BEGIN = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_BREAK = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_CASE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_CLASS = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_DEF = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_DEFINE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_DEFINED = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_DO = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_EEND = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_ELSE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_ELSIF = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_ENCODING = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_END = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_ENSURE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_FALSE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_FILE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_FOR = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_IF = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_IN = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_MODULE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_NEXT = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_NIL = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_NOT = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_OR = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_POSTEXE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_PREEXE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_REDO = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_RESCUE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_RETRY = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_RETURN = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_SELF = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_SUPER = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_THEN = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_TRUE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_UNDEF = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_UNLESS = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_UNTIL = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_WHEN = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_WHILE = T.let(T.unsafe(nil), String)
+Unparser::Constants::K_YIELD = T.let(T.unsafe(nil), String)
+Unparser::Constants::UNARY_OPERATORS = T.let(T.unsafe(nil), Set)
+
+module Unparser::DSL
+ private
+
+ def children(*names); end
+ def define_child(name, index); end
+ def define_group(name, range); end
+ def define_remaining_children(names); end
+end
+
+class Unparser::Diff
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+
+ def colorized_diff(&block); end
+ def diff(&block); end
+
+ private
+
+ def diffs; end
+ def hunks; end
+ def max_length; end
+ def minimized_hunk; end
+
+ class << self
+ def build(old, new); end
+
+ private
+
+ def colorize_line(line); end
+ def lines(source); end
+ end
+end
+
+Unparser::Diff::ADDITION = T.let(T.unsafe(nil), String)
+Unparser::Diff::DELETION = T.let(T.unsafe(nil), String)
+Unparser::Diff::NEWLINE = T.let(T.unsafe(nil), String)
+Unparser::EMPTY_ARRAY = T.let(T.unsafe(nil), Array)
+Unparser::EMPTY_STRING = T.let(T.unsafe(nil), String)
+
+class Unparser::Either
+ include ::Unparser::RequireBlock
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+
+ def left?; end
+ def right?; end
+
+ class << self
+ def wrap_error(*exceptions); end
+ end
+end
+
+class Unparser::Either::Left < ::Unparser::Either
+ def bind(&block); end
+ def either(left, _right); end
+ def fmap(&block); end
+ def from_left; end
+ def from_right; end
+ def lmap; end
+end
+
+class Unparser::Either::Right < ::Unparser::Either
+ def bind; end
+ def either(_left, right); end
+ def fmap; end
+ def from_left; end
+ def from_right; end
+ def lmap(&block); end
+end
+
+class Unparser::Emitter
+ include ::Unparser::NodeHelpers
+ include ::Unparser::Generation
+ include ::Unparser::Constants
+ include ::Unparser::AbstractType
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ include ::Unparser::Anima::InstanceMethods
+ include ::Unparser::Equalizer::Methods
+ extend ::Unparser::AbstractType::AbstractMethodDeclarations
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+ extend ::Unparser::DSL
+
+ def buffer; end
+ def comments; end
+ def dispatch(*_arg0); end
+ def emit_mlhs; end
+ def local_variable_scope; end
+ def node; end
+ def node_type; end
+
+ class << self
+ def anima; end
+ def emitter(buffer:, comments:, node:, local_variable_scope:); end
+ def new(*args, &block); end
+
+ private
+
+ def handle(*types); end
+ end
+end
+
+class Unparser::Emitter::Alias < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def remaining_children; end
+ def source; end
+ def target; end
+end
+
+class Unparser::Emitter::Args < ::Unparser::Emitter
+ def emit_block_arguments; end
+ def emit_def_arguments; end
+ def emit_lambda_arguments; end
+
+ private
+
+ def emit_shadowargs; end
+ def normal_arguments(&block); end
+ def shadowargs(&block); end
+end
+
+class Unparser::Emitter::Argument < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Array < ::Unparser::Emitter
+ def emit_heredoc_reminders; end
+
+ private
+
+ def dispatch; end
+ def emitters(&block); end
+end
+
+class Unparser::Emitter::ArrayPattern < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def emit_member(node); end
+end
+
+class Unparser::Emitter::Assignment < ::Unparser::Emitter
+ def emit_heredoc_reminders; end
+ def emit_left(*_arg0); end
+ def symbol_name; end
+
+ private
+
+ def dispatch; end
+ def emit_right; end
+end
+
+Unparser::Emitter::Assignment::BINARY_OPERATOR = T.let(T.unsafe(nil), Array)
+
+class Unparser::Emitter::Assignment::Constant < ::Unparser::Emitter::Assignment
+ private
+
+ def base; end
+ def emit_left; end
+ def name; end
+ def remaining_children; end
+ def right; end
+end
+
+class Unparser::Emitter::Assignment::Variable < ::Unparser::Emitter::Assignment
+ private
+
+ def emit_left; end
+ def name; end
+ def remaining_children; end
+ def right; end
+end
+
+class Unparser::Emitter::Begin < ::Unparser::Emitter
+ def emit_heredoc_reminders; end
+
+ private
+
+ def body; end
+ def dispatch; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Binary < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def writer(&block); end
+end
+
+class Unparser::Emitter::BinaryAssign < ::Unparser::Emitter
+ def emit_heredoc_reminders; end
+
+ private
+
+ def dispatch; end
+ def expression; end
+ def remaining_children; end
+ def target; end
+end
+
+Unparser::Emitter::BinaryAssign::MAP = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::Block < ::Unparser::Emitter
+ private
+
+ def arguments; end
+ def body; end
+ def dispatch; end
+ def emit_block_arguments; end
+ def emit_lambda_arguments; end
+ def emit_send_target; end
+ def emit_target; end
+ def need_do?; end
+ def numblock?; end
+ def remaining_children; end
+ def target; end
+ def target_writer(&block); end
+ def write_close; end
+ def write_open; end
+end
+
+class Unparser::Emitter::BlockPass < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::CBase < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+end
+
+class Unparser::Emitter::Case < ::Unparser::Emitter
+ private
+
+ def condition; end
+ def dispatch; end
+ def emit_condition; end
+ def emit_else; end
+ def emit_whens; end
+ def remaining_children; end
+ def whens(&block); end
+end
+
+class Unparser::Emitter::CaseGuard < ::Unparser::Emitter
+ private
+
+ def condition; end
+ def dispatch; end
+ def remaining_children; end
+end
+
+Unparser::Emitter::CaseGuard::MAP = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::CaseMatch < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def else_branch; end
+ def emit_else_branch; end
+ def patterns(&block); end
+ def remaining_children; end
+ def target; end
+end
+
+class Unparser::Emitter::Class < ::Unparser::Emitter
+ include ::Unparser::Emitter::LocalVariableRoot
+
+ def local_variable_scope(&block); end
+
+ private
+
+ def body; end
+ def dispatch; end
+ def emit_superclass; end
+ def name; end
+ def remaining_children; end
+ def superclass; end
+end
+
+class Unparser::Emitter::Const < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def emit_scope; end
+ def name; end
+ def remaining_children; end
+ def scope; end
+end
+
+class Unparser::Emitter::ConstPattern < ::Unparser::Emitter
+ private
+
+ def const; end
+ def dispatch; end
+ def pattern; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::DStr < ::Unparser::Emitter
+ def emit_heredoc_reminders; end
+
+ private
+
+ def dispatch; end
+end
+
+class Unparser::Emitter::DSym < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def emit_begin_child(component); end
+ def emit_str_child(value); end
+end
+
+class Unparser::Emitter::Def < ::Unparser::Emitter
+ include ::Unparser::Emitter::LocalVariableRoot
+
+ def local_variable_scope(&block); end
+
+ private
+
+ def body(*_arg0); end
+ def dispatch; end
+ def emit_arguments; end
+ def emit_name(*_arg0); end
+end
+
+class Unparser::Emitter::Def::Instance < ::Unparser::Emitter::Def
+ private
+
+ def arguments; end
+ def body; end
+ def emit_name; end
+ def name; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Def::Singleton < ::Unparser::Emitter::Def
+ private
+
+ def arguments; end
+ def body; end
+ def emit_name; end
+ def name; end
+ def remaining_children; end
+ def subject; end
+ def subject_without_parens?; end
+end
+
+class Unparser::Emitter::Defined < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def remaining_children; end
+ def subject; end
+end
+
+class Unparser::Emitter::FlipFlop < ::Unparser::Emitter
+ def symbol_name; end
+
+ private
+
+ def dispatch; end
+ def left; end
+ def remaining_children; end
+ def right; end
+end
+
+Unparser::Emitter::FlipFlop::MAP = T.let(T.unsafe(nil), Hash)
+Unparser::Emitter::FlipFlop::SYMBOLS = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::Float < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def remaining_children; end
+ def value; end
+end
+
+Unparser::Emitter::Float::INFINITY = T.let(T.unsafe(nil), Float)
+Unparser::Emitter::Float::NEG_INFINITY = T.let(T.unsafe(nil), Float)
+
+class Unparser::Emitter::FlowModifier < ::Unparser::Emitter
+ def emit_heredoc_reminders; end
+
+ private
+
+ def dispatch; end
+ def emit_arguments; end
+end
+
+Unparser::Emitter::FlowModifier::MAP = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::For < ::Unparser::Emitter
+ private
+
+ def assignment; end
+ def body; end
+ def condition; end
+ def dispatch; end
+ def emit_condition; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Hash < ::Unparser::Emitter
+ def emit_heredoc_reminders; end
+ def emit_last_argument_hash; end
+
+ private
+
+ def dispatch; end
+ def emit_hash_body; end
+ def emit_heredoc_reminder_member(node); end
+end
+
+class Unparser::Emitter::HashPattern < ::Unparser::Emitter
+ def emit_const_pattern; end
+
+ private
+
+ def dispatch; end
+ def emit_hash_body; end
+ def emit_match_var(node); end
+ def emit_member(node); end
+ def emit_pair(node); end
+ def write_symbol_body(symbol); end
+end
+
+class Unparser::Emitter::Hookexe < ::Unparser::Emitter
+ private
+
+ def body; end
+ def dispatch; end
+ def remaining_children; end
+end
+
+Unparser::Emitter::Hookexe::MAP = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::If < ::Unparser::Emitter
+ def emit_ternary; end
+
+ private
+
+ def condition; end
+ def dispatch; end
+ def else_branch; end
+ def emit_condition; end
+ def emit_else_branch; end
+ def emit_if_branch; end
+ def emit_normal; end
+ def emit_postcondition; end
+ def if_branch; end
+ def keyword; end
+ def postcondition?; end
+ def remaining_children; end
+ def unless?; end
+end
+
+class Unparser::Emitter::InMatch < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def pattern; end
+ def remaining_children; end
+ def target; end
+end
+
+class Unparser::Emitter::InPattern < ::Unparser::Emitter
+ private
+
+ def branch; end
+ def dispatch; end
+ def else_branch; end
+ def remaining_children; end
+ def target; end
+ def unless_guard; end
+end
+
+class Unparser::Emitter::Index < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def emit_receiver; end
+end
+
+class Unparser::Emitter::Index::Assign < ::Unparser::Emitter::Index
+ def dispatch; end
+ def emit_heredoc_reminders; end
+ def emit_mlhs; end
+
+ private
+
+ def emit_operation(indices); end
+end
+
+Unparser::Emitter::Index::Assign::NO_VALUE_PARENT = T.let(T.unsafe(nil), Set)
+Unparser::Emitter::Index::Assign::VALUE_RANGE = T.let(T.unsafe(nil), Range)
+
+class Unparser::Emitter::Index::Reference < ::Unparser::Emitter::Index
+ private
+
+ def emit_operation; end
+ def indices(&block); end
+end
+
+class Unparser::Emitter::KWBegin < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def emit_multiple_body; end
+end
+
+class Unparser::Emitter::KeywordOptional < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+ def value; end
+end
+
+class Unparser::Emitter::KwSplat < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def remaining_children; end
+ def subject; end
+end
+
+class Unparser::Emitter::Kwarg < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Kwargs < ::Unparser::Emitter
+ def dispatch; end
+end
+
+class Unparser::Emitter::Lambda < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+end
+
+module Unparser::Emitter::LocalVariableRoot
+ def local_variable_scope; end
+
+ class << self
+ def included(descendant); end
+ end
+end
+
+class Unparser::Emitter::MASGN < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def remaining_children; end
+ def source; end
+ def target; end
+end
+
+class Unparser::Emitter::MLHS < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def emit_many; end
+ def emit_one_child_mlhs; end
+end
+
+Unparser::Emitter::MLHS::NO_COMMA = T.let(T.unsafe(nil), Array)
+class Unparser::Emitter::Match < ::Unparser::Emitter; end
+
+class Unparser::Emitter::Match::CurrentLine < ::Unparser::Emitter::Match
+ private
+
+ def dispatch; end
+ def regexp; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Match::Lvasgn < ::Unparser::Emitter::Match
+ private
+
+ def dispatch; end
+ def lvasgn; end
+ def regexp; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::MatchAlt < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def left; end
+ def remaining_children; end
+ def right; end
+end
+
+class Unparser::Emitter::MatchAs < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def left; end
+ def remaining_children; end
+ def right; end
+end
+
+class Unparser::Emitter::MatchPattern < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def pattern; end
+ def remaining_children; end
+ def target; end
+end
+
+class Unparser::Emitter::MatchRest < ::Unparser::Emitter
+ def emit_array_pattern; end
+ def emit_hash_pattern; end
+
+ private
+
+ def emit_match_var; end
+ def match_var; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::MatchVar < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Module < ::Unparser::Emitter
+ include ::Unparser::Emitter::LocalVariableRoot
+
+ def local_variable_scope(&block); end
+
+ private
+
+ def body; end
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Morearg < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+end
+
+Unparser::Emitter::Morearg::MAP = T.let(T.unsafe(nil), Hash)
+Unparser::Emitter::NO_INDENT = T.let(T.unsafe(nil), Array)
+
+class Unparser::Emitter::NthRef < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+end
+
+Unparser::Emitter::NthRef::PREFIX = T.let(T.unsafe(nil), String)
+
+class Unparser::Emitter::OpAssign < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def emit_operator; end
+ def operator; end
+ def remaining_children; end
+ def target; end
+ def value; end
+end
+
+class Unparser::Emitter::Optarg < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+ def value; end
+end
+
+class Unparser::Emitter::Pair < ::Unparser::Emitter
+ private
+
+ def colon?(key); end
+ def dispatch; end
+ def key; end
+ def remaining_children; end
+ def value; end
+end
+
+Unparser::Emitter::Pair::BAREWORD = T.let(T.unsafe(nil), Regexp)
+
+class Unparser::Emitter::Pin < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def remaining_children; end
+ def target; end
+end
+
+class Unparser::Emitter::Post < ::Unparser::Emitter
+ private
+
+ def body; end
+ def condition; end
+ def dispatch; end
+ def remaining_children; end
+end
+
+Unparser::Emitter::Post::MAP = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::Primitive < ::Unparser::Emitter
+ private
+
+ def remaining_children; end
+ def value; end
+end
+
+class Unparser::Emitter::Primitive::Complex < ::Unparser::Emitter::Primitive
+ private
+
+ def dispatch; end
+ def emit_imaginary; end
+ def imaginary_node; end
+end
+
+Unparser::Emitter::Primitive::Complex::MAP = T.let(T.unsafe(nil), Hash)
+Unparser::Emitter::Primitive::Complex::RATIONAL_FORMAT = T.let(T.unsafe(nil), String)
+
+class Unparser::Emitter::Primitive::Inspect < ::Unparser::Emitter::Primitive
+ private
+
+ def dispatch; end
+end
+
+class Unparser::Emitter::Primitive::Numeric < ::Unparser::Emitter::Primitive
+ private
+
+ def dispatch; end
+end
+
+class Unparser::Emitter::Primitive::Rational < ::Unparser::Emitter::Primitive
+ private
+
+ def dispatch; end
+ def write_rational(value); end
+end
+
+Unparser::Emitter::Primitive::Rational::RATIONAL_FORMAT = T.let(T.unsafe(nil), String)
+
+class Unparser::Emitter::Procarg < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def needs_parens?; end
+end
+
+Unparser::Emitter::Procarg::PARENS = T.let(T.unsafe(nil), Array)
+Unparser::Emitter::REGISTRY = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::Range < ::Unparser::Emitter
+ def symbol_name; end
+
+ private
+
+ def begin_node; end
+ def dispatch; end
+ def end_node; end
+ def remaining_children; end
+end
+
+Unparser::Emitter::Range::SYMBOLS = T.let(T.unsafe(nil), Hash)
+Unparser::Emitter::Range::TOKENS = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::Regexp < ::Unparser::Emitter
+ private
+
+ def body(&block); end
+ def dispatch; end
+ def emit_body(node); end
+ def emit_options; end
+end
+
+class Unparser::Emitter::Repetition < ::Unparser::Emitter
+ private
+
+ def body; end
+ def condition; end
+ def dispatch; end
+ def emit_keyword; end
+ def emit_normal; end
+ def emit_postcontrol; end
+ def postcontrol?; end
+ def remaining_children; end
+end
+
+Unparser::Emitter::Repetition::MAP = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::Rescue < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+end
+
+class Unparser::Emitter::Restarg < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Root < ::Unparser::Emitter
+ include ::Unparser::Emitter::LocalVariableRoot
+
+ def dispatch; end
+ def local_variable_scope(&block); end
+end
+
+Unparser::Emitter::Root::END_NL = T.let(T.unsafe(nil), Array)
+
+class Unparser::Emitter::SClass < ::Unparser::Emitter
+ private
+
+ def body; end
+ def dispatch; end
+ def object; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::Send < ::Unparser::Emitter
+ def emit_heredoc_reminders; end
+ def emit_mlhs; end
+
+ private
+
+ def dispatch; end
+ def writer(&block); end
+end
+
+class Unparser::Emitter::Simple < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+end
+
+Unparser::Emitter::Simple::MAP = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Emitter::Splat < ::Unparser::Emitter
+ def emit_mlhs; end
+
+ private
+
+ def dispatch; end
+ def remaining_children; end
+ def subject; end
+ def subject_emitter(&block); end
+end
+
+class Unparser::Emitter::Super < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+end
+
+class Unparser::Emitter::Undef < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+end
+
+class Unparser::Emitter::Variable < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def name; end
+ def remaining_children; end
+end
+
+class Unparser::Emitter::When < ::Unparser::Emitter
+ private
+
+ def captures(&block); end
+ def dispatch; end
+ def emit_captures; end
+end
+
+class Unparser::Emitter::XStr < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+ def emit_begin(component); end
+ def emit_heredoc; end
+ def emit_string(value); end
+ def emit_xstr; end
+ def escape_xstr(input); end
+ def heredoc?; end
+end
+
+class Unparser::Emitter::Yield < ::Unparser::Emitter
+ private
+
+ def dispatch; end
+end
+
+class Unparser::Equalizer < ::Module
+ def initialize(*keys); end
+
+ private
+
+ def define_cmp_method; end
+ def define_hash_method; end
+ def define_inspect_method; end
+ def define_methods; end
+ def included(descendant); end
+end
+
+module Unparser::Equalizer::Methods
+ def ==(other); end
+ def eql?(other); end
+end
+
+module Unparser::Generation
+ def emit_heredoc_reminders; end
+ def symbol_name; end
+ def write_to_buffer; end
+
+ private
+
+ def children; end
+ def conditional_parentheses(flag, &block); end
+ def delimited(nodes, delimiter = T.unsafe(nil), &block); end
+ def emit_body(node, indent: T.unsafe(nil)); end
+ def emit_body_ensure_rescue(node); end
+ def emit_body_inner(node); end
+ def emit_body_member(node); end
+ def emit_body_rescue(node); end
+ def emit_comments(comments); end
+ def emit_comments_before(source_part = T.unsafe(nil)); end
+ def emit_ensure(node); end
+ def emit_eof_comments; end
+ def emit_eol_comments; end
+ def emit_join(nodes, emit_node, emit_delimiter); end
+ def emit_optional_body(node, indent: T.unsafe(nil)); end
+ def emit_optional_body_ensure_rescue(node); end
+ def emit_rescue_postcontrol(node); end
+ def emit_rescue_regular(node); end
+ def emitter(node); end
+ def first_child; end
+ def indented; end
+ def k_end; end
+ def nl; end
+ def parentheses(open = T.unsafe(nil), close = T.unsafe(nil)); end
+ def visit(node); end
+ def visit_deep(node); end
+ def with_comments; end
+ def write(*strings); end
+ def writer_with(klass, node); end
+ def ws; end
+end
+
+Unparser::Generation::EXTRA_NL = T.let(T.unsafe(nil), Array)
+
+class Unparser::InvalidNodeError < ::RuntimeError
+ def initialize(message, node); end
+
+ def node; end
+end
+
+module Unparser::NodeDetails
+ include ::Unparser::NodeHelpers
+ include ::Unparser::Constants
+
+ private
+
+ def children; end
+
+ class << self
+ def included(descendant); end
+ end
+end
+
+class Unparser::NodeDetails::Send
+ include ::Unparser::NodeHelpers
+ include ::Unparser::Constants
+ include ::Unparser::NodeDetails
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+ extend ::Unparser::DSL
+
+ def arguments(&block); end
+ def arguments?; end
+ def assignment?(&block); end
+ def assignment_operator?; end
+ def binary_syntax_allowed?; end
+ def non_assignment_selector; end
+ def receiver; end
+ def selector; end
+ def selector_binary_operator?; end
+ def selector_unary_operator?; end
+ def string_selector(&block); end
+
+ private
+
+ def remaining_children; end
+end
+
+Unparser::NodeDetails::Send::ASSIGN_SUFFIX = T.let(T.unsafe(nil), String)
+Unparser::NodeDetails::Send::NON_ASSIGN_RANGE = T.let(T.unsafe(nil), Range)
+
+module Unparser::NodeHelpers
+ def n(type, children = T.unsafe(nil)); end
+ def n?(type, node); end
+ def s(type, *children); end
+ def unwrap_single_begin(node); end
+
+ private
+
+ def n_arg?(node); end
+ def n_args?(node); end
+ def n_array?(node); end
+ def n_array_pattern?(node); end
+ def n_begin?(node); end
+ def n_block?(node); end
+ def n_cbase?(node); end
+ def n_const?(node); end
+ def n_dstr?(node); end
+ def n_empty_else?(node); end
+ def n_ensure?(node); end
+ def n_hash?(node); end
+ def n_hash_pattern?(node); end
+ def n_if?(node); end
+ def n_in_pattern?(node); end
+ def n_int?(node); end
+ def n_kwsplat?(node); end
+ def n_lambda?(node); end
+ def n_match_rest?(node); end
+ def n_pair?(node); end
+ def n_rescue?(node); end
+ def n_send?(node); end
+ def n_shadowarg?(node); end
+ def n_splat?(node); end
+ def n_str?(node); end
+ def n_sym?(node); end
+end
+
+module Unparser::RequireBlock
+ private
+
+ def require_block; end
+end
+
+class Unparser::UnknownNodeError < ::ArgumentError; end
+
+class Unparser::Validation
+ include ::Unparser::Anima::InstanceMethods
+ include ::Unparser::Equalizer::Methods
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+
+ def generated_node; end
+ def generated_source; end
+ def identification; end
+ def original_node; end
+ def original_source; end
+ def report(&block); end
+ def success?; end
+
+ private
+
+ def make_report(label, attribute_name); end
+ def node_diff_report; end
+ def report_exception(exception); end
+
+ class << self
+ def anima; end
+ def from_node(original_node); end
+ def from_path(path); end
+ def from_string(original_source); end
+
+ private
+
+ def const_unit(_value); end
+ end
+end
+
+class Unparser::Validation::Literal < ::Unparser::Validation
+ def report; end
+ def success?; end
+
+ private
+
+ def source_diff_report; end
+end
+
+module Unparser::Writer
+ include ::Unparser::NodeHelpers
+ include ::Unparser::Generation
+ include ::Unparser::Anima::InstanceMethods
+ include ::Unparser::Equalizer::Methods
+
+ mixes_in_class_methods ::Unparser::DSL
+
+ class << self
+ def included(descendant); end
+ end
+end
+
+class Unparser::Writer::Binary
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ include ::Unparser::NodeHelpers
+ include ::Unparser::Generation
+ include ::Unparser::Writer
+ include ::Unparser::Anima::InstanceMethods
+ include ::Unparser::Equalizer::Methods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+ extend ::Unparser::DSL
+
+ def buffer; end
+ def comments; end
+ def dispatch; end
+ def emit_operator; end
+ def local_variable_scope; end
+ def node; end
+ def symbol_name; end
+
+ private
+
+ def effective_symbol; end
+ def emit_with(map); end
+ def keyword_symbol; end
+ def left; end
+ def left_emitter(&block); end
+ def operator_symbol; end
+ def remaining_children; end
+ def right; end
+ def right_emitter(&block); end
+
+ class << self
+ def anima; end
+ end
+end
+
+Unparser::Writer::Binary::KEYWORD_SYMBOLS = T.let(T.unsafe(nil), Hash)
+Unparser::Writer::Binary::KEYWORD_TOKENS = T.let(T.unsafe(nil), Hash)
+Unparser::Writer::Binary::MAP = T.let(T.unsafe(nil), Hash)
+Unparser::Writer::Binary::NEED_KEYWORD = T.let(T.unsafe(nil), Array)
+Unparser::Writer::Binary::OPERATOR_SYMBOLS = T.let(T.unsafe(nil), Hash)
+Unparser::Writer::Binary::OPERATOR_TOKENS = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Writer::DynamicString
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ include ::Unparser::NodeHelpers
+ include ::Unparser::Generation
+ include ::Unparser::Writer
+ include ::Unparser::Anima::InstanceMethods
+ include ::Unparser::Equalizer::Methods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+ extend ::Unparser::DSL
+
+ def buffer; end
+ def comments; end
+ def dispatch; end
+ def emit_heredoc_reminder; end
+ def local_variable_scope; end
+ def node; end
+
+ private
+
+ def breakpoint?(child, current); end
+ def classify(node); end
+ def classify_str(node); end
+ def emit_body(children); end
+ def emit_dstr; end
+ def emit_dynamic(child); end
+ def emit_dynamic_component(node); end
+ def emit_heredoc_body; end
+ def emit_heredoc_footer; end
+ def emit_heredoc_header; end
+ def emit_normal_heredoc_body; end
+ def emit_segment(children, index); end
+ def emit_squiggly_heredoc_body; end
+ def escape_dynamic(string); end
+ def heredoc?; end
+ def heredoc_header; end
+ def heredoc_pattern?; end
+ def heredoc_pattern_2?; end
+ def heredoc_pattern_3?; end
+ def nl_last_child?; end
+ def segments; end
+ def str_empty?(node); end
+ def str_nl?(node); end
+ def str_ws?(node); end
+
+ class << self
+ def anima; end
+ end
+end
+
+Unparser::Writer::DynamicString::FLAT_INTERPOLATION = T.let(T.unsafe(nil), Set)
+Unparser::Writer::DynamicString::PATTERNS_2 = T.let(T.unsafe(nil), Array)
+Unparser::Writer::DynamicString::PATTERNS_3 = T.let(T.unsafe(nil), Array)
+
+class Unparser::Writer::Resbody
+ include ::Unparser::NodeHelpers
+ include ::Unparser::Generation
+ include ::Unparser::Writer
+ include ::Unparser::Anima::InstanceMethods
+ include ::Unparser::Equalizer::Methods
+ extend ::Unparser::DSL
+
+ def buffer; end
+ def comments; end
+ def emit_postcontrol; end
+ def emit_regular; end
+ def local_variable_scope; end
+ def node; end
+
+ private
+
+ def assignment; end
+ def body; end
+ def emit_assignment; end
+ def emit_exception; end
+ def exception; end
+ def remaining_children; end
+
+ class << self
+ def anima; end
+ end
+end
+
+class Unparser::Writer::Rescue
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ include ::Unparser::NodeHelpers
+ include ::Unparser::Generation
+ include ::Unparser::Writer
+ include ::Unparser::Anima::InstanceMethods
+ include ::Unparser::Equalizer::Methods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+ extend ::Unparser::DSL
+
+ def buffer; end
+ def comments; end
+ def emit_heredoc_reminders; end
+ def emit_postcontrol; end
+ def emit_regular; end
+ def local_variable_scope; end
+ def node; end
+
+ private
+
+ def body; end
+ def else_node; end
+ def emit_rescue_body(node); end
+ def remaining_children; end
+ def rescue_bodies(&block); end
+ def rescue_body; end
+
+ class << self
+ def anima; end
+ end
+end
+
+class Unparser::Writer::Send
+ include ::Unparser::NodeHelpers
+ include ::Unparser::Generation
+ include ::Unparser::Constants
+ include ::Unparser::Adamantium
+ include ::Unparser::Adamantium::InstanceMethods
+ include ::Unparser::Writer
+ include ::Unparser::Anima::InstanceMethods
+ include ::Unparser::Equalizer::Methods
+ extend ::Unparser::Adamantium::ModuleMethods
+ extend ::Unparser::Adamantium::ClassMethods
+ extend ::Unparser::DSL
+
+ def buffer; end
+ def comments; end
+ def dispatch; end
+ def emit_heredoc_reminders; end
+ def emit_mlhs; end
+ def emit_selector; end
+ def local_variable_scope; end
+ def node; end
+
+ private
+
+ def arguments; end
+ def avoid_clash?; end
+ def details(&block); end
+ def effective_writer(&block); end
+ def effective_writer_class; end
+ def emit_arguments; end
+ def emit_heredoc_reminder(argument); end
+ def emit_normal_arguments; end
+ def emit_operator; end
+ def emit_send_regular(node); end
+ def local_variable_clash?; end
+ def parses_as_constant?; end
+ def receiver; end
+ def remaining_children; end
+ def selector; end
+ def write_as_attribute_assignment?; end
+
+ class << self
+ def anima; end
+ end
+end
+
+class Unparser::Writer::Send::AttributeAssignment < ::Unparser::Writer::Send
+ def dispatch; end
+ def emit_send_mlhs; end
+
+ private
+
+ def emit_attribute; end
+ def emit_receiver; end
+ def first_argument; end
+ def receiver; end
+ def remaining_children; end
+ def selector; end
+end
+
+class Unparser::Writer::Send::Binary < ::Unparser::Writer::Send
+ def dispatch; end
+
+ private
+
+ def emit_operator; end
+ def emit_right; end
+end
+
+Unparser::Writer::Send::INDEX_ASSIGN = T.let(T.unsafe(nil), Symbol)
+Unparser::Writer::Send::INDEX_REFERENCE = T.let(T.unsafe(nil), Symbol)
+Unparser::Writer::Send::OPERATORS = T.let(T.unsafe(nil), Hash)
+
+class Unparser::Writer::Send::Regular < ::Unparser::Writer::Send
+ def dispatch; end
+ def emit_arguments_without_heredoc_body; end
+ def emit_receiver; end
+ def emit_send_mlhs; end
+end
+
+class Unparser::Writer::Send::Unary < ::Unparser::Writer::Send
+ def dispatch; end
+end
+
+Unparser::Writer::Send::Unary::MAP = T.let(T.unsafe(nil), Hash) | true |
Other | Homebrew | brew | 9dee4606fca4b6531695b2bf271cca12c58837f1.json | Update RBI files for tapioca. | Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | @@ -12,6 +12,12 @@ class AbstractDownloadStrategy
extend ::T::Private::Methods::SingletonMethodHooks
end
+class ActiveRecordColumnTypeHelper
+ extend ::T::Sig
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
module ActiveSupport
def parse_json_times(); end
@@ -3247,6 +3253,56 @@ module DidYouMean
def self.formatter=(formatter); end
end
+class Diff::LCS::Block
+ def changes(); end
+
+ def diff_size(); end
+
+ def initialize(chunk); end
+
+ def insert(); end
+
+ def op(); end
+
+ def remove(); end
+end
+
+class Diff::LCS::Block
+end
+
+class Diff::LCS::Hunk
+ def blocks(); end
+
+ def diff(format, last=T.unsafe(nil)); end
+
+ def end_new(); end
+
+ def end_old(); end
+
+ def file_length_difference(); end
+
+ def flag_context(); end
+
+ def flag_context=(context); end
+
+ def initialize(data_old, data_new, piece, flag_context, file_length_difference); end
+
+ def merge(hunk); end
+
+ def missing_last_newline?(data); end
+
+ def overlaps?(hunk); end
+
+ def start_new(); end
+
+ def start_old(); end
+
+ def unshift(hunk); end
+end
+
+class Diff::LCS::Hunk
+end
+
class Dir
def children(); end
@@ -7219,6 +7275,82 @@ module PyPI
extend ::T::Private::Methods::SingletonMethodHooks
end
+class RBI::ASTVisitor
+ extend ::T::Helpers
+ extend ::T::Sig
+ extend ::T::Private::Abstract::Hooks
+ extend ::T::InterfaceWrapper::Helpers
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class RBI::File
+ extend ::T::Sig
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class RBI::Index
+ include ::T::Enumerable
+end
+
+module RBI::Indexable
+ extend ::T::Sig
+ extend ::T::Helpers
+ extend ::T::Private::Abstract::Hooks
+ extend ::T::InterfaceWrapper::Helpers
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class RBI::Loc
+ extend ::T::Sig
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class RBI::Node
+ extend ::T::Sig
+ extend ::T::Helpers
+ extend ::T::Private::Abstract::Hooks
+ extend ::T::InterfaceWrapper::Helpers
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class RBI::ParseError
+ extend ::T::Sig
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class RBI::Parser
+ extend ::T::Sig
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class RBI::Rewriters::Merge::Conflict
+ extend ::T::Sig
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class RBI::Rewriters::Merge
+ extend ::T::Sig
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class RBI::Visitor
+ extend ::T::Helpers
+ extend ::T::Sig
+ extend ::T::Private::Abstract::Hooks
+ extend ::T::InterfaceWrapper::Helpers
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
class REXML::XPathParser
DEBUG = ::T.let(nil, ::T.untyped)
end
@@ -9305,6 +9437,12 @@ class Tapioca::Compilers::Dsl::Base
extend ::T::Private::Methods::SingletonMethodHooks
end
+module Tapioca::Reflection
+ extend ::T::Sig
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
class Tempfile
def _close(); end
| true |
Other | Homebrew | brew | 4b4f78b8cf57920820c4b2557781739fea8dacae.json | Update RBI files for bootsnap. | Library/Homebrew/sorbet/rbi/gems/bootsnap@1.9.0.rbi | @@ -17,14 +17,14 @@ module Bootsnap
def log!; end
def logger; end
def logger=(logger); end
- def setup(cache_dir:, development_mode: T.unsafe(nil), load_path_cache: T.unsafe(nil), autoload_paths_cache: T.unsafe(nil), disable_trace: T.unsafe(nil), compile_cache_iseq: T.unsafe(nil), compile_cache_yaml: T.unsafe(nil)); end
+ def setup(cache_dir:, development_mode: T.unsafe(nil), load_path_cache: T.unsafe(nil), autoload_paths_cache: T.unsafe(nil), disable_trace: T.unsafe(nil), compile_cache_iseq: T.unsafe(nil), compile_cache_yaml: T.unsafe(nil), compile_cache_json: T.unsafe(nil)); end
end
end
module Bootsnap::CompileCache
class << self
def permission_error(path); end
- def setup(cache_dir:, iseq:, yaml:); end
+ def setup(cache_dir:, iseq:, yaml:, json:); end
def supported?; end
end
end | false |
Other | Homebrew | brew | 966189d07db604c953855e97c97377006e4ce8dd.json | style: add shfmt exit status to `brew style` | Library/Homebrew/style.rb | @@ -65,12 +65,16 @@ def check_style_impl(files, output_type,
run_shellcheck(shell_files, output_type)
end
- run_shfmt(shell_files, fix: fix) if ruby_files.none? || shell_files.any?
+ shfmt_result = if ruby_files.any? && shell_files.none?
+ true
+ else
+ run_shfmt(shell_files, fix: fix)
+ end
if output_type == :json
Offenses.new(rubocop_result + shellcheck_result)
else
- rubocop_result && shellcheck_result
+ rubocop_result && shellcheck_result && shfmt_result
end
end
| false |
Other | Homebrew | brew | d559d3ff46f374c73d4fb20a8a31ed09477c0b12.json | utils/shfmt.sh: reuse similar code fragments | Library/Homebrew/utils/shfmt.sh | @@ -49,6 +49,7 @@ do
SHFMT_ARGS+=("${arg}")
shift
done
+unset arg
FILES=()
for file in "$@"
@@ -66,6 +67,7 @@ do
exit 1
fi
done
+unset file
if [[ "${#FILES[@]}" == 0 ]]
then
@@ -76,32 +78,48 @@ fi
### Custom shell script styling
###
-# Check pattern:
-# '^\t+'
-#
-# Replace tabs with 2 spaces instead
-#
-no_tabs() {
+# Check for specific patterns and prompt messages if detected
+no_forbidden_patten() {
local file="$1"
local tempfile="$2"
+ local subject="$3"
+ local message="$4"
+ local regex_pos="$5"
+ local regex_neg="${6:-}"
local line
local num=0
local retcode=0
- local regex_pos='^[[:space:]]+'
- local regex_neg='^ +'
while IFS='' read -r line
do
num="$((num + 1))"
- if [[ "${line}" =~ ${regex_pos} && ! "${line}" =~ ${regex_neg} ]]
+ if [[ "${line}" =~ ${regex_pos} ]] &&
+ [[ -z "${regex_neg}" || ! "${line}" =~ ${regex_neg} ]]
then
- onoe "Indent by tab detected at \"${file}\", line ${num}."
+ onoe "${subject} detected at \"${file}\", line ${num}."
+ [[ -n "${message}" ]] && onoe "${message}"
retcode=1
fi
done <"${file}"
return "${retcode}"
}
+# Check pattern:
+# '^\t+'
+#
+# Replace tabs with 2 spaces instead
+#
+no_tabs() {
+ local file="$1"
+ local tempfile="$2"
+
+ no_forbidden_patten "${file}" "${tempfile}" \
+ "Indent with tab" \
+ 'Replace tabs with 2 spaces instead.' \
+ '^[[:space:]]+' \
+ '^ +'
+}
+
# Check pattern:
# for var in ... \
# ...; do
@@ -116,18 +134,10 @@ no_tabs() {
no_multiline_for_statements() {
local file="$1"
local tempfile="$2"
- local line
- local num=0
- local retcode=0
local regex='^ *for [_[:alnum:]]+ in .*\\$'
-
- while IFS='' read -r line
- do
- num="$((num + 1))"
- if [[ "${line}" =~ ${regex} ]]
- then
- onoe "Multiline for statement detected at \"${file}\", line ${num}."
- cat >&2 <<EOMSG
+ local message
+ message="$(
+ cat <<EOMSG
Use the followings instead (keep for statements only one line):
ARRAY=(
...
@@ -137,10 +147,12 @@ Use the followings instead (keep for statements only one line):
...
done
EOMSG
- retcode=1
- fi
- done <"${file}"
- return "${retcode}"
+ )"
+
+ no_forbidden_patten "${file}" "${tempfile}" \
+ "Multiline for statement" \
+ "${message}" \
+ "${regex}"
}
# Check pattern:
@@ -155,32 +167,26 @@ EOMSG
no_IFS_newline() {
local file="$1"
local tempfile="$2"
- local line
- local num=0
- local retcode=0
local regex="^[^#]*IFS=\\\$'\\\\n'"
-
- while IFS='' read -r line
- do
- num="$((num + 1))"
- if [[ "${line}" =~ ${regex} ]]
- then
- onoe "Pattern \`IFS=\$'\\n'\` detected at \"${file}\", line ${num}."
- cat >&2 <<EOMSG
+ local message
+ message="$(
+ cat <<EOMSG
Use the followings instead:
while IFS='' read -r line
do
...
done < <(command)
EOMSG
- retcode=1
- fi
- done <"${file}"
- return "${retcode}"
+ )"
+
+ no_forbidden_patten "${file}" "${tempfile}" \
+ "Pattern \`IFS=\$'\\n'\`" \
+ "${message}" \
+ "${regex}"
}
# Combine all forbidden styles
-no_forbiddens() {
+no_forbidden_styles() {
local file="$1"
local tempfile="$2"
@@ -304,15 +310,14 @@ align_multiline_switch_cases() {
format() {
local file="$1"
+ local tempfile
if [[ ! -f "${file}" || ! -r "${file}" ]]
then
onoe "File \"${file}\" is not readable."
return 1
fi
- # shellcheck disable=SC2155
- local tempfile="$(dirname "${file}")/.${file##*/}.temp"
-
+ tempfile="$(dirname "${file}")/.${file##*/}.temp"
trap 'rm -f "${tempfile}" 2>/dev/null' RETURN
cp -af "${file}" "${tempfile}"
@@ -325,15 +330,12 @@ format() {
# Format with `shfmt` first
if ! "${SHFMT}" -w "${SHFMT_ARGS[@]}" "${tempfile}"
then
- onoe "Failed to run \`shfmt\`"
+ onoe "Failed to run \`shfmt\` for file \"${file}\"."
return 1
fi
- # Fail fast when forbidden patterns detected
- if ! no_forbiddens "${file}" "${tempfile}"
- then
- return 2
- fi
+ # Fail fast when forbidden styles detected
+ ! no_forbidden_styles "${file}" "${tempfile}" && return 2
# Tweak it with custom shell script styles
wrap_then_do "${file}" "${tempfile}" | false |
Other | Homebrew | brew | 22db7aa516ef385949582cac1f12d8984e441f8b.json | superenv: set `M4` on Linux when `bison` is a dependency
Bison no longer remembers the path to `m4` as of
Homebrew/homebrew-core#84931. Since superenv does not put runtime
dependencies of build dependences in `PATH`, we now need to help Bison
find `m4` by setting `M4` in the environment.
See also Homebrew/homebrew-core#85260. | Library/Homebrew/extend/os/linux/extend/ENV/super.rb | @@ -24,6 +24,7 @@ def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_a
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
+ self["M4"] = "#{HOMEBREW_PREFIX}/opt/m4/bin/m4" if deps.any? { |d| d.name == "libtool" || d.name == "bison" }
end
def homebrew_extra_paths | false |
Other | Homebrew | brew | d5a15cf289862af8df1487543a2809dabdfa3b35.json | brew.sh: remove deprecated command
Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> | Library/Homebrew/brew.sh | @@ -647,7 +647,6 @@ case "${HOMEBREW_COMMAND}" in
uninstal) HOMEBREW_COMMAND="uninstall" ;;
rm) HOMEBREW_COMMAND="uninstall" ;;
remove) HOMEBREW_COMMAND="uninstall" ;;
- configure) HOMEBREW_COMMAND="diy" ;;
abv) HOMEBREW_COMMAND="info" ;;
dr) HOMEBREW_COMMAND="doctor" ;;
--repo) HOMEBREW_COMMAND="--repository" ;; | false |
Other | Homebrew | brew | 2688e7e56bf2983670d6a1e187006fe3a8feba3b.json | style: apply suggestions from code review | Library/Homebrew/style.rb | @@ -65,7 +65,7 @@ def check_style_impl(files, output_type,
run_shellcheck(shell_files, output_type)
end
- run_shfmt(shell_files, inplace: fix) if ruby_files.none? || shell_files.any?
+ run_shfmt(shell_files, fix: fix) if ruby_files.none? || shell_files.any?
if output_type == :json
Offenses.new(rubocop_result + shellcheck_result)
@@ -166,7 +166,7 @@ def run_rubocop(files, output_type,
end
def run_shellcheck(files, output_type)
- files = [*shell_scripts, HOMEBREW_REPOSITORY/"Dockerfile"] if files.empty?
+ files = shell_scripts if files.blank?
args = ["--shell=bash", "--enable=all", "--external-sources", "--source-path=#{HOMEBREW_LIBRARY}", "--", *files]
@@ -214,15 +214,22 @@ def run_shellcheck(files, output_type)
end
end
- def run_shfmt(files, inplace: false)
- files = shell_scripts if files.empty?
+ def run_shfmt(files, fix: false)
+ files = shell_scripts if files.blank?
# Do not format completions and Dockerfile
files.delete(HOMEBREW_REPOSITORY/"completions/bash/brew")
files.delete(HOMEBREW_REPOSITORY/"Dockerfile")
+ # shfmt options:
+ # -i 2 : indent by 2 spaces
+ # -ci : indent switch cases
+ # -ln bash : language variant to parse ("bash")
+ # -w : write result to file instead of stdout (inplace fixing)
+ # "--" is needed for `utils/shfmt.sh`
args = ["-i", "2", "-ci", "-ln", "bash", "--", *files]
- args.unshift("-w") if inplace
+ # Do inplace fixing
+ args << "-w" if fix
system shfmt, *args
$CHILD_STATUS.success? | false |
Other | Homebrew | brew | bd8db0737de7cf3ce7788c0377f08c6b41a1b6db.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/brew.sh | @@ -74,7 +74,8 @@ esac
# These variables are set from the user environment.
# shellcheck disable=SC2154
ohai() {
- if [[ -n "${HOMEBREW_COLOR}" || (-t 1 && -z "${HOMEBREW_NO_COLOR}") ]] # check whether stdout is a tty.
+ # Check whether stdout is a tty.
+ if [[ -n "${HOMEBREW_COLOR}" || (-t 1 && -z "${HOMEBREW_NO_COLOR}") ]]
then
echo -e "\\033[34m==>\\033[0m \\033[1m$*\\033[0m" # blue arrow and bold text
else
@@ -83,7 +84,8 @@ ohai() {
}
opoo() {
- if [[ -n "${HOMEBREW_COLOR}" || (-t 2 && -z "${HOMEBREW_NO_COLOR}") ]] # check whether stderr is a tty.
+ # Check whether stderr is a tty.
+ if [[ -n "${HOMEBREW_COLOR}" || (-t 2 && -z "${HOMEBREW_NO_COLOR}") ]]
then
echo -ne "\\033[4;33mWarning\\033[0m: " >&2 # highlight Warning with underline and yellow color
else
@@ -98,7 +100,8 @@ opoo() {
}
bold() {
- if [[ -n "${HOMEBREW_COLOR}" || (-t 2 && -z "${HOMEBREW_NO_COLOR}") ]] # check whether stderr is a tty.
+ # Check whether stderr is a tty.
+ if [[ -n "${HOMEBREW_COLOR}" || (-t 2 && -z "${HOMEBREW_NO_COLOR}") ]]
then
echo -e "\\033[1m""$*""\\033[0m"
else
@@ -107,7 +110,8 @@ bold() {
}
onoe() {
- if [[ -n "${HOMEBREW_COLOR}" || (-t 2 && -z "${HOMEBREW_NO_COLOR}") ]] # check whether stderr is a tty.
+ # Check whether stderr is a tty.
+ if [[ -n "${HOMEBREW_COLOR}" || (-t 2 && -z "${HOMEBREW_NO_COLOR}") ]]
then
echo -ne "\\033[4;31mError\\033[0m: " >&2 # highlight Error with underline and red color
else
@@ -742,6 +746,6 @@ else
{
update-preinstall "$@"
exec "${HOMEBREW_RUBY_PATH}" "${HOMEBREW_RUBY_WARNINGS}" "${RUBY_DISABLE_OPTIONS}" \
- "${HOMEBREW_LIBRARY}/Homebrew/brew.rb" "$@"
+ "${HOMEBREW_LIBRARY}/Homebrew/brew.rb" "$@"
}
fi | true |
Other | Homebrew | brew | bd8db0737de7cf3ce7788c0377f08c6b41a1b6db.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/cmd/shellenv.sh | @@ -10,8 +10,11 @@
# HOMEBREW_REPOSITORY is set by bin/brew
# shellcheck disable=SC2154
homebrew-shellenv() {
- [[ "${HOMEBREW_SHELLENV_PREFIX}" == "${HOMEBREW_PREFIX}" ]] &&
- [[ "$(PATH="${HOMEBREW_PATH}" command -v brew)" == "${HOMEBREW_PREFIX}/bin/brew" ]] && return
+ if [[ "${HOMEBREW_SHELLENV_PREFIX}" == "${HOMEBREW_PREFIX}" ]] &&
+ [[ "$(PATH="${HOMEBREW_PATH}" command -v brew)" == "${HOMEBREW_PREFIX}/bin/brew" ]]
+ then
+ return
+ fi
case "$(/bin/ps -p "${PPID}" -c -o comm=)" in
fish | -fish) | true |
Other | Homebrew | brew | bd8db0737de7cf3ce7788c0377f08c6b41a1b6db.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/cmd/update.sh | @@ -602,7 +602,7 @@ EOS
else
# Capture stderr to tmp_failure_file
if ! git fetch --tags --force "${QUIET_ARGS[@]}" origin \
- "refs/heads/${UPSTREAM_BRANCH_DIR}:refs/remotes/origin/${UPSTREAM_BRANCH_DIR}" 2>>"${tmp_failure_file}"
+ "refs/heads/${UPSTREAM_BRANCH_DIR}:refs/remotes/origin/${UPSTREAM_BRANCH_DIR}" 2>>"${tmp_failure_file}"
then
# Reprint fetch errors to stderr
[[ -f "${tmp_failure_file}" ]] && cat "${tmp_failure_file}" 1>&2
@@ -650,7 +650,7 @@ EOS
# shellcheck disable=SC2031
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
[[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
- [[ "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" || \
+ [[ "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ||
"${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]]
then
continue | true |
Other | Homebrew | brew | bd8db0737de7cf3ce7788c0377f08c6b41a1b6db.json | style: fix inconsistent code style for shell scripts | bin/brew | @@ -2,13 +2,15 @@
set +o posix
# Fail fast with concise message when cwd does not exist
-if ! [[ -d "${PWD}" ]]; then
+if ! [[ -d "${PWD}" ]]
+then
echo "Error: The current working directory doesn't exist, cannot proceed." >&2
exit 1
fi
# Fail fast with concise message when not using bash
-if [ -z "${BASH_VERSION:-}" ]; then
+if [ -z "${BASH_VERSION:-}" ]
+then
echo "Error: Bash is required to run brew." >&2
exit 1
fi | true |
Other | Homebrew | brew | 09a16bcea115b3fe3927df7a6e0cdb202db42624.json | utils/shfmt.sh: implement checkers for forbidden styles | Library/Homebrew/utils/shfmt.sh | @@ -83,71 +83,122 @@ fi
#
no_tabs() {
local file="$1"
+ local tempfile="$2"
+ local line
+ local num=0
+ local retcode=0
+ local regex_pos='^[[:space:]]+'
+ local regex_neg='^ +'
- # TODO: use bash built-in regex match syntax instead
- if grep -qE '^\t+' "${file}"
- then
- # TODO: add line number
- onoe "Indent by tab detected."
- return 1
- fi
+ while IFS='' read -r line
+ do
+ num="$((num + 1))"
+ if [[ "${line}" =~ ${regex_pos} && ! "${line}" =~ ${regex_neg} ]]
+ then
+ onoe "Indent by tab detected at \"${file}\", line ${num}."
+ retcode=1
+ fi
+ done <"${file}"
+ return "${retcode}"
}
# Check pattern:
# for var in ... \
# ...; do
#
# Use the followings instead (keep for statements only one line):
-# ARRAY=(
-# ...
-# ...
-# )
-# for var in "${ARRAY[@]}"
-# do
+# ARRAY=(
+# ...
+# )
+# for var in "${ARRAY[@]}"
+# do
#
no_multiline_for_statements() {
local file="$1"
+ local tempfile="$2"
+ local line
+ local num=0
+ local retcode=0
+ local regex='^ *for [_[:alnum:]]+ in .*\\$'
- # TODO: use bash built-in regex match syntax instead
- if grep -qE '^\s*for .*\\\(#.*\)\?$' "${file}"
- then
- # TODO: add line number
- onoe "Multi-line for statement detected."
- return 1
- fi
+ while IFS='' read -r line
+ do
+ num="$((num + 1))"
+ if [[ "${line}" =~ ${regex} ]]
+ then
+ onoe "Multiline for statement detected at \"${file}\", line ${num}."
+ cat >&2 <<EOMSG
+Use the followings instead (keep for statements only one line):
+ ARRAY=(
+ ...
+ )
+ for var in "\${ARRAY[@]}"
+ do
+ ...
+ done
+EOMSG
+ retcode=1
+ fi
+ done <"${file}"
+ return "${retcode}"
}
# Check pattern:
# IFS=$'\n'
#
# Use the followings instead:
-# while IFS='' read -r line
-# do
-# ...
-# done < <(command)
+# while IFS='' read -r line
+# do
+# ...
+# done < <(command)
#
no_IFS_newline() {
local file="$1"
+ local tempfile="$2"
+ local line
+ local num=0
+ local retcode=0
+ local regex="^[^#]*IFS=\\\$'\\\\n'"
- # TODO: use bash built-in regex match syntax instead
- if grep -qE "^[^#]*IFS=\\\$'\\\\n'" "${file}"
- then
- # TODO: add line number
- onoe "Pattern \`IFS=\$'\\\\n'\` detected."
- return 1
- fi
+ while IFS='' read -r line
+ do
+ num="$((num + 1))"
+ if [[ "${line}" =~ ${regex} ]]
+ then
+ onoe "Pattern \`IFS=\$'\\n'\` detected at \"${file}\", line ${num}."
+ cat >&2 <<EOMSG
+Use the followings instead:
+ while IFS='' read -r line
+ do
+ ...
+ done < <(command)
+EOMSG
+ retcode=1
+ fi
+ done <"${file}"
+ return "${retcode}"
+}
+
+# Combine all forbidden styles
+no_forbiddens() {
+ local file="$1"
+ local tempfile="$2"
+
+ no_tabs "${file}" "${tempfile}" || return 1
+ no_multiline_for_statements "${file}" "${tempfile}" || return 1
+ no_IFS_newline "${file}" "${tempfile}" || return 1
}
# Align multiline if condition (indent with 3 spaces or 6 spaces (start with "-"))
# before: after:
-# if [[ ... ]] || if [[ ... ]] ||
-# [[ ... ]] [[ ... ]]
-# then then
+# if [[ ... ]] || if [[ ... ]] ||
+# [[ ... ]] [[ ... ]]
+# then then
#
# before: after:
-# if [[ -n ... || \ if [[ -n ... || \
-# -n ... ]] -n ... ]]
-# then then
+# if [[ -n ... || \ if [[ -n ... || \
+# -n ... ]] -n ... ]]
+# then then
#
align_multiline_if_condition() {
local multiline_if_begin_regex='^( *)(el)?if '
@@ -188,20 +239,21 @@ align_multiline_if_condition() {
# Wrap `then` and `do` to a separated line
# before: after:
-# if [[ ... ]]; then if [[ ... ]]
-# then
+# if [[ ... ]]; then if [[ ... ]]
+# then
#
# before: after:
-# if [[ ... ]] || if [[ ... ]] ||
-# [[ ... ]]; then [[ ... ]]
-# then
+# if [[ ... ]] || if [[ ... ]] ||
+# [[ ... ]]; then [[ ... ]]
+# then
#
# before: after:
-# for var in ...; do for var in ...
-# do
+# for var in ...; do for var in ...
+# do
#
wrap_then_do() {
local file="$1"
+ local tempfile="$2"
local -a processed
local line
@@ -240,20 +292,16 @@ wrap_then_do() {
buffer=()
fi
fi
- done < <(cat "${file}")
+ done <"${tempfile}"
- printf "%s\n" "${processed[@]}" >"${file}"
+ printf "%s\n" "${processed[@]}" >"${tempfile}"
}
# TODO: it's hard to align multiline switch cases
align_multiline_switch_cases() {
true
}
-no_forbiddens() {
- true
-}
-
format() {
local file="$1"
if [[ ! -f "${file}" || ! -r "${file}" ]]
@@ -282,17 +330,16 @@ format() {
fi
# Fail fast when forbidden patterns detected
- if ! no_tabs "${tempfile}" ||
- ! no_multiline_for_statements "${tempfile}" ||
- ! no_IFS_newline "${tempfile}"
+ if ! no_forbiddens "${file}" "${tempfile}"
then
- return 1
+ return 2
fi
# Tweak it with custom shell script styles
- wrap_then_do "${tempfile}"
+ wrap_then_do "${file}" "${tempfile}"
+ align_multiline_switch_cases "${file}" "${tempfile}"
- if ! diff -q "${file}" "${tempfile}"
+ if ! diff -q "${file}" "${tempfile}" &>/dev/null
then
# Show differences
diff -d -C 1 --color=auto "${file}" "${tempfile}"
@@ -314,9 +361,9 @@ do
then
if [[ "$?" == 1 ]]
then
- onoe "${0##*/}: Failed to format file \"${file}\". Function exited with code $?."
+ onoe "${0##*/}: Failed to format file \"${file}\". Function exited with code 1."
else
- onoe "${0##*/}: Bad style for file \"${file}\". Function exited with code $?."
+ onoe "${0##*/}: Bad style for file \"${file}\". Function exited with code 2."
fi
onoe
RETCODE=1 | false |
Other | Homebrew | brew | 03c7a142be52a909ceea0adac03071b059cf76a5.json | style: add keyward argument `inplace` to run_shfmt | Library/Homebrew/style.rb | @@ -65,7 +65,7 @@ def check_style_impl(files, output_type,
run_shellcheck(shell_files, output_type)
end
- run_shfmt(shell_files) if ruby_files.none? || shell_files.any?
+ run_shfmt(shell_files, inplace: fix) if ruby_files.none? || shell_files.any?
if output_type == :json
Offenses.new(rubocop_result + shellcheck_result)
@@ -214,11 +214,16 @@ def run_shellcheck(files, output_type)
end
end
- def run_shfmt(files)
+ def run_shfmt(files, inplace: false)
files = shell_scripts if files.empty?
+ # Do not format completions and Dockerfile
+ files.delete(HOMEBREW_REPOSITORY/"completions/bash/brew")
+ files.delete(HOMEBREW_REPOSITORY/"Dockerfile")
args = ["-i", "2", "-ci", "-ln", "bash", "--", *files]
+ args.unshift("-w") if inplace
+
system shfmt, *args
$CHILD_STATUS.success?
end | false |
Other | Homebrew | brew | 1bb68bda3f3d009847ac21dbc474638056d0f00f.json | utils/shfmt.sh: add function wrap_then_do | Library/Homebrew/utils/shfmt.sh | @@ -55,9 +55,14 @@ for file in "$@"
do
if [[ -f "${file}" ]]
then
- FILES+=("${file}")
+ if [[ -w "${file}" ]]
+ then
+ FILES+=("${file}")
+ else
+ onoe "${0##*/}: File \"${file}\" is not writable."
+ fi
else
- echo "${0##*/}: File \"${file}\" does not exist." >&2
+ onoe "${0##*/}: File \"${file}\" does not exist."
exit 1
fi
done
@@ -67,10 +72,6 @@ then
exit
fi
-check_read_and_write() {
- [[ -f "$1" && -w "$1" ]]
-}
-
###
### Custom shell script styling
###
@@ -106,7 +107,6 @@ no_tabs() {
#
no_multiline_for_statements() {
local file="$1"
- check_read_and_write "${file}" || return 1
# TODO: use bash built-in regex match syntax instead
if grep -qE '^\s*for .*\\\(#.*\)\?$' "${file}"
@@ -128,8 +128,6 @@ no_multiline_for_statements() {
#
no_IFS_newline() {
local file="$1"
- check_read_and_write "${file}" || return 1
-
# TODO: use bash built-in regex match syntax instead
if grep -qE "^[^#]*IFS=\\\$'\\\\n'" "${file}"
@@ -140,102 +138,189 @@ no_IFS_newline() {
fi
}
-# TODO: Wrap `then` to a separated line
+# Align multiline if condition (indent with 3 spaces or 6 spaces (start with "-"))
# before: after:
-# if [[ ... ]]; then if [[ ... ]]
-# then
+# if [[ ... ]] || if [[ ... ]] ||
+# [[ ... ]] [[ ... ]]
+# then then
#
# before: after:
-# if [[ ... ]] || if [[ ... ]] ||
-# [[ ... ]]; then [[ ... ]]
-# then
+# if [[ -n ... || \ if [[ -n ... || \
+# -n ... ]] -n ... ]]
+# then then
#
-wrap_then() {
- local file="$1"
- check_read_and_write "${file}" || return 1
+align_multiline_if_condition() {
+ local multiline_if_begin_regex='^( *)(el)?if '
+ local multiline_then_end_regex='^(.*)\; (then( *#.*)?)$'
+ local within_test_regex='^( *)(((! )?-[fdrwxes])|([^\[]+ == ))'
+ local base_indent=''
+ local extra_indent=''
+ local line
+ local lastline=''
+
+ if [[ "$1" =~ ${multiline_if_begin_regex} ]]
+ then
+ base_indent="${BASH_REMATCH[1]}"
+ [[ -n "${BASH_REMATCH[2]}" ]] && extra_indent=' '
+ echo "$1"
+ shift
+ fi
- true
+ while [[ "$#" -gt 0 ]]
+ do
+ line="$1"
+ shift
+ if [[ "${line}" =~ ${multiline_then_end_regex} ]]
+ then
+ line="${BASH_REMATCH[1]}"
+ lastline="${base_indent}${BASH_REMATCH[2]}"
+ fi
+ if [[ "${line}" =~ ${within_test_regex} ]]
+ then
+ echo " ${extra_indent}${line}"
+ else
+ echo " ${extra_indent}${line}"
+ fi
+ done
+
+ echo "${lastline}"
}
-# Probably merge into the above function
-# TODO: Wrap `do` to a separated line
+# Wrap `then` and `do` to a separated line
# before: after:
-# for var in ...; do for var in ...do
-# do
+# if [[ ... ]]; then if [[ ... ]]
+# then
#
-wrap_do() {
- local file="$1"
- check_read_and_write "${file}" || return 1
-
- true
-}
-
-# TODO: Align multiline if condition (indent with 3 spaces or 6 spaces (start with "-"))
# before: after:
# if [[ ... ]] || if [[ ... ]] ||
-# [[ ... ]] [[ ... ]]
-# then then
+# [[ ... ]]; then [[ ... ]]
+# then
#
# before: after:
-# if [[ -n ... || \ if [[ -n ... || \
-# -n ... ]] -n ... ]]
-# then then
+# for var in ...; do for var in ...
+# do
#
-align_multiline_if_condition() {
+wrap_then_do() {
local file="$1"
- check_read_and_write "${file}" || return 1
- true
+ local -a processed
+ local line
+ local singleline_then_regex='^( *)(el)?if (.+)\; (then( *#.*)?)$'
+ local singleline_do_regex='^( *)(for|while) (.+)\; (do( *#.*)?)$'
+ local multiline_if_begin_regex='^( *)(el)?if '
+ local multiline_then_end_regex='^(.*)\; (then( *#.*)?)$'
+ local -a buffer=()
+
+ while IFS='' read -r line
+ do
+ if [[ "${#buffer[@]}" == 0 ]]
+ then
+ if [[ "${line}" =~ ${singleline_then_regex} ]]
+ then
+ processed+=("${BASH_REMATCH[1]}${BASH_REMATCH[2]}if ${BASH_REMATCH[3]}")
+ processed+=("${BASH_REMATCH[1]}${BASH_REMATCH[4]}")
+ elif [[ "${line}" =~ ${singleline_do_regex} ]]
+ then
+ processed+=("${BASH_REMATCH[1]}${BASH_REMATCH[2]} ${BASH_REMATCH[3]}")
+ processed+=("${BASH_REMATCH[1]}${BASH_REMATCH[4]}")
+ elif [[ "${line}" =~ ${multiline_if_begin_regex} ]]
+ then
+ buffer=("${line}")
+ else
+ processed+=("${line}")
+ fi
+ else
+ buffer+=("${line}")
+ if [[ "${line}" =~ ${multiline_then_end_regex} ]]
+ then
+ while IFS='' read -r line
+ do
+ processed+=("${line}")
+ done < <(align_multiline_if_condition "${buffer[@]}")
+ buffer=()
+ fi
+ fi
+ done < <(cat "${file}")
+
+ printf "%s\n" "${processed[@]}" >"${file}"
}
-# TODO: It's hard to align multiline switch cases
+# TODO: it's hard to align multiline switch cases
align_multiline_switch_cases() {
true
}
+no_forbiddens() {
+ true
+}
+
format() {
local file="$1"
+ if [[ ! -f "${file}" || ! -r "${file}" ]]
+ then
+ onoe "File \"${file}\" is not readable."
+ return 1
+ fi
+
# shellcheck disable=SC2155
local tempfile="$(dirname "${file}")/.${file##*/}.temp"
- local retcode=0
+ trap 'rm -f "${tempfile}" 2>/dev/null' RETURN
cp -af "${file}" "${tempfile}"
+ if [[ ! -f "${tempfile}" || ! -w "${tempfile}" ]]
+ then
+ onoe "File \"${tempfile}\" is not writable."
+ return 1
+ fi
+
# Format with `shfmt` first
- "${SHFMT}" -w "${SHFMT_ARGS[@]}" "${tempfile}"
+ if ! "${SHFMT}" -w "${SHFMT_ARGS[@]}" "${tempfile}"
+ then
+ onoe "Failed to run \`shfmt\`"
+ return 1
+ fi
# Fail fast when forbidden patterns detected
if ! no_tabs "${tempfile}" ||
! no_multiline_for_statements "${tempfile}" ||
! no_IFS_newline "${tempfile}"
then
- rm -f "${tempfile}" 2>/dev/null
return 1
fi
# Tweak it with custom shell script styles
- wrap_then "${tempfile}"
- wrap_do "${tempfile}"
- align_multiline_if_condition "${tempfile}"
+ wrap_then_do "${tempfile}"
if ! diff -q "${file}" "${tempfile}"
then
# Show differences
diff -d -C 1 --color=auto "${file}" "${tempfile}"
- if [[ -n "${INPLACE}" ]]; then
+ if [[ -n "${INPLACE}" ]]
+ then
cp -af "${tempfile}" "${file}"
fi
- retcode=1
+ return 2
else
# File is identical between code formations (good styling)
- retcode=0
+ return 0
fi
- rm -f "${tempfile}" 2>/dev/null
- return "${retcode}"
}
+RETCODE=0
for file in "${FILES[@]}"
do
- # TODO: catch return values
- format "${file}"
+ if ! format "${file}"
+ then
+ if [[ "$?" == 1 ]]
+ then
+ onoe "${0##*/}: Failed to format file \"${file}\". Function exited with code $?."
+ else
+ onoe "${0##*/}: Bad style for file \"${file}\". Function exited with code $?."
+ fi
+ onoe
+ RETCODE=1
+ fi
done
+
+exit "${RETCODE}" | false |
Other | Homebrew | brew | a839d7e5ffd73097524e3d92202e4b33c37d9965.json | utils/shfmt.sh: add function prototypes | Library/Homebrew/utils/shfmt.sh | @@ -1,12 +1,19 @@
#!/bin/bash
-# HOMEBREW_LIBRARY is set by bin/brew
+onoe() {
+ echo "$*" >&2
+}
+
+odie() {
+ onoe "$@"
+ exit 1
+}
+
# HOMEBREW_PREFIX is set by extend/ENV/super.rb
# shellcheck disable=SC2154
-if [[ -z "${HOMEBREW_LIBRARY}" || -z "${HOMEBREW_PREFIX}" ]]
+if [[ -z "${HOMEBREW_PREFIX}" ]]
then
- echo "${0##*/}: This program is internal and must be run via brew." >&2
- exit 1
+ odie "${0##*/}: This program is internal and must be run via brew."
fi
# HOMEBREW_PREFIX is set by extend/ENV/super.rb
@@ -15,8 +22,12 @@ SHFMT="${HOMEBREW_PREFIX}/opt/shfmt/bin/shfmt"
if [[ ! -x "${SHFMT}" ]]
then
- echo "${0##*/}: Please install shfmt by running \`brew install shfmt\`." >&2
- exit 1
+ odie "${0##*/}: Please install shfmt by running \`brew install shfmt\`."
+fi
+
+if [[ ! -x "$(command -v diff)" ]]
+then
+ odie "${0##*/}: Please install diff by running \`brew install diffutils\`."
fi
SHFMT_ARGS=()
@@ -56,4 +67,175 @@ then
exit
fi
-"${SHFMT}" "${SHFMT_ARGS[@]}" "${FILES[@]}"
+check_read_and_write() {
+ [[ -f "$1" && -w "$1" ]]
+}
+
+###
+### Custom shell script styling
+###
+
+# Check pattern:
+# '^\t+'
+#
+# Replace tabs with 2 spaces instead
+#
+no_tabs() {
+ local file="$1"
+
+ # TODO: use bash built-in regex match syntax instead
+ if grep -qE '^\t+' "${file}"
+ then
+ # TODO: add line number
+ onoe "Indent by tab detected."
+ return 1
+ fi
+}
+
+# Check pattern:
+# for var in ... \
+# ...; do
+#
+# Use the followings instead (keep for statements only one line):
+# ARRAY=(
+# ...
+# ...
+# )
+# for var in "${ARRAY[@]}"
+# do
+#
+no_multiline_for_statements() {
+ local file="$1"
+ check_read_and_write "${file}" || return 1
+
+ # TODO: use bash built-in regex match syntax instead
+ if grep -qE '^\s*for .*\\\(#.*\)\?$' "${file}"
+ then
+ # TODO: add line number
+ onoe "Multi-line for statement detected."
+ return 1
+ fi
+}
+
+# Check pattern:
+# IFS=$'\n'
+#
+# Use the followings instead:
+# while IFS='' read -r line
+# do
+# ...
+# done < <(command)
+#
+no_IFS_newline() {
+ local file="$1"
+ check_read_and_write "${file}" || return 1
+
+
+ # TODO: use bash built-in regex match syntax instead
+ if grep -qE "^[^#]*IFS=\\\$'\\\\n'" "${file}"
+ then
+ # TODO: add line number
+ onoe "Pattern \`IFS=\$'\\\\n'\` detected."
+ return 1
+ fi
+}
+
+# TODO: Wrap `then` to a separated line
+# before: after:
+# if [[ ... ]]; then if [[ ... ]]
+# then
+#
+# before: after:
+# if [[ ... ]] || if [[ ... ]] ||
+# [[ ... ]]; then [[ ... ]]
+# then
+#
+wrap_then() {
+ local file="$1"
+ check_read_and_write "${file}" || return 1
+
+ true
+}
+
+# Probably merge into the above function
+# TODO: Wrap `do` to a separated line
+# before: after:
+# for var in ...; do for var in ...do
+# do
+#
+wrap_do() {
+ local file="$1"
+ check_read_and_write "${file}" || return 1
+
+ true
+}
+
+# TODO: Align multiline if condition (indent with 3 spaces or 6 spaces (start with "-"))
+# before: after:
+# if [[ ... ]] || if [[ ... ]] ||
+# [[ ... ]] [[ ... ]]
+# then then
+#
+# before: after:
+# if [[ -n ... || \ if [[ -n ... || \
+# -n ... ]] -n ... ]]
+# then then
+#
+align_multiline_if_condition() {
+ local file="$1"
+ check_read_and_write "${file}" || return 1
+
+ true
+}
+
+# TODO: It's hard to align multiline switch cases
+align_multiline_switch_cases() {
+ true
+}
+
+format() {
+ local file="$1"
+ # shellcheck disable=SC2155
+ local tempfile="$(dirname "${file}")/.${file##*/}.temp"
+ local retcode=0
+
+ cp -af "${file}" "${tempfile}"
+
+ # Format with `shfmt` first
+ "${SHFMT}" -w "${SHFMT_ARGS[@]}" "${tempfile}"
+
+ # Fail fast when forbidden patterns detected
+ if ! no_tabs "${tempfile}" ||
+ ! no_multiline_for_statements "${tempfile}" ||
+ ! no_IFS_newline "${tempfile}"
+ then
+ rm -f "${tempfile}" 2>/dev/null
+ return 1
+ fi
+
+ # Tweak it with custom shell script styles
+ wrap_then "${tempfile}"
+ wrap_do "${tempfile}"
+ align_multiline_if_condition "${tempfile}"
+
+ if ! diff -q "${file}" "${tempfile}"
+ then
+ # Show differences
+ diff -d -C 1 --color=auto "${file}" "${tempfile}"
+ if [[ -n "${INPLACE}" ]]; then
+ cp -af "${tempfile}" "${file}"
+ fi
+ retcode=1
+ else
+ # File is identical between code formations (good styling)
+ retcode=0
+ fi
+ rm -f "${tempfile}" 2>/dev/null
+ return "${retcode}"
+}
+
+for file in "${FILES[@]}"
+do
+ # TODO: catch return values
+ format "${file}"
+done | false |
Other | Homebrew | brew | 9efde249c139f46f3db2c265fba1b8f284b6641e.json | style: add shfmt implementation | Library/Homebrew/style.rb | @@ -65,6 +65,8 @@ def check_style_impl(files, output_type,
run_shellcheck(shell_files, output_type)
end
+ run_shfmt(shell_files) if ruby_files.none? || shell_files.any?
+
if output_type == :json
Offenses.new(rubocop_result + shellcheck_result)
else
@@ -164,30 +166,7 @@ def run_rubocop(files, output_type,
end
def run_shellcheck(files, output_type)
- # Always use the latest brewed shellcheck
- unless Formula["shellcheck"].latest_version_installed?
- if Formula["shellcheck"].any_version_installed?
- ohai "Upgrading `shellcheck` for shell style checks..."
- safe_system HOMEBREW_BREW_FILE, "upgrade", "shellcheck"
- else
- ohai "Installing `shellcheck` for shell style checks..."
- safe_system HOMEBREW_BREW_FILE, "install", "shellcheck"
- end
- end
- shellcheck = Formula["shellcheck"].opt_bin/"shellcheck"
-
- if files.empty?
- files = [
- HOMEBREW_BREW_FILE,
- HOMEBREW_REPOSITORY/"completions/bash/brew",
- HOMEBREW_REPOSITORY/"Dockerfile",
- *HOMEBREW_LIBRARY.glob("Homebrew/*.sh"),
- *HOMEBREW_LIBRARY.glob("Homebrew/shims/**/*").map(&:realpath).uniq
- .reject { |path| path.directory? || path.basename.to_s == "cc" },
- *HOMEBREW_LIBRARY.glob("Homebrew/{dev-,}cmd/*.sh"),
- *HOMEBREW_LIBRARY.glob("Homebrew/{cask/,}utils/*.sh"),
- ]
- end
+ files = [*shell_scripts, HOMEBREW_REPOSITORY/"Dockerfile"] if files.empty?
args = ["--shell=bash", "--enable=all", "--external-sources", "--source-path=#{HOMEBREW_LIBRARY}", "--", *files]
@@ -235,6 +214,15 @@ def run_shellcheck(files, output_type)
end
end
+ def run_shfmt(files)
+ files = shell_scripts if files.empty?
+
+ args = ["-i", "2", "-ci", "-ln", "bash", "--", *files]
+
+ system shfmt, *args
+ $CHILD_STATUS.success?
+ end
+
def json_result!(result)
# An exit status of 1 just means violations were found; other numbers mean
# execution errors.
@@ -244,6 +232,49 @@ def json_result!(result)
JSON.parse(result.stdout)
end
+ def shell_scripts
+ [
+ HOMEBREW_BREW_FILE,
+ HOMEBREW_REPOSITORY/"completions/bash/brew",
+ HOMEBREW_REPOSITORY/"Dockerfile",
+ *HOMEBREW_LIBRARY.glob("Homebrew/*.sh"),
+ *HOMEBREW_LIBRARY.glob("Homebrew/shims/**/*").map(&:realpath).uniq
+ .reject { |path| path.directory? || path.basename.to_s == "cc" },
+ *HOMEBREW_LIBRARY.glob("Homebrew/{dev-,}cmd/*.sh"),
+ *HOMEBREW_LIBRARY.glob("Homebrew/{cask/,}utils/*.sh"),
+ ]
+ end
+
+ def shellcheck
+ # Always use the latest brewed shellcheck
+ unless Formula["shellcheck"].latest_version_installed?
+ if Formula["shellcheck"].any_version_installed?
+ ohai "Upgrading `shellcheck` for shell style checks..."
+ safe_system HOMEBREW_BREW_FILE, "upgrade", "shellcheck"
+ else
+ ohai "Installing `shellcheck` for shell style checks..."
+ safe_system HOMEBREW_BREW_FILE, "install", "shellcheck"
+ end
+ end
+
+ Formula["shellcheck"].opt_bin/"shellcheck"
+ end
+
+ def shfmt
+ # Always use the latest brewed shfmt
+ unless Formula["shfmt"].latest_version_installed?
+ if Formula["shfmt"].any_version_installed?
+ ohai "Upgrading `shfmt` to format shell scripts..."
+ safe_system HOMEBREW_BREW_FILE, "upgrade", "shfmt"
+ else
+ ohai "Installing `shfmt` to format shell scripts..."
+ safe_system HOMEBREW_BREW_FILE, "install", "shfmt"
+ end
+ end
+
+ HOMEBREW_LIBRARY/"Homebrew/utils/shfmt.sh"
+ end
+
# Collection of style offenses.
class Offenses
include Enumerable | true |
Other | Homebrew | brew | 9efde249c139f46f3db2c265fba1b8f284b6641e.json | style: add shfmt implementation | Library/Homebrew/utils/shfmt.sh | @@ -0,0 +1,59 @@
+#!/bin/bash
+
+# HOMEBREW_LIBRARY is set by bin/brew
+# HOMEBREW_PREFIX is set by extend/ENV/super.rb
+# shellcheck disable=SC2154
+if [[ -z "${HOMEBREW_LIBRARY}" || -z "${HOMEBREW_PREFIX}" ]]
+then
+ echo "${0##*/}: This program is internal and must be run via brew." >&2
+ exit 1
+fi
+
+# HOMEBREW_PREFIX is set by extend/ENV/super.rb
+# shellcheck disable=SC2154
+SHFMT="${HOMEBREW_PREFIX}/opt/shfmt/bin/shfmt"
+
+if [[ ! -x "${SHFMT}" ]]
+then
+ echo "${0##*/}: Please install shfmt by running \`brew install shfmt\`." >&2
+ exit 1
+fi
+
+SHFMT_ARGS=()
+INPLACE=''
+while [[ $# -gt 0 ]]
+do
+ arg="$1"
+ if [[ "${arg}" == "--" ]]
+ then
+ shift
+ break
+ fi
+ if [[ "${arg}" == "-w" ]]
+ then
+ shift
+ INPLACE=1
+ continue
+ fi
+ SHFMT_ARGS+=("${arg}")
+ shift
+done
+
+FILES=()
+for file in "$@"
+do
+ if [[ -f "${file}" ]]
+ then
+ FILES+=("${file}")
+ else
+ echo "${0##*/}: File \"${file}\" does not exist." >&2
+ exit 1
+ fi
+done
+
+if [[ "${#FILES[@]}" == 0 ]]
+then
+ exit
+fi
+
+"${SHFMT}" "${SHFMT_ARGS[@]}" "${FILES[@]}" | true |
Other | Homebrew | brew | f38a3239e656447c169df2f5f53d7a9fc97e801b.json | workflows: reduce GITHUB_TOKEN permissions | .github/workflows/docker.yml | @@ -9,6 +9,8 @@ on:
release:
types:
- published
+permissions:
+ contents: read
jobs:
ubuntu:
if: startsWith(github.repository, 'Homebrew/') | true |
Other | Homebrew | brew | f38a3239e656447c169df2f5f53d7a9fc97e801b.json | workflows: reduce GITHUB_TOKEN permissions | .github/workflows/doctor.yml | @@ -8,6 +8,8 @@ on:
- Library/Homebrew/extend/os/diagnostic.rb
- Library/Homebrew/extend/os/mac/diagnostic.rb
- Library/Homebrew/os/mac/xcode.rb
+permissions:
+ contents: read
env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_AUTO_UPDATE: 1 | true |
Other | Homebrew | brew | f38a3239e656447c169df2f5f53d7a9fc97e801b.json | workflows: reduce GITHUB_TOKEN permissions | .github/workflows/sorbet.yml | @@ -10,6 +10,9 @@ on:
- cron: "0 0 * * *"
workflow_dispatch:
+permissions:
+ contents: read
+
jobs:
tapioca:
if: github.repository == 'Homebrew/brew' | true |
Other | Homebrew | brew | f38a3239e656447c169df2f5f53d7a9fc97e801b.json | workflows: reduce GITHUB_TOKEN permissions | .github/workflows/spdx.yml | @@ -7,6 +7,8 @@ on:
- master
schedule:
- cron: "0 0 * * *"
+permissions:
+ contents: read
jobs:
spdx:
if: github.repository == 'Homebrew/brew' | true |
Other | Homebrew | brew | f38a3239e656447c169df2f5f53d7a9fc97e801b.json | workflows: reduce GITHUB_TOKEN permissions | .github/workflows/tests.yml | @@ -6,6 +6,9 @@ on:
- master
pull_request:
+permissions:
+ contents: read
+
env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_AUTO_UPDATE: 1 | true |
Other | Homebrew | brew | f38a3239e656447c169df2f5f53d7a9fc97e801b.json | workflows: reduce GITHUB_TOKEN permissions | .github/workflows/triage.yml | @@ -12,6 +12,8 @@ on:
schedule:
- cron: "0 */3 * * *" # every 3 hours
+permissions:
+
concurrency: triage-${{ github.ref }}
jobs: | true |
Other | Homebrew | brew | f38a3239e656447c169df2f5f53d7a9fc97e801b.json | workflows: reduce GITHUB_TOKEN permissions | .github/workflows/update-man-completions.yml | @@ -18,6 +18,9 @@ on:
- cron: "0 0 * * *"
workflow_dispatch:
+permissions:
+ contents: read
+
jobs:
update-manpage:
runs-on: ubuntu-latest | true |
Other | Homebrew | brew | f38a3239e656447c169df2f5f53d7a9fc97e801b.json | workflows: reduce GITHUB_TOKEN permissions | .github/workflows/vendor-gems.yml | @@ -8,6 +8,10 @@ on:
description: Pull request number
required: true
+permissions:
+ contents: read
+ pull-requests: read
+
jobs:
vendor-gems:
if: > | true |
Other | Homebrew | brew | 8a363b2fb5ea729727260ec4b4680389078375a8.json | style: trim trailing whitespaces | Library/Homebrew/cmd/outdated.rb | @@ -31,7 +31,7 @@ def outdated_args
flag "--json",
description: "Print output in JSON format. There are two versions: `v1` and `v2`. " \
"`v1` is deprecated and is currently the default if no version is specified. " \
- "`v2` prints outdated formulae and casks. "
+ "`v2` prints outdated formulae and casks."
switch "--fetch-HEAD",
description: "Fetch the upstream repository to detect if the HEAD installation of the "\
"formula is outdated. Otherwise, the repository's HEAD will only be checked for "\ | true |
Other | Homebrew | brew | 8a363b2fb5ea729727260ec4b4680389078375a8.json | style: trim trailing whitespaces | completions/fish/brew.fish | @@ -1036,7 +1036,7 @@ __fish_brew_complete_arg 'outdated' -l greedy -d 'Print outdated casks with `aut
__fish_brew_complete_arg 'outdated' -l greedy-auto-updates -d 'Print outdated casks including those with `auto_updates true`'
__fish_brew_complete_arg 'outdated' -l greedy-latest -d 'Print outdated casks including those with `version :latest`'
__fish_brew_complete_arg 'outdated' -l help -d 'Show this message'
-__fish_brew_complete_arg 'outdated' -l json -d 'Print output in JSON format. There are two versions: `v1` and `v2`. `v1` is deprecated and is currently the default if no version is specified. `v2` prints outdated formulae and casks. '
+__fish_brew_complete_arg 'outdated' -l json -d 'Print output in JSON format. There are two versions: `v1` and `v2`. `v1` is deprecated and is currently the default if no version is specified. `v2` prints outdated formulae and casks'
__fish_brew_complete_arg 'outdated' -l quiet -d 'List only the names of outdated kegs (takes precedence over `--verbose`)'
__fish_brew_complete_arg 'outdated' -l verbose -d 'Include detailed version information'
__fish_brew_complete_arg 'outdated; and not __fish_seen_argument -l cask -l casks' -a '(__fish_brew_suggest_formulae_all)' | true |
Other | Homebrew | brew | 8a363b2fb5ea729727260ec4b4680389078375a8.json | style: trim trailing whitespaces | completions/zsh/_brew | @@ -1267,7 +1267,7 @@ _brew_outdated() {
'--greedy-auto-updates[Print outdated casks including those with `auto_updates true`]' \
'--greedy-latest[Print outdated casks including those with `version :latest`]' \
'--help[Show this message]' \
- '(--quiet --verbose)--json[Print output in JSON format. There are two versions: `v1` and `v2`. `v1` is deprecated and is currently the default if no version is specified. `v2` prints outdated formulae and casks. ]' \
+ '(--quiet --verbose)--json[Print output in JSON format. There are two versions: `v1` and `v2`. `v1` is deprecated and is currently the default if no version is specified. `v2` prints outdated formulae and casks]' \
'(--verbose --json)--quiet[List only the names of outdated kegs (takes precedence over `--verbose`)]' \
'(--quiet --json)--verbose[Include detailed version information]' \
- formula \ | true |
Other | Homebrew | brew | 8a363b2fb5ea729727260ec4b4680389078375a8.json | style: trim trailing whitespaces | docs/Adding-Software-to-Homebrew.md | @@ -13,7 +13,7 @@ If everything checks out, you're ready to get started on a new formula!
1. If you're starting from scratch, the [`brew create` command](Manpage.md#create-options-url) can be used to produce a basic version of your formula. This command accepts a number of options and you may be able to save yourself some work by using an appropriate template option like `--python`.
-1. You will now have to work to develop the boilerplate code from `brew create` into a fully-fledged formula. Your main references will be the [Formula Cookbook](Formula-Cookbook.md), similar formulae in Homebrew, and the upstream documentation for your chosen software. Be sure to also take note of the Homebrew documentation for writing [`Python`](Python-for-Formula-Authors.md) and [`Node`](Node-for-Formula-Authors.md) formulae, if applicable.
+1. You will now have to work to develop the boilerplate code from `brew create` into a fully-fledged formula. Your main references will be the [Formula Cookbook](Formula-Cookbook.md), similar formulae in Homebrew, and the upstream documentation for your chosen software. Be sure to also take note of the Homebrew documentation for writing [`Python`](Python-for-Formula-Authors.md) and [`Node`](Node-for-Formula-Authors.md) formulae, if applicable.
1. Make sure you write a good test as part of your formula. Refer to the "[Add a test to the formula](Formula-Cookbook.md#add-a-test-to-the-formula)" section of the Cookbook for help with this.
| true |
Other | Homebrew | brew | 8a363b2fb5ea729727260ec4b4680389078375a8.json | style: trim trailing whitespaces | docs/Manpage.md | @@ -463,7 +463,7 @@ information is displayed in interactive shells, and suppressed otherwise.
* `--cask`:
List only outdated casks.
* `--json`:
- Print output in JSON format. There are two versions: `v1` and `v2`. `v1` is deprecated and is currently the default if no version is specified. `v2` prints outdated formulae and casks.
+ Print output in JSON format. There are two versions: `v1` and `v2`. `v1` is deprecated and is currently the default if no version is specified. `v2` prints outdated formulae and casks.
* `--fetch-HEAD`:
Fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the repository's HEAD will only be checked for updates when a new stable or development version has been released.
* `--greedy`: | true |
Other | Homebrew | brew | 8a363b2fb5ea729727260ec4b4680389078375a8.json | style: trim trailing whitespaces | docs/assets/img/docs/managing-pull-requests.drawio.svg | @@ -172,7 +172,7 @@
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
Does it
<br/>
- say
+ say
<span style="font-family: "system-ui-monospace" , "ui-monospace" , "lucida console" , "menlo" , monospace">
bottle
<br/>
@@ -566,7 +566,7 @@
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
Does it
<br/>
- say
+ say
<span style="font-family: "system-ui-monospace" , "ui-monospace" , "lucida console" , "menlo" , monospace">
bottle
<br/>
@@ -772,4 +772,4 @@
</text>
</a>
</switch>
-</svg>
\ No newline at end of file
+</svg> | true |
Other | Homebrew | brew | 570fac7f47ca37f065c3c43585d3c0b0cc91c847.json | .vscode: add extension shellcheck and shell-format | .vscode/extensions.json | @@ -3,6 +3,8 @@
"kaiwood.endwise",
"misogi.ruby-rubocop",
"rebornix.ruby",
- "wingrunr21.vscode-ruby"
+ "wingrunr21.vscode-ruby",
+ "timonwong.shellcheck",
+ "foxundermoon.shell-format"
]
} | true |
Other | Homebrew | brew | 570fac7f47ca37f065c3c43585d3c0b0cc91c847.json | .vscode: add extension shellcheck and shell-format | .vscode/settings.json | @@ -1,6 +1,17 @@
{
- "ruby.rubocop.executePath": "Library/Homebrew/shims/gems/",
- "files.trimTrailingWhitespace": true,
- "editor.tabSize": 2,
- "files.insertFinalNewline": true
+ "editor.insertSpaces": true,
+ "editor.tabSize": 2,
+ "files.encoding": "utf8",
+ "files.eol": "\n",
+ "files.trimTrailingWhitespace": true,
+ "files.insertFinalNewline": true,
+ "files.trimFinalNewlines": true,
+ "ruby.rubocop.executePath": "Library/Homebrew/shims/gems/",
+ "shellcheck.customArgs": [
+ "--shell=bash",
+ "--enable=all",
+ "--external-sources",
+ "--source-path=${workspaceFolder}/Library"
+ ],
+ "shellformat.flag": "-i 2 -ci"
} | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | .github/workflows/docker.yml | @@ -34,31 +34,31 @@ jobs:
- name: Deploy the tagged Docker image to GitHub Packages
if: startsWith(github.ref, 'refs/tags/')
run: |
- brew_version=${GITHUB_REF:10}
- echo "brew_version=$brew_version" >> ${GITHUB_ENV}
+ brew_version="${GITHUB_REF:10}"
+ echo "brew_version=${brew_version}" >> "${GITHUB_ENV}"
echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | docker login ghcr.io -u BrewTestBot --password-stdin
- docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:$brew_version"
- docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:$brew_version"
+ docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:${brew_version}"
+ docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:${brew_version}"
docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest"
docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest"
- name: Deploy the tagged Docker image to Docker Hub
if: startsWith(github.ref, 'refs/tags/')
run: |
echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | docker login -u brewtestbot --password-stdin
- docker tag brew "homebrew/ubuntu${{matrix.version}}:$brew_version"
- docker push "homebrew/ubuntu${{matrix.version}}:$brew_version"
+ docker tag brew "homebrew/ubuntu${{matrix.version}}:${brew_version}"
+ docker push "homebrew/ubuntu${{matrix.version}}:${brew_version}"
docker tag brew "homebrew/ubuntu${{matrix.version}}:latest"
docker push "homebrew/ubuntu${{matrix.version}}:latest"
- name: Deploy the homebrew/brew Docker image to GitHub Packages and Docker Hub
if: startsWith(github.ref, 'refs/tags/') && matrix.version == '20.04'
run: |
- docker tag brew "ghcr.io/homebrew/brew:$brew_version"
- docker push "ghcr.io/homebrew/brew:$brew_version"
+ docker tag brew "ghcr.io/homebrew/brew:${brew_version}"
+ docker push "ghcr.io/homebrew/brew:${brew_version}"
docker tag brew "ghcr.io/homebrew/brew:latest"
docker push "ghcr.io/homebrew/brew:latest"
- docker tag brew "homebrew/brew:$brew_version"
- docker push "homebrew/brew:$brew_version"
+ docker tag brew "homebrew/brew:${brew_version}"
+ docker push "homebrew/brew:${brew_version}"
docker tag brew "homebrew/brew:latest"
docker push "homebrew/brew:latest" | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | .github/workflows/sorbet.yml | @@ -40,20 +40,23 @@ jobs:
BRANCH="sorbet-files-update"
echo "::set-output name=branch::${BRANCH}"
- if git ls-remote --exit-code --heads origin "$BRANCH"; then
- git checkout "$BRANCH"
+ if git ls-remote --exit-code --heads origin "${BRANCH}"
+ then
+ git checkout "${BRANCH}"
git reset --hard origin/master
else
- git checkout --no-track -B "$BRANCH" origin/master
+ git checkout --no-track -B "${BRANCH}" origin/master
fi
- if brew typecheck --update --fail-if-not-changed; then
- git add "$GITHUB_WORKSPACE/Library/Homebrew/sorbet"
+ if brew typecheck --update --fail-if-not-changed
+ then
+ git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
git commit -m "sorbet: Update RBI files." \
-m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow."
echo "::set-output name=committed::true"
- PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state")
- if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then
+ PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
+ if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]]
+ then
echo "::set-output name=pull_request::true"
fi
fi | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | .github/workflows/spdx.yml | @@ -37,19 +37,22 @@ jobs:
BRANCH="spdx-update"
echo "::set-output name=branch::${BRANCH}"
- if git ls-remote --exit-code --heads origin "$BRANCH"; then
- git checkout "$BRANCH"
+ if git ls-remote --exit-code --heads origin "${BRANCH}"
+ then
+ git checkout "${BRANCH}"
git reset --hard origin/master
else
- git checkout --no-track -B "$BRANCH" origin/master
+ git checkout --no-track -B "${BRANCH}" origin/master
fi
- if brew update-license-data --fail-if-not-changed; then
- git add "$GITHUB_WORKSPACE/Library/Homebrew/data/spdx"
+ if brew update-license-data --fail-if-not-changed
+ then
+ git add "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx"
git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)."
echo "::set-output name=committed::true"
- PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state")
- if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then
+ PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
+ if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]]
+ then
echo "::set-output name=pull_request::true"
fi
fi | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | .github/workflows/tests.yml | @@ -90,10 +90,10 @@ jobs:
- name: Set up all Homebrew taps
run: |
HOMEBREW_REPOSITORY="$(brew --repo)"
- HOMEBREW_CORE_REPOSITORY="$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core"
- git -C "$HOMEBREW_CORE_REPOSITORY" remote add homebrew_core https://github.com/Homebrew/homebrew-core
- git -C "$HOMEBREW_CORE_REPOSITORY" fetch homebrew_core || git -C "$HOMEBREW_CORE_REPOSITORY" fetch homebrew_core
- git -C "$HOMEBREW_CORE_REPOSITORY" checkout --force -B master homebrew_core/master
+ HOMEBREW_CORE_REPOSITORY="${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core"
+ git -C "${HOMEBREW_CORE_REPOSITORY}" remote add homebrew_core https://github.com/Homebrew/homebrew-core
+ git -C "${HOMEBREW_CORE_REPOSITORY}" fetch homebrew_core || git -C "${HOMEBREW_CORE_REPOSITORY}" fetch homebrew_core
+ git -C "${HOMEBREW_CORE_REPOSITORY}" checkout --force -B master homebrew_core/master
brew tap homebrew/aliases
brew tap homebrew/autoupdate
@@ -111,7 +111,7 @@ jobs:
brew update-reset Library/Taps/homebrew/homebrew-bundle
# brew style doesn't like world writable directories
- sudo chmod -R g-w,o-w "$HOMEBREW_REPOSITORY/Library/Taps"
+ sudo chmod -R g-w,o-w "${HOMEBREW_REPOSITORY}/Library/Taps"
- name: Run brew style on homebrew-core
run: brew style --display-cop-names homebrew/core
@@ -178,11 +178,11 @@ jobs:
- name: Deploy the Docker image to GitHub Packages and Docker Hub
if: github.ref == 'refs/heads/master'
run: |
- echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | \
+ echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} |
docker login ghcr.io -u BrewTestBot --password-stdin
docker tag brew "ghcr.io/homebrew/ubuntu16.04:master"
docker push "ghcr.io/homebrew/ubuntu16.04:master"
- echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | \
+ echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} |
docker login -u brewtestbot --password-stdin
docker tag brew "homebrew/ubuntu16.04:master"
docker push "homebrew/ubuntu16.04:master"
@@ -321,9 +321,10 @@ jobs:
run: |
# Retry multiple times when using BuildPulse to detect and submit
# flakiness (because rspec-retry is disabled).
- if [ -n "$HOMEBREW_BUILDPULSE_ACCESS_KEY_ID" ]; then
- brew tests --online --coverage || \
- brew tests --online --coverage || \
+ if [[ -n "${HOMEBREW_BUILDPULSE_ACCESS_KEY_ID}" ]]
+ then
+ brew tests --online --coverage ||
+ brew tests --online --coverage ||
brew tests --online --coverage
else
brew tests --online --coverage | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | .github/workflows/update-man-completions.yml | @@ -44,27 +44,31 @@ jobs:
BRANCH=update-man-completions
echo "::set-output name=branch::${BRANCH}"
- if git ls-remote --exit-code --heads origin "$BRANCH"; then
- git checkout "$BRANCH"
+ if git ls-remote --exit-code --heads origin "${BRANCH}"
+ then
+ git checkout "${BRANCH}"
git reset --hard origin/master
else
- git checkout --no-track -B "$BRANCH" origin/master
+ git checkout --no-track -B "${BRANCH}" origin/master
fi
- if [ "${{github.event_name}}" != "push" ]; then
+ if [[ "${{github.event_name}}" != "push" ]]
+ then
brew update-maintainers
fi
- if brew generate-man-completions --fail-if-not-changed; then
- git add "$GITHUB_WORKSPACE/README.md" \
- "$GITHUB_WORKSPACE/docs/Manpage.md" \
- "$GITHUB_WORKSPACE/manpages/brew.1" \
- "$GITHUB_WORKSPACE/completions"
+ if brew generate-man-completions --fail-if-not-changed
+ then
+ git add "${GITHUB_WORKSPACE}/README.md" \
+ "${GITHUB_WORKSPACE}/docs/Manpage.md" \
+ "${GITHUB_WORKSPACE}/manpages/brew.1" \
+ "${GITHUB_WORKSPACE}/completions"
git commit -m "Update maintainers, manpage and completions." \
-m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/update-man-completions.yml) workflow."
echo "::set-output name=committed::true"
- PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state")
- if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then
+ PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
+ if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]]
+ then
echo "::set-output name=pull_request::true"
fi
fi | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | .github/workflows/vendor-gems.yml | @@ -51,7 +51,8 @@ jobs:
run: |
set -u
- if [[ "${GEM_NAME}" == 'sorbet' ]]; then
+ if [[ "${GEM_NAME}" == 'sorbet' ]]
+ then
brew vendor-gems --update sorbet,sorbet-runtime
else
brew vendor-gems
@@ -63,8 +64,10 @@ jobs:
run: |
set -u
- if brew typecheck --update --fail-if-not-changed; then
- if git add Library/Homebrew/sorbet; then
+ if brew typecheck --update --fail-if-not-changed
+ then
+ if git add Library/Homebrew/sorbet
+ then
git commit -m "Update RBI files for ${GEM_NAME}."
fi
| true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | .vscode/settings.json | @@ -2,5 +2,5 @@
"ruby.rubocop.executePath": "Library/Homebrew/shims/gems/",
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2,
- "files.insertFinalNewline": true,
+ "files.insertFinalNewline": true
} | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Dockerfile | @@ -34,7 +34,7 @@ RUN apt-get update \
USER linuxbrew
COPY --chown=linuxbrew:linuxbrew . /home/linuxbrew/.linuxbrew/Homebrew
-ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH
+ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}"
WORKDIR /home/linuxbrew
RUN mkdir -p \ | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/brew.sh | @@ -17,10 +17,11 @@ esac
# same file under the native architecture
# These variables are set from the user environment.
# shellcheck disable=SC2154
-if [[ "${HOMEBREW_CHANGE_ARCH_TO_ARM}" = "1" ]] && \
- [[ "${HOMEBREW_MACOS}" = "1" ]] && \
- [[ "$(sysctl -n hw.optional.arm64 2>/dev/null)" = "1" ]] && \
- [[ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" = "1" ]]; then
+if [[ "${HOMEBREW_CHANGE_ARCH_TO_ARM}" == "1" ]] &&
+ [[ "${HOMEBREW_MACOS}" == "1" ]] &&
+ [[ "$(sysctl -n hw.optional.arm64 2>/dev/null)" == "1" ]] &&
+ [[ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" == "1" ]]
+then
exec arch -arm64e "${HOMEBREW_BREW_FILE}" "$@"
fi
@@ -55,15 +56,15 @@ HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
# HOMEBREW_LIBRARY set by bin/brew
# shellcheck disable=SC2249,SC2154
case "$*" in
- --cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;;
- --repository|--repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;;
- --caskroom) echo "${HOMEBREW_PREFIX}/Caskroom"; exit 0 ;;
- --cache) echo "${HOMEBREW_CACHE}"; exit 0 ;;
- shellenv) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/shellenv.sh"; homebrew-shellenv; exit 0 ;;
- formulae) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/formulae.sh"; homebrew-formulae; exit 0 ;;
- casks) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/casks.sh"; homebrew-casks; exit 0 ;;
+ --cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;;
+ --repository | --repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;;
+ --caskroom) echo "${HOMEBREW_PREFIX}/Caskroom"; exit 0 ;;
+ --cache) echo "${HOMEBREW_CACHE}"; exit 0 ;;
+ shellenv) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/shellenv.sh"; homebrew-shellenv; exit 0 ;;
+ formulae) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/formulae.sh"; homebrew-formulae; exit 0 ;;
+ casks) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/casks.sh"; homebrew-casks; exit 0 ;;
# falls back to cmd/prefix.rb on a non-zero return
- --prefix*) source "${HOMEBREW_LIBRARY}/Homebrew/prefix.sh"; homebrew-prefix "$@" && exit 0 ;;
+ --prefix*) source "${HOMEBREW_LIBRARY}/Homebrew/prefix.sh"; homebrew-prefix "$@" && exit 0 ;;
esac
#####
@@ -144,16 +145,16 @@ numeric() {
}
check-run-command-as-root() {
- [[ "$(id -u)" = 0 ]] || return
+ [[ "$(id -u)" == 0 ]] || return
# Allow Azure Pipelines/GitHub Actions/Docker/Concourse/Kubernetes to do everything as root (as it's normal there)
[[ -f /proc/1/cgroup ]] && grep -E "azpl_job|actions_job|docker|garden|kubepods" -q /proc/1/cgroup && return
# Homebrew Services may need `sudo` for system-wide daemons.
- [[ "${HOMEBREW_COMMAND}" = "services" ]] && return
+ [[ "${HOMEBREW_COMMAND}" == "services" ]] && return
# It's fine to run this as root as it's not changing anything.
- [[ "${HOMEBREW_COMMAND}" = "--prefix" ]] && return
+ [[ "${HOMEBREW_COMMAND}" == "--prefix" ]] && return
odie <<EOS
Running Homebrew as root is extremely dangerous and no longer supported.
@@ -165,7 +166,7 @@ EOS
check-prefix-is-not-tmpdir() {
[[ -z "${HOMEBREW_MACOS}" ]] && return
- if [[ "${HOMEBREW_PREFIX}" = "${HOMEBREW_TEMP}"* ]]
+ if [[ "${HOMEBREW_PREFIX}" == "${HOMEBREW_TEMP}"* ]]
then
odie <<EOS
Your HOMEBREW_PREFIX is in the Homebrew temporary directory, which Homebrew
@@ -195,10 +196,13 @@ update-preinstall() {
# If we've checked for updates, we don't need to check again.
export HOMEBREW_AUTO_UPDATE_CHECKED="1"
- if [[ "${HOMEBREW_COMMAND}" = "install" || "${HOMEBREW_COMMAND}" = "upgrade" ||
- "${HOMEBREW_COMMAND}" = "bump-formula-pr" || "${HOMEBREW_COMMAND}" = "bump-cask-pr" ||
- "${HOMEBREW_COMMAND}" = "bundle" || "${HOMEBREW_COMMAND}" = "release" ||
- "${HOMEBREW_COMMAND}" = "tap" && ${HOMEBREW_ARG_COUNT} -gt 1 ]]
+ if [[ "${HOMEBREW_COMMAND}" == "install" ]] ||
+ [[ "${HOMEBREW_COMMAND}" == "upgrade" ]] ||
+ [[ "${HOMEBREW_COMMAND}" == "bump-formula-pr" ]] ||
+ [[ "${HOMEBREW_COMMAND}" == "bump-cask-pr" ]] ||
+ [[ "${HOMEBREW_COMMAND}" == "bundle" ]] ||
+ [[ "${HOMEBREW_COMMAND}" == "release" ]] ||
+ [[ "${HOMEBREW_COMMAND}" == "tap" && "${HOMEBREW_ARG_COUNT}" -gt 1 ]]
then
export HOMEBREW_AUTO_UPDATING="1"
@@ -210,8 +214,8 @@ update-preinstall() {
# Skip auto-update if the repository has been updated in the
# last $HOMEBREW_AUTO_UPDATE_SECS.
repo_fetch_head="${HOMEBREW_REPOSITORY}/.git/FETCH_HEAD"
- if [[ -f "${repo_fetch_head}" &&
- -n "$(find "${repo_fetch_head}" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]]
+ if [[ -f "${repo_fetch_head}" ]] &&
+ [[ -n "$(find "${repo_fetch_head}" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]]
then
return
fi
@@ -244,7 +248,8 @@ update-preinstall() {
# Colorize output on GitHub Actions.
# This is set by the user environment.
# shellcheck disable=SC2154
-if [[ -n "${GITHUB_ACTIONS}" ]]; then
+if [[ -n "${GITHUB_ACTIONS}" ]]
+then
export HOMEBREW_COLOR="1"
fi
@@ -261,13 +266,13 @@ else
export LC_ALL=C
elif [[ "$(locale charmap)" != "UTF-8" ]]
then
- locales=$(locale -a)
+ locales="$(locale -a)"
c_utf_regex='\bC\.(utf8|UTF-8)\b'
en_us_regex='\ben_US\.(utf8|UTF-8)\b'
utf_regex='\b[a-z][a-z]_[A-Z][A-Z]\.(utf8|UTF-8)\b'
if [[ ${locales} =~ ${c_utf_regex} || ${locales} =~ ${en_us_regex} || ${locales} =~ ${utf_regex} ]]
then
- export LC_ALL=${BASH_REMATCH[0]}
+ export LC_ALL="${BASH_REMATCH[0]}"
else
export LC_ALL=C
fi
@@ -278,7 +283,7 @@ fi
##### odie as quickly as possible.
#####
-if [[ "${HOMEBREW_PREFIX}" = "/" || "${HOMEBREW_PREFIX}" = "/usr" ]]
+if [[ "${HOMEBREW_PREFIX}" == "/" || "${HOMEBREW_PREFIX}" == "/usr" ]]
then
# it may work, but I only see pain this route and don't want to support it
odie "Cowardly refusing to continue at this prefix: ${HOMEBREW_PREFIX}"
@@ -296,17 +301,16 @@ fi
#####
# USER isn't always set so provide a fall back for `brew` and subprocesses.
-export USER=${USER:-$(id -un)}
+export USER="${USER:-$(id -un)}"
# A depth of 1 means this command was directly invoked by a user.
# Higher depths mean this command was invoked by another Homebrew command.
-export HOMEBREW_COMMAND_DEPTH=$((HOMEBREW_COMMAND_DEPTH + 1))
+export HOMEBREW_COMMAND_DEPTH="$((HOMEBREW_COMMAND_DEPTH + 1))"
# This is set by the user environment.
# shellcheck disable=SC2154
-if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" &&
- -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] &&
- "${HOMEBREW_PREFIX}/opt/curl/bin/curl" --version >/dev/null
+if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] &&
+ "${HOMEBREW_PREFIX}/opt/curl/bin/curl" --version >/dev/null
then
HOMEBREW_CURL="${HOMEBREW_PREFIX}/opt/curl/bin/curl"
elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_CURL_PATH}" ]]
@@ -318,9 +322,8 @@ fi
# This is set by the user environment.
# shellcheck disable=SC2154
-if [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" &&
- -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] &&
- "${HOMEBREW_PREFIX}/opt/git/bin/git" --version >/dev/null
+if [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] &&
+ "${HOMEBREW_PREFIX}/opt/git/bin/git" --version >/dev/null
then
HOMEBREW_GIT="${HOMEBREW_PREFIX}/opt/git/bin/git"
elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_GIT_PATH}" ]]
@@ -344,7 +347,11 @@ HOMEBREW_CORE_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core"
HOMEBREW_CASK_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask"
case "$*" in
- --version|-v) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/--version.sh"; homebrew-version; exit 0 ;;
+ --version | -v)
+ source "${HOMEBREW_LIBRARY}/Homebrew/cmd/--version.sh"
+ homebrew-version
+ exit 0
+ ;;
esac
# shellcheck disable=SC2154
@@ -357,7 +364,7 @@ if [[ -n "${HOMEBREW_MACOS}" ]]
then
HOMEBREW_PRODUCT="Homebrew"
HOMEBREW_SYSTEM="Macintosh"
- [[ "${HOMEBREW_PROCESSOR}" = "x86_64" ]] && HOMEBREW_PROCESSOR="Intel"
+ [[ "${HOMEBREW_PROCESSOR}" == "x86_64" ]] && HOMEBREW_PROCESSOR="Intel"
HOMEBREW_MACOS_VERSION="$(/usr/bin/sw_vers -productVersion)"
# Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X ${HOMEBREW_MACOS_VERSION}"
@@ -423,17 +430,19 @@ else
curl_version_output="$(${HOMEBREW_CURL} --version 2>/dev/null)"
curl_name_and_version="${curl_version_output%% (*}"
# shellcheck disable=SC2248
- if [[ $(numeric "${curl_name_and_version##* }") -lt $(numeric "${HOMEBREW_MINIMUM_CURL_VERSION}") ]]
+ if [[ "$(numeric "${curl_name_and_version##* }")" -lt "$(numeric "${HOMEBREW_MINIMUM_CURL_VERSION}")" ]]
then
- message="Please update your system curl.
+ message="Please update your system curl.
Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION}
Your curl version: ${curl_name_and_version##* }
Your curl executable: $(type -p ${HOMEBREW_CURL})"
- if [[ -z ${HOMEBREW_CURL_PATH} || -z ${HOMEBREW_DEVELOPER} ]]; then
+ if [[ -z ${HOMEBREW_CURL_PATH} || -z ${HOMEBREW_DEVELOPER} ]]
+ then
HOMEBREW_SYSTEM_CURL_TOO_OLD=1
HOMEBREW_FORCE_BREWED_CURL=1
- if [[ -z ${HOMEBREW_CURL_WARNING} ]]; then
+ if [[ -z ${HOMEBREW_CURL_WARNING} ]]
+ then
onoe "${message}"
HOMEBREW_CURL_WARNING=1
fi
@@ -448,17 +457,19 @@ Your curl executable: $(type -p ${HOMEBREW_CURL})"
git_version_output="$(${HOMEBREW_GIT} --version 2>/dev/null)"
# $extra is intentionally discarded.
# shellcheck disable=SC2034
- IFS=. read -r major minor micro build extra <<< "${git_version_output##* }"
+ IFS='.' read -r major minor micro build extra <<<"${git_version_output##* }"
# shellcheck disable=SC2248
- if [[ $(numeric "${major}.${minor}.${micro}.${build}") -lt $(numeric "${HOMEBREW_MINIMUM_GIT_VERSION}") ]]
+ if [[ "$(numeric "${major}.${minor}.${micro}.${build}")" -lt "$(numeric "${HOMEBREW_MINIMUM_GIT_VERSION}")" ]]
then
message="Please update your system Git.
Minimum required version: ${HOMEBREW_MINIMUM_GIT_VERSION}
Your Git version: ${major}.${minor}.${micro}.${build}
Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})"
- if [[ -z ${HOMEBREW_GIT_PATH} || -z ${HOMEBREW_DEVELOPER} ]]; then
+ if [[ -z ${HOMEBREW_GIT_PATH} || -z ${HOMEBREW_DEVELOPER} ]]
+ then
HOMEBREW_FORCE_BREWED_GIT="1"
- if [[ -z ${HOMEBREW_GIT_WARNING} ]]; then
+ if [[ -z ${HOMEBREW_GIT_WARNING} ]]
+ then
onoe "${message}"
HOMEBREW_GIT_WARNING=1
fi
@@ -471,7 +482,7 @@ Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})"
unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH
HOMEBREW_CORE_REPOSITORY_ORIGIN="$("${HOMEBREW_GIT}" -C "${HOMEBREW_CORE_REPOSITORY}" remote get-url origin)"
- if [[ "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" = "https://github.com/Homebrew/homebrew-core" ]]
+ if [[ "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" == "https://github.com/Homebrew/homebrew-core" ]]
then
# If the remote origin has been set to Homebrew/homebrew-core by the install script,
# then we are in the case of a new installation of brew, using Homebrew/homebrew-core as a Linux core repository.
@@ -490,12 +501,15 @@ fi
# That will be when macOS 12 is the minimum required version.
# HOMEBREW_BOTTLE_DOMAIN is set from the user environment
# shellcheck disable=SC2154
-if [[ -n "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" && "${HOMEBREW_BOTTLE_DOMAIN}" = "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" ]]
+if [[ -n "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" ]] &&
+ [[ "${HOMEBREW_BOTTLE_DOMAIN}" == "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" ]]
then
unset HOMEBREW_BOTTLE_DOMAIN
fi
-if [[ -n "${HOMEBREW_MACOS}" || -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" || -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
+if [[ -n "${HOMEBREW_MACOS}" ]] ||
+ [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] ||
+ [[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
then
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://ghcr.io/v2/homebrew/core"
else
@@ -535,8 +549,8 @@ export HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH
if [[ -n "${HOMEBREW_MACOS}" && -x "/usr/bin/xcode-select" ]]
then
- XCODE_SELECT_PATH=$('/usr/bin/xcode-select' --print-path 2>/dev/null)
- if [[ "${XCODE_SELECT_PATH}" = "/" ]]
+ XCODE_SELECT_PATH="$('/usr/bin/xcode-select' --print-path 2>/dev/null)"
+ if [[ "${XCODE_SELECT_PATH}" == "/" ]]
then
odie <<EOS
Your xcode-select path is currently set to '/'.
@@ -555,7 +569,7 @@ EOS
XCRUN_OUTPUT="$(/usr/bin/xcrun clang 2>&1)"
XCRUN_STATUS="$?"
- if [[ "${XCRUN_STATUS}" -ne 0 && "${XCRUN_OUTPUT}" = *license* ]]
+ if [[ "${XCRUN_STATUS}" -ne 0 && "${XCRUN_OUTPUT}" == *license* ]]
then
odie <<EOS
You have not agreed to the Xcode license. Please resolve this by running:
@@ -565,7 +579,7 @@ EOS
fi
fi
-if [[ "$1" = -v ]]
+if [[ "$1" == "-v" ]]
then
# Shift the -v to the end of the parameter list
shift
@@ -574,9 +588,9 @@ fi
for arg in "$@"
do
- [[ ${arg} = "--" ]] && break
+ [[ "${arg}" == "--" ]] && break
- if [[ ${arg} = "--help" || ${arg} = "-h" || ${arg} = "--usage" || ${arg} = "-?" ]]
+ if [[ "${arg}" == "--help" || "${arg}" == "-h" || "${arg}" == "--usage" || "${arg}" == "-?" ]]
then
export HOMEBREW_HELP="1"
break
@@ -611,7 +625,7 @@ if [[ -z "${HOMEBREW_DEVELOPER}" ]]
then
export HOMEBREW_GIT_CONFIG_FILE="${HOMEBREW_REPOSITORY}/.git/config"
HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="${HOMEBREW_GIT_CONFIG_FILE}" --get homebrew.devcmdrun 2>/dev/null)"
- if [[ "${HOMEBREW_GIT_CONFIG_DEVELOPERMODE}" = "true" ]]
+ if [[ "${HOMEBREW_GIT_CONFIG_DEVELOPERMODE}" == "true" ]]
then
export HOMEBREW_DEV_CMD_RUN="1"
fi
@@ -635,7 +649,9 @@ then
fi
export HOMEBREW_BREW_GIT_REMOTE
-if [[ -n "${HOMEBREW_MACOS}" ]] || [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] || [[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
+if [[ -n "${HOMEBREW_MACOS}" ]] ||
+ [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] ||
+ [[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]]
then
HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/homebrew-core"
else
@@ -676,9 +692,9 @@ check-run-command-as-root
check-prefix-is-not-tmpdir
# shellcheck disable=SC2250
-if [[ "${HOMEBREW_PREFIX}" = "/usr/local" &&
- "${HOMEBREW_PREFIX}" != "${HOMEBREW_REPOSITORY}" &&
- "${HOMEBREW_CELLAR}" = "${HOMEBREW_REPOSITORY}/Cellar" ]]
+if [[ "${HOMEBREW_PREFIX}" == "/usr/local" ]] &&
+ [[ "${HOMEBREW_PREFIX}" != "${HOMEBREW_REPOSITORY}" ]] &&
+ [[ "${HOMEBREW_CELLAR}" == "${HOMEBREW_REPOSITORY}/Cellar" ]]
then
cat >&2 <<EOS
Warning: your HOMEBREW_PREFIX is set to /usr/local but HOMEBREW_CELLAR is set
@@ -702,7 +718,13 @@ then
# Shellcheck can't follow this dynamic `source`.
# shellcheck disable=SC1090
source "${HOMEBREW_BASH_COMMAND}"
- { update-preinstall "$@"; "homebrew-${HOMEBREW_COMMAND}" "$@"; exit $?; }
+
+ {
+ update-preinstall "$@"
+ "homebrew-${HOMEBREW_COMMAND}" "$@"
+ exit $?
+ }
+
else
source "${HOMEBREW_LIBRARY}/Homebrew/utils/ruby.sh"
setup-ruby-path
@@ -711,5 +733,9 @@ else
[[ "${HOMEBREW_ARG_COUNT}" -gt 0 ]] && set -- "${HOMEBREW_COMMAND}" "$@"
# HOMEBREW_RUBY_PATH set by utils/ruby.sh
# shellcheck disable=SC2154
- { update-preinstall "$@"; exec "${HOMEBREW_RUBY_PATH}" "${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 | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/cask/utils/rmdir.sh | @@ -4,34 +4,41 @@ set -euo pipefail
# Try removing as many empty directories as possible with a single
# `rmdir` call to avoid or at least speed up the loop below.
-if /bin/rmdir -- "${@}" &>/dev/null; then
+if /bin/rmdir -- "${@}" &>/dev/null
+then
exit
fi
-for path in "${@}"; do
+for path in "${@}"
+do
symlink=true
[[ -L "${path}" ]] || symlink=false
directory=false
- if [[ -d "${path}" ]]; then
+ if [[ -d "${path}" ]]
+ then
directory=true
- if [[ -e "${path}/.DS_Store" ]]; then
+ if [[ -e "${path}/.DS_Store" ]]
+ then
/bin/rm -- "${path}/.DS_Store"
fi
# Some packages leave broken symlinks around; we clean them out before
# attempting to `rmdir` to prevent extra cruft from accumulating.
/usr/bin/find -f "${path}" -- -mindepth 1 -maxdepth 1 -type l ! -exec /bin/test -e {} \; -delete
- elif ! ${symlink} && [[ ! -e "${path}" ]]; then
+ elif ! ${symlink} && [[ ! -e "${path}" ]]
+ then
# Skip paths that don't exists and aren't a broken symlink.
continue
fi
- if ${symlink}; then
+ if ${symlink}
+ then
# Delete directory symlink.
/bin/rm -- "${path}"
- elif ${directory}; then
+ elif ${directory}
+ then
# Delete directory if empty.
/usr/bin/find -f "${path}" -- -maxdepth 0 -type d -empty -exec /bin/rmdir -- {} \;
else | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/cmd/--version.sh | @@ -6,28 +6,31 @@
# shellcheck disable=SC2154
version_string() {
local repo="$1"
- if ! [ -d "${repo}" ]; then
+ if ! [[ -d "${repo}" ]]
+ then
echo "N/A"
return
fi
local pretty_revision
pretty_revision="$(git -C "${repo}" rev-parse --short --verify --quiet HEAD)"
- if [ -z "${pretty_revision}" ]; then
+ if [[ -z "${pretty_revision}" ]]
+ then
echo "(no Git repository)"
return
fi
local git_last_commit_date
- git_last_commit_date=$(git -C "${repo}" show -s --format='%cd' --date=short HEAD)
+ git_last_commit_date="$(git -C "${repo}" show -s --format='%cd' --date=short HEAD)"
echo "(git revision ${pretty_revision}; last commit ${git_last_commit_date})"
}
homebrew-version() {
echo "Homebrew ${HOMEBREW_VERSION}"
echo "Homebrew/homebrew-core $(version_string "${HOMEBREW_CORE_REPOSITORY}")"
- if [ -d "${HOMEBREW_CASK_REPOSITORY}" ]; then
+ if [[ -d "${HOMEBREW_CASK_REPOSITORY}" ]]
+ then
echo "Homebrew/homebrew-cask $(version_string "${HOMEBREW_CASK_REPOSITORY}")"
fi
} | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/cmd/shellenv.sh | @@ -4,14 +4,14 @@
#:
#: The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times.
#: The variable `HOMEBREW_SHELLENV_PREFIX` will be exported to avoid adding duplicate entries to the environment variables.
-#: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval $(brew shellenv)`
+#: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval "$(brew shellenv)"`
# HOMEBREW_CELLAR and HOMEBREW_PREFIX are set by extend/ENV/super.rb
# HOMEBREW_REPOSITORY is set by bin/brew
# shellcheck disable=SC2154
homebrew-shellenv() {
- [[ "${HOMEBREW_SHELLENV_PREFIX}" == "${HOMEBREW_PREFIX}" &&
- "$(PATH="${HOMEBREW_PATH}" command -v brew)" == "${HOMEBREW_PREFIX}/bin/brew" ]] && return
+ [[ "${HOMEBREW_SHELLENV_PREFIX}" == "${HOMEBREW_PREFIX}" ]] &&
+ [[ "$(PATH="${HOMEBREW_PATH}" command -v brew)" == "${HOMEBREW_PREFIX}/bin/brew" ]] && return
case "$(/bin/ps -p "${PPID}" -c -o comm=)" in
fish | -fish) | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/cmd/update-reset.sh | @@ -11,10 +11,10 @@ homebrew-update-reset() {
for option in "$@"
do
case "${option}" in
- -\?|-h|--help|--usage) brew help update-reset; exit $? ;;
- --debug) HOMEBREW_DEBUG=1 ;;
+ -\? | -h | --help | --usage) brew help update-reset; exit $? ;;
+ --debug) HOMEBREW_DEBUG=1 ;;
-*)
- [[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1
+ [[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1
;;
*)
REPOS+=("${option}") | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/cmd/update.sh | @@ -77,7 +77,7 @@ repo_var() {
local repo_var
repo_var="$1"
- if [[ "${repo_var}" = "${HOMEBREW_REPOSITORY}" ]]
+ if [[ "${repo_var}" == "${HOMEBREW_REPOSITORY}" ]]
then
repo_var=""
else
@@ -193,16 +193,18 @@ merge_or_rebase() {
trap reset_on_interrupt SIGINT
- if [[ "${DIR}" = "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]]
+ if [[ "${DIR}" == "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]]
then
- UPSTREAM_TAG="$(git tag --list |
- sort --field-separator=. --key=1,1nr -k 2,2nr -k 3,3nr |
- grep --max-count=1 '^[0-9]*\.[0-9]*\.[0-9]*$')"
+ UPSTREAM_TAG="$(
+ git tag --list |
+ sort --field-separator=. --key=1,1nr -k 2,2nr -k 3,3nr |
+ grep --max-count=1 '^[0-9]*\.[0-9]*\.[0-9]*$'
+ )"
else
UPSTREAM_TAG=""
fi
- if [ -n "${UPSTREAM_TAG}" ]
+ if [[ -n "${UPSTREAM_TAG}" ]]
then
REMOTE_REF="refs/tags/${UPSTREAM_TAG}"
UPSTREAM_BRANCH="stable"
@@ -288,8 +290,8 @@ EOS
if [[ -n "${HOMEBREW_NO_UPDATE_CLEANUP}" ]]
then
- if [[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" &&
- ! "${INITIAL_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]]
+ if [[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" ]] &&
+ [[ ! "${INITIAL_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]]
then
git checkout "${INITIAL_BRANCH}" "${QUIET_ARGS[@]}"
fi
@@ -310,7 +312,7 @@ homebrew-update() {
for option in "$@"
do
case "${option}" in
- -\?|-h|--help|--usage) brew help update; exit $? ;;
+ -\? | -h | --help | --usage) brew help update; exit $? ;;
--verbose) HOMEBREW_VERBOSE=1 ;;
--debug) HOMEBREW_DEBUG=1 ;;
--quiet) HOMEBREW_QUIET=1 ;;
@@ -320,10 +322,10 @@ homebrew-update() {
--preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;;
--*) ;;
-*)
- [[ "${option}" = *v* ]] && HOMEBREW_VERBOSE=1
- [[ "${option}" = *q* ]] && HOMEBREW_QUIET=1
- [[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1
- [[ "${option}" = *f* ]] && HOMEBREW_UPDATE_FORCE=1
+ [[ "${option}" == *v* ]] && HOMEBREW_VERBOSE=1
+ [[ "${option}" == *q* ]] && HOMEBREW_QUIET=1
+ [[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1
+ [[ "${option}" == *f* ]] && HOMEBREW_UPDATE_FORCE=1
;;
*)
odie <<EOS
@@ -371,8 +373,7 @@ EOS
fi
# we may want to use a Homebrew curl
- if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" &&
- ! -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]]
+ if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && ! -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]]
then
# we cannot install a Homebrew cURL if homebrew/core is unavailable.
if [[ ! -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] || ! brew install curl
@@ -382,8 +383,7 @@ EOS
fi
if ! git --version &>/dev/null ||
- [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" &&
- ! -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]]
+ [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && ! -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]]
then
# we cannot install a Homebrew Git if homebrew/core is unavailable.
if [[ ! -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] || ! brew install git
@@ -394,7 +394,7 @@ EOS
[[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1
[[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask/.git/shallow" ]] && HOMEBREW_CASK_SHALLOW=1
- if [[ -n ${HOMEBREW_CORE_SHALLOW} && -n ${HOMEBREW_CASK_SHALLOW} ]]
+ if [[ -n "${HOMEBREW_CORE_SHALLOW}" && -n "${HOMEBREW_CASK_SHALLOW}" ]]
then
SHALLOW_COMMAND_PHRASE="These commands"
SHALLOW_REPO_PHRASE="repositories"
@@ -403,7 +403,7 @@ EOS
SHALLOW_REPO_PHRASE="repository"
fi
- if [[ -n ${HOMEBREW_CORE_SHALLOW} || -n ${HOMEBREW_CASK_SHALLOW} ]]
+ if [[ -n "${HOMEBREW_CORE_SHALLOW}" || -n "${HOMEBREW_CASK_SHALLOW}" ]]
then
odie <<EOS
${HOMEBREW_CORE_SHALLOW:+
@@ -480,9 +480,8 @@ EOS
safe_cd "${HOMEBREW_REPOSITORY}"
# if an older system had a newer curl installed, change each repo's remote URL from GIT to HTTPS
- if [[ -n "${HOMEBREW_SYSTEM_CURL_TOO_OLD}" &&
- -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" &&
- "$(git config remote.origin.url)" =~ ^git:// ]]
+ if [[ -n "${HOMEBREW_SYSTEM_CURL_TOO_OLD}" && -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] &&
+ [[ "$(git config remote.origin.url)" =~ ^git:// ]]
then
git config remote.origin.url "${HOMEBREW_BREW_GIT_REMOTE}"
git config -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/config" remote.origin.url "${HOMEBREW_CORE_GIT_REMOTE}"
@@ -498,8 +497,9 @@ EOS
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
do
- if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] && [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
- [[ "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]]
+ if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
+ [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
+ [[ "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]]
then
continue
fi
@@ -518,15 +518,15 @@ EOS
declare PREFETCH_REVISION"${TAP_VAR}"="$(git rev-parse -q --verify refs/remotes/origin/"${UPSTREAM_BRANCH_DIR}")"
# Force a full update if we don't have any tags.
- if [[ "${DIR}" = "${HOMEBREW_REPOSITORY}" && -z "$(git tag --list)" ]]
+ if [[ "${DIR}" == "${HOMEBREW_REPOSITORY}" && -z "$(git tag --list)" ]]
then
HOMEBREW_UPDATE_FORCE=1
fi
if [[ -z "${HOMEBREW_UPDATE_FORCE}" ]]
then
- [[ -n "${SKIP_FETCH_BREW_REPOSITORY}" && "${DIR}" = "${HOMEBREW_REPOSITORY}" ]] && continue
- [[ -n "${SKIP_FETCH_CORE_REPOSITORY}" && "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] && continue
+ [[ -n "${SKIP_FETCH_BREW_REPOSITORY}" && "${DIR}" == "${HOMEBREW_REPOSITORY}" ]] && continue
+ [[ -n "${SKIP_FETCH_CORE_REPOSITORY}" && "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] && continue
fi
# The upstream repository's default branch may not be master;
@@ -538,12 +538,12 @@ EOS
# HOMEBREW_UPDATE_FORCE and HOMEBREW_UPDATE_PREINSTALL aren't modified here so ignore subshell warning.
# shellcheck disable=SC2030
- if [[ "${UPSTREAM_REPOSITORY_URL}" = "https://github.com/"* ]]
+ if [[ "${UPSTREAM_REPOSITORY_URL}" == "https://github.com/"* ]]
then
UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY_URL#https://github.com/}"
UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY%.git}"
- if [[ "${DIR}" = "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]]
+ if [[ "${DIR}" == "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]]
then
# Only try to `git fetch` when the upstream tags have changed
# (so the API does not return 304: unmodified).
@@ -560,19 +560,21 @@ EOS
# HOMEBREW_CURL is set by brew.sh (and isn't mispelt here)
# shellcheck disable=SC2153
- UPSTREAM_SHA_HTTP_CODE="$("${HOMEBREW_CURL}" \
- "${CURL_DISABLE_CURLRC_ARGS[@]}" \
- --silent --max-time 3 \
- --location --no-remote-time --output /dev/null --write-out "%{http_code}" \
- --dump-header "${DIR}/.git/GITHUB_HEADERS" \
- --user-agent "${HOMEBREW_USER_AGENT_CURL}" \
- --header "Accept: ${GITHUB_API_ACCEPT}" \
- --header "If-None-Match: \"${GITHUB_API_ETAG}\"" \
- "https://api.github.com/repos/${UPSTREAM_REPOSITORY}/${GITHUB_API_ENDPOINT}")"
+ UPSTREAM_SHA_HTTP_CODE="$(
+ "${HOMEBREW_CURL}" \
+ "${CURL_DISABLE_CURLRC_ARGS[@]}" \
+ --silent --max-time 3 \
+ --location --no-remote-time --output /dev/null --write-out "%{http_code}" \
+ --dump-header "${DIR}/.git/GITHUB_HEADERS" \
+ --user-agent "${HOMEBREW_USER_AGENT_CURL}" \
+ --header "Accept: ${GITHUB_API_ACCEPT}" \
+ --header "If-None-Match: \"${GITHUB_API_ETAG}\"" \
+ "https://api.github.com/repos/${UPSTREAM_REPOSITORY}/${GITHUB_API_ENDPOINT}"
+ )"
# Touch FETCH_HEAD to confirm we've checked for an update.
[[ -f "${DIR}/.git/FETCH_HEAD" ]] && touch "${DIR}/.git/FETCH_HEAD"
- [[ -z "${HOMEBREW_UPDATE_FORCE}" ]] && [[ "${UPSTREAM_SHA_HTTP_CODE}" = "304" ]] && exit
+ [[ -z "${HOMEBREW_UPDATE_FORCE}" ]] && [[ "${UPSTREAM_SHA_HTTP_CODE}" == "304" ]] && exit
elif [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]]
then
FORCE_AUTO_UPDATE="$(git config homebrew.forceautoupdate 2>/dev/null || echo "false")"
@@ -583,7 +585,6 @@ EOS
fi
fi
-
# HOMEBREW_VERBOSE isn't modified here so ignore subshell warning.
# shellcheck disable=SC2030
if [[ -n "${HOMEBREW_VERBOSE}" ]]
@@ -606,15 +607,15 @@ EOS
# Reprint fetch errors to stderr
[[ -f "${tmp_failure_file}" ]] && cat "${tmp_failure_file}" 1>&2
- if [[ "${UPSTREAM_SHA_HTTP_CODE}" = "404" ]]
+ if [[ "${UPSTREAM_SHA_HTTP_CODE}" == "404" ]]
then
TAP="${DIR#${HOMEBREW_LIBRARY}/Taps/}"
echo "${TAP} does not exist! Run \`brew untap ${TAP}\` to remove it." >>"${update_failed_file}"
else
echo "Fetching ${DIR} failed!" >>"${update_failed_file}"
if [[ -f "${tmp_failure_file}" ]] &&
- [[ "$(<"${tmp_failure_file}")" = "fatal: couldn't find remote ref refs/heads/${UPSTREAM_BRANCH_DIR}" ]]
+ [[ "$(cat "${tmp_failure_file}")" == "fatal: couldn't find remote ref refs/heads/${UPSTREAM_BRANCH_DIR}" ]]
then
echo "${DIR}" >>"${missing_remote_ref_dirs_file}"
fi
@@ -638,7 +639,7 @@ EOS
if [[ -f "${missing_remote_ref_dirs_file}" ]]
then
- HOMEBREW_MISSING_REMOTE_REF_DIRS="$(<"${missing_remote_ref_dirs_file}")"
+ HOMEBREW_MISSING_REMOTE_REF_DIRS="$(cat "${missing_remote_ref_dirs_file}")"
rm -f "${missing_remote_ref_dirs_file}"
export HOMEBREW_MISSING_REMOTE_REF_DIRS
fi
@@ -647,9 +648,10 @@ EOS
do
# HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell.
# shellcheck disable=SC2031
- if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] && [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
- [[ "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ||
- "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]]
+ if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
+ [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] &&
+ [[ "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" || \
+ "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]]
then
continue
fi
@@ -672,8 +674,8 @@ EOS
then
simulate_from_current_branch "${DIR}" "${TAP_VAR}" "${UPSTREAM_BRANCH}" "${CURRENT_REVISION}"
elif [[ -z "${HOMEBREW_UPDATE_FORCE}" ]] &&
- [[ "${PREFETCH_REVISION}" = "${POSTFETCH_REVISION}" ]] &&
- [[ "${CURRENT_REVISION}" = "${POSTFETCH_REVISION}" ]]
+ [[ "${PREFETCH_REVISION}" == "${POSTFETCH_REVISION}" ]] &&
+ [[ "${CURRENT_REVISION}" == "${POSTFETCH_REVISION}" ]]
then
export HOMEBREW_UPDATE_BEFORE"${TAP_VAR}"="${CURRENT_REVISION}"
export HOMEBREW_UPDATE_AFTER"${TAP_VAR}"="${CURRENT_REVISION}"
@@ -687,18 +689,17 @@ EOS
# HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell.
# shellcheck disable=SC2031
- if [[ -n "${HOMEBREW_UPDATED}" ||
- -n "${HOMEBREW_UPDATE_FAILED}" ||
- -n "${HOMEBREW_MISSING_REMOTE_REF_DIRS}" ||
- -n "${HOMEBREW_UPDATE_FORCE}" ||
- -d "${HOMEBREW_LIBRARY}/LinkedKegs" ||
- ! -f "${HOMEBREW_CACHE}/all_commands_list.txt" ||
- (-n "${HOMEBREW_DEVELOPER}" && -z "${HOMEBREW_UPDATE_PREINSTALL}") ]]
+ if [[ -n "${HOMEBREW_UPDATED}" ]] ||
+ [[ -n "${HOMEBREW_UPDATE_FAILED}" ]] ||
+ [[ -n "${HOMEBREW_MISSING_REMOTE_REF_DIRS}" ]] ||
+ [[ -n "${HOMEBREW_UPDATE_FORCE}" ]] ||
+ [[ -d "${HOMEBREW_LIBRARY}/LinkedKegs" ]] ||
+ [[ ! -f "${HOMEBREW_CACHE}/all_commands_list.txt" ]] ||
+ [[ -n "${HOMEBREW_DEVELOPER}" && -z "${HOMEBREW_UPDATE_PREINSTALL}" ]]
then
brew update-report "$@"
return $?
- elif [[ -z "${HOMEBREW_UPDATE_PREINSTALL}" &&
- -z "${HOMEBREW_QUIET}" ]]
+ elif [[ -z "${HOMEBREW_UPDATE_PREINSTALL}" && -z "${HOMEBREW_QUIET}" ]]
then
echo "Already up-to-date."
fi | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/cmd/vendor-install.sh | @@ -14,7 +14,7 @@ VENDOR_DIR="${HOMEBREW_LIBRARY}/Homebrew/vendor"
# Built from https://github.com/Homebrew/homebrew-portable-ruby.
if [[ -n "${HOMEBREW_MACOS}" ]]
then
- if [[ "${HOMEBREW_PROCESSOR}" = "Intel" ]]
+ if [[ "${HOMEBREW_PROCESSOR}" == "Intel" ]]
then
ruby_FILENAME="portable-ruby-2.6.3_2.yosemite.bottle.tar.gz"
ruby_SHA="b065e5e3783954f3e65d8d3a6377ca51649bfcfa21b356b0dd70490f74c6bd86"
@@ -26,7 +26,7 @@ then
ruby_FILENAME="portable-ruby-2.6.3_2.x86_64_linux.bottle.tar.gz"
ruby_SHA="97e639a64dcec285392b53ad804b5334c324f1d2a8bdc2b5087b8bf8051e332f"
;;
- *)
+ *) ;;
esac
fi
@@ -43,13 +43,15 @@ then
then
ruby_URLs+=("${HOMEBREW_BOTTLE_DOMAIN}/bottles-portable-ruby/${ruby_FILENAME}")
fi
- ruby_URLs+=("https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}"
- "https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/${ruby_FILENAME}")
+ ruby_URLs+=(
+ "https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}"
+ "https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/${ruby_FILENAME}"
+ )
ruby_URL="${ruby_URLs[0]}"
fi
check_linux_glibc_version() {
- if [[ -z ${HOMEBREW_LINUX} || -z ${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION} ]]
+ if [[ -z "${HOMEBREW_LINUX}" || -z "${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION}" ]]
then
return 0
fi
@@ -58,15 +60,15 @@ check_linux_glibc_version() {
local glibc_version_major
local glibc_version_minor
- local minimum_required_major=${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION%.*}
- local minimum_required_minor=${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION#*.}
+ local minimum_required_major="${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION%.*}"
+ local minimum_required_minor="${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION#*.}"
- if [[ $(/usr/bin/ldd --version) =~ \ [0-9]\.[0-9]+ ]]
+ if [[ "$(/usr/bin/ldd --version)" =~ \ [0-9]\.[0-9]+ ]]
then
- glibc_version=${BASH_REMATCH[0]// /}
- glibc_version_major=${glibc_version%.*}
- glibc_version_minor=${glibc_version#*.}
- if (( glibc_version_major < minimum_required_major || glibc_version_minor < minimum_required_minor ))
+ glibc_version="${BASH_REMATCH[0]// /}"
+ glibc_version_major="${glibc_version%.*}"
+ glibc_version_minor="${glibc_version#*.}"
+ if ((glibc_version_major < minimum_required_major || glibc_version_minor < minimum_required_minor))
then
odie "Vendored tools require system Glibc ${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION} or later (yours is ${glibc_version})."
fi
@@ -77,7 +79,8 @@ check_linux_glibc_version() {
# Execute the specified command, and suppress stderr unless HOMEBREW_STDERR is set.
quiet_stderr() {
- if [[ -z "${HOMEBREW_STDERR}" ]]; then
+ if [[ -z "${HOMEBREW_STDERR}" ]]
+ then
command "$@" 2>/dev/null
else
command "$@"
@@ -180,13 +183,14 @@ EOS
sha="$(sha256sum "${CACHED_LOCATION}" | cut -d' ' -f1)"
elif [[ -x "$(type -P ruby)" ]]
then
- sha="$(ruby <<EOSCRIPT
- require 'digest/sha2'
- digest = Digest::SHA256.new
- File.open('${CACHED_LOCATION}', 'rb') { |f| digest.update(f.read) }
- puts digest.hexdigest
+ sha="$(
+ ruby <<EOSCRIPT
+require 'digest/sha2'
+digest = Digest::SHA256.new
+File.open('${CACHED_LOCATION}', 'rb') { |f| digest.update(f.read) }
+puts digest.hexdigest
EOSCRIPT
-)"
+ )"
else
odie "Cannot verify checksum ('shasum' or 'sha256sum' not found)!"
fi
@@ -261,9 +265,9 @@ homebrew-vendor-install() {
--debug) HOMEBREW_DEBUG=1 ;;
--*) ;;
-*)
- [[ "${option}" = *v* ]] && HOMEBREW_VERBOSE=1
- [[ "${option}" = *q* ]] && HOMEBREW_QUIET=1
- [[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1
+ [[ "${option}" == *v* ]] && HOMEBREW_VERBOSE=1
+ [[ "${option}" == *q* ]] && HOMEBREW_QUIET=1
+ [[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1
;;
*)
[[ -n "${VENDOR_NAME}" ]] && odie "This command does not take multiple vendor targets!"
@@ -282,7 +286,7 @@ homebrew-vendor-install() {
VENDOR_FILENAME="${!filename_var}"
VENDOR_SHA="${!sha_var}"
VENDOR_URL="${!url_var}"
- VENDOR_VERSION="$(<"${VENDOR_DIR}/portable-${VENDOR_NAME}-version")"
+ VENDOR_VERSION="$(cat "${VENDOR_DIR}/portable-${VENDOR_NAME}-version")"
if [[ -z "${VENDOR_URL}" || -z "${VENDOR_SHA}" ]]
then
@@ -292,7 +296,7 @@ homebrew-vendor-install() {
# Expand the name to an array of variables
# The array name must be "${VENDOR_NAME}_URLs"! Otherwise substitution errors will occur!
# shellcheck disable=SC2086
- read -r -a VENDOR_URLs <<< "$(eval "echo "\$\{${url_var}s[@]\}"")"
+ read -r -a VENDOR_URLs <<<"$(eval "echo "\$\{${url_var}s[@]\}"")"
CACHED_LOCATION="${HOMEBREW_CACHE}/${VENDOR_FILENAME}"
| true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/dev-cmd/rubocop.sh | @@ -14,7 +14,8 @@ homebrew-rubocop() {
GEM_VERSION="$("${HOMEBREW_RUBY_PATH}" "${RUBY_DISABLE_OPTIONS}" -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]')"
GEM_HOME="${HOMEBREW_LIBRARY}/Homebrew/vendor/bundle/ruby/${GEM_VERSION}"
- if ! [[ -f "${GEM_HOME}/bin/rubocop" ]]; then
+ if ! [[ -f "${GEM_HOME}/bin/rubocop" ]]
+ then
"${HOMEBREW_BREW_FILE}" install-bundler-gems
fi
| true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/items.sh | @@ -1,21 +1,22 @@
homebrew-items() {
local items
local sed_extended_regex_flag
- local find_filter=$1
- local sed_filter=$2
- local grep_filter=$3
+ local find_filter="$1"
+ local sed_filter="$2"
+ local grep_filter="$3"
# HOMEBREW_MACOS is set by brew.sh
# shellcheck disable=SC2154
- if [[ -n "${HOMEBREW_MACOS}" ]]; then
+ if [[ -n "${HOMEBREW_MACOS}" ]]
+ then
sed_extended_regex_flag="-E"
else
sed_extended_regex_flag="-r"
fi
# HOMEBREW_REPOSITORY is set by brew.sh
# shellcheck disable=SC2154
- items="$( \
+ items="$(
find "${HOMEBREW_REPOSITORY}/Library/Taps" \
-type d \( \
-name "${find_filter}" -o \
@@ -25,15 +26,15 @@ homebrew-items() {
-name spec -o \
-name vendor \
\) \
- -prune -false -o -name '*\.rb' | \
- sed "${sed_extended_regex_flag}" \
- -e 's/\.rb//g' \
- -e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' \
- -e "${sed_filter}" \
+ -prune -false -o -name '*\.rb' |
+ sed "${sed_extended_regex_flag}" \
+ -e 's/\.rb//g' \
+ -e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' \
+ -e "${sed_filter}"
)"
local shortnames
shortnames="$(echo "${items}" | cut -d "/" -f 3)"
- echo -e "${items}\n${shortnames}" | \
- grep -v "${grep_filter}" | \
+ echo -e "${items}\n${shortnames}" |
+ grep -v "${grep_filter}" |
sort -uf
} | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/prefix.sh | @@ -5,28 +5,35 @@
# HOMEBREW_PREFIX and HOMEBREW_REPOSITORY are set by brew.sh
# shellcheck disable=SC2154
homebrew-prefix() {
- while [[ "$#" -gt 0 ]]; do
- case $1 in
- # check we actually have --prefix and not e.g. --prefixsomething
- --prefix) local prefix="1"; shift ;;
- # reject all other flags
- -*) return 1 ;;
- *) [ -n "${formula}" ] && return 1; local formula="$1"; shift ;;
- esac
+ while [[ "$#" -gt 0 ]]
+ do
+ case "$1" in
+ # check we actually have --prefix and not e.g. --prefixsomething
+ --prefix)
+ local prefix="1"; shift
+ ;;
+ # reject all other flags
+ -*) return 1 ;;
+ *)
+ [[ -n "${formula}" ]] && return 1
+ local formula="$1"; shift
+ ;;
+ esac
done
- [ -z "${prefix}" ] && return 1
- [ -z "${formula}" ] && echo "${HOMEBREW_PREFIX}" && return 0
+ [[ -z "${prefix}" ]] && return 1
+ [[ -z "${formula}" ]] && echo "${HOMEBREW_PREFIX}" && return 0
local formula_path
- if [ -f "${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core/Formula/${formula}.rb" ]; then
+ if [[ -f "${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core/Formula/${formula}.rb" ]]
+ then
formula_path="${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core/Formula/${formula}.rb"
else
formula_path="$(
shopt -s nullglob
echo "${HOMEBREW_REPOSITORY}/Library/Taps"/*/*/{Formula/,HomebrewFormula/,}"${formula}.rb"
)"
fi
- [ -z "${formula_path}" ] && return 1
+ [[ -z "${formula_path}" ]] && return 1
echo "${HOMEBREW_PREFIX}/opt/${formula}"
return 0 | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/shims/linux/super/make | @@ -4,13 +4,19 @@
# HOMEBREW_LIBRARY is set by bin/brew
# shellcheck disable=SC2154,SC2250
pathremove() {
- local IFS=':' NEWPATH="" DIR="" PATHVARIABLE=${2:-PATH}
- for DIR in ${!PATHVARIABLE} ; do
- if [ "${DIR}" != "$1" ] ; then
- NEWPATH=${NEWPATH:+$NEWPATH:}${DIR}
- fi
- done
- export "${PATHVARIABLE}"="${NEWPATH}"
+ local IFS=':'
+ local NEWPATH=""
+ local DIR=""
+ local PATHVARIABLE="${2:-PATH}"
+
+ for DIR in ${!PATHVARIABLE}
+ do
+ if [[ "${DIR}" != "$1" ]]
+ then
+ NEWPATH="${NEWPATH:+$NEWPATH:}${DIR}"
+ fi
+ done
+ export "${PATHVARIABLE}"="${NEWPATH}"
}
SAVED_PATH="${PATH}" | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/shims/mac/super/pkg-config | @@ -4,7 +4,8 @@
# shellcheck disable=SC2154
pkg_config="${HOMEBREW_OPT}/pkg-config/bin/pkg-config"
-if [ -z "${HOMEBREW_SDKROOT}" ]; then
+if [[ -z "${HOMEBREW_SDKROOT}" ]]
+then
exec "${pkg_config}" "$@"
fi
| true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/shims/mac/super/ruby | @@ -9,8 +9,9 @@ source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
try_exec_non_system "${SHIM_FILE}" "$@"
-if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]; then
- export SDKROOT=${HOMEBREW_SDKROOT}
+if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]
+then
+ export SDKROOT="${HOMEBREW_SDKROOT}"
fi
safe_exec "/usr/bin/${SHIM_FILE}" "$@" | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/shims/mac/super/swift | @@ -7,8 +7,9 @@
# shellcheck disable=SC2154
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
-if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]; then
- export SDKROOT=${HOMEBREW_SDKROOT}
+if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]
+then
+ export SDKROOT="${HOMEBREW_SDKROOT}"
fi
try_exec_non_system "swift" "$@" | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/shims/mac/super/xcrun | @@ -7,18 +7,21 @@
# These could be used in conjunction with `--sdk` which ignores SDKROOT.
# HOMEBREW_DEVELOPER_DIR, HOMEBREW_SDKROOT and HOMEBREW_PREFER_CLT_PROXIES are set by extend/ENV/super.rb
# shellcheck disable=SC2154
-if [[ "$*" =~ (^| )-?-show-sdk-(path|version|build) && -n "${HOMEBREW_DEVELOPER_DIR}" ]]; then
- export DEVELOPER_DIR=${HOMEBREW_DEVELOPER_DIR}
+if [[ "$*" =~ (^| )-?-show-sdk-(path|version|build) && -n "${HOMEBREW_DEVELOPER_DIR}" ]]
+then
+ export DEVELOPER_DIR="${HOMEBREW_DEVELOPER_DIR}"
else
# Some build tools set DEVELOPER_DIR, so discard it
unset DEVELOPER_DIR
fi
-if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]; then
- export SDKROOT=${HOMEBREW_SDKROOT}
+if [[ -z "${SDKROOT}" && -n "${HOMEBREW_SDKROOT}" ]]
+then
+ export SDKROOT="${HOMEBREW_SDKROOT}"
fi
-if [ $# -eq 0 ]; then
+if [[ $# -eq 0 ]]
+then
exec /usr/bin/xcrun "$@"
fi
@@ -27,38 +30,45 @@ case "$1" in
-*) exec /usr/bin/xcrun "$@" ;;
esac
-arg0=$1
+arg0="$1"
shift
exe="/usr/bin/${arg0}"
-if [[ -x "${exe}" ]]; then
- if [[ -n "${HOMEBREW_PREFER_CLT_PROXIES}" ]]; then
+if [[ -x "${exe}" ]]
+then
+ if [[ -n "${HOMEBREW_PREFER_CLT_PROXIES}" ]]
+ then
exec "${exe}" "$@"
- elif [[ -z "${HOMEBREW_SDKROOT}" || ! -d "${HOMEBREW_SDKROOT}" ]]; then
+ elif [[ -z "${HOMEBREW_SDKROOT}" || ! -d "${HOMEBREW_SDKROOT}" ]]
+ then
exec "${exe}" "$@"
fi
fi
-SUPERBIN=$(cd "${0%/*}" && pwd -P)
+SUPERBIN="$(cd "${0%/*}" && pwd -P)"
-exe=$(/usr/bin/xcrun --find "${arg0}" 2>/dev/null)
-if [[ -x "${exe}" && "${exe%/*}" != "${SUPERBIN}" ]]; then
+exe="$(/usr/bin/xcrun --find "${arg0}" 2>/dev/null)"
+if [[ -x "${exe}" && "${exe%/*}" != "${SUPERBIN}" ]]
+then
exec "${exe}" "$@"
fi
-old_IFS=${IFS}
-IFS=:
-for path in ${PATH}; do
- if [ "${path}" = "${SUPERBIN}" ]; then
+old_IFS="${IFS}"
+IFS=':'
+for path in ${PATH}
+do
+ if [[ "${path}" == "${SUPERBIN}" ]]
+ then
continue
fi
exe="${path}/${arg0}"
- if [ -x "${exe}" ]; then
+ if [[ -x "${exe}" ]]
+ then
exec "${exe}" "$@"
fi
done
-IFS=${old_IFS}
+IFS="${old_IFS}"
echo >&2 "
Failed to execute ${arg0} ${*} | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/shims/scm/git | @@ -7,9 +7,9 @@
# SHIM_FILE is set by shims/utils.sh
# HOMEBREW_GIT is set by brew.sh
# HOMEBREW_SVN is from the user environment.
-# HOMEBREW_PREFIX is set extend/ENV/super.rb
+# HOMEBREW_PREFIX is set by extend/ENV/super.rb
# shellcheck disable=SC2154
-if [ -z "${HOMEBREW_LIBRARY}" ]
+if [[ -z "${HOMEBREW_LIBRARY}" ]]
then
echo "${0##*/}: This shim is internal and must be run via brew." >&2
exit 1 | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/shims/super/cc | @@ -1,11 +1,11 @@
#!/bin/sh
# Make sure this shim uses the same Ruby interpreter that is used by Homebrew.
-if [ -z "$HOMEBREW_RUBY_PATH" ]
+if [[ -z "${HOMEBREW_RUBY_PATH}" ]]
then
echo "${0##*/}: The build tool has reset ENV; --env=std required." >&2
exit 1
fi
-exec "$HOMEBREW_RUBY_PATH" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -x "$0" "$@"
+exec "${HOMEBREW_RUBY_PATH}" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -x "$0" "$@"
#!/usr/bin/env ruby -W0
require "pathname" | true |
Other | Homebrew | brew | 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd.json | style: fix inconsistent code style for shell scripts | Library/Homebrew/shims/utils.sh | @@ -1,7 +1,10 @@
set +o posix
quiet_safe_cd() {
- cd "$1" &>/dev/null || { echo "Error: failed to cd to $1" >&2; exit 1; }
+ cd "$1" &>/dev/null || {
+ echo "Error: failed to cd to $1" >&2
+ exit 1
+ }
}
absdir() {
@@ -25,7 +28,7 @@ realpath() {
while [[ -L "${path}" ]]
do
dest="$(readlink "${path}")"
- if [[ "${dest}" = "/"* ]]
+ if [[ "${dest}" == "/"* ]]
then
path="${dest}"
else
@@ -54,11 +57,11 @@ safe_exec() {
return
fi
# prevent fork-bombs
- if [[ "$(lowercase "${arg0}")" = "${SHIM_FILE}" || "$(realpath "${arg0}")" = "${SHIM_REAL}" ]]
+ if [[ "$(lowercase "${arg0}")" == "${SHIM_FILE}" || "$(realpath "${arg0}")" == "${SHIM_REAL}" ]]
then
return
fi
- if [[ "${HOMEBREW}" = "print-path" ]]
+ if [[ "${HOMEBREW}" == "print-path" ]]
then
local dir
dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)"
@@ -71,25 +74,23 @@ safe_exec() {
}
try_exec_non_system() {
- local file="$1"
+ local file="$1"
shift
- IFS=$'\n'
- for path in $(type -aP "${file}")
- do
- if [[ "${path}" != "/usr/bin/${file}" ]]
- then
- safe_exec "${path}" "$@"
- fi
- done
- unset IFS
+ local path
+ while read -r path
+ do
+ if [[ "${path}" != "/usr/bin/${file}" ]]
+ then
+ safe_exec "${path}" "$@"
+ fi
+ done < <(type -aP "${file}")
}
-
SHIM_FILE="${0##*/}"
SHIM_REAL="$(realpath "$0")"
-if [[ "$1" = --homebrew=* ]]
+if [[ "$1" == "--homebrew="* ]]
then
HOMEBREW="${1:11}"
shift | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.