Merge branch 'master' into formula-api

This commit is contained in:
Mike McQuaid 2024-11-08 08:44:19 +00:00 committed by GitHub
commit e910cb5985
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
172 changed files with 3215 additions and 1855 deletions

View File

@ -26,10 +26,12 @@ concurrency:
group: "actionlint-${{ github.ref }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions: {}
jobs:
workflow_syntax:
if: github.repository_owner == 'Homebrew'
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: setup-homebrew
@ -39,12 +41,13 @@ jobs:
cask: false
test-bot: false
- name: Set up actionlint
- name: Install tools
run: brew install actionlint shellcheck zizmor
- name: Set up GITHUB_WORKSPACE
env:
HOMEBREW_REPOSITORY: ${{ steps.setup-homebrew.outputs.repository-path }}
run: |
brew install actionlint shellcheck
# Annotations work only relative to GITHUB_WORKSPACE
(shopt -s dotglob; rm -rf "${GITHUB_WORKSPACE:?}"/*; mv "${HOMEBREW_REPOSITORY:?}"/* "$GITHUB_WORKSPACE")
rmdir "$HOMEBREW_REPOSITORY"
@ -52,4 +55,31 @@ jobs:
echo "::add-matcher::.github/actionlint-matcher.json"
- run: zizmor --format sarif . >results.sarif
- name: Upload SARIF file
uses: actions/upload-artifact@v4
with:
name: results.sarif
path: results.sarif
- run: actionlint
upload_sarif:
needs: workflow_syntax
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Download SARIF file
uses: actions/download-artifact@v4
with:
name: results.sarif
path: results.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
category: zizmor

View File

@ -22,7 +22,7 @@ defaults:
jobs:
autogenerated:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
if: github.repository == 'Homebrew/brew'
steps:
- name: Set up Homebrew
@ -34,7 +34,7 @@ jobs:
test-bot: true
- name: Cache Bundler RubyGems
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}

View File

@ -15,7 +15,7 @@ defaults:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
@ -23,10 +23,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@f779452ac5af1c261dce0346a8f964149f49322b # v3
uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3
with:
languages: ruby
config: |
@ -34,4 +36,4 @@ jobs:
- Library/Homebrew/vendor
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@f779452ac5af1c261dce0346a8f964149f49322b # v3
uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3

View File

@ -21,14 +21,14 @@ jobs:
ubuntu:
if: github.repository_owner == 'Homebrew'
name: docker (Ubuntu ${{ matrix.version }})
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ["18.04", "20.04", "22.04", "24.04"]
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
persist-credentials: false

View File

@ -23,7 +23,7 @@ defaults:
jobs:
docs:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew
@ -34,7 +34,9 @@ jobs:
test-bot: false
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: Install vale
run: brew install vale
@ -53,7 +55,7 @@ jobs:
run: vale docs/
- name: Install Ruby
uses: ruby/setup-ruby@f26937343756480a8cb3ae1f623b9c8d89ed6984 # v1.196.0
uses: ruby/setup-ruby@46ca53beb334a2329bcd0e46a694816a6ae6d173 # v1.201.0
with:
bundler-cache: true
working-directory: docs

View File

@ -22,7 +22,7 @@ defaults:
jobs:
determine-runners:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
outputs:
runners: ${{ steps.determine-runners.outputs.runners }}
steps:

View File

@ -79,7 +79,7 @@ jobs:
run: rm -f "${RUNNER_TEMP}/${TEMPORARY_CERTIFICATE_FILE}"
- name: Checkout another Homebrew to brew subdirectory
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
path: brew
fetch-depth: 0
@ -96,12 +96,14 @@ jobs:
run: security list-keychain -d user -s "${RUNNER_TEMP}/${TEMPORARY_KEYCHAIN_FILE}"
- name: Build Homebrew installer component package
env:
HOMEBREW_VERSION: ${{ steps.homebrew-version.outputs.version }}
# Note: `Library/Homebrew/test/support/fixtures/` contains unsigned
# binaries so it needs to be excluded from notarization.
run: pkgbuild --root brew
--scripts brew/package/scripts
--identifier sh.brew.homebrew
--version "${{ steps.homebrew-version.outputs.version }}"
--version "${HOMEBREW_VERSION}"
--install-location /opt/homebrew
--filter .DS_Store
--filter "(.*)/Library/Homebrew/test/support/fixtures/"
@ -114,11 +116,13 @@ jobs:
pandoc --from markdown --standalone --output brew/package/resources/LICENSE.rtf
- name: Build Homebrew installer product package
env:
HOMEBREW_VERSION: ${{ steps.homebrew-version.outputs.version }}
run: productbuild --resources brew/package/resources
--distribution brew/package/Distribution.xml
--package-path Homebrew.pkg
--sign "${PKG_APPLE_DEVELOPER_TEAM_ID}"
Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg
"Homebrew-${HOMEBREW_VERSION}.pkg"
- name: Clean up temporary macOS keychain
if: ${{ always() }}
@ -129,7 +133,7 @@ jobs:
fi
- name: Generate build provenance
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3
uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4
with:
subject-path: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg
@ -173,7 +177,9 @@ jobs:
run: echo | sudo tee /var/log/install.log
- name: Install Homebrew from installer package
run: sudo installer -verbose -pkg "${{ needs.build.outputs.installer_path }}" -target /
env:
INSTALLER_PATH: ${{ needs.build.outputs.installer_path }}
run: sudo installer -verbose -pkg "${INSTALLER_PATH}" -target /
- name: Output installer logs
if: ${{ always() }}
@ -187,7 +193,9 @@ jobs:
run: echo | sudo tee /var/log/install.log
- name: Reinstall Homebrew from installer package
run: sudo installer -verbose -pkg "${{ needs.build.outputs.installer_path }}" -target /
env:
INSTALLER_PATH: ${{ needs.build.outputs.installer_path }}
run: sudo installer -verbose -pkg "${INSTALLER_PATH}" -target /
- name: Output installer logs (again)
if: ${{ always() }}
@ -213,7 +221,8 @@ jobs:
env:
PKG_APPLE_ID_EMAIL: ${{ secrets.PKG_APPLE_ID_EMAIL }}
PKG_APPLE_ID_APP_SPECIFIC_PASSWORD: ${{ secrets.PKG_APPLE_ID_APP_SPECIFIC_PASSWORD }}
run: xcrun notarytool submit "${{ needs.build.outputs.installer_path }}"
INSTALLER_PATH: ${{ needs.build.outputs.installer_path }}
run: xcrun notarytool submit "${INSTALLER_PATH}"
--team-id "${PKG_APPLE_DEVELOPER_TEAM_ID}"
--apple-id "${PKG_APPLE_ID_EMAIL}"
--password "${PKG_APPLE_ID_APP_SPECIFIC_PASSWORD}"
@ -226,9 +235,10 @@ jobs:
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ github.token }}
INSTALLER_PATH: ${{ needs.build.outputs.installer_path }}
run: gh release upload --repo Homebrew/brew
"${GITHUB_REF//refs\/tags\//}"
"${{ needs.build.outputs.installer_path }}"
"${INSTALLER_PATH}"
issue:
needs: [build, test, upload]

View File

@ -23,7 +23,7 @@ defaults:
jobs:
rubydoc:
if: github.repository == 'Homebrew/brew'
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/rubydoc/Gemfile
steps:
@ -36,13 +36,14 @@ jobs:
test-bot: false
- name: Checkout Homebrew/rubydoc.brew.sh
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
repository: Homebrew/rubydoc.brew.sh
path: rubydoc
persist-credentials: false
- name: Install Ruby
uses: ruby/setup-ruby@f26937343756480a8cb3ae1f623b9c8d89ed6984 # v1.196.0
uses: ruby/setup-ruby@46ca53beb334a2329bcd0e46a694816a6ae6d173 # v1.201.0
with:
bundler-cache: true
working-directory: rubydoc

View File

@ -19,7 +19,7 @@ defaults:
jobs:
spdx:
if: github.repository == 'Homebrew/brew'
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew

View File

@ -19,7 +19,7 @@ defaults:
jobs:
spdx:
if: github.repository == 'Homebrew/brew'
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew

View File

@ -27,7 +27,7 @@ defaults:
jobs:
updates:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
if: github.repository == 'Homebrew/brew'
steps:
- name: Setup Homebrew
@ -49,7 +49,7 @@ jobs:
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
- name: Cache Bundler RubyGems
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}

View File

@ -12,10 +12,7 @@ on:
- cron: "0 0 * * *"
issue_comment:
permissions:
contents: write
issues: write
pull-requests: write
permissions: {}
defaults:
run:
@ -35,6 +32,10 @@ jobs:
)
)
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Mark/Close Stale Issues and Pull Requests
uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9
@ -61,6 +62,10 @@ jobs:
)
)
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Mark/Close Stale `bump-formula-pr` and `bump-cask-pr` Pull Requests
uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9

View File

@ -29,7 +29,7 @@ concurrency:
jobs:
syntax:
if: github.repository_owner == 'Homebrew'
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew
@ -40,7 +40,7 @@ jobs:
test-bot: false
- name: Cache Bundler RubyGems
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-syntax-${{ steps.set-up-homebrew.outputs.gems-hash }}
@ -53,7 +53,7 @@ jobs:
run: brew install shellcheck shfmt
- name: Cache style cache
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ~/.cache/Homebrew/style
key: syntax-style-cache-${{ github.sha }}
@ -92,7 +92,7 @@ jobs:
test-bot: true
- name: Cache Bundler RubyGems
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-tap-syntax-${{ steps.set-up-homebrew.outputs.gems-hash }}
@ -102,7 +102,7 @@ jobs:
run: brew install-bundler-gems --groups=style
- name: Cache style cache
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ~/.cache/Homebrew/style
key: tap-syntax-style-cache-${{ github.sha }}
@ -193,7 +193,7 @@ jobs:
vendored-gems:
name: vendored gems
needs: syntax
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew
@ -225,8 +225,8 @@ jobs:
strategy:
matrix:
include:
- name: update-test (Ubuntu 22.04)
runs-on: ubuntu-22.04
- name: update-test (Ubuntu)
runs-on: ubuntu-latest
- name: update-test (macOS)
runs-on: macos-15
steps:
@ -257,6 +257,9 @@ jobs:
- name: tests (generic OS)
test-flags: --generic --coverage
runs-on: ubuntu-latest
- name: tests (Ubuntu 24.04)
test-flags: --coverage
runs-on: ubuntu-24.04
- name: tests (Ubuntu 22.04)
test-flags: --coverage
runs-on: ubuntu-22.04
@ -282,7 +285,7 @@ jobs:
test-bot: false
- name: Cache Bundler RubyGems
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ matrix.runs-on }}-tests-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
@ -297,7 +300,7 @@ jobs:
run: mkdir tests
- name: Cache parallel tests log
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: tests
key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec-${{ github.sha }}

View File

@ -15,7 +15,7 @@ defaults:
jobs:
check-vendor-version:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew
@ -37,7 +37,7 @@ jobs:
working-directory: ${{ steps.set-up-homebrew.outputs.gems-path }}/${{ steps.ruby-abi.outputs.version }}/gems
run: |
{
echo "vendor-version=$(cat ../.homebrew_vendor_version)"
echo "vendor-version=$(<../.homebrew_vendor_version)"
echo "ignored<<EOS"
git check-ignore -- *
echo "EOS"
@ -45,12 +45,14 @@ jobs:
- name: Compare to base ref
working-directory: ${{ steps.set-up-homebrew.outputs.gems-path }}/${{ steps.ruby-abi.outputs.version }}
env:
VENDOR_VERSION: ${{ steps.gem-info.outputs.vendor-version }}
IGNORED_GEMS: ${{ steps.gem-info.outputs.ignored }}
run: |
git checkout "origin/${GITHUB_BASE_REF}"
rm .homebrew_vendor_version
brew install-bundler-gems --groups=all
if [[ "$(cat .homebrew_vendor_version)" == "${{ steps.gem-info.outputs.vendor-version }}" ]]; then
ignored_gems="${{ steps.gem-info.outputs.ignored }}"
if [[ "$(<.homebrew_vendor_version)" == "${VENDOR_VERSION}" ]]; then
while IFS= read -r gem; do
gem_dir="./gems/${gem}"
[[ -d "${gem_dir}" ]] || continue
@ -64,5 +66,5 @@ jobs:
fi
exit "${exit_code}"
fi
done <<< "${ignored_gems}"
done <<< "${IGNORED_GEMS}"
fi

View File

@ -420,6 +420,11 @@ Style/OptionalBooleanParameter:
- respond_to?
- respond_to_missing?
# Broken in RuboCop 1.68.0 so tries to fix line continuations in inline patch blocks:
# https://github.com/Homebrew/brew/actions/runs/11653110391/job/32460881827?pr=18682
Style/RedundantLineContinuation:
Enabled: false
# Rescuing `StandardError` is an understood default.
Style/RescueStandardError:
EnforcedStyle: implicit

View File

@ -1 +1 @@
3.3.5
3.3.6

View File

@ -14,7 +14,7 @@ GEM
bindata (~> 2)
erubi (1.13.0)
hana (1.3.7)
json (2.7.2)
json (2.7.6)
json_schemer (2.3.0)
bigdecimal
hana (~> 1.3)
@ -30,7 +30,7 @@ GEM
parallel (1.26.3)
parallel_tests (4.7.2)
parallel
parser (3.3.5.0)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
patchelf (1.5.1)
@ -50,12 +50,12 @@ GEM
logger
redcarpet (3.6.0)
regexp_parser (2.9.2)
rexml (3.3.8)
rexml (3.3.9)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
@ -72,7 +72,7 @@ GEM
rspec-support (3.13.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.66.1)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
@ -82,24 +82,24 @@ GEM
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
rubocop-ast (1.33.0)
parser (>= 3.3.1.0)
rubocop-md (1.2.3)
rubocop-md (1.2.4)
rubocop (>= 1.45)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.1.0)
rubocop-rspec (3.2.0)
rubocop (~> 1.61)
rubocop-sorbet (0.8.6)
rubocop-sorbet (0.8.7)
rubocop (>= 1)
ruby-lsp (0.20.1)
ruby-lsp (0.21.3)
language_server-protocol (~> 3.17.0)
prism (>= 1.2, < 2.0)
rbs (>= 3, < 4)
sorbet-runtime (>= 0.5.10782)
ruby-macho (4.1.0)
ruby-prof (1.7.0)
ruby-prof (1.7.1)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
docile (~> 1.1)
@ -111,22 +111,22 @@ GEM
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
simpleidn (0.2.3)
sorbet (0.5.11604)
sorbet-static (= 0.5.11604)
sorbet-runtime (0.5.11604)
sorbet-static (0.5.11604-aarch64-linux)
sorbet-static (0.5.11604-universal-darwin)
sorbet-static (0.5.11604-x86_64-linux)
sorbet-static-and-runtime (0.5.11604)
sorbet (= 0.5.11604)
sorbet-runtime (= 0.5.11604)
sorbet (0.5.11641)
sorbet-static (= 0.5.11641)
sorbet-runtime (0.5.11641)
sorbet-static (0.5.11641-aarch64-linux)
sorbet-static (0.5.11641-universal-darwin)
sorbet-static (0.5.11641-x86_64-linux)
sorbet-static-and-runtime (0.5.11641)
sorbet (= 0.5.11641)
sorbet-runtime (= 0.5.11641)
spoom (1.5.0)
erubi (>= 1.10.0)
prism (>= 0.28.0)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
stackprof (0.2.26)
tapioca (0.16.3)
tapioca (0.16.4)
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
@ -137,7 +137,7 @@ GEM
yard-sorbet
thor (1.3.2)
unicode-display_width (2.6.0)
vernier (1.2.1)
vernier (1.3.1)
warning (1.4.0)
yard (0.9.37)
yard-sorbet (0.9.0)
@ -192,7 +192,7 @@ DEPENDENCIES
yard-sorbet
RUBY VERSION
ruby 3.3.5p100
ruby 3.3.6p108
BUNDLED WITH
2.5.20

View File

@ -93,7 +93,14 @@ begin
Utils::Analytics.report_command_run(command_instance)
command_instance.run
else
Homebrew.public_send Commands.method_name(cmd)
begin
Homebrew.public_send Commands.method_name(cmd)
rescue NoMethodError => e
case_error = "undefined method `#{cmd.downcase}' for module Homebrew"
odie "Unknown command: brew #{cmd}" if e.message == case_error
raise
end
end
elsif (path = Commands.external_ruby_cmd_path(cmd))
Homebrew.running_command = cmd

View File

@ -74,7 +74,9 @@ module Homebrew
short_version = self.short_version.then(&make_version)
other_short_version = other.short_version.then(&make_version)
return short_version <=> other_short_version
short_version_difference = short_version <=> other_short_version
return short_version_difference unless short_version_difference.nil?
end
difference

View File

@ -173,8 +173,8 @@ module Cask
sig { returns(T.nilable(Time)) }
def install_time
# <caskroom_path>/.metadata/<version>/<timestamp>/Casks/<token>.{rb,json} -> <timestamp>
time = installed_caskfile&.dirname&.dirname&.basename&.to_s
Time.strptime(time, Metadata::TIMESTAMP_FORMAT) if time
caskfile = installed_caskfile
Time.strptime(caskfile.dirname.dirname.basename.to_s, Metadata::TIMESTAMP_FORMAT) if caskfile
end
sig { returns(T.nilable(Pathname)) }

View File

@ -188,23 +188,6 @@ module Cask
self.class.new(explicit: other.explicit.merge(explicit))
end
# Get explicit configuration as a string.
#
# @api internal
#
# TODO: This is only used by `homebrew/bundle`, so move it there.
sig { returns(String) }
def explicit_s
explicit.map do |key, value|
# inverse of #env - converts :languages config key back to --language flag
if key == :languages
key = "language"
value = T.cast(explicit.fetch(:languages, []), T::Array[String]).join(",")
end
"#{key}: \"#{value.to_s.sub(/^#{Dir.home}/, "~")}\""
end.join(", ")
end
sig { params(options: T.untyped).returns(String) }
def to_json(*options)
{

View File

@ -216,11 +216,11 @@ module Cask
# including both file ownership and whether system permissions are granted.
# Here we just want to check whether sudo would be needed.
looks_writable_without_sudo = if app.owned?
(app.lstat.mode & 0200) != 0
app.lstat.mode.anybits?(0200)
elsif app.grpowned?
(app.lstat.mode & 0020) != 0
app.lstat.mode.anybits?(0020)
else
(app.lstat.mode & 0002) != 0
app.lstat.mode.anybits?(0002)
end
if looks_writable_without_sudo

View File

@ -152,10 +152,11 @@ module Homebrew
resource_name = basename_str[/\A.*?--(.*?)--?(?:#{Regexp.escape(version.to_s)})/, 1]
stable = formula.stable
if resource_name == "patch"
patch_hashes = formula.stable&.patches&.select(&:external?)&.map(&:resource)&.map(&:version)
patch_hashes = stable&.patches&.filter_map { _1.resource.version if _1.external? }
return true unless patch_hashes&.include?(Checksum.new(version.to_s))
elsif resource_name && (resource_version = formula.stable&.resources&.dig(resource_name)&.version)
elsif resource_name && stable && (resource_version = stable.resources[resource_name]&.version)
return true if resource_version != version
elsif (formula.latest_version_installed? && formula.pkg_version.to_s != version) ||
formula.pkg_version.to_s > version

View File

@ -43,10 +43,6 @@ homebrew-shellenv() {
echo "fish_add_path --global --move --path \"${HOMEBREW_PREFIX}/bin\" \"${HOMEBREW_PREFIX}/sbin\";"
echo "if test -n \"\$MANPATH[1]\"; set --global --export MANPATH '' \$MANPATH; end;"
echo "if not contains \"${HOMEBREW_PREFIX}/share/info\" \$INFOPATH; set --global --export INFOPATH \"${HOMEBREW_PREFIX}/share/info\" \$INFOPATH; end;"
if [[ -n "${HOMEBREW_LINUX}" ]]
then
echo "if test -n \"\$XDG_DATA_DIRS\"; set --global --export XDG_DATA_DIRS \"${HOMEBREW_PREFIX}/share\" \$XDG_DATA_DIRS; end;"
fi
;;
csh | -csh | tcsh | -tcsh)
echo "setenv HOMEBREW_PREFIX ${HOMEBREW_PREFIX};"
@ -60,10 +56,6 @@ homebrew-shellenv() {
fi
echo "test \${?MANPATH} -eq 1 && setenv MANPATH :\${MANPATH};"
echo "setenv INFOPATH ${HOMEBREW_PREFIX}/share/info\`test \${?INFOPATH} -eq 1 && echo :\${INFOPATH}\`;"
if [[ -n "${HOMEBREW_LINUX}" ]]
then
echo "test \${?XDG_DATA_DIRS} -eq 1 && setenv XDG_DATA_DIRS \"${HOMEBREW_PREFIX}/share:\$XDG_DATA_DIRS\";"
fi
;;
pwsh | -pwsh | pwsh-preview | -pwsh-preview)
echo "[System.Environment]::SetEnvironmentVariable('HOMEBREW_PREFIX','${HOMEBREW_PREFIX}',[System.EnvironmentVariableTarget]::Process)"
@ -72,10 +64,6 @@ homebrew-shellenv() {
echo "[System.Environment]::SetEnvironmentVariable('PATH',\$('${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:'+\$ENV:PATH),[System.EnvironmentVariableTarget]::Process)"
echo "[System.Environment]::SetEnvironmentVariable('MANPATH',\$('${HOMEBREW_PREFIX}/share/man'+\$(if(\${ENV:MANPATH}){':'+\${ENV:MANPATH}})+':'),[System.EnvironmentVariableTarget]::Process)"
echo "[System.Environment]::SetEnvironmentVariable('INFOPATH',\$('${HOMEBREW_PREFIX}/share/info'+\$(if(\${ENV:INFOPATH}){':'+\${ENV:INFOPATH}})),[System.EnvironmentVariableTarget]::Process)"
if [[ -n "${HOMEBREW_LINUX}" ]]
then
echo "if(\${ENV:XDG_DATA_DIRS}){[System.Environment]::SetEnvironmentVariable('XDG_DATA_DIRS',\$('${HOMEBREW_PREFIX}/share:'+\${ENV:XDG_DATA_DIRS}),[System.EnvironmentVariableTarget]::Process)}"
fi
;;
*)
echo "export HOMEBREW_PREFIX=\"${HOMEBREW_PREFIX}\";"
@ -93,10 +81,6 @@ homebrew-shellenv() {
fi
echo "[ -z \"\${MANPATH-}\" ] || export MANPATH=\":\${MANPATH#:}\";"
echo "export INFOPATH=\"${HOMEBREW_PREFIX}/share/info:\${INFOPATH:-}\";"
if [[ -n "${HOMEBREW_LINUX}" ]]
then
echo "[ -z \"\${XDG_DATA_DIRS-}\" ] || export XDG_DATA_DIRS=\"${HOMEBREW_PREFIX}/share:\${XDG_DATA_DIRS-}\";"
fi
;;
esac
}

View File

@ -148,7 +148,7 @@ module Homebrew
new_mirrors ||= args.mirror
if new_url.present? && (new_mirror = determine_mirror(new_url))
new_mirrors ||= [new_mirror]
check_for_mirrors(formula, old_mirrors, new_mirrors)
check_for_mirrors(formula.name, old_mirrors, new_mirrors)
end
old_hash = formula_spec.checksum&.hexdigest

View File

@ -176,21 +176,21 @@ module Homebrew
# Since `method_defined?` is not a supported type guard, the use of `alias_method` below is not typesafe:
BottleSpecification.class_eval do
T.unsafe(self).alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
define_method(:method_missing) do |*|
define_method(:method_missing) do |*_|
# do nothing
end
end
Module.class_eval do
T.unsafe(self).alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
define_method(:method_missing) do |*|
define_method(:method_missing) do |*_|
# do nothing
end
end
Resource.class_eval do
T.unsafe(self).alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
define_method(:method_missing) do |*|
define_method(:method_missing) do |*_|
# do nothing
end
end
@ -200,7 +200,7 @@ module Homebrew
T.unsafe(self).alias_method :old_parse_symbol_spec,
:parse_symbol_spec
end
define_method(:parse_symbol_spec) do |*|
define_method(:parse_symbol_spec) do |*_|
# do nothing
end
end

View File

@ -119,7 +119,7 @@ class Hash
case object
when Hash
# We can't use `each_key` here because we're updating the hash in-place.
object.keys.each do |key| # rubocop:disable Style/HashEachMethods
object.keys.each do |key|
value = object.delete(key)
object[yield(key)] = _deep_transform_keys_in_object!(value, &block)
end

View File

@ -62,20 +62,6 @@ module OS
f&.unlink
end
def check_xdg_data_dirs
xdg_data_dirs = ENV.fetch("HOMEBREW_XDG_DATA_DIRS", nil)
return if xdg_data_dirs.blank?
return if xdg_data_dirs.split(":").include?("#{HOMEBREW_PREFIX}/share")
<<~EOS
Homebrew's share was not found in your XDG_DATA_DIRS but you have
this variable set to include other locations.
Some programs like `vapigen` may not work correctly.
Consider adding Homebrew's share directory to XDG_DATA_DIRS like so:
echo 'export XDG_DATA_DIRS="#{HOMEBREW_PREFIX}/share:$XDG_DATA_DIRS"' >> #{Utils::Shell.profile}
EOS
end
def check_umask_not_zero
return unless File.umask.zero?

View File

@ -28,7 +28,7 @@ module OS
if file.dylib?
id = relocated_name_for(file.dylib_id, relocation)
modified = change_dylib_id(id, file)
modified = change_dylib_id(id, file) if id
needs_codesigning ||= modified
end
@ -141,6 +141,9 @@ module OS
end
def dylib_id_for(file)
# Swift dylib IDs should be /usr/lib/swift
return file.dylib_id if file.dylib_id.start_with?("/usr/lib/swift/libswift")
# The new dylib ID should have the same basename as the old dylib ID, not
# the basename of the file itself.
basename = File.basename(file.dylib_id)
@ -148,6 +151,7 @@ module OS
(opt_record/relative_dirname/basename).to_s
end
sig { params(old_name: String, relocation: ::Keg::Relocation).returns(T.nilable(String)) }
def relocated_name_for(old_name, relocation)
old_prefix, new_prefix = relocation.replacement_pair_for(:prefix)
old_cellar, new_cellar = relocation.replacement_pair_for(:cellar)

View File

@ -593,7 +593,11 @@ class Formula
# @api internal
sig { returns(T::Array[String]) }
def aliases
@aliases ||= tap&.alias_reverse_table&.dig(full_name)&.map { _1.split("/").last } || []
@aliases ||= if (tap = self.tap)
tap.alias_reverse_table.fetch(full_name, []).map { _1.split("/").last }
else
[]
end
end
# The {Resource}s for the currently active {SoftwareSpec}.
@ -1849,12 +1853,16 @@ class Formula
#
# @api public
sig {
params(output: T.any(String, Pathname),
ldflags: T.nilable(T.any(String, T::Array[String]))).returns(T::Array[String])
params(
output: T.any(String, Pathname),
ldflags: T.nilable(T.any(String, T::Array[String])),
gcflags: T.nilable(T.any(String, T::Array[String])),
).returns(T::Array[String])
}
def std_go_args(output: bin/name, ldflags: nil)
def std_go_args(output: bin/name, ldflags: nil, gcflags: nil)
args = ["-trimpath", "-o=#{output}"]
args += ["-ldflags=#{Array(ldflags).join(" ")}"] if ldflags
args += ["-gcflags=#{Array(gcflags).join(" ")}"] if gcflags
args
end

View File

@ -361,8 +361,10 @@ module Homebrew
EOS
end
# we want to allow uses_from_macos for aliases but not bare dependencies
if self.class.aliases.include?(dep.name) && !dep.uses_from_macos?
# we want to allow uses_from_macos for aliases but not bare dependencies.
# we also allow `pkg-config` for backwards compatibility in external taps.
# TODO: after migrating all `pkg-config` usage to `pkgconf`, do not allow `pkg-config` in core tap
if self.class.aliases.include?(dep.name) && !dep.uses_from_macos? && dep.name != "pkg-config"
problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'."
end

View File

@ -379,6 +379,7 @@ class FormulaInstaller
next unless dep.to_formula.pinned?
next if dep.satisfied?(inherited_options_for(dep))
next if dep.build? && pour_bottle?
next if dep.test?
pinned_unsatisfied_deps << dep
end

View File

@ -418,10 +418,12 @@ module Formulary
@caveats_string = json_formula["caveats"]
def caveats
self.class.instance_variable_get(:@caveats_string)
&.gsub(HOMEBREW_PREFIX_PLACEHOLDER, HOMEBREW_PREFIX)
&.gsub(HOMEBREW_CELLAR_PLACEHOLDER, HOMEBREW_CELLAR)
&.gsub(HOMEBREW_HOME_PLACEHOLDER, Dir.home)
caveats_string = self.class.instance_variable_get(:@caveats_string)
return unless caveats_string
caveats_string.gsub(HOMEBREW_PREFIX_PLACEHOLDER, HOMEBREW_PREFIX)
.gsub(HOMEBREW_CELLAR_PLACEHOLDER, HOMEBREW_CELLAR)
.gsub(HOMEBREW_HOME_PLACEHOLDER, Dir.home)
end
@tap_git_head_string = if Homebrew::API.internal_json_v3?

View File

@ -169,6 +169,8 @@ class GitHubRunnerMatrix
["#{version}-arm64", runner_timeout]
end
# We test recursive dependents on ARM macOS, so they can be slower than our Intel runners.
timeout *= 2 if @dependent_matrix && timeout < GITHUB_ACTIONS_RUNNER_TIMEOUT
spec = MacOSRunnerSpec.new(
name: "macOS #{version}-arm64",
runner:,

View File

@ -15,7 +15,7 @@ class Keg
RELOCATABLE_PATH_REGEX_PREFIX = /(?:(?<=-F|-I|-L|-isystem)|(?<![a-zA-Z0-9]))/
def initialize
@replacement_map = {}
@replacement_map = T.let({}, T::Hash[Symbol, [T.any(String, Regexp), String]])
end
def freeze
@ -29,7 +29,7 @@ class Keg
@replacement_map[key] = [old_value, new_value]
end
sig { params(key: Symbol).returns(T::Array[T.any(String, Regexp)]) }
sig { params(key: Symbol).returns([T.any(String, Regexp), String]) }
def replacement_pair_for(key)
@replacement_map.fetch(key)
end
@ -44,7 +44,7 @@ class Keg
any_changed = T.let(nil, T.nilable(String))
sorted_keys.each do |key|
changed = text.gsub!(key, replacements[key])
changed = text.gsub!(key, replacements.fetch(key))
any_changed ||= changed
end
!any_changed.nil?

View File

@ -28,6 +28,13 @@ module Language
end
private_class_method :find_openjdk_formula
# Returns the directory of the newest matching OpenJDK installation or
# `nil` if none is available. When used in a {Formula}, there should be
# a dependency and corresponding `version` for reproducible output.
#
# @api public
# @param version OpenJDK version constraint which can be specific
# (e.g. `"21"`) or a lower-bounded range (e.g. `"21+"`)
sig { params(version: T.nilable(String)).returns(T.nilable(Pathname)) }
def self.java_home(version = nil)
find_openjdk_formula(version)&.opt_libexec
@ -39,11 +46,36 @@ module Language
end
private_class_method :java_home_shell
# Returns a `JAVA_HOME` environment variable to use a specific OpenJDK.
# Usually combined with either {Pathname#write_env_script} or
# {Pathname#env_script_all_files}.
#
# ### Example
#
# Use `openjdk@21` for all commands:
#
# ```ruby
# bin.env_script_all_files libexec/"bin", Language::Java.java_home_env("21")
# ```
#
# @api public
sig { params(version: T.nilable(String)).returns({ JAVA_HOME: String }) }
def self.java_home_env(version = nil)
{ JAVA_HOME: java_home_shell(version) }
end
# Returns a `JAVA_HOME` environment variable to use a default OpenJDK.
# Unlike {.java_home_env} the OpenJDK can be overridden at runtime.
#
# ### Example
#
# Use latest `openjdk` as default:
#
# ```ruby
# bin.env_script_all_files libexec/"bin", Language::Java.overridable_java_home_env
# ```
#
# @api public
sig { params(version: T.nilable(String)).returns({ JAVA_HOME: String }) }
def self.overridable_java_home_env(version = nil)
{ JAVA_HOME: "${JAVA_HOME:-#{java_home_shell(version)}}" }

View File

@ -187,17 +187,21 @@ module Language
venv.create(system_site_packages:, without_pip:)
# Find any Python bindings provided by recursive dependencies
formula_deps = formula.recursive_dependencies
pth_contents = formula_deps.filter_map do |d|
next if d.build? || d.test?
pth_contents = []
formula.recursive_dependencies do |dependent, dep|
Dependency.prune if dep.build? || dep.test?
# Apply default filter
Dependency.prune if (dep.optional? || dep.recommended?) && !dependent.build.with?(dep)
# Do not add the main site-package provided by the brewed
# Python formula, to keep the virtual-env's site-package pristine
next if python_names.include? d.name
Dependency.prune if python_names.include? dep.name
# Skip uses_from_macos dependencies as these imply no Python bindings
Dependency.prune if dep.uses_from_macos?
dep_site_packages = Formula[d.name].opt_prefix/Language::Python.site_packages(python)
next unless dep_site_packages.exist?
dep_site_packages = dep.to_formula.opt_prefix/Language::Python.site_packages(python)
Dependency.prune unless dep_site_packages.exist?
"import site; site.addsitedir('#{dep_site_packages}')\n"
pth_contents << "import site; site.addsitedir('#{dep_site_packages}')\n"
end
(venv.site_packages/"homebrew_deps.pth").write pth_contents.join unless pth_contents.empty?
@ -236,7 +240,7 @@ module Language
).returns(Virtualenv)
}
def virtualenv_install_with_resources(using: nil, system_site_packages: true, without_pip: true,
link_manpages: false, without: nil, start_with: nil, end_with: nil)
link_manpages: true, without: nil, start_with: nil, end_with: nil)
python = using
if python.nil?
wanted = python_names.select { |py| needs_python?(py) }
@ -411,7 +415,7 @@ module Language
build_isolation: T::Boolean,
).void
}
def pip_install_and_link(targets, link_manpages: false, build_isolation: true)
def pip_install_and_link(targets, link_manpages: true, build_isolation: true)
bin_before = Dir[@venv_root/"bin/*"].to_set
man_before = Dir[@venv_root/"share/man/man*/*"].to_set if link_manpages

View File

@ -195,8 +195,13 @@ module Homebrew
extract_plist = true if formulae_and_casks_total == 1
formulae_checked = formulae_and_casks_to_check.map.with_index do |formula_or_cask, i|
formula = formula_or_cask if formula_or_cask.is_a?(Formula)
cask = formula_or_cask if formula_or_cask.is_a?(Cask::Cask)
case formula_or_cask
when Formula
formula = formula_or_cask
formula.head&.downloader&.quiet!
when Cask::Cask
cask = formula_or_cask
end
use_full_name = full_name || ambiguous_names.include?(formula_or_cask)
name = package_or_resource_name(formula_or_cask, full_name: use_full_name)
@ -238,8 +243,6 @@ module Homebrew
next
end
formula&.head&.downloader&.quiet!
# Use the `stable` version for comparison except for installed
# head-only formulae. A formula with `stable` and `head` that's
# installed using `--head` will still use the `stable` version for
@ -508,10 +511,10 @@ module Homebrew
params(
livecheck_url: T.any(String, Symbol),
package_or_resource: T.any(Formula, Cask::Cask, Resource),
).returns(T.nilable(String))
).returns(String)
}
def self.livecheck_url_to_string(livecheck_url, package_or_resource)
case livecheck_url
livecheck_url_string = case livecheck_url
when String
livecheck_url
when :url
@ -521,6 +524,12 @@ module Homebrew
when :homepage
package_or_resource.homepage unless package_or_resource.is_a?(Resource)
end
if livecheck_url.is_a?(Symbol) && !livecheck_url_string
raise ArgumentError, "`url #{livecheck_url.inspect}` does not reference a checkable URL"
end
livecheck_url_string
end
# Returns an Array containing the formula/cask/resource URLs that can be used by livecheck.
@ -846,7 +855,7 @@ module Homebrew
livecheck_strategy = livecheck.strategy
livecheck_strategy_block = livecheck.strategy_block
livecheck_url_string = livecheck_url_to_string(livecheck_url, resource)
livecheck_url_string = livecheck_url_to_string(livecheck_url, resource) if livecheck_url
urls = [livecheck_url_string] if livecheck_url_string
urls ||= checkable_urls(resource)

View File

@ -31,6 +31,17 @@ class MacOSVersion < Version
el_capitan: "10.11",
}.freeze
sig { params(macos_version: MacOSVersion).returns(Version) }
def self.kernel_major_version(macos_version)
version_major = macos_version.major.to_i
if version_major > 10
Version.new((version_major + 9).to_s)
else
version_minor = macos_version.minor.to_i
Version.new((version_minor + 4).to_s)
end
end
sig { params(version: Symbol).returns(T.attached_class) }
def self.from_symbol(version)
str = SYMBOLS.fetch(version) { raise MacOSVersion::Error, version }

View File

@ -30,8 +30,8 @@ module OS
# @api public
sig { returns(Version) }
def self.kernel_version
require "utils/popen"
@kernel_version ||= T.let(Version.new(Utils.safe_popen_read("uname", "-r").chomp), T.nilable(Version))
require "etc"
@kernel_version ||= T.let(Version.new(Etc.uname.fetch(:release)), T.nilable(Version))
end
# Get the kernel name.
@ -39,8 +39,8 @@ module OS
# @api public
sig { returns(String) }
def self.kernel_name
require "utils/popen"
@kernel_name ||= T.let(Utils.safe_popen_read("uname", "-s").chomp, T.nilable(String))
require "etc"
@kernel_name ||= T.let(Etc.uname.fetch(:sysname), T.nilable(String))
end
::OS_VERSION = T.let(ENV.fetch("HOMEBREW_OS_VERSION").freeze, String)

View File

@ -94,7 +94,7 @@ class StringPatch < EmbeddedPatch
end
end
# A string containing a patch.
# A file containing a patch.
class ExternalPatch
extend Forwardable
@ -140,7 +140,12 @@ class ExternalPatch
patch_files.each do |patch_file|
ohai "Applying #{patch_file}"
patch_file = patch_dir/patch_file
safe_system "patch", "-g", "0", "-f", "-#{strip}", "-i", patch_file
Utils.safe_popen_write("patch", "-g", "0", "-f", "-#{strip}") do |p|
File.foreach(patch_file) do |line|
data = line.gsub("@@HOMEBREW_PREFIX@@", HOMEBREW_PREFIX)
p.write(data)
end
end
end
end
end

View File

@ -338,8 +338,7 @@ module RuboCop
good_args = "Utils.#{command}({ \"#{match[1]}\" => \"#{match[2]}\" }, \"#{match[3]}\")"
problem "Use `#{good_args}` instead of `#{method.source}`" do |corrector|
corrector.replace(@offensive_node.source_range,
"{ \"#{match[1]}\" => \"#{match[2]}\" }, \"#{match[3]}\"")
corrector.replace(method.source_range, good_args)
end
end
end

View File

@ -97,7 +97,8 @@ module RuboCop
%r{^http://hackage\.haskell\.org/},
%r{^http://(?:[^/]*\.)?archive\.org},
%r{^http://(?:[^/]*\.)?freedesktop\.org},
%r{^http://(?:[^/]*\.)?mirrorservice\.org/}])
%r{^http://(?:[^/]*\.)?mirrorservice\.org/},
%r{^http://downloads?\.sourceforge\.net/}])
audit_urls(urls, http_to_https_patterns) do |_, url, index|
# It's fine to have a plain HTTP mirror further down the mirror list.
https_url = url.dup.insert(4, "s")
@ -153,7 +154,7 @@ module RuboCop
problem "Don't use /download in SourceForge urls (url is #{url})." if url.end_with?("/download")
if url.match?(%r{^https?://sourceforge\.}) && url != livecheck_url
if url.match?(%r{^https?://(sourceforge|sf)\.}) && url != livecheck_url
problem "Use https://downloads.sourceforge.net to get geolocation (url is #{url})."
end
@ -165,7 +166,10 @@ module RuboCop
problem "Don't use specific dl mirrors in SourceForge urls (url is #{url})."
end
problem "Please use https:// for #{url}" if url.start_with? "http://downloads"
# sf.net does HTTPS -> HTTP redirects.
if url.match?(%r{^https?://downloads?\.sf\.net})
problem "Use https://downloads.sourceforge.net instead of downloads.sf.net (url is #{url})"
end
end
# Debian has an abundance of secure mirrors. Let's not pluck the insecure

View File

@ -468,7 +468,7 @@ class RSpec::Core::Configuration
# @see #before
# @see #prepend_before
#
# source://rspec-core//lib/rspec/core/configuration.rb#2026
# source://rspec-core//lib/rspec/core/configuration.rb#2031
def after(scope = T.unsafe(nil), *meta, &block); end
# Creates a method that defines an example group with the provided
@ -609,7 +609,7 @@ class RSpec::Core::Configuration
# @see #before
# @see #prepend_before
#
# source://rspec-core//lib/rspec/core/configuration.rb#2056
# source://rspec-core//lib/rspec/core/configuration.rb#2061
def append_after(scope = T.unsafe(nil), *meta, &block); end
# Defines a `before` hook. See {Hooks#before} for full docs.
@ -623,20 +623,20 @@ class RSpec::Core::Configuration
# @see #after
# @see #append_after
#
# source://rspec-core//lib/rspec/core/configuration.rb#1971
# source://rspec-core//lib/rspec/core/configuration.rb#1976
def append_before(scope = T.unsafe(nil), *meta, &block); end
# @private
# @raise [SystemStackError]
#
# source://rspec-core//lib/rspec/core/configuration.rb#1936
# source://rspec-core//lib/rspec/core/configuration.rb#1941
def apply_derived_metadata_to(metadata); end
# Registers `block` as an `around` hook.
#
# See {Hooks#around} for full `around` hook docs.
#
# source://rspec-core//lib/rspec/core/configuration.rb#2074
# source://rspec-core//lib/rspec/core/configuration.rb#2079
def around(scope = T.unsafe(nil), *meta, &block); end
# Regexps used to exclude lines from backtraces.
@ -700,7 +700,7 @@ class RSpec::Core::Configuration
# @see #after
# @see #append_after
#
# source://rspec-core//lib/rspec/core/configuration.rb#1971
# source://rspec-core//lib/rspec/core/configuration.rb#1976
def before(scope = T.unsafe(nil), *meta, &block); end
# Determines which bisect runner implementation gets used to run subsets
@ -730,7 +730,7 @@ class RSpec::Core::Configuration
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#2120
# source://rspec-core//lib/rspec/core/configuration.rb#2125
def bisect_runner_class; end
# Enables color output if the output is a TTY. As of RSpec 3.6, this is
@ -788,12 +788,12 @@ class RSpec::Core::Configuration
#
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1577
# source://rspec-core//lib/rspec/core/configuration.rb#1580
def configure_example(example, example_hooks); end
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1617
# source://rspec-core//lib/rspec/core/configuration.rb#1622
def configure_expectation_framework; end
# Used internally to extend a group with modules using `include`, `prepend` and/or
@ -801,12 +801,12 @@ class RSpec::Core::Configuration
#
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1565
# source://rspec-core//lib/rspec/core/configuration.rb#1568
def configure_group(group); end
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1611
# source://rspec-core//lib/rspec/core/configuration.rb#1616
def configure_mock_framework; end
# The default output color. Defaults to `:white` but can be set to one of
@ -889,7 +889,7 @@ class RSpec::Core::Configuration
# @yieldparam metadata [Hash] original metadata hash from an example or
# group. Mutate this in your block as needed.
#
# source://rspec-core//lib/rspec/core/configuration.rb#1895
# source://rspec-core//lib/rspec/core/configuration.rb#1900
def define_derived_metadata(*filters, &block); end
# Determines where deprecation warnings are printed.
@ -930,7 +930,7 @@ class RSpec::Core::Configuration
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1876
# source://rspec-core//lib/rspec/core/configuration.rb#1881
def disable_monkey_patching; end
# Enables zero monkey patching mode for RSpec. It removes monkey
@ -968,12 +968,12 @@ class RSpec::Core::Configuration
# (or similar) they will still have monkey patching active
# in their test environment from mocha.
#
# source://rspec-core//lib/rspec/core/configuration.rb#1868
# source://rspec-core//lib/rspec/core/configuration.rb#1873
def disable_monkey_patching!; end
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1876
# source://rspec-core//lib/rspec/core/configuration.rb#1881
def disable_monkey_patching=(_arg0); end
# Run examples over DRb (default: `false`). RSpec doesn't supply the DRb
@ -1158,7 +1158,7 @@ class RSpec::Core::Configuration
# end
# @param method_name [Symbol] the name of the helper method
#
# source://rspec-core//lib/rspec/core/configuration.rb#1806
# source://rspec-core//lib/rspec/core/configuration.rb#1811
def expose_current_running_example_as(method_name); end
# Use this to expose the core RSpec DSL via `Module` and the `main`
@ -1215,7 +1215,7 @@ class RSpec::Core::Configuration
# @see #include
# @see #prepend
#
# source://rspec-core//lib/rspec/core/configuration.rb#1515
# source://rspec-core//lib/rspec/core/configuration.rb#1518
def extend(mod, *filters); end
# If specified, indicates the number of failures required before cleaning
@ -1499,12 +1499,12 @@ class RSpec::Core::Configuration
# config.format_docstrings { |s| s.strip }
# end
#
# source://rspec-core//lib/rspec/core/configuration.rb#1656
# source://rspec-core//lib/rspec/core/configuration.rb#1661
def format_docstrings(&block); end
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1661
# source://rspec-core//lib/rspec/core/configuration.rb#1666
def format_docstrings_block; end
# Adds a formatter to the set RSpec will use for this run.
@ -1580,12 +1580,12 @@ class RSpec::Core::Configuration
#
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#2104
# source://rspec-core//lib/rspec/core/configuration.rb#2109
def hooks; end
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1602
# source://rspec-core//lib/rspec/core/configuration.rb#1607
def in_project_source_dir_regex; end
# Tells RSpec to include `mod` in example groups. Methods defined in
@ -1620,6 +1620,9 @@ class RSpec::Core::Configuration
#
# # included in examples with `:type => :request` metadata
# config.include(AuthenticationHelpers, :type => :request)
#
# # included in examples where the `:type` metadata matches a proc condition
# config.include(AuthenticationHelpers, :type => proc { |type, _metadata| [:request, :controller].include?(type) })
# end
#
# describe "edit profile", :preferences, :type => :request do
@ -1639,7 +1642,7 @@ class RSpec::Core::Configuration
# @see #extend
# @see #prepend
#
# source://rspec-core//lib/rspec/core/configuration.rb#1425
# source://rspec-core//lib/rspec/core/configuration.rb#1428
def include(mod, *filters); end
# Tells RSpec to include the named shared example group in example groups.
@ -1682,7 +1685,7 @@ class RSpec::Core::Configuration
# example.
# @see #include
#
# source://rspec-core//lib/rspec/core/configuration.rb#1472
# source://rspec-core//lib/rspec/core/configuration.rb#1475
def include_context(shared_group_name, *filters); end
# Returns the `inclusion_filter`. If none has been set, returns an empty
@ -1722,7 +1725,7 @@ class RSpec::Core::Configuration
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1625
# source://rspec-core//lib/rspec/core/configuration.rb#1630
def load_spec_files; end
# @private
@ -1794,14 +1797,14 @@ class RSpec::Core::Configuration
# Invokes block before defining an example group
#
# source://rspec-core//lib/rspec/core/configuration.rb#2109
# source://rspec-core//lib/rspec/core/configuration.rb#2114
def on_example_group_definition(&block); end
# Returns an array of blocks to call before defining an example group
#
# @api private
#
# source://rspec-core//lib/rspec/core/configuration.rb#2115
# source://rspec-core//lib/rspec/core/configuration.rb#2120
def on_example_group_definition_callbacks; end
# Indicates if the `--only-failures` (or `--next-failure`) flag is being used.
@ -1827,7 +1830,7 @@ class RSpec::Core::Configuration
#
# @see #register_ordering
#
# source://rspec-core//lib/rspec/core/configuration.rb#1668
# source://rspec-core//lib/rspec/core/configuration.rb#1673
def order=(*args, &block); end
# @private
@ -1835,7 +1838,7 @@ class RSpec::Core::Configuration
# source://rspec-core//lib/rspec/core/configuration.rb#522
def ordering_manager; end
# source://rspec-core//lib/rspec/core/configuration.rb#1668
# source://rspec-core//lib/rspec/core/configuration.rb#1673
def ordering_registry(*args, &block); end
# Determines where RSpec will send its output.
@ -1945,7 +1948,7 @@ class RSpec::Core::Configuration
# @see #include
# @see #extend
#
# source://rspec-core//lib/rspec/core/configuration.rb#1554
# source://rspec-core//lib/rspec/core/configuration.rb#1557
def prepend(mod, *filters); end
# Defines a `after` hook. See {Hooks#after} for full docs.
@ -1959,7 +1962,7 @@ class RSpec::Core::Configuration
# @see #before
# @see #prepend_before
#
# source://rspec-core//lib/rspec/core/configuration.rb#2026
# source://rspec-core//lib/rspec/core/configuration.rb#2031
def prepend_after(scope = T.unsafe(nil), *meta, &block); end
# Adds `block` to the start of the list of `before` blocks in the same
@ -1977,7 +1980,7 @@ class RSpec::Core::Configuration
# @see #after
# @see #append_after
#
# source://rspec-core//lib/rspec/core/configuration.rb#2001
# source://rspec-core//lib/rspec/core/configuration.rb#2006
def prepend_before(scope = T.unsafe(nil), *meta, &block); end
# Defaults `profile_examples` to 10 examples when `@profile_examples` is
@ -2037,7 +2040,7 @@ class RSpec::Core::Configuration
# rspec.raise_errors_for_deprecations!
# end
#
# source://rspec-core//lib/rspec/core/configuration.rb#1828
# source://rspec-core//lib/rspec/core/configuration.rb#1833
def raise_errors_for_deprecations!; end
# Turns RSpec warnings into errors. This can be useful when
@ -2050,7 +2053,7 @@ class RSpec::Core::Configuration
# rspec.raise_on_warning = true
# end
#
# source://rspec-core//lib/rspec/core/configuration.rb#1776
# source://rspec-core//lib/rspec/core/configuration.rb#1781
def raise_on_warning=(value); end
# Registers a named ordering strategy that can later be
@ -2092,7 +2095,7 @@ class RSpec::Core::Configuration
# @yieldparam list [Array<RSpec::Core::Example>, Array<RSpec::Core::ExampleGroup>] The examples or groups to order
# @yieldreturn [Array<RSpec::Core::Example>, Array<RSpec::Core::ExampleGroup>] The re-ordered examples or groups
#
# source://rspec-core//lib/rspec/core/configuration.rb#1668
# source://rspec-core//lib/rspec/core/configuration.rb#1673
def register_ordering(*args, &block); end
# @return [RSpec::Core::Reporter] the currently configured reporter
@ -2109,7 +2112,7 @@ class RSpec::Core::Configuration
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1594
# source://rspec-core//lib/rspec/core/configuration.rb#1597
def requires=(paths); end
# @private
@ -2160,15 +2163,15 @@ class RSpec::Core::Configuration
# We recommend, actually, that you use the command line approach so you
# don't accidentally leave the seed encoded.
#
# source://rspec-core//lib/rspec/core/configuration.rb#1668
# source://rspec-core//lib/rspec/core/configuration.rb#1673
def seed(*args, &block); end
# Sets the seed value and sets the default global ordering to random.
#
# source://rspec-core//lib/rspec/core/configuration.rb#1668
# source://rspec-core//lib/rspec/core/configuration.rb#1673
def seed=(*args, &block); end
# source://rspec-core//lib/rspec/core/configuration.rb#1668
# source://rspec-core//lib/rspec/core/configuration.rb#1673
def seed_used?(*args, &block); end
# Configures how RSpec treats metadata passed as part of a shared example
@ -2314,12 +2317,12 @@ class RSpec::Core::Configuration
# Set Ruby warnings on or off.
#
# source://rspec-core//lib/rspec/core/configuration.rb#1755
# source://rspec-core//lib/rspec/core/configuration.rb#1760
def warnings=(value); end
# @return [Boolean] Whether or not ruby warnings are enabled.
#
# source://rspec-core//lib/rspec/core/configuration.rb#1760
# source://rspec-core//lib/rspec/core/configuration.rb#1765
def warnings?; end
# Defines a callback that runs after the first example with matching
@ -2341,12 +2344,12 @@ class RSpec::Core::Configuration
# end
# end
#
# source://rspec-core//lib/rspec/core/configuration.rb#1918
# source://rspec-core//lib/rspec/core/configuration.rb#1923
def when_first_matching_example_defined(*filters); end
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#2086
# source://rspec-core//lib/rspec/core/configuration.rb#2091
def with_suite_hooks; end
# @private
@ -2365,111 +2368,111 @@ class RSpec::Core::Configuration
#
# @return [Boolean]
#
# source://rspec-core//lib/rspec/core/configuration.rb#2249
# source://rspec-core//lib/rspec/core/configuration.rb#2254
def absolute_pattern?(pattern); end
# source://rspec-core//lib/rspec/core/configuration.rb#2350
# source://rspec-core//lib/rspec/core/configuration.rb#2355
def add_hook_to_existing_matching_groups(meta, scope, &block); end
# @raise [MustBeConfiguredBeforeExampleGroupsError]
#
# source://rspec-core//lib/rspec/core/configuration.rb#2289
# source://rspec-core//lib/rspec/core/configuration.rb#2294
def assert_no_example_groups_defined(config_option); end
# source://rspec-core//lib/rspec/core/configuration.rb#2339
# source://rspec-core//lib/rspec/core/configuration.rb#2344
def clear_values_derived_from_example_status_persistence_file_path; end
# source://rspec-core//lib/rspec/core/configuration.rb#2271
# source://rspec-core//lib/rspec/core/configuration.rb#2276
def command; end
# source://rspec-core//lib/rspec/core/configuration.rb#2315
# source://rspec-core//lib/rspec/core/configuration.rb#2320
def conditionally_disable_expectations_monkey_patching; end
# source://rspec-core//lib/rspec/core/configuration.rb#2306
# source://rspec-core//lib/rspec/core/configuration.rb#2311
def conditionally_disable_mocks_monkey_patching; end
# source://rspec-core//lib/rspec/core/configuration.rb#2344
# source://rspec-core//lib/rspec/core/configuration.rb#2349
def configure_group_with(group, module_list, application_method); end
# source://rspec-core//lib/rspec/core/configuration.rb#2279
# source://rspec-core//lib/rspec/core/configuration.rb#2284
def define_built_in_hooks; end
# source://rspec-core//lib/rspec/core/configuration.rb#2402
# source://rspec-core//lib/rspec/core/configuration.rb#2407
def define_mixed_in_module(mod, filters, mod_list, config_method, &block); end
# source://rspec-core//lib/rspec/core/configuration.rb#2254
# source://rspec-core//lib/rspec/core/configuration.rb#2259
def extract_location(path); end
# source://rspec-core//lib/rspec/core/configuration.rb#2231
# source://rspec-core//lib/rspec/core/configuration.rb#2236
def file_glob_from(path, pattern); end
# source://rspec-core//lib/rspec/core/configuration.rb#2220
# source://rspec-core//lib/rspec/core/configuration.rb#2225
def gather_directories(path); end
# source://rspec-core//lib/rspec/core/configuration.rb#2199
# source://rspec-core//lib/rspec/core/configuration.rb#2204
def get_files_to_run(paths); end
# source://rspec-core//lib/rspec/core/configuration.rb#2226
# source://rspec-core//lib/rspec/core/configuration.rb#2231
def get_matching_files(path, pattern); end
# source://rspec-core//lib/rspec/core/configuration.rb#2166
# source://rspec-core//lib/rspec/core/configuration.rb#2171
def handle_suite_hook(scope, meta); end
# source://rspec-core//lib/rspec/core/configuration.rb#2138
# source://rspec-core//lib/rspec/core/configuration.rb#2143
def load_file_handling_errors(method, file); end
# @return [Boolean]
#
# source://rspec-core//lib/rspec/core/configuration.rb#2372
# source://rspec-core//lib/rspec/core/configuration.rb#2377
def metadata_applies_to_group?(meta, group); end
# source://rspec-core//lib/rspec/core/configuration.rb#2364
# source://rspec-core//lib/rspec/core/configuration.rb#2369
def on_existing_matching_groups(meta); end
# @return [Boolean]
#
# source://rspec-core//lib/rspec/core/configuration.rb#2302
# source://rspec-core//lib/rspec/core/configuration.rb#2307
def output_to_tty?(output = T.unsafe(nil)); end
# source://rspec-core//lib/rspec/core/configuration.rb#2298
# source://rspec-core//lib/rspec/core/configuration.rb#2303
def output_wrapper; end
# source://rspec-core//lib/rspec/core/configuration.rb#2211
# source://rspec-core//lib/rspec/core/configuration.rb#2216
def paths_to_check(paths); end
# @return [Boolean]
#
# source://rspec-core//lib/rspec/core/configuration.rb#2216
# source://rspec-core//lib/rspec/core/configuration.rb#2221
def pattern_might_load_specs_from_vendored_dirs?; end
# @return [Boolean]
#
# source://rspec-core//lib/rspec/core/configuration.rb#2325
# source://rspec-core//lib/rspec/core/configuration.rb#2330
def rspec_expectations_loaded?; end
# @return [Boolean]
#
# source://rspec-core//lib/rspec/core/configuration.rb#2321
# source://rspec-core//lib/rspec/core/configuration.rb#2326
def rspec_mocks_loaded?; end
# source://rspec-core//lib/rspec/core/configuration.rb#2181
# source://rspec-core//lib/rspec/core/configuration.rb#2186
def run_suite_hooks(hook_description, hooks); end
# source://rspec-core//lib/rspec/core/configuration.rb#2387
# source://rspec-core//lib/rspec/core/configuration.rb#2392
def safe_extend(mod, host); end
# :nocov:
#
# source://rspec-core//lib/rspec/core/configuration.rb#2383
# source://rspec-core//lib/rspec/core/configuration.rb#2388
def safe_include(mod, host); end
# source://rspec-core//lib/rspec/core/configuration.rb#2377
# source://rspec-core//lib/rspec/core/configuration.rb#2382
def safe_prepend(mod, host); end
# source://rspec-core//lib/rspec/core/configuration.rb#2329
# source://rspec-core//lib/rspec/core/configuration.rb#2334
def update_pattern_attr(name, value); end
# source://rspec-core//lib/rspec/core/configuration.rb#2275
# source://rspec-core//lib/rspec/core/configuration.rb#2280
def value_for(key); end
class << self
@ -2505,14 +2508,14 @@ class RSpec::Core::Configuration
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1666
# source://rspec-core//lib/rspec/core/configuration.rb#1671
def delegate_to_ordering_manager(*methods); end
end
end
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1646
# source://rspec-core//lib/rspec/core/configuration.rb#1651
RSpec::Core::Configuration::DEFAULT_FORMATTER = T.let(T.unsafe(nil), Proc)
# This buffer is used to capture all messages sent to the reporter during
@ -2538,7 +2541,7 @@ end
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1816
# source://rspec-core//lib/rspec/core/configuration.rb#1821
module RSpec::Core::Configuration::ExposeCurrentExample; end
# @private
@ -2568,7 +2571,7 @@ RSpec::Core::Configuration::PENDING_STATUS = T.let(T.unsafe(nil), String)
# @private
#
# source://rspec-core//lib/rspec/core/configuration.rb#1765
# source://rspec-core//lib/rspec/core/configuration.rb#1770
RSpec::Core::Configuration::RAISE_ERROR_WARNING_NOTIFIER = T.let(T.unsafe(nil), Proc)
# Module that holds `attr_reader` declarations. It's in a separate
@ -2768,7 +2771,9 @@ class RSpec::Core::ConfigurationOptions
# source://rspec-core//lib/rspec/core/configuration_options.rb#146
def custom_options; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#188
# :nocov:
#
# source://rspec-core//lib/rspec/core/configuration_options.rb#190
def custom_options_file; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#133
@ -2785,10 +2790,10 @@ class RSpec::Core::ConfigurationOptions
# source://rspec-core//lib/rspec/core/configuration_options.rb#158
def global_options; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#200
# source://rspec-core//lib/rspec/core/configuration_options.rb#202
def global_options_file; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#211
# source://rspec-core//lib/rspec/core/configuration_options.rb#213
def home_options_file_path; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#121
@ -2797,10 +2802,12 @@ class RSpec::Core::ConfigurationOptions
# source://rspec-core//lib/rspec/core/configuration_options.rb#150
def local_options; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#196
# source://rspec-core//lib/rspec/core/configuration_options.rb#198
def local_options_file; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#180
# :nocov:
#
# source://rspec-core//lib/rspec/core/configuration_options.rb#181
def options_file_as_erb_string(path); end
# source://rspec-core//lib/rspec/core/configuration_options.rb#162
@ -2821,16 +2828,16 @@ class RSpec::Core::ConfigurationOptions
# source://rspec-core//lib/rspec/core/configuration_options.rb#154
def project_options; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#192
# source://rspec-core//lib/rspec/core/configuration_options.rb#194
def project_options_file; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#227
# source://rspec-core//lib/rspec/core/configuration_options.rb#229
def resolve_xdg_config_home; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#204
# source://rspec-core//lib/rspec/core/configuration_options.rb#206
def xdg_options_file_if_exists; end
# source://rspec-core//lib/rspec/core/configuration_options.rb#220
# source://rspec-core//lib/rspec/core/configuration_options.rb#222
def xdg_options_file_path; end
end
@ -2938,8 +2945,9 @@ class RSpec::Core::DidYouMean
def initialize(relative_file_name); end
# return a hint if API for ::DidYouMean::SpellChecker not supported
# :nocov:
#
# source://rspec-core//lib/rspec/core/did_you_mean.rb#14
# source://rspec-core//lib/rspec/core/did_you_mean.rb#15
def call; end
# Returns the value of attribute relative_file_name.
@ -2949,13 +2957,15 @@ class RSpec::Core::DidYouMean
private
# source://rspec-core//lib/rspec/core/did_you_mean.rb#30
# :nocov:
#
# source://rspec-core//lib/rspec/core/did_you_mean.rb#35
def formats(probables); end
# source://rspec-core//lib/rspec/core/did_you_mean.rb#40
# source://rspec-core//lib/rspec/core/did_you_mean.rb#45
def red_font(mytext); end
# source://rspec-core//lib/rspec/core/did_you_mean.rb#35
# source://rspec-core//lib/rspec/core/did_you_mean.rb#40
def top_and_tail(rspec_format); end
end
@ -5452,7 +5462,7 @@ class RSpec::Core::Formatters::ExceptionPresenter
private
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#224
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#226
def add_shared_group_lines(lines, colorizer); end
# Returns the value of attribute backtrace_formatter.
@ -5465,9 +5475,9 @@ class RSpec::Core::Formatters::ExceptionPresenter
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#12
def detail_formatter; end
# for 1.8.7
# :nocov:
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#282
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#286
def encoded_description(description); end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#120
@ -5478,16 +5488,18 @@ class RSpec::Core::Formatters::ExceptionPresenter
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#116
def encoding_of(string); end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#292
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#298
def exception_backtrace; end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#150
def exception_class_name(exception = T.unsafe(nil)); end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#202
# :nocov:
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#204
def exception_lines; end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#184
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#185
def exception_message_string(exception); end
# Returns the value of attribute extra_detail_formatter.
@ -5495,7 +5507,7 @@ class RSpec::Core::Formatters::ExceptionPresenter
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#12
def extra_detail_formatter; end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#213
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#215
def extra_failure_lines; end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#156
@ -5507,10 +5519,10 @@ class RSpec::Core::Formatters::ExceptionPresenter
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#104
def final_exception(exception, previous = T.unsafe(nil)); end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#258
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#262
def find_failed_line; end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#273
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#277
def formatted_message_and_backtrace(colorizer); end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#134
@ -5521,7 +5533,7 @@ class RSpec::Core::Formatters::ExceptionPresenter
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#12
def message_color; end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#234
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#236
def read_failed_lines; end
end
@ -5532,49 +5544,49 @@ end
#
# @private
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#301
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#307
class RSpec::Core::Formatters::ExceptionPresenter::Factory
# @return [Factory] a new instance of Factory
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#308
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#314
def initialize(example); end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#302
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#308
def build; end
private
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#363
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#369
def multiple_exception_summarizer(exception, prior_detail_formatter, color); end
# @return [Boolean]
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#359
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#365
def multiple_exceptions_error?(exception); end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#318
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#324
def options; end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#322
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#328
def pending_options; end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#384
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#390
def sub_failure_list_formatter(exception, message_color); end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#343
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#349
def with_multiple_error_options_as_needed(exception, options); end
end
# @private
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#417
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#423
class RSpec::Core::Formatters::ExceptionPresenter::Factory::CommonBacktraceTruncater
# @return [CommonBacktraceTruncater] a new instance of CommonBacktraceTruncater
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#418
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#424
def initialize(parent); end
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#422
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#428
def with_truncated_backtrace(child); end
end
@ -5583,17 +5595,17 @@ end
#
# @private
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#410
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#416
module RSpec::Core::Formatters::ExceptionPresenter::Factory::EmptyBacktraceFormatter
class << self
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#411
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#417
def format_backtrace(*_arg0); end
end
end
# @private
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#442
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#448
RSpec::Core::Formatters::ExceptionPresenter::PENDING_DETAIL_FORMATTER = T.let(T.unsafe(nil), Proc)
# @private
@ -8228,57 +8240,57 @@ end
# individual spec has multiple exceptions, such as one in the `it` block
# and one in an `after` block.
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#452
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#458
class RSpec::Core::MultipleExceptionError < ::StandardError
include ::RSpec::Core::MultipleExceptionError::InterfaceTag
# @param exceptions [Array<Exception>] The initial list of exceptions.
# @return [MultipleExceptionError] a new instance of MultipleExceptionError
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#513
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#519
def initialize(*exceptions); end
# @return [nil] Provided only for interface compatibility with
# `RSpec::Expectations::MultipleExpectationsNotMetError`.
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#510
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#516
def aggregation_block_label; end
# @return [Hash] Metadata used by RSpec for formatting purposes.
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#506
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#512
def aggregation_metadata; end
# @return [Array<Exception>] The list of failures and other exceptions, combined.
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#503
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#509
def all_exceptions; end
# return [String] A description of the failure/error counts.
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#538
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#544
def exception_count_description; end
# @return [Array<Exception>] The list of failures.
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#497
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#503
def failures; end
# @note RSpec does not actually use this -- instead it formats each exception
# individually.
# @return [String] Combines all the exception messages into a single string.
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#528
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#534
def message; end
# @return [Array<Exception>] The list of other errors.
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#500
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#506
def other_errors; end
# @return [String] A summary of the failure, including the block label and a count of failures.
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#533
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#539
def summary; end
end
@ -8289,14 +8301,14 @@ end
#
# @private
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#458
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#464
module RSpec::Core::MultipleExceptionError::InterfaceTag
# Appends the provided exception to the list.
#
# @param exception [Exception] Exception to append to the list.
# @private
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#462
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#468
def add(exception); end
class << self
@ -8306,7 +8318,7 @@ module RSpec::Core::MultipleExceptionError::InterfaceTag
#
# @private
#
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#488
# source://rspec-core//lib/rspec/core/formatters/exception_presenter.rb#494
def for(ex); end
end
end
@ -9603,16 +9615,16 @@ class RSpec::Core::Parser
private
# source://rspec-core//lib/rspec/core/option_parser.rb#310
# source://rspec-core//lib/rspec/core/option_parser.rb#312
def add_tag_filter(options, filter_type, tag_name, value = T.unsafe(nil)); end
# source://rspec-core//lib/rspec/core/option_parser.rb#318
# source://rspec-core//lib/rspec/core/option_parser.rb#320
def configure_only_failures(options); end
# source://rspec-core//lib/rspec/core/option_parser.rb#39
def parser(options); end
# source://rspec-core//lib/rspec/core/option_parser.rb#314
# source://rspec-core//lib/rspec/core/option_parser.rb#316
def set_fail_fast(options, value); end
class << self

View File

@ -443,18 +443,18 @@ class RuboCop::AST::Builder < ::Parser::Builders::Default
#
# @return [Node] the generated node
#
# source://rubocop-ast//lib/rubocop/ast/builder.rb#99
# source://rubocop-ast//lib/rubocop/ast/builder.rb#105
def n(type, children, source_map); end
# TODO: Figure out what to do about literal encoding handling...
# More details here https://github.com/whitequark/parser/issues/283
#
# source://rubocop-ast//lib/rubocop/ast/builder.rb#105
# source://rubocop-ast//lib/rubocop/ast/builder.rb#111
def string_value(token); end
private
# source://rubocop-ast//lib/rubocop/ast/builder.rb#111
# source://rubocop-ast//lib/rubocop/ast/builder.rb#117
def node_klass(type); end
end
@ -574,26 +574,17 @@ end
#
# source://rubocop-ast//lib/rubocop/ast/node/casgn_node.rb#8
class RuboCop::AST::CasgnNode < ::RuboCop::AST::Node
include ::RuboCop::AST::ConstantNode
# The expression being assigned to the variable.
#
# @return [Node] the expression being assigned.
#
# source://rubocop-ast//lib/rubocop/ast/node/casgn_node.rb#26
# source://rubocop-ast//lib/rubocop/ast/node/casgn_node.rb#16
def expression; end
# The name of the variable being assigned as a symbol.
#
# @return [Symbol] the name of the variable being assigned
#
# source://rubocop-ast//lib/rubocop/ast/node/casgn_node.rb#19
# source://rubocop-ast//lib/rubocop/ast/node/mixin/constant_node.rb#14
def name; end
# The namespace of the constant being assigned.
#
# @return [Node, nil] the node associated with the scope (e.g. cbase, const, ...)
#
# source://rubocop-ast//lib/rubocop/ast/node/casgn_node.rb#12
def namespace; end
end
# A node extension for `class` nodes. This will be used in place of a plain
@ -1084,16 +1075,24 @@ end
#
# source://rubocop-ast//lib/rubocop/ast/node/const_node.rb#6
class RuboCop::AST::ConstNode < ::RuboCop::AST::Node
include ::RuboCop::AST::ConstantNode
end
# Common functionality for nodes that deal with constants:
# `const`, `casgn`.
#
# source://rubocop-ast//lib/rubocop/ast/node/mixin/constant_node.rb#7
module RuboCop::AST::ConstantNode
# @return [Boolean] if the constant starts with `::` (aka s(:cbase))
#
# source://rubocop-ast//lib/rubocop/ast/node/const_node.rb#26
# source://rubocop-ast//lib/rubocop/ast/node/mixin/constant_node.rb#27
def absolute?; end
# @return [Boolean] if the constant is a Module / Class, according to the standard convention.
# Note: some classes might have uppercase in which case this method
# returns false
#
# source://rubocop-ast//lib/rubocop/ast/node/const_node.rb#20
# source://rubocop-ast//lib/rubocop/ast/node/mixin/constant_node.rb#21
def class_name?; end
# Yield nodes for the namespace
@ -1103,29 +1102,29 @@ class RuboCop::AST::ConstNode < ::RuboCop::AST::Node
# s(:const, :Foo), then
# s(:const, s(:const, :Foo), :Bar)
#
# source://rubocop-ast//lib/rubocop/ast/node/const_node.rb#43
# source://rubocop-ast//lib/rubocop/ast/node/mixin/constant_node.rb#44
def each_path(&block); end
# @return [Boolean] if the constant is a Module / Class, according to the standard convention.
# Note: some classes might have uppercase in which case this method
# returns false
#
# source://rubocop-ast//lib/rubocop/ast/node/const_node.rb#20
# source://rubocop-ast//lib/rubocop/ast/node/mixin/constant_node.rb#21
def module_name?; end
# @return [Node, nil] the node associated with the scope (e.g. cbase, const, ...)
#
# source://rubocop-ast//lib/rubocop/ast/node/const_node.rb#8
# source://rubocop-ast//lib/rubocop/ast/node/mixin/constant_node.rb#9
def namespace; end
# @return [Boolean] if the constant does not start with `::` (aka s(:cbase))
#
# source://rubocop-ast//lib/rubocop/ast/node/const_node.rb#33
# source://rubocop-ast//lib/rubocop/ast/node/mixin/constant_node.rb#34
def relative?; end
# @return [Symbol] the demodulized name of the constant: "::Foo::Bar" => :Bar
#
# source://rubocop-ast//lib/rubocop/ast/node/const_node.rb#13
# source://rubocop-ast//lib/rubocop/ast/node/mixin/constant_node.rb#14
def short_name; end
end
@ -2046,6 +2045,71 @@ class RuboCop::AST::LambdaNode < ::RuboCop::AST::Node
def first_argument_index; end
end
# A node extension for `masgn` nodes.
# This will be used in place of a plain node when the builder constructs
# the AST, making its methods available to all assignment nodes within RuboCop.
#
# source://rubocop-ast//lib/rubocop/ast/node/masgn_node.rb#8
class RuboCop::AST::MasgnNode < ::RuboCop::AST::Node
# @return [Array<Node>] the assignment nodes of the multiple assignment
#
# source://rubocop-ast//lib/rubocop/ast/node/masgn_node.rb#16
def assignments; end
# The RHS (right hand side) of the multiple assignment. This returns
# the nodes as parsed: either a single node if the RHS has a single value,
# or an `array` node containing multiple nodes.
#
# NOTE: Due to how parsing works, `expression` will return the same for
# `a, b = x, y` and `a, b = [x, y]`.
#
# @return [Node] the right hand side of a multiple assignment.
#
# source://rubocop-ast//lib/rubocop/ast/node/masgn_node.rb#39
def expression; end
# @return [MlhsNode] the `mlhs` node
#
# source://rubocop-ast//lib/rubocop/ast/node/masgn_node.rb#10
def lhs; end
# @return [Array<Symbol>] names of all the variables being assigned
#
# source://rubocop-ast//lib/rubocop/ast/node/masgn_node.rb#21
def names; end
# The RHS (right hand side) of the multiple assignment. This returns
# the nodes as parsed: either a single node if the RHS has a single value,
# or an `array` node containing multiple nodes.
#
# NOTE: Due to how parsing works, `expression` will return the same for
# `a, b = x, y` and `a, b = [x, y]`.
#
# @return [Node] the right hand side of a multiple assignment.
#
# source://rubocop-ast//lib/rubocop/ast/node/masgn_node.rb#39
def rhs; end
# In contrast to `expression`, `values` always returns a Ruby array
# containing all the nodes being assigned on the RHS.
#
# Literal arrays are considered a singular value; but unlike `expression`,
# implied `array` nodes from assigning multiple values on the RHS are treated
# as separate.
#
# @return [Array<Node>] individual values being assigned on the RHS of the multiple assignment
#
# source://rubocop-ast//lib/rubocop/ast/node/masgn_node.rb#52
def values; end
private
# @return [Boolean]
#
# source://rubocop-ast//lib/rubocop/ast/node/masgn_node.rb#58
def multiple_rhs?; end
end
# Common functionality for nodes that are a kind of method dispatch:
# `send`, `csend`, `super`, `zsuper`, `yield`, `defined?`,
# and (modern only): `index`, `indexasgn`, `lambda`
@ -2478,6 +2542,22 @@ RuboCop::AST::MethodIdentifierPredicates::NONMUTATING_UNARY_OPERATOR_METHODS = T
# source://rubocop-ast//lib/rubocop/ast/node/mixin/method_identifier_predicates.rb#20
RuboCop::AST::MethodIdentifierPredicates::OPERATOR_METHODS = T.let(T.unsafe(nil), Set)
# A node extension for `mlhs` nodes.
# This will be used in place of a plain node when the builder constructs
# the AST, making its methods available to all assignment nodes within RuboCop.
#
# source://rubocop-ast//lib/rubocop/ast/node/mlhs_node.rb#8
class RuboCop::AST::MlhsNode < ::RuboCop::AST::Node
# Returns all the assignment nodes on the left hand side (LHS) of a multiple assignment.
# These are generally assignment nodes (`lvasgn`, `ivasgn`, `cvasgn`, `gvasgn`, `casgn`)
# but can also be `send` nodes in case of `foo.bar, ... =` or `foo[:bar], ... =`.
#
# @return [Array<Node>] the assignment nodes of the multiple assignment LHS
#
# source://rubocop-ast//lib/rubocop/ast/node/mlhs_node.rb#14
def assignments; end
end
# Common functionality for nodes that can be used as modifiers:
# `if`, `while`, `until`
#
@ -4459,7 +4539,7 @@ class RuboCop::AST::NodePattern::LexerRex
# The current location in the parse.
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#104
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#103
def location; end
# The StringScanner for this lexer.
@ -4474,22 +4554,22 @@ class RuboCop::AST::NodePattern::LexerRex
# Lex the next token.
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#113
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#112
def next_token; end
# Parse the given string.
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#84
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#83
def parse(str); end
# Read in and parse the file at +path+.
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#94
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#93
def parse_file(path); end
# The current scanner class. Must be overridden in subclasses.
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#77
# source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#76
def scanner_class; end
# The StringScanner for this lexer.
@ -4863,116 +4943,116 @@ class RuboCop::AST::NodePattern::Parser < ::Racc::Parser
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.rb#19
def initialize(builder = T.unsafe(nil)); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#333
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#335
def _reduce_10(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#337
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#339
def _reduce_11(val, _values); end
# reduce 12 omitted
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#343
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#345
def _reduce_13(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#347
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#349
def _reduce_14(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#351
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#353
def _reduce_15(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#355
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#357
def _reduce_16(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#359
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#361
def _reduce_17(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#363
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#365
def _reduce_18(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#367
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#369
def _reduce_19(val, _values); end
# reduce 1 omitted
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#301
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#303
def _reduce_2(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#371
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#373
def _reduce_20(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#375
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#377
def _reduce_21(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#379
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#381
def _reduce_22(val, _values); end
# reduce 24 omitted
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#387
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#389
def _reduce_25(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#393
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#395
def _reduce_26(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#305
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#307
def _reduce_3(val, _values); end
# reduce 32 omitted
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#413
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#415
def _reduce_33(val, _values); end
# reduce 36 omitted
#
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#423
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#425
def _reduce_37(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#427
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#429
def _reduce_38(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#431
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#433
def _reduce_39(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#309
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#311
def _reduce_4(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#435
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#437
def _reduce_40(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#439
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#441
def _reduce_41(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#443
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#445
def _reduce_42(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#447
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#449
def _reduce_43(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#451
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#453
def _reduce_44(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#455
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#457
def _reduce_45(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#459
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#461
def _reduce_46(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#313
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#315
def _reduce_5(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#317
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#319
def _reduce_6(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#321
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#323
def _reduce_7(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#325
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#327
def _reduce_8(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#329
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#331
def _reduce_9(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#463
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#465
def _reduce_none(val, _values); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
@ -5032,10 +5112,10 @@ RuboCop::AST::NodePattern::Parser::Lexer = RuboCop::AST::NodePattern::Lexer
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#227
RuboCop::AST::NodePattern::Parser::Racc_arg = T.let(T.unsafe(nil), Array)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#293
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#295
RuboCop::AST::NodePattern::Parser::Racc_debug_parser = T.let(T.unsafe(nil), FalseClass)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#243
# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#244
RuboCop::AST::NodePattern::Parser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array)
# Overrides Parser to use `WithMeta` variants and provide additional methods
@ -5406,7 +5486,7 @@ RuboCop::AST::NodePattern::Sets::SET_RECEIVE_RECEIVE_MESSAGE_CHAIN = T.let(T.uns
RuboCop::AST::NodePattern::Sets::SET_REDUCE_INJECT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_REJECT_DELETE_IF_REJECT = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_REJECT_REJECT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_REQUIRE_REQUIRE_RELATIVE = T.let(T.unsafe(nil), Set)
@ -5418,7 +5498,7 @@ RuboCop::AST::NodePattern::Sets::SET_SELECT_FILTER_FIND_ALL = T.let(T.unsafe(nil
RuboCop::AST::NodePattern::Sets::SET_SELECT_FILTER_FIND_ALL_REJECT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_SELECT_SELECT = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_SELECT_SELECT_FILTER_FILTER = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_SEND_PUBLIC_SEND___SEND__ = T.let(T.unsafe(nil), Set)
@ -6022,7 +6102,7 @@ class RuboCop::AST::ProcessedSource
# source://rubocop-ast//lib/rubocop/ast/processed_source.rb#58
def lines; end
# source://rubocop-md/1.2.2/lib/rubocop/markdown/rubocop_ext.rb#95
# source://rubocop-md/1.2.4/lib/rubocop/markdown/rubocop_ext.rb#98
def parse(src, *args); end
# Returns the value of attribute parser_engine.
@ -7083,6 +7163,18 @@ class RuboCop::AST::UntilNode < ::RuboCop::AST::Node
def keyword; end
end
# A node extension for `lvar`, `ivar`, `cvar` and `gvar` nodes.
# This will be used in place of a plain node when the builder constructs
# the AST, making its methods available to all assignment nodes within RuboCop.
#
# source://rubocop-ast//lib/rubocop/ast/node/var_node.rb#8
class RuboCop::AST::VarNode < ::RuboCop::AST::Node
# @return [Symbol] The name of the variable.
#
# source://rubocop-ast//lib/rubocop/ast/node/var_node.rb#10
def name; end
end
# source://rubocop-ast//lib/rubocop/ast/version.rb#5
module RuboCop::AST::Version; end
@ -7183,6 +7275,335 @@ class RuboCop::AST::YieldNode < ::RuboCop::AST::Node
def node_parts; end
end
class RuboCop::CommentConfig
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#34
def initialize(processed_source); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#63
def comment_only_line?(line_number); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def config(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#51
def cop_disabled_line_ranges; end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#39
def cop_enabled_at_line?(cop, line_number); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#47
def cop_opted_in?(cop); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#55
def extra_enabled_comments; end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#30
def processed_source; end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def registry(*_arg0, **_arg1, &_arg2); end
private
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#96
def analyze; end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#124
def analyze_cop(analysis, directive); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#144
def analyze_disabled(analysis, directive); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#155
def analyze_rest(analysis, directive); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#135
def analyze_single_line(analysis, directive); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#164
def cop_line_ranges(analysis); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#170
def each_directive; end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#69
def extra_enabled_comments_with_names(extras:, names:); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#190
def handle_enable_all(directive, names, extras); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#204
def handle_switch(directive, names, extras); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#115
def inject_disabled_cops_directives(analyses); end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#183
def non_comment_token_line_numbers; end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#83
def opt_in_cops; end
# source://rubocop/1.67.0/lib/rubocop/comment_config.rb#179
def qualified_cop_name(cop_name); end
end
class RuboCop::Config
# source://rubocop/1.67.0/lib/rubocop/config.rb#30
def initialize(hash = T.unsafe(nil), loaded_path = T.unsafe(nil)); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def [](*_arg0, **_arg1, &_arg2); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def []=(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#170
def active_support_extensions_enabled?; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#96
def add_excludes_from_higher_level(highest_config); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#197
def allowed_camel_case_file?(file); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#241
def base_dir_for_path_parameters; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#271
def bundler_lock_file_path; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#51
def check; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#142
def clusivity_config_for_badge?(badge); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def delete(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#108
def deprecation_check; end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def dig(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#162
def disabled_new_cops?; end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def each(*_arg0, **_arg1, &_arg2); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def each_key(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#166
def enabled_new_cops?; end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def fetch(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#219
def file_to_exclude?(file); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#178
def file_to_include?(file); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#158
def for_all_cops; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#128
def for_badge(badge); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#122
def for_cop(cop); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#153
def for_department(department_name); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#296
def gem_versions_in_target; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#300
def inspect; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#76
def internal?; end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def key?(*_arg0, **_arg1, &_arg2); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def keys(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#47
def loaded_features; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#20
def loaded_path; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#81
def make_excludes_absolute; end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def map(*_arg0, **_arg1, &_arg2); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def merge(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#251
def parser_engine; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#232
def path_relative_to_config(path); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#228
def patterns_to_exclude; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#224
def patterns_to_include; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#282
def pending_cops; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#211
def possibly_include_hidden?; end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def replace(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#71
def signature; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#266
def smart_loaded_path; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#174
def string_literals_frozen_by_default?; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#255
def target_rails_version; end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def target_ruby_version(*_arg0, **_arg1, &_arg2); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def to_h(*_arg0, **_arg1, &_arg2); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def to_hash(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#67
def to_s; end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def transform_values(*_arg0, **_arg1, &_arg2); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def validate(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#58
def validate_after_resolution; end
private
# source://rubocop/1.67.0/lib/rubocop/config.rb#350
def department_of(qualified_cop_name); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#338
def enable_cop?(qualified_cop_name, cop_options); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#325
def gem_version_to_major_minor_float(gem_version); end
# source://rubocop/1.67.0/lib/rubocop/config.rb#331
def read_gem_versions_from_target_lockfile; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#312
def read_rails_version_from_bundler_lock_file; end
# source://rubocop/1.67.0/lib/rubocop/config.rb#307
def target_rails_version_from_bundler_lock_file; end
class << self
# source://rubocop/1.67.0/lib/rubocop/config.rb#22
def create(hash, path, check: T.unsafe(nil)); end
end
end
class RuboCop::ConfigValidator
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#27
def initialize(config); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def for_all_cops(*_arg0, **_arg1, &_arg2); end
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9
def smart_loaded_path(*_arg0, **_arg1, &_arg2); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#63
def target_ruby_version; end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#33
def validate; end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#59
def validate_after_resolution; end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#67
def validate_section_presence(name); end
private
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#104
def alert_about_unrecognized_cops(invalid_cop_names); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#254
def check_cop_config_value(hash, parent = T.unsafe(nil)); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#77
def check_obsoletions; end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#84
def check_target_ruby; end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#195
def each_invalid_parameter(cop_name); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#120
def list_unknown_cops(invalid_cop_names); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#274
def param_error_message(parent, key, value, supposed_values); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#242
def reject_conflicting_safe_settings; end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#233
def reject_mutually_exclusive_defaults; end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#142
def suggestion(name); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#75
def target_ruby; end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#207
def validate_enforced_styles(valid_cop_names); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#169
def validate_new_cops_parameter; end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#180
def validate_parameter_names(valid_cop_names); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#227
def validate_support_and_has_list(name, formats, valid); end
# source://rubocop/1.67.0/lib/rubocop/config_validator.rb#158
def validate_syntax_cop; end
end
# Similar to `Forwardable#def_delegators`, but simpler & faster
#
# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#5

View File

@ -489,10 +489,10 @@ class RuboCop::Cop::RSpec::ChangeByZero < ::RuboCop::Cop::RSpec::Base
private
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#133
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#134
def autocorrect(corrector, node, change_node); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#140
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#141
def autocorrect_compound(corrector, node); end
# @return [Boolean]
@ -500,28 +500,28 @@ class RuboCop::Cop::RSpec::ChangeByZero < ::RuboCop::Cop::RSpec::Base
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#120
def compound_expectations?(node); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#150
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#151
def insert_operator(corrector, node, change_node); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#124
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#125
def message(change_node); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#128
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#129
def message_compound(change_node); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#174
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#175
def negated_matcher; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#178
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#179
def preferred_method; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#105
def register_offense(node, change_node); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#163
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#164
def remove_by_zero(corrector, node, change_node); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#159
# source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#160
def replace_node(node, change_node); end
end
@ -713,6 +713,9 @@ RuboCop::Cop::RSpec::ContextMethod::MSG = T.let(T.unsafe(nil), String)
# include `if`, `unless`, `for`, `before`, `after`, or `during`.
# They may consist of multiple words if desired.
#
# If both `Prefixes` and `AllowedPatterns` are empty, this cop will always
# report an offense. So you need to set at least one of them.
#
# This cop can be customized allowed context description pattern
# with `AllowedPatterns`. By default, there are no checking by pattern.
#
@ -754,41 +757,42 @@ RuboCop::Cop::RSpec::ContextMethod::MSG = T.let(T.unsafe(nil), String)
# end
# @see http://www.betterspecs.org/#contexts
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#58
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#61
class RuboCop::Cop::RSpec::ContextWording < ::RuboCop::Cop::RSpec::Base
include ::RuboCop::Cop::AllowedPattern
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#64
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#69
def context_wording(param0 = T.unsafe(nil)); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#68
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#73
def on_block(node); end
private
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#79
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#83
def allowed_patterns; end
# @return [Boolean]
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#87
def bad_pattern?(node); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#93
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#91
def description(context); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#101
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#107
def expect_patterns; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#83
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#99
def message; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#87
def prefix_regexes; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#111
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#117
def prefixes; end
end
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#61
RuboCop::Cop::RSpec::ContextWording::MSG = T.let(T.unsafe(nil), String)
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#65
RuboCop::Cop::RSpec::ContextWording::MSG_ALWAYS = T.let(T.unsafe(nil), String)
# source://rubocop-rspec//lib/rubocop/cop/rspec/context_wording.rb#64
RuboCop::Cop::RSpec::ContextWording::MSG_MATCH = T.let(T.unsafe(nil), String)
# Check that the first argument to the top-level describe is a constant.
#
@ -4010,7 +4014,7 @@ class RuboCop::Cop::RSpec::MultipleExpectations < ::RuboCop::Cop::RSpec::Base
# source://rubocop-rspec//lib/rubocop/cop/rspec/multiple_expectations.rb#86
def expect?(param0 = T.unsafe(nil)); end
# source://rubocop/1.66.1/lib/rubocop/cop/exclude_limit.rb#11
# source://rubocop/1.67.0/lib/rubocop/cop/exclude_limit.rb#11
def max=(value); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/multiple_expectations.rb#93
@ -4125,7 +4129,7 @@ RuboCop::Cop::RSpec::MultipleExpectations::TRUE_NODE = T.let(T.unsafe(nil), Proc
class RuboCop::Cop::RSpec::MultipleMemoizedHelpers < ::RuboCop::Cop::RSpec::Base
include ::RuboCop::Cop::RSpec::Variable
# source://rubocop/1.66.1/lib/rubocop/cop/exclude_limit.rb#11
# source://rubocop/1.67.0/lib/rubocop/cop/exclude_limit.rb#11
def max=(value); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/multiple_memoized_helpers.rb#91
@ -4467,7 +4471,7 @@ end
class RuboCop::Cop::RSpec::NestedGroups < ::RuboCop::Cop::RSpec::Base
include ::RuboCop::Cop::RSpec::TopLevelGroup
# source://rubocop/1.66.1/lib/rubocop/cop/exclude_limit.rb#11
# source://rubocop/1.67.0/lib/rubocop/cop/exclude_limit.rb#11
def max=(value); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/nested_groups.rb#107
@ -6958,7 +6962,7 @@ class RuboCop::Cop::RSpec::VoidExpect < ::RuboCop::Cop::RSpec::Base
# source://rubocop-rspec//lib/rubocop/cop/rspec/void_expect.rb#26
def expect_block?(param0 = T.unsafe(nil)); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/void_expect.rb#36
# source://rubocop-rspec//lib/rubocop/cop/rspec/void_expect.rb#37
def on_block(node); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/void_expect.rb#30
@ -6966,12 +6970,17 @@ class RuboCop::Cop::RSpec::VoidExpect < ::RuboCop::Cop::RSpec::Base
private
# source://rubocop-rspec//lib/rubocop/cop/rspec/void_expect.rb#44
# source://rubocop-rspec//lib/rubocop/cop/rspec/void_expect.rb#46
def check_expect(node); end
# @return [Boolean]
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/void_expect.rb#50
# source://rubocop-rspec//lib/rubocop/cop/rspec/void_expect.rb#59
def inside_example?(node); end
# @return [Boolean]
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/void_expect.rb#52
def void?(expect); end
end

View File

@ -55,7 +55,7 @@ module RBI; end
# source://tapioca//lib/tapioca/rbi_ext/model.rb#5
class RBI::Tree < ::RBI::NodeWithComments
# source://rbi/0.2.0/lib/rbi/model.rb#121
# source://rbi/0.2.1/lib/rbi/model.rb#121
sig do
params(
loc: T.nilable(::RBI::Loc),
@ -65,15 +65,15 @@ class RBI::Tree < ::RBI::NodeWithComments
end
def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
# source://rbi/0.2.0/lib/rbi/model.rb#128
# source://rbi/0.2.1/lib/rbi/model.rb#128
sig { params(node: ::RBI::Node).void }
def <<(node); end
# source://rbi/0.2.0/lib/rbi/rewriters/add_sig_templates.rb#66
# source://rbi/0.2.1/lib/rbi/rewriters/add_sig_templates.rb#66
sig { params(with_todo_comment: T::Boolean).void }
def add_sig_templates!(with_todo_comment: T.unsafe(nil)); end
# source://rbi/0.2.0/lib/rbi/rewriters/annotate.rb#49
# source://rbi/0.2.1/lib/rbi/rewriters/annotate.rb#49
sig { params(annotation: ::String, annotate_scopes: T::Boolean, annotate_properties: T::Boolean).void }
def annotate!(annotation, annotate_scopes: T.unsafe(nil), annotate_properties: T.unsafe(nil)); end
@ -138,35 +138,35 @@ class RBI::Tree < ::RBI::NodeWithComments
end
def create_type_variable(name, type:, variance: T.unsafe(nil), fixed: T.unsafe(nil), upper: T.unsafe(nil), lower: T.unsafe(nil)); end
# source://rbi/0.2.0/lib/rbi/rewriters/deannotate.rb#41
# source://rbi/0.2.1/lib/rbi/rewriters/deannotate.rb#41
sig { params(annotation: ::String).void }
def deannotate!(annotation); end
# source://rbi/0.2.0/lib/rbi/model.rb#134
# source://rbi/0.2.1/lib/rbi/model.rb#134
sig { returns(T::Boolean) }
def empty?; end
# source://rbi/0.2.0/lib/rbi/rewriters/filter_versions.rb#118
# source://rbi/0.2.1/lib/rbi/rewriters/filter_versions.rb#118
sig { params(version: ::Gem::Version).void }
def filter_versions!(version); end
# source://rbi/0.2.0/lib/rbi/rewriters/flatten_singleton_methods.rb#60
# source://rbi/0.2.1/lib/rbi/rewriters/flatten_singleton_methods.rb#60
sig { void }
def flatten_singleton_methods!; end
# source://rbi/0.2.0/lib/rbi/rewriters/flatten_visibilities.rb#60
# source://rbi/0.2.1/lib/rbi/rewriters/flatten_visibilities.rb#60
sig { void }
def flatten_visibilities!; end
# source://rbi/0.2.0/lib/rbi/rewriters/group_nodes.rb#81
# source://rbi/0.2.1/lib/rbi/rewriters/group_nodes.rb#81
sig { void }
def group_nodes!; end
# source://rbi/0.2.0/lib/rbi/index.rb#68
# source://rbi/0.2.1/lib/rbi/index.rb#68
sig { returns(::RBI::Index) }
def index; end
# source://rbi/0.2.0/lib/rbi/rewriters/merge_trees.rb#324
# source://rbi/0.2.1/lib/rbi/rewriters/merge_trees.rb#324
sig do
params(
other: ::RBI::Tree,
@ -177,27 +177,27 @@ class RBI::Tree < ::RBI::NodeWithComments
end
def merge(other, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
# source://rbi/0.2.0/lib/rbi/rewriters/nest_non_public_members.rb#46
# source://rbi/0.2.1/lib/rbi/rewriters/nest_non_public_members.rb#46
sig { void }
def nest_non_public_members!; end
# source://rbi/0.2.0/lib/rbi/rewriters/nest_singleton_methods.rb#36
# source://rbi/0.2.1/lib/rbi/rewriters/nest_singleton_methods.rb#36
sig { void }
def nest_singleton_methods!; end
# source://rbi/0.2.0/lib/rbi/rewriters/nest_top_level_members.rb#63
# source://rbi/0.2.1/lib/rbi/rewriters/nest_top_level_members.rb#63
sig { void }
def nest_top_level_members!; end
# source://rbi/0.2.0/lib/rbi/model.rb#112
# source://rbi/0.2.1/lib/rbi/model.rb#112
sig { returns(T::Array[::RBI::Node]) }
def nodes; end
# source://rbi/0.2.0/lib/rbi/rewriters/attr_to_methods.rb#53
# source://rbi/0.2.1/lib/rbi/rewriters/attr_to_methods.rb#53
sig { void }
def replace_attributes_with_methods!; end
# source://rbi/0.2.0/lib/rbi/rewriters/sort_nodes.rb#119
# source://rbi/0.2.1/lib/rbi/rewriters/sort_nodes.rb#119
sig { void }
def sort_nodes!; end
@ -218,7 +218,7 @@ class RBI::TypedParam < ::T::Struct
const :type, ::String
class << self
# source://sorbet-runtime/0.5.11589/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11641/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -1141,7 +1141,7 @@ class Tapioca::ConfigHelper::ConfigError < ::T::Struct
const :message_parts, T::Array[::Tapioca::ConfigHelper::ConfigErrorMessagePart]
class << self
# source://sorbet-runtime/0.5.11589/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11641/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -1152,7 +1152,7 @@ class Tapioca::ConfigHelper::ConfigErrorMessagePart < ::T::Struct
const :colors, T::Array[::Symbol]
class << self
# source://sorbet-runtime/0.5.11589/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11641/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2221,7 +2221,7 @@ class Tapioca::GemInfo < ::T::Struct
sig { params(spec: ::Bundler::LazySpecification).returns(::Tapioca::GemInfo) }
def from_spec(spec); end
# source://sorbet-runtime/0.5.11589/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11641/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2736,7 +2736,7 @@ module Tapioca::RBIHelper
sig { params(name: ::String).returns(T::Boolean) }
def valid_method_name?(name); end
# source://tapioca//lib/tapioca/helpers/rbi_helper.rb#123
# source://tapioca//lib/tapioca/helpers/rbi_helper.rb#114
sig { params(name: ::String).returns(T::Boolean) }
def valid_parameter_name?(name); end
@ -2955,7 +2955,7 @@ module Tapioca::Runtime::Reflection
extend ::Tapioca::Runtime::AttachedClassOf
extend ::Tapioca::Runtime::Reflection
# source://tapioca//lib/tapioca/runtime/reflection.rb#201
# source://tapioca//lib/tapioca/runtime/reflection.rb#207
sig { params(constant: ::Module).returns(T.untyped) }
def abstract_type_of(constant); end
@ -3008,11 +3008,11 @@ module Tapioca::Runtime::Reflection
end
def descendants_of(klass); end
# source://tapioca//lib/tapioca/runtime/reflection.rb#194
# source://tapioca//lib/tapioca/runtime/reflection.rb#200
sig { params(constant: ::Module).returns(T::Set[::String]) }
def file_candidates_for(constant); end
# source://tapioca//lib/tapioca/runtime/reflection.rb#207
# source://tapioca//lib/tapioca/runtime/reflection.rb#213
sig { params(constant: ::Module).returns(T::Boolean) }
def final_module?(constant); end
@ -3053,14 +3053,15 @@ module Tapioca::Runtime::Reflection
def qualified_name_of(constant); end
# Examines the call stack to identify the closest location where a "require" is performed
# by searching for the label "<top (required)>". If none is found, it returns the location
# by searching for the label "<top (required)>" or "block in <class:...>" in the
# case of an ActiveSupport.on_load hook. If none is found, it returns the location
# labeled "<main>", which is the original call site.
#
# source://tapioca//lib/tapioca/runtime/reflection.rb#184
# source://tapioca//lib/tapioca/runtime/reflection.rb#185
sig { params(locations: T.nilable(T::Array[::Thread::Backtrace::Location])).returns(::String) }
def resolve_loc(locations); end
# source://tapioca//lib/tapioca/runtime/reflection.rb#212
# source://tapioca//lib/tapioca/runtime/reflection.rb#218
sig { params(constant: ::Module).returns(T::Boolean) }
def sealed_module?(constant); end
@ -3082,23 +3083,23 @@ module Tapioca::Runtime::Reflection
private
# source://tapioca//lib/tapioca/runtime/reflection.rb#249
# source://tapioca//lib/tapioca/runtime/reflection.rb#255
sig { params(parent: ::Module, name: ::String).returns(T.nilable(::Module)) }
def child_module_for_parent_with_name(parent, name); end
# source://tapioca//lib/tapioca/runtime/reflection.rb#265
# source://tapioca//lib/tapioca/runtime/reflection.rb#271
sig { params(name: ::String).returns(T::Boolean) }
def has_aliased_namespace?(name); end
# source://tapioca//lib/tapioca/runtime/reflection.rb#260
# source://tapioca//lib/tapioca/runtime/reflection.rb#266
sig { params(method: ::UnboundMethod).returns(T::Boolean) }
def method_defined_by_forwardable_module?(method); end
# source://tapioca//lib/tapioca/runtime/reflection.rb#235
# source://tapioca//lib/tapioca/runtime/reflection.rb#241
sig { params(constant: ::Module).returns(T::Array[::UnboundMethod]) }
def methods_for(constant); end
# source://tapioca//lib/tapioca/runtime/reflection.rb#219
# source://tapioca//lib/tapioca/runtime/reflection.rb#225
sig { params(constant: ::Module).returns(T::Array[::UnboundMethod]) }
def relevant_methods_for(constant); end
end

View File

@ -7,6 +7,7 @@ dependency_require_map = {
}.freeze
additional_requires_map = {
"parser" => ["parser/current"],
"rubocop-rspec" => ["rubocop/rspec/expect_offense"],
}.freeze

View File

@ -524,7 +524,7 @@ class Tap
Commands.rebuild_commands_completion_list
link_completions_and_manpages
formatted_contents = contents.presence&.to_sentence&.dup&.prepend(" ")
formatted_contents = contents.presence&.to_sentence&.prepend(" ")
$stderr.puts "Tapped#{formatted_contents} (#{path.abv})." unless quiet
require "description_cache_store"
@ -622,7 +622,7 @@ class Tap
$stderr.puts "Untapping #{name}..."
abv = path.abv
formatted_contents = contents.presence&.to_sentence&.dup&.prepend(" ")
formatted_contents = contents.presence&.to_sentence&.prepend(" ")
require "description_cache_store"
CacheStoreDatabase.use(:descriptions) do |db|
@ -1116,6 +1116,8 @@ class Tap
return false unless list.include? formula_or_cask
return list[formula_or_cask] if value.blank?
return list[formula_or_cask].include?(value) if list[formula_or_cask].is_a?(Array)
list[formula_or_cask] == value
end
end

View File

@ -16,7 +16,7 @@ require "cli/parser"
require "dev-cmd/test"
require "json/add/exception"
TEST_TIMEOUT_SECONDS = 5 * 60
DEFAULT_TEST_TIMEOUT_SECONDS = 5 * 60
begin
ENV.delete("HOMEBREW_FORBID_PACKAGES_FROM_PATHS")
@ -49,7 +49,9 @@ begin
if args.debug? # --debug is interactive
run_test.call
else
Timeout.timeout(TEST_TIMEOUT_SECONDS, &run_test)
# HOMEBREW_TEST_TIMEOUT_SECS is private API and subject to change.
timeout = ENV["HOMEBREW_TEST_TIMEOUT_SECS"]&.to_i || DEFAULT_TEST_TIMEOUT_SECONDS
Timeout.timeout(timeout, &run_test)
end
rescue Exception => e # rubocop:disable Lint/RescueException
error_pipe.puts e.to_json

View File

@ -71,10 +71,6 @@ RSpec.describe Cask::Config, :cask do
it "returns array of preferred languages" do
expect(config.explicit[:languages]).to eq(["zh-TW", "en"])
end
it "returns string of explicit config keys and values" do
expect(config.explicit_s).to eq('appdir: "/explicit/path/to/apps", language: "zh-TW,en"')
end
end
context "when installing a cask and then adding a global default dir" do

View File

@ -49,7 +49,7 @@ RSpec.describe Language::Python::Virtualenv, :needs_python do
f.libexec, "python", { system_site_packages: true, without_pip: true }
).and_return(venv)
expect(venv).to receive(:pip_install).with([r_a, r_b, r_c, r_d])
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false })
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true })
f.virtualenv_install_with_resources(using: "python")
end
@ -58,21 +58,21 @@ RSpec.describe Language::Python::Virtualenv, :needs_python do
f.libexec, "python3.12", { system_site_packages: true, without_pip: true }
).and_return(venv)
expect(venv).to receive(:pip_install).with([r_a, r_b, r_c, r_d])
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false })
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true })
f.virtualenv_install_with_resources(using: "python@3.12")
end
it "skips a `without` resource string and installs remaining resources in order" do
expect(f).to receive(:virtualenv_create).and_return(venv)
expect(venv).to receive(:pip_install).with([r_a, r_b, r_d])
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false })
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true })
f.virtualenv_install_with_resources(using: "python", without: r_c.name)
end
it "skips all resources in `without` array and installs remaining resources in order" do
expect(f).to receive(:virtualenv_create).and_return(venv)
expect(venv).to receive(:pip_install).with([r_b, r_c])
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false })
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true })
f.virtualenv_install_with_resources(using: "python", without: [r_d.name, r_a.name])
end
@ -91,14 +91,14 @@ RSpec.describe Language::Python::Virtualenv, :needs_python do
it "installs a `start_with` resource string and then remaining resources in order" do
expect(f).to receive(:virtualenv_create).and_return(venv)
expect(venv).to receive(:pip_install).with([r_c, r_a, r_b, r_d])
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false })
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true })
f.virtualenv_install_with_resources(using: "python", start_with: r_c.name)
end
it "installs all resources in `start_with` array and then remaining resources in order" do
expect(f).to receive(:virtualenv_create).and_return(venv)
expect(venv).to receive(:pip_install).with([r_d, r_b, r_a, r_c])
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false })
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true })
f.virtualenv_install_with_resources(using: "python", start_with: [r_d.name, r_b.name])
end
@ -117,14 +117,14 @@ RSpec.describe Language::Python::Virtualenv, :needs_python do
it "installs an `end_with` resource string as last resource" do
expect(f).to receive(:virtualenv_create).and_return(venv)
expect(venv).to receive(:pip_install).with([r_a, r_c, r_d, r_b])
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false })
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true })
f.virtualenv_install_with_resources(using: "python", end_with: r_b.name)
end
it "installs all resources in `end_with` array after other resources are installed" do
expect(f).to receive(:virtualenv_create).and_return(venv)
expect(venv).to receive(:pip_install).with([r_a, r_d, r_c, r_b])
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false })
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true })
f.virtualenv_install_with_resources(using: "python", end_with: [r_c.name, r_b.name])
end
@ -143,7 +143,7 @@ RSpec.describe Language::Python::Virtualenv, :needs_python do
it "installs resources in correct order when combining `without`, `start_with` and `end_with" do
expect(f).to receive(:virtualenv_create).and_return(venv)
expect(venv).to receive(:pip_install).with([r_d, r_c, r_b])
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false })
expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true })
f.virtualenv_install_with_resources(using: "python", without: r_a.name,
start_with: r_d.name, end_with: r_b.name)
end
@ -254,7 +254,7 @@ RSpec.describe Language::Python::Virtualenv, :needs_python do
expect(virtualenv).to receive(:pip_install).with("foo", { build_isolation: true })
expect(Dir).to receive(:[]).with(src_bin/"*").twice.and_return(bin_before, bin_after)
virtualenv.pip_install_and_link "foo"
virtualenv.pip_install_and_link("foo", link_manpages: false)
expect(src_bin/"kilroy").to exist
expect(dest_bin/"kilroy").to exist

View File

@ -36,6 +36,15 @@ RSpec.describe Homebrew::Livecheck do
end
end
let(:f_stable_url_only) do
stable_url_s = stable_url
formula("test_stable_url_only") do
desc "Test formula with only a stable URL"
url stable_url_s
end
end
let(:r) { f.resources.first }
let(:c) do
@ -56,6 +65,17 @@ RSpec.describe Homebrew::Livecheck do
RUBY
end
let(:c_no_checkable_urls) do
Cask::CaskLoader.load(+<<-RUBY)
cask "test_no_checkable_urls" do
version "1.2.3"
name "Test"
desc "Test cask with no checkable URLs"
end
RUBY
end
describe "::resolve_livecheck_reference" do
context "when a formula/cask has a livecheck block without formula/cask methods" do
it "returns [nil, []]" do
@ -167,9 +187,35 @@ RSpec.describe Homebrew::Livecheck do
end
it "returns nil when not given a string or valid symbol" do
expect(livecheck.livecheck_url_to_string(:invalid_symbol, f_livecheck_url)).to be_nil
expect(livecheck.livecheck_url_to_string(:invalid_symbol, c_livecheck_url)).to be_nil
expect(livecheck.livecheck_url_to_string(:invalid_symbol, r_livecheck_url)).to be_nil
error_text = "`url :%<symbol>s` does not reference a checkable URL"
# Invalid symbol in any context
expect { livecheck.livecheck_url_to_string(:invalid_symbol, f_livecheck_url) }
.to raise_error(ArgumentError, format(error_text, symbol: :invalid_symbol))
expect { livecheck.livecheck_url_to_string(:invalid_symbol, c_livecheck_url) }
.to raise_error(ArgumentError, format(error_text, symbol: :invalid_symbol))
expect { livecheck.livecheck_url_to_string(:invalid_symbol, r_livecheck_url) }
.to raise_error(ArgumentError, format(error_text, symbol: :invalid_symbol))
# Valid symbol in provided context but referenced URL is not present
expect { livecheck.livecheck_url_to_string(:head, f_stable_url_only) }
.to raise_error(ArgumentError, format(error_text, symbol: :head))
expect { livecheck.livecheck_url_to_string(:homepage, f_stable_url_only) }
.to raise_error(ArgumentError, format(error_text, symbol: :homepage))
expect { livecheck.livecheck_url_to_string(:homepage, c_no_checkable_urls) }
.to raise_error(ArgumentError, format(error_text, symbol: :homepage))
expect { livecheck.livecheck_url_to_string(:url, c_no_checkable_urls) }
.to raise_error(ArgumentError, format(error_text, symbol: :url))
# Valid symbol but not in the provided context
expect { livecheck.livecheck_url_to_string(:head, c_livecheck_url) }
.to raise_error(ArgumentError, format(error_text, symbol: :head))
expect { livecheck.livecheck_url_to_string(:homepage, r_livecheck_url) }
.to raise_error(ArgumentError, format(error_text, symbol: :homepage))
expect { livecheck.livecheck_url_to_string(:stable, c_livecheck_url) }
.to raise_error(ArgumentError, format(error_text, symbol: :stable))
expect { livecheck.livecheck_url_to_string(:url, f_livecheck_url) }
.to raise_error(ArgumentError, format(error_text, symbol: :url))
end
end
@ -189,6 +235,8 @@ RSpec.describe Homebrew::Livecheck do
expect(livecheck.checkable_urls(c)).to eq([cask_url, homepage_url])
expect(livecheck.checkable_urls(r)).to eq([resource_url])
expect(livecheck.checkable_urls(f_duplicate_urls)).to eq([stable_url, head_url])
expect(livecheck.checkable_urls(f_stable_url_only)).to eq([stable_url])
expect(livecheck.checkable_urls(c_no_checkable_urls)).to eq([])
end
end

View File

@ -7,6 +7,18 @@ RSpec.describe MacOSVersion do
let(:big_sur_major) { described_class.new("11.0") }
let(:big_sur_update) { described_class.new("11.1") }
describe ".kernel_major_version" do
it "returns the kernel major version" do
expect(described_class.kernel_major_version(version)).to eq "18"
expect(described_class.kernel_major_version(big_sur_major)).to eq "20"
expect(described_class.kernel_major_version(big_sur_update)).to eq "20"
end
it "matches the major version returned by OS.kernel_version", :needs_macos do
expect(described_class.kernel_major_version(OS::Mac.version)).to eq OS.kernel_version.major
end
end
specify "comparison with Symbol" do
expect(version).to be > :high_sierra
expect(version).to eq :mojave

View File

@ -11,11 +11,13 @@ RSpec.describe "patching", type: :system do
TESTBALL_PATCHES_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1-patches.tgz".freeze
PATCH_URL_A = "file://#{TEST_FIXTURE_DIR}/patches/noop-a.diff".freeze
PATCH_URL_B = "file://#{TEST_FIXTURE_DIR}/patches/noop-b.diff".freeze
PATCH_URL_D = "file://#{TEST_FIXTURE_DIR}/patches/noop-d.diff".freeze
PATCH_A_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-a.diff").freeze
PATCH_B_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-b.diff").freeze
APPLY_A = "noop-a.diff"
APPLY_B = "noop-b.diff"
APPLY_C = "noop-c.diff"
APPLY_D = "noop-d.diff"
# rubocop:enable RSpec/LeakyConstantDeclaration,Lint/ConstantDefinitionInBlock
url TESTBALL_URL
@ -39,6 +41,18 @@ RSpec.describe "patching", type: :system do
end
end
matcher :be_patched_with_homebrew_prefix do
match do |formula|
formula.brew do
formula.patch
s = File.read("libexec/NOOP")
expect(s).not_to include("NOOP"), "libexec/NOOP was not patched as expected"
expect(s).not_to include("@@HOMEBREW_PREFIX@@"), "libexec/NOOP was not patched as expected"
expect(s).to include(HOMEBREW_PREFIX.to_s), "libexec/NOOP was not patched as expected"
end
end
end
matcher :have_its_resource_patched do
match do |formula|
formula.brew do
@ -226,6 +240,17 @@ RSpec.describe "patching", type: :system do
end
f.brew { |formula, _staging| formula.patch }
end.to raise_error(BuildError)
end.to raise_error(Errno::ENOENT)
end
specify "patch_dsl_with_homebrew_prefix" do
expect(
formula do
patch do
url PATCH_URL_D
sha256 PATCH_D_SHA256
end
end,
).to be_patched_with_homebrew_prefix
end
end

View File

@ -19,7 +19,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::ShellVariables do
expect_correction(<<~RUBY)
class Foo < Formula
def install
Utils.popen { "SHELL" => "bash" }, "foo"
Utils.popen({ "SHELL" => "bash" }, "foo")
end
end
RUBY
@ -38,7 +38,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::ShellVariables do
expect_correction(<<~RUBY)
class Foo < Formula
def install
Utils.safe_popen_read { "SHELL" => "bash" }, "foo"
Utils.safe_popen_read({ "SHELL" => "bash" }, "foo")
end
end
RUBY
@ -57,7 +57,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::ShellVariables do
expect_correction(<<~RUBY)
class Foo < Formula
def install
Utils.safe_popen_write { "SHELL" => "bash" }, "foo"
Utils.safe_popen_write({ "SHELL" => "bash" }, "foo")
end
end
RUBY
@ -76,7 +76,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::ShellVariables do
expect_correction(<<~RUBY)
class Foo < Formula
def install
Utils.popen { "SHELL" => "bash" }, "\#{bin}/foo"
Utils.popen({ "SHELL" => "bash" }, "\#{bin}/foo")
end
end
RUBY

View File

@ -10,10 +10,14 @@ if ENV["HOMEBREW_TESTS_COVERAGE"]
]
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters)
if RUBY_PLATFORM[/darwin/] && ENV["TEST_ENV_NUMBER"]
# Needed for outputting coverage reporting only once for parallel_tests.
# Otherwise, "Coverage report generated" will get spammed for each process.
if ENV["TEST_ENV_NUMBER"]
SimpleCov.at_exit do
result = SimpleCov.result
result.format! if ParallelTests.number_of_running_processes <= 1
# `SimpleCov.result` calls `ParallelTests.wait_for_other_processes_to_finish`
# internally for you on the last process.
result.format! if ParallelTests.last_process?
end
end
end

View File

@ -0,0 +1,10 @@
diff --git a/libexec/NOOP b/libexec/NOOP
index bfdda4c..e08d8f4 100755
--- a/libexec/NOOP
+++ b/libexec/NOOP
@@ -1,2 +1,2 @@
#!/bin/bash
-echo NOOP
\ No newline at end of file
+echo @@HOMEBREW_PREFIX@@
\ No newline at end of file

View File

@ -47,5 +47,6 @@ TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda865300270
TESTBALL_PATCHES_SHA256 = "799c2d551ac5c3a5759bea7796631a7906a6a24435b52261a317133a0bfb34d9"
PATCH_A_SHA256 = "83404f4936d3257e65f176c4ffb5a5b8d6edd644a21c8d8dcc73e22a6d28fcfa"
PATCH_B_SHA256 = "57958271bb802a59452d0816e0670d16c8b70bdf6530bcf6f78726489ad89b90"
PATCH_D_SHA256 = "07c72c4463339e6e2ce235f3b26e316d4940017bf4b5236e27e757a44d67636c"
TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"

View File

@ -3,8 +3,6 @@
require_relative "shared_examples"
RSpec.describe UnpackStrategy::Directory do
subject(:strategy) { described_class.new(path) }
let(:path) do
mktmpdir.tap do |path|
FileUtils.touch path/"file"
@ -17,33 +15,100 @@ RSpec.describe UnpackStrategy::Directory do
let(:unpack_dir) { mktmpdir }
it "does not follow symlinks" do
strategy.extract(to: unpack_dir)
expect(unpack_dir/"symlink").to be_a_symlink
shared_examples "extract directory" do |move:|
subject(:strategy) { described_class.new(path, move:) }
it "does not follow symlinks" do
strategy.extract(to: unpack_dir)
expect(unpack_dir/"symlink").to be_a_symlink
end
it "does not follow top level symlinks to directories" do
strategy.extract(to: unpack_dir)
expect(unpack_dir/"folderSymlink").to be_a_symlink
end
it "preserves permissions of contained files" do
FileUtils.chmod 0644, path/"file"
strategy.extract(to: unpack_dir)
expect((unpack_dir/"file").stat.mode & 0777).to eq 0644
end
it "preserves permissions of contained subdirectories" do
FileUtils.mkdir unpack_dir/"folder"
FileUtils.chmod 0755, unpack_dir/"folder"
FileUtils.chmod 0700, path/"folder"
strategy.extract(to: unpack_dir)
expect((unpack_dir/"folder").stat.mode & 0777).to eq 0700
end
it "preserves permissions of the destination directory" do
FileUtils.chmod 0700, path
FileUtils.chmod 0755, unpack_dir
strategy.extract(to: unpack_dir)
expect(unpack_dir.stat.mode & 0777).to eq 0755
end
it "preserves mtime of contained files and directories" do
FileUtils.mkdir unpack_dir/"folder"
FileUtils.touch path/"folder", mtime: Time.utc(2000, 1, 2, 3, 4, 5, 678999), nocreate: true
mtimes = path.children.to_h { |child| [child.basename, child.lstat.mtime] }
strategy.extract(to: unpack_dir)
expect(unpack_dir.children.to_h { |child| [child.basename, child.lstat.mtime] }).to eq mtimes
end
it "preserves unrelated destination files and subdirectories" do
FileUtils.touch unpack_dir/"existing_file"
FileUtils.mkdir unpack_dir/"existing_folder"
strategy.extract(to: unpack_dir)
expect(unpack_dir/"existing_file").to be_a_file
expect(unpack_dir/"existing_folder").to be_a_directory
end
it "overwrites destination files/symlinks with source files/symlinks" do
FileUtils.mkdir unpack_dir/"existing_folder"
FileUtils.ln_s unpack_dir/"existing_folder", unpack_dir/"symlink"
(unpack_dir/"file").write "existing contents"
strategy.extract(to: unpack_dir)
expect((unpack_dir/"file").read).to be_empty
expect((unpack_dir/"symlink").readlink).to eq Pathname("file")
end
it "fails when overwriting a directory with a file" do
FileUtils.mkdir unpack_dir/"file"
expect { strategy.extract(to: unpack_dir) }.to raise_error(/Is a directory|cannot overwrite directory/i)
end
it "fails when overwriting a nested directory with a file" do
FileUtils.touch path/"folder/nested"
FileUtils.mkdir_p unpack_dir/"folder/nested"
expect { strategy.extract(to: unpack_dir) }.to raise_error(/Is a directory|cannot overwrite directory/i)
end
end
it "does not follow top level symlinks to directories" do
strategy.extract(to: unpack_dir)
expect(unpack_dir/"folderSymlink").to be_a_symlink
context "with `move: false`" do
include_examples "extract directory", move: false
end
it "preserves hardlinks" do
strategy.extract(to: unpack_dir)
expect((unpack_dir/"file").stat.ino).to eq (unpack_dir/"hardlink").stat.ino
end
context "with `move: true`" do
include_examples "extract directory", move: true
it "preserves permissions of contained files" do
FileUtils.chmod 0644, path/"file"
it "preserves hardlinks" do
strategy.extract(to: unpack_dir)
expect((unpack_dir/"file").stat.ino).to eq (unpack_dir/"hardlink").stat.ino
end
strategy.extract(to: unpack_dir)
expect((unpack_dir/"file").stat.mode & 0777).to eq 0644
end
it "preserves the permissions of the destination directory" do
FileUtils.chmod 0700, path
FileUtils.chmod 0755, unpack_dir
strategy.extract(to: unpack_dir)
expect(unpack_dir.stat.mode & 0777).to eq 0755
# NOTE: We don't test `move: false` because system cp behaviour is inconsistent,
# e.g. Ventura cp does not error but Sequoia and Linux cp will error
it "fails when overwriting a file with a directory" do
FileUtils.touch unpack_dir/"folder"
expect { strategy.extract(to: unpack_dir) }.to raise_error(/cannot overwrite non-directory/i)
end
end
end

View File

@ -11,49 +11,42 @@ RSpec.describe Utils::Inreplace do
a
b
c
aa
EOS
end
after { file.unlink }
it "raises error if there are no files given to replace" do
expect do
described_class.inreplace [], "d", "f"
end.to raise_error(Utils::Inreplace::Error)
end
it "raises error if there is nothing to replace" do
expect do
described_class.inreplace file.path, "d", "f"
end.to raise_error(Utils::Inreplace::Error)
end
it "raises error if there is nothing to replace in block form" do
expect do
described_class.inreplace(file.path) do |s|
s.gsub!("d", "f") # rubocop:disable Performance/StringReplacement
end
end.to raise_error(Utils::Inreplace::Error)
end
it "raises error if there is no make variables to replace" do
expect do
described_class.inreplace(file.path) do |s|
s.change_make_var! "VAR", "value"
s.remove_make_var! "VAR2"
end
end.to raise_error(Utils::Inreplace::Error)
end
describe "#inreplace_pairs" do
it "raises error if there is no old value" do
describe ".inreplace" do
it "raises error if there are no files given to replace" do
expect do
described_class.inreplace_pairs(file.path, [[nil, "f"]])
described_class.inreplace [], "d", "f"
end.to raise_error(Utils::Inreplace::Error)
end
it "raises error if there is nothing to replace" do
expect do
described_class.inreplace file.path, "d", "f"
end.to raise_error(Utils::Inreplace::Error)
end
it "raises error if there is nothing to replace in block form" do
expect do
described_class.inreplace(file.path) do |s|
s.gsub!("d", "f") # rubocop:disable Performance/StringReplacement
end
end.to raise_error(Utils::Inreplace::Error)
end
it "raises error if there is no make variables to replace" do
expect do
described_class.inreplace(file.path) do |s|
s.change_make_var! "VAR", "value"
s.remove_make_var! "VAR2"
end
end.to raise_error(Utils::Inreplace::Error)
end
end
describe "#gsub!" do
it "substitutes pathname within file" do
# For a specific instance of this, see https://github.com/Homebrew/homebrew-core/blob/a8b0b10/Formula/loki.rb#L48
described_class.inreplace(file.path) do |s|
@ -63,7 +56,74 @@ RSpec.describe Utils::Inreplace do
a
f
c
aa
EOS
end
it "substitutes all occurrences within file when `global: true`" do
described_class.inreplace(file.path, "a", "foo")
expect(File.binread(file)).to eq <<~EOS
foo
b
c
foofoo
EOS
end
it "substitutes only the first occurrence when `global: false`" do
described_class.inreplace(file.path, "a", "foo", global: false)
expect(File.binread(file)).to eq <<~EOS
foo
b
c
aa
EOS
end
end
describe ".inreplace_pairs" do
it "raises error if there is no old value" do
expect do
described_class.inreplace_pairs(file.path, [[nil, "f"]])
end.to raise_error(Utils::Inreplace::Error)
end
it "substitutes returned string but not file when `read_only_run: true`" do
expect(described_class.inreplace_pairs(file.path, [["a", "foo"]], read_only_run: true)).to eq <<~EOS
foo
b
c
foofoo
EOS
expect(File.binread(file)).to eq <<~EOS
a
b
c
aa
EOS
end
it "substitutes both returned string and file when `read_only_run: false`" do
replace_result = <<~TEXT
foo
b
c
foofoo
TEXT
expect(described_class.inreplace_pairs(file.path, [["a", "foo"]])).to eq replace_result
expect(File.binread(file)).to eq replace_result
end
it "substitutes multiple pairs in order" do
pairs = [["a", "b"], ["bb", "test"], ["b", "z"]]
replace_result = <<~TEXT
z
z
c
test
TEXT
expect(described_class.inreplace_pairs(file.path, pairs)).to eq replace_result
expect(File.binread(file)).to eq replace_result
end
end
end

View File

@ -249,12 +249,20 @@ RSpec.describe StringInreplaceExtension do
it "replaces the first occurrence" do
string_extension.sub!("o", "e")
expect(string_extension.inreplace_string).to eq("feo")
expect(string_extension.errors).to be_empty
end
it "adds an error to #errors when no replacement was made" do
string_extension.sub! "not here", "test"
expect(string_extension.inreplace_string).to eq(string)
expect(string_extension.errors).to eq(['expected replacement of "not here" with "test"'])
end
it "doesn't add an error to #errors when no replace was made and `audit_result: false`" do
string_extension.sub! "not here", "test", audit_result: false
expect(string_extension.inreplace_string).to eq(string)
expect(string_extension.errors).to be_empty
end
end
describe "#gsub!" do

View File

@ -183,7 +183,7 @@ module UnpackStrategy
FileUtils.chmod "u+w", path, verbose:
end
Directory.new(tmp_unpack_dir).extract(to:, verbose:)
Directory.new(tmp_unpack_dir, move: true).extract(to:, verbose:)
end
end

View File

@ -16,33 +16,56 @@ module UnpackStrategy
path.directory?
end
sig {
params(
path: T.any(String, Pathname),
ref_type: T.nilable(Symbol),
ref: T.nilable(String),
merge_xattrs: T::Boolean,
move: T::Boolean,
).void
}
def initialize(path, ref_type: nil, ref: nil, merge_xattrs: false, move: false)
super(path, ref_type:, ref:, merge_xattrs:)
@move = move
end
private
sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).void }
def extract_to_dir(unpack_dir, basename:, verbose:)
move_to_dir(unpack_dir, verbose:) if @move
path_children = path.children
return if path_children.empty?
existing = unpack_dir.children
system_command!("cp", args: ["-pR", *path_children, unpack_dir], verbose:)
end
# We run a few cp attempts in the following order:
#
# 1. Start with `-al` to create hardlinks rather than copying files if the source and
# target are on the same filesystem. On macOS, this is the only cp option that can
# preserve hardlinks but it is only available since macOS 12.3 (file_cmds-353.100.22).
# 2. Try `-a` as GNU `cp -a` preserves hardlinks. macOS `cp -a` is identical to `cp -pR`.
# 3. Fall back on `-pR` to handle the case where GNU `cp -a` failed. This may happen if
# installing into a filesystem that doesn't support hardlinks like an exFAT USB drive.
cp_arg_attempts = ["-a", "-pR"]
cp_arg_attempts.unshift("-al") if path.stat.dev == unpack_dir.stat.dev
# Move all files from source `path` to target `unpack_dir`. Any existing
# subdirectories are not modified and only the contents are moved.
#
# @raise [RuntimeError] on unsupported `mv` operation, e.g. overwriting a file with a directory
sig { params(unpack_dir: Pathname, verbose: T::Boolean).void }
def move_to_dir(unpack_dir, verbose:)
path.find do |src|
next if src == path
cp_arg_attempts.each do |arg|
args = [arg, *path_children, unpack_dir]
must_succeed = print_stderr = (arg == cp_arg_attempts.last)
result = system_command("cp", args:, verbose:, must_succeed:, print_stderr:)
break if result.success?
dst = unpack_dir/src.relative_path_from(path)
if dst.exist?
dst_real_dir = dst.directory? && !dst.symlink?
src_real_dir = src.directory? && !src.symlink?
# Avoid moving a directory over an existing non-directory and vice versa.
# This outputs the same error message as GNU mv which is more readable than macOS mv.
raise "mv: cannot overwrite non-directory '#{dst}' with directory '#{src}'" if src_real_dir && !dst_real_dir
raise "mv: cannot overwrite directory '#{dst}' with non-directory '#{src}'" if !src_real_dir && dst_real_dir
# Defer writing over existing directories. Handle this later on to copy attributes
next if dst_real_dir
FileUtils.rm_r(unpack_dir.children - existing)
FileUtils.rm(dst, verbose:)
end
FileUtils.mv(src, dst, verbose:)
Find.prune
end
end
end

View File

@ -467,9 +467,15 @@ module Utils
if status.success?
open_args = {}
content_type = headers["content-type"]
# Use the last `Content-Type` header if there is more than one instance
# in the response
content_type = content_type.last if content_type.is_a?(Array)
# Try to get encoding from Content-Type header
# TODO: add guessing encoding by <meta http-equiv="Content-Type" ...> tag
if (content_type = headers["content-type"]) &&
if content_type &&
(match = content_type.match(/;\s*charset\s*=\s*([^\s]+)/)) &&
(charset = match[1])
begin

View File

@ -47,10 +47,11 @@ module Utils
before: T.nilable(T.any(Pathname, Regexp, String)),
after: T.nilable(T.any(Pathname, String, Symbol)),
audit_result: T::Boolean,
global: T::Boolean,
block: T.nilable(T.proc.params(s: StringInreplaceExtension).void),
).void
}
def self.inreplace(paths, before = nil, after = nil, audit_result: true, &block)
def self.inreplace(paths, before = nil, after = nil, audit_result: true, global: true, &block)
paths = Array(paths)
after &&= after.to_s
before = before.to_s if before.is_a?(Pathname)
@ -67,8 +68,10 @@ module Utils
raise ArgumentError, "Must supply a block or before/after params" unless block
yield s
else
elsif global
s.gsub!(T.must(before), T.must(after), audit_result:)
else
s.sub!(T.must(before), T.must(after), audit_result:)
end
errors[path] = s.errors unless s.errors.empty?

View File

@ -56,12 +56,16 @@ _create_lock() {
local utils_lock_sh="${HOMEBREW_LIBRARY}/Homebrew/utils/lock_sh"
local oldest_ruby_with_flock="1.8.7"
if [[ -x "${ruby}" ]] && "${ruby}" "${utils_lock_sh}/ruby_check_version.rb" "${oldest_ruby_with_flock}"
if [[ -x "$(type -P lockf)" ]]
then
"${ruby}" "${utils_lock_sh}/ruby_lock_file_descriptor.rb" "${lock_file_descriptor}"
lockf -t 0 "${lock_file_descriptor}"
elif [[ -x "$(type -P flock)" ]]
then
flock -n "${lock_file_descriptor}"
elif [[ -x "${ruby}" ]] && "${ruby}" "${utils_lock_sh}/ruby_check_version.rb" "${oldest_ruby_with_flock}"
then
"${ruby}" "${utils_lock_sh}/ruby_lock_file_descriptor.rb" "${lock_file_descriptor}"
elif [[ -x "${python}" ]]
then
"${python}" -c "import fcntl; fcntl.flock(${lock_file_descriptor}, fcntl.LOCK_EX | fcntl.LOCK_NB)"

View File

@ -272,7 +272,7 @@ module PyPI
else
stable = T.must(formula.stable)
url = if stable.specs[:tag].present?
url = "git+#{stable.url}@#{stable.specs[:tag]}"
"git+#{stable.url}@#{stable.specs[:tag]}"
else
stable.url
end

View File

@ -154,7 +154,9 @@ module SPDX
if with_parts.length > 1
{ with_parts.first => { with: with_parts.second } }
else
license_sym = result[/^#{LICENSEREF_PREFIX}(.+)/o, 1]&.downcase&.tr("-", "_")&.to_sym
return result unless result.start_with?(LICENSEREF_PREFIX)
license_sym = result.delete_prefix(LICENSEREF_PREFIX).downcase.tr("-", "_").to_sym
ALLOWED_LICENSE_SYMBOLS.include?(license_sym) ? license_sym : result
end
end

View File

@ -1,7 +1,7 @@
# typed: strict
# typed: strong
# frozen_string_literal: true
# Used by the `inreplace` function (in `utils.rb`).
# Used by the {Utils::Inreplace.inreplace} function.
class StringInreplaceExtension
sig { returns(T::Array[String]) }
attr_accessor :errors
@ -18,10 +18,10 @@ class StringInreplaceExtension
# Same as `String#sub!`, but warns if nothing was replaced.
#
# @api public
sig { params(before: T.any(Regexp, String), after: String).returns(T.nilable(String)) }
def sub!(before, after)
sig { params(before: T.any(Regexp, String), after: String, audit_result: T::Boolean).returns(T.nilable(String)) }
def sub!(before, after, audit_result: true)
result = inreplace_string.sub!(before, after)
errors << "expected replacement of #{before.inspect} with #{after.inspect}" unless result
errors << "expected replacement of #{before.inspect} with #{after.inspect}" if audit_result && result.nil?
result
end

View File

@ -47,12 +47,12 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/elftools-1.3.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/erubi-1.13.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/hana-1.3.7/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/json-2.7.2")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json-2.7.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/json-2.7.6")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json-2.7.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/regexp_parser-2.9.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simpleidn-0.2.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json_schemer-2.3.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rexml-3.3.8/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rexml-3.3.9/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/kramdown-2.4.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/language_server-protocol-3.17.0.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/logger-1.6.1/lib")
@ -63,21 +63,21 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel_tests-4.7.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/racc-1.8.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/racc-1.8.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parser-3.3.5.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parser-3.3.6.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/patchelf-1.5.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/plist-3.7.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/prism-1.2.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/prism-1.2.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/pry-0.14.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11604/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11641/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.2.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/rbs-3.6.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.6.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/redcarpet-3.6.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/redcarpet-3.6.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-support-3.13.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-core-3.13.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-core-3.13.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-expectations-3.13.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-mocks-3.13.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-3.13.0/lib")
@ -85,32 +85,32 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-retry-0.6.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-sorbet-1.9.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec_junit_formatter-0.6.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.32.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.33.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.13.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.6.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.66.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-md-1.2.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.68.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-md-1.2.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.22.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-3.1.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.8.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.20.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-3.2.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.8.7/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.21.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-4.1.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/ruby-prof-1.7.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-prof-1.7.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/ruby-prof-1.7.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-prof-1.7.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-html-0.13.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov_json_formatter-0.1.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-0.22.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-cobertura-2.1.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.5.11604-universal-darwin/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.11604/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.11604/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.5.11641-universal-darwin/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.11641/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.11641/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.3.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.5.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/stackprof-0.2.26")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/stackprof-0.2.26/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.37/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.9.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.16.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/vernier-1.2.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/vernier-1.2.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.16.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/vernier-1.3.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/vernier-1.3.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.4.0/lib")

View File

@ -14,17 +14,7 @@ module T::Private::Methods::CallValidation
def self.wrap_method_if_needed(mod, method_sig, original_method)
original_visibility = visibility_method_name(mod, method_sig.method_name)
if method_sig.mode == T::Private::Methods::Modes.abstract
T::Private::ClassUtils.replace_method(mod, method_sig.method_name, true) do |*args, &blk|
# We allow abstract methods to be implemented by things further down the ancestor chain.
# So, if a super method exists, call it.
if defined?(super)
super(*args, &blk)
else
raise NotImplementedError.new(
"The method `#{method_sig.method_name}` on #{mod} is declared as `abstract`. It does not have an implementation."
)
end
end
create_abstract_wrapper(mod, method_sig, original_method, original_visibility)
# Do nothing in this case; this method was not wrapped in _on_method_added.
elsif method_sig.defined_raw
# Note, this logic is duplicated (intentionally, for micro-perf) at `Methods._on_method_added`,
@ -55,6 +45,24 @@ module T::Private::Methods::CallValidation
@is_allowed_to_have_fast_path = false
end
def self.create_abstract_wrapper(mod, method_sig, original_method, original_visibility)
mod.module_eval(<<~METHOD, __FILE__, __LINE__ + 1)
#{original_visibility}
def #{method_sig.method_name}(...)
# We allow abstract methods to be implemented by things further down the ancestor chain.
# So, if a super method exists, call it.
if defined?(super)
super
else
raise NotImplementedError.new(
"The method `#{method_sig.method_name}` on #{mod} is declared as `abstract`. It does not have an implementation."
)
end
end
METHOD
end
def self.create_validator_method(mod, original_method, method_sig, original_visibility)
has_fixed_arity = method_sig.kwarg_types.empty? && !method_sig.has_rest && !method_sig.has_keyrest &&
original_method.parameters.all? {|(kind, _name)| kind == :req || kind == :block}

Some files were not shown because too many files have changed in this diff Show More