Merge branch 'master' into create-cop-for-os-checks
This commit is contained in:
commit
00990e34a7
67
.github/workflows/docs.yml
vendored
Normal file
67
.github/workflows/docs.yml
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
name: Documentation CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linting:
|
||||||
|
if: github.repository == 'Homebrew/brew'
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: docs
|
||||||
|
steps:
|
||||||
|
- name: Set up Homebrew
|
||||||
|
id: set-up-homebrew
|
||||||
|
uses: Homebrew/actions/setup-homebrew@master
|
||||||
|
|
||||||
|
- name: Install vale
|
||||||
|
run: brew install vale
|
||||||
|
|
||||||
|
- name: Run vale for docs linting
|
||||||
|
run: vale .
|
||||||
|
|
||||||
|
- name: Install Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: "2.7"
|
||||||
|
bundler-cache: true
|
||||||
|
working-directory: docs
|
||||||
|
|
||||||
|
- name: Check Markdown syntax
|
||||||
|
run: bundle exec rake lint
|
||||||
|
|
||||||
|
- name: Build docs site
|
||||||
|
run: bundle exec rake build
|
||||||
|
|
||||||
|
rubydoc:
|
||||||
|
if: github.repository == 'Homebrew/brew'
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
env:
|
||||||
|
BUNDLE_GEMFILE: ${{ github.workspace }}/rubydoc/Gemfile
|
||||||
|
steps:
|
||||||
|
- name: Set up Homebrew
|
||||||
|
id: set-up-homebrew
|
||||||
|
uses: Homebrew/actions/setup-homebrew@master
|
||||||
|
|
||||||
|
- name: Checkout Homebrew/rubydoc.brew.sh
|
||||||
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
repository: Homebrew/rubydoc.brew.sh
|
||||||
|
path: rubydoc
|
||||||
|
|
||||||
|
- name: Install Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: "2.7"
|
||||||
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Process rubydoc comments
|
||||||
|
working-directory: Library/Homebrew
|
||||||
|
run: bundle exec yard doc --plugin sorbet --no-output #--fail-on-warning
|
||||||
16
.github/workflows/doctor.yml
vendored
16
.github/workflows/doctor.yml
vendored
@ -13,14 +13,19 @@ permissions:
|
|||||||
env:
|
env:
|
||||||
HOMEBREW_DEVELOPER: 1
|
HOMEBREW_DEVELOPER: 1
|
||||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||||
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
version: ["12-arm64", "12", "11-arm64", "11", "10.15"]
|
runner:
|
||||||
|
- "13-arm64-${{github.run_id}}-${{github.run_attempt}}"
|
||||||
|
- "12-arm64"
|
||||||
|
- "12-${{github.run_id}}-${{github.run_attempt}}"
|
||||||
|
- "11-arm64"
|
||||||
|
- "11-${{github.run_id}}-${{github.run_attempt}}"
|
||||||
|
- "10.15-${{github.run_id}}-${{github.run_attempt}}"
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ${{ matrix.version }}
|
runs-on: ${{ matrix.runner }}
|
||||||
env:
|
env:
|
||||||
PATH: "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
PATH: "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
||||||
defaults:
|
defaults:
|
||||||
@ -32,8 +37,9 @@ jobs:
|
|||||||
uses: Homebrew/actions/setup-homebrew@master
|
uses: Homebrew/actions/setup-homebrew@master
|
||||||
|
|
||||||
- run: brew test-bot --only-cleanup-before
|
- run: brew test-bot --only-cleanup-before
|
||||||
|
if: !contains(matrix.runner, github.run_id)
|
||||||
|
|
||||||
- run: brew test-bot --only-setup
|
- run: brew doctor
|
||||||
|
|
||||||
- run: brew test-bot --only-cleanup-after
|
- run: brew test-bot --only-cleanup-after
|
||||||
if: always()
|
if: always() && !contains(matrix.runner, github.run_id)
|
||||||
|
|||||||
10
.github/workflows/tests.yml
vendored
10
.github/workflows/tests.yml
vendored
@ -37,18 +37,13 @@ jobs:
|
|||||||
- name: Install Bundler RubyGems
|
- name: Install Bundler RubyGems
|
||||||
run: brew install-bundler-gems --groups=sorbet
|
run: brew install-bundler-gems --groups=sorbet
|
||||||
|
|
||||||
- name: Install shellcheck
|
- name: Install shellcheck and shfmt
|
||||||
run: brew install shellcheck
|
run: brew install shellcheck shfmt
|
||||||
|
|
||||||
- run: brew style --display-cop-names
|
- run: brew style --display-cop-names
|
||||||
|
|
||||||
- run: brew typecheck
|
- run: brew typecheck
|
||||||
|
|
||||||
- name: Run vale for docs linting
|
|
||||||
run: |
|
|
||||||
brew install vale
|
|
||||||
vale docs/
|
|
||||||
|
|
||||||
tap-syntax:
|
tap-syntax:
|
||||||
name: tap syntax
|
name: tap syntax
|
||||||
needs: syntax
|
needs: syntax
|
||||||
@ -282,6 +277,7 @@ jobs:
|
|||||||
|
|
||||||
test-default-formula-linux:
|
test-default-formula-linux:
|
||||||
name: ${{ matrix.name }}
|
name: ${{ matrix.name }}
|
||||||
|
if: startsWith(github.repository, 'Homebrew/')
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
env:
|
env:
|
||||||
HOMEBREW_BOOTSNAP: 1
|
HOMEBREW_BOOTSNAP: 1
|
||||||
|
|||||||
@ -11,8 +11,6 @@ Style/Documentation:
|
|||||||
- "default_prefix.rb"
|
- "default_prefix.rb"
|
||||||
- "global.rb"
|
- "global.rb"
|
||||||
- "keg_relocate.rb"
|
- "keg_relocate.rb"
|
||||||
- "os/linux/global.rb"
|
|
||||||
- "os/mac/global.rb"
|
|
||||||
- "os/mac/keg.rb"
|
- "os/mac/keg.rb"
|
||||||
- "reinstall.rb"
|
- "reinstall.rb"
|
||||||
- "software_spec.rb"
|
- "software_spec.rb"
|
||||||
@ -27,7 +25,6 @@ Style/Documentation:
|
|||||||
|
|
||||||
Lint/EmptyBlock:
|
Lint/EmptyBlock:
|
||||||
Exclude:
|
Exclude:
|
||||||
- "dependency.rb"
|
|
||||||
- "dev-cmd/extract.rb"
|
- "dev-cmd/extract.rb"
|
||||||
- "test/cache_store_spec.rb"
|
- "test/cache_store_spec.rb"
|
||||||
- "test/checksum_verification_spec.rb"
|
- "test/checksum_verification_spec.rb"
|
||||||
|
|||||||
@ -11,7 +11,7 @@ GEM
|
|||||||
public_suffix (>= 2.0.2, < 6.0)
|
public_suffix (>= 2.0.2, < 6.0)
|
||||||
ast (2.4.2)
|
ast (2.4.2)
|
||||||
bindata (2.4.14)
|
bindata (2.4.14)
|
||||||
bootsnap (1.14.0)
|
bootsnap (1.15.0)
|
||||||
msgpack (~> 1.2)
|
msgpack (~> 1.2)
|
||||||
byebug (11.1.3)
|
byebug (11.1.3)
|
||||||
coderay (1.1.3)
|
coderay (1.1.3)
|
||||||
@ -82,7 +82,7 @@ GEM
|
|||||||
parser
|
parser
|
||||||
rainbow (~> 3.0)
|
rainbow (~> 3.0)
|
||||||
sorbet-runtime (>= 0.5)
|
sorbet-runtime (>= 0.5)
|
||||||
parser (3.1.2.1)
|
parser (3.1.3.0)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
patchelf (1.4.0)
|
patchelf (1.4.0)
|
||||||
elftools (>= 1.2)
|
elftools (>= 1.2)
|
||||||
@ -92,7 +92,7 @@ GEM
|
|||||||
method_source (~> 1.0)
|
method_source (~> 1.0)
|
||||||
public_suffix (5.0.0)
|
public_suffix (5.0.0)
|
||||||
racc (1.6.0)
|
racc (1.6.0)
|
||||||
rack (3.0.0)
|
rack (3.0.1)
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
rbi (0.0.14)
|
rbi (0.0.14)
|
||||||
ast
|
ast
|
||||||
@ -147,7 +147,7 @@ GEM
|
|||||||
rubocop-performance (1.15.1)
|
rubocop-performance (1.15.1)
|
||||||
rubocop (>= 1.7.0, < 2.0)
|
rubocop (>= 1.7.0, < 2.0)
|
||||||
rubocop-ast (>= 0.4.0)
|
rubocop-ast (>= 0.4.0)
|
||||||
rubocop-rails (2.17.2)
|
rubocop-rails (2.17.3)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 1.33.0, < 2.0)
|
rubocop (>= 1.33.0, < 2.0)
|
||||||
|
|||||||
@ -13,26 +13,6 @@ case "${HOMEBREW_SYSTEM}" in
|
|||||||
Linux) HOMEBREW_LINUX="1" ;;
|
Linux) HOMEBREW_LINUX="1" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "${HOMEBREW_MACOS}" == "1" ]] &&
|
|
||||||
[[ "$(sysctl -n hw.optional.arm64 2>/dev/null)" == "1" ]]
|
|
||||||
then
|
|
||||||
# used in vendor-install.sh
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
HOMEBREW_PHYSICAL_PROCESSOR="arm64"
|
|
||||||
HOMEBREW_ROSETTA="$(sysctl -n sysctl.proc_translated)"
|
|
||||||
|
|
||||||
# If we're running under macOS Rosetta 2, and it was requested by setting
|
|
||||||
# HOMEBREW_CHANGE_ARCH_TO_ARM (for example in CI), then we re-exec this
|
|
||||||
# same file under the native architecture
|
|
||||||
# These variables are set from the user environment.
|
|
||||||
# shellcheck disable=SC2154
|
|
||||||
if [[ "${HOMEBREW_CHANGE_ARCH_TO_ARM}" == "1" ]] &&
|
|
||||||
[[ "${HOMEBREW_ROSETTA}" == "1" ]]
|
|
||||||
then
|
|
||||||
exec arch -arm64e "${HOMEBREW_BREW_FILE}" "$@"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
|
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
|
||||||
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
|
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
|
||||||
# These variables are set by bin/brew
|
# These variables are set by bin/brew
|
||||||
@ -170,6 +150,8 @@ safe_cd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
brew() {
|
brew() {
|
||||||
|
# This variable is set by bin/brew
|
||||||
|
# shellcheck disable=SC2154
|
||||||
"${HOMEBREW_BREW_FILE}" "$@"
|
"${HOMEBREW_BREW_FILE}" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,6 +424,13 @@ then
|
|||||||
# Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12
|
# Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12
|
||||||
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X ${HOMEBREW_MACOS_VERSION}"
|
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X ${HOMEBREW_MACOS_VERSION}"
|
||||||
|
|
||||||
|
if [[ "$(sysctl -n hw.optional.arm64 2>/dev/null)" == "1" ]]
|
||||||
|
then
|
||||||
|
# used in vendor-install.sh
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
HOMEBREW_PHYSICAL_PROCESSOR="arm64"
|
||||||
|
fi
|
||||||
|
|
||||||
# Intentionally set this variable by exploding another.
|
# Intentionally set this variable by exploding another.
|
||||||
# shellcheck disable=SC2086,SC2183
|
# shellcheck disable=SC2086,SC2183
|
||||||
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
|
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
|
||||||
|
|||||||
@ -8,5 +8,5 @@
|
|||||||
source "${HOMEBREW_LIBRARY}/Homebrew/items.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/items.sh"
|
||||||
|
|
||||||
homebrew-casks() {
|
homebrew-casks() {
|
||||||
homebrew-items 'Formula' 's|/Casks/|/|' '^homebrew/cask'
|
homebrew-items '*/Casks/*\.rb' '' 's|/Casks/|/|' '^homebrew/cask'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,5 +8,5 @@
|
|||||||
source "${HOMEBREW_LIBRARY}/Homebrew/items.sh"
|
source "${HOMEBREW_LIBRARY}/Homebrew/items.sh"
|
||||||
|
|
||||||
homebrew-formulae() {
|
homebrew-formulae() {
|
||||||
homebrew-items 'Casks' 's|/Formula/|/|' '^homebrew/core'
|
homebrew-items '*\.rb' 'Casks' 's|/Formula/|/|' '^homebrew/core'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ module Homebrew
|
|||||||
flag "--version=",
|
flag "--version=",
|
||||||
description: "Specify the new <version> for the cask."
|
description: "Specify the new <version> for the cask."
|
||||||
flag "--message=",
|
flag "--message=",
|
||||||
description: "Append <message> to the default pull request message."
|
description: "Prepend <message> to the default pull request message."
|
||||||
flag "--url=",
|
flag "--url=",
|
||||||
description: "Specify the <URL> for the new download."
|
description: "Specify the <URL> for the new download."
|
||||||
flag "--sha256=",
|
flag "--sha256=",
|
||||||
|
|||||||
@ -60,7 +60,7 @@ module Homebrew
|
|||||||
"that `--version=0` can be used to delete an existing version override from a " \
|
"that `--version=0` can be used to delete an existing version override from a " \
|
||||||
"formula if it has become redundant."
|
"formula if it has become redundant."
|
||||||
flag "--message=",
|
flag "--message=",
|
||||||
description: "Append <message> to the default pull request message."
|
description: "Prepend <message> to the default pull request message."
|
||||||
flag "--url=",
|
flag "--url=",
|
||||||
description: "Specify the <URL> for the new download. If a <URL> is specified, the <SHA-256> " \
|
description: "Specify the <URL> for the new download. If a <URL> is specified, the <SHA-256> " \
|
||||||
"checksum of the new download should also be specified."
|
"checksum of the new download should also be specified."
|
||||||
|
|||||||
@ -181,32 +181,6 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
# Anaconda installs multiple system & brew dupes, including OpenSSL, Python,
|
|
||||||
# sqlite, libpng, Qt, etc. Regularly breaks compile on Vim, MacVim and others.
|
|
||||||
# Is flagged as part of the *-config script checks below, but people seem
|
|
||||||
# to ignore those as warnings rather than extremely likely breakage.
|
|
||||||
def check_for_anaconda
|
|
||||||
return unless which("anaconda")
|
|
||||||
return unless which("python")
|
|
||||||
|
|
||||||
anaconda_directory = which("anaconda").realpath.dirname
|
|
||||||
python_binary = Utils.popen_read(which("python"), "-c", "import sys; sys.stdout.write(sys.executable)")
|
|
||||||
python_directory = Pathname.new(python_binary).realpath.dirname
|
|
||||||
|
|
||||||
# Only warn if Python lives with Anaconda, since is most problematic case.
|
|
||||||
return unless python_directory == anaconda_directory
|
|
||||||
|
|
||||||
<<~EOS
|
|
||||||
Anaconda is known to frequently break Homebrew builds, including Vim and
|
|
||||||
MacVim, due to bundling many duplicates of system and Homebrew-provided
|
|
||||||
tools.
|
|
||||||
|
|
||||||
If you encounter a build failure please temporarily remove Anaconda
|
|
||||||
from your $PATH and attempt the build again prior to reporting the
|
|
||||||
failure to us. Thanks!
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
def __check_stray_files(dir, pattern, allow_list, message)
|
def __check_stray_files(dir, pattern, allow_list, message)
|
||||||
return unless File.directory?(dir)
|
return unless File.directory?(dir)
|
||||||
|
|
||||||
@ -477,54 +451,6 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_for_config_scripts
|
|
||||||
return unless HOMEBREW_CELLAR.exist?
|
|
||||||
|
|
||||||
real_cellar = HOMEBREW_CELLAR.realpath
|
|
||||||
|
|
||||||
scripts = []
|
|
||||||
|
|
||||||
allowlist = %W[
|
|
||||||
/bin /sbin
|
|
||||||
/usr/bin /usr/sbin
|
|
||||||
/usr/X11/bin /usr/X11R6/bin /opt/X11/bin
|
|
||||||
#{HOMEBREW_PREFIX}/bin #{HOMEBREW_PREFIX}/sbin
|
|
||||||
/Applications/Server.app/Contents/ServerRoot/usr/bin
|
|
||||||
/Applications/Server.app/Contents/ServerRoot/usr/sbin
|
|
||||||
]
|
|
||||||
if OS.mac? && Hardware::CPU.physical_cpu_arm64?
|
|
||||||
allowlist += %W[
|
|
||||||
#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/bin
|
|
||||||
#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/sbin
|
|
||||||
#{HOMEBREW_DEFAULT_PREFIX}/bin
|
|
||||||
#{HOMEBREW_DEFAULT_PREFIX}/sbin
|
|
||||||
]
|
|
||||||
end
|
|
||||||
allowlist.map!(&:downcase)
|
|
||||||
|
|
||||||
paths.each do |p|
|
|
||||||
next if allowlist.include?(p.downcase) || !File.directory?(p)
|
|
||||||
|
|
||||||
realpath = Pathname.new(p).realpath.to_s
|
|
||||||
next if realpath.start_with?(real_cellar.to_s, HOMEBREW_CELLAR.to_s)
|
|
||||||
|
|
||||||
scripts += Dir.chdir(p) { Dir["*-config"] }.map { |c| File.join(p, c) }
|
|
||||||
end
|
|
||||||
|
|
||||||
return if scripts.empty?
|
|
||||||
|
|
||||||
inject_file_list scripts, <<~EOS
|
|
||||||
"config" scripts exist outside your system or Homebrew directories.
|
|
||||||
`./configure` scripts often look for *-config scripts to determine if
|
|
||||||
software packages are installed, and which additional flags to use when
|
|
||||||
compiling and linking.
|
|
||||||
|
|
||||||
Having additional scripts in your path can confuse software installed via
|
|
||||||
Homebrew if the config script overrides a system or Homebrew-provided
|
|
||||||
script of the same name. We found the following "config" scripts:
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_for_symlinked_cellar
|
def check_for_symlinked_cellar
|
||||||
return unless HOMEBREW_CELLAR.exist?
|
return unless HOMEBREW_CELLAR.exist?
|
||||||
return unless HOMEBREW_CELLAR.symlink?
|
return unless HOMEBREW_CELLAR.symlink?
|
||||||
|
|||||||
@ -471,7 +471,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
|
|
||||||
lines = output.to_s.lines.map(&:chomp)
|
lines = output.to_s.lines.map(&:chomp)
|
||||||
|
|
||||||
final_url = curl_response_last_location(parsed_output[:responses], absolutize: true, base_url: url)
|
final_url = curl_response_follow_redirections(parsed_output[:responses], url)
|
||||||
final_url ||= url
|
final_url ||= url
|
||||||
|
|
||||||
content_disposition_parser = Mechanize::HTTP::ContentDispositionParser.new
|
content_disposition_parser = Mechanize::HTTP::ContentDispositionParser.new
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
homebrew-items() {
|
homebrew-items() {
|
||||||
local items
|
local items
|
||||||
local sed_extended_regex_flag
|
local sed_extended_regex_flag
|
||||||
local find_filter="$1"
|
local find_include_filter="$1"
|
||||||
local sed_filter="$2"
|
local find_exclude_filter="$2"
|
||||||
local grep_filter="$3"
|
local sed_filter="$3"
|
||||||
|
local grep_filter="$4"
|
||||||
|
|
||||||
# HOMEBREW_MACOS is set by brew.sh
|
# HOMEBREW_MACOS is set by brew.sh
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
@ -19,14 +20,14 @@ homebrew-items() {
|
|||||||
items="$(
|
items="$(
|
||||||
find "${HOMEBREW_REPOSITORY}/Library/Taps" \
|
find "${HOMEBREW_REPOSITORY}/Library/Taps" \
|
||||||
-type d \( \
|
-type d \( \
|
||||||
-name "${find_filter}" -o \
|
-name "${find_exclude_filter}" -o \
|
||||||
-name cmd -o \
|
-name cmd -o \
|
||||||
-name .github -o \
|
-name .github -o \
|
||||||
-name lib -o \
|
-name lib -o \
|
||||||
-name spec -o \
|
-name spec -o \
|
||||||
-name vendor \
|
-name vendor \
|
||||||
\) \
|
\) \
|
||||||
-prune -false -o -name '*\.rb' |
|
-prune -false -o -path "${find_include_filter}" |
|
||||||
sed "${sed_extended_regex_flag}" \
|
sed "${sed_extended_regex_flag}" \
|
||||||
-e 's/\.rb//g' \
|
-e 's/\.rb//g' \
|
||||||
-e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' \
|
-e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' \
|
||||||
|
|||||||
@ -18,7 +18,7 @@ module Bootsnap
|
|||||||
def logger; end
|
def logger; end
|
||||||
def logger=(logger); end
|
def logger=(logger); end
|
||||||
def rb_get_path(fname); end
|
def rb_get_path(fname); end
|
||||||
def setup(cache_dir:, development_mode: T.unsafe(nil), load_path_cache: T.unsafe(nil), ignore_directories: T.unsafe(nil), compile_cache_iseq: T.unsafe(nil), compile_cache_yaml: T.unsafe(nil), compile_cache_json: T.unsafe(nil)); end
|
def setup(cache_dir:, development_mode: T.unsafe(nil), load_path_cache: T.unsafe(nil), ignore_directories: T.unsafe(nil), readonly: T.unsafe(nil), compile_cache_iseq: T.unsafe(nil), compile_cache_yaml: T.unsafe(nil), compile_cache_json: T.unsafe(nil)); end
|
||||||
def unload_cache!; end
|
def unload_cache!; end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -26,7 +26,7 @@ end
|
|||||||
module Bootsnap::CompileCache
|
module Bootsnap::CompileCache
|
||||||
class << self
|
class << self
|
||||||
def permission_error(path); end
|
def permission_error(path); end
|
||||||
def setup(cache_dir:, iseq:, yaml:, json:); end
|
def setup(cache_dir:, iseq:, yaml:, json:, readonly: T.unsafe(nil)); end
|
||||||
def supported?; end
|
def supported?; end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -54,7 +54,7 @@ module Bootsnap::LoadPathCache
|
|||||||
def enabled?; end
|
def enabled?; end
|
||||||
def load_path_cache; end
|
def load_path_cache; end
|
||||||
def loaded_features_index; end
|
def loaded_features_index; end
|
||||||
def setup(cache_path:, development_mode:, ignore_directories:); end
|
def setup(cache_path:, development_mode:, ignore_directories:, readonly: T.unsafe(nil)); end
|
||||||
def supported?; end
|
def supported?; end
|
||||||
def unload!; end
|
def unload!; end
|
||||||
end
|
end
|
||||||
@ -193,7 +193,7 @@ Bootsnap::LoadPathCache::PathScanner::REQUIRABLE_EXTENSIONS = T.let(T.unsafe(nil
|
|||||||
Bootsnap::LoadPathCache::SLASH = T.let(T.unsafe(nil), String)
|
Bootsnap::LoadPathCache::SLASH = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class Bootsnap::LoadPathCache::Store
|
class Bootsnap::LoadPathCache::Store
|
||||||
def initialize(store_path); end
|
def initialize(store_path, readonly: T.unsafe(nil)); end
|
||||||
|
|
||||||
def fetch(key); end
|
def fetch(key); end
|
||||||
def get(key); end
|
def get(key); end
|
||||||
@ -59,6 +59,8 @@ class Parser::AST::Processor < ::AST::Processor
|
|||||||
def on_find_pattern(node); end
|
def on_find_pattern(node); end
|
||||||
def on_for(node); end
|
def on_for(node); end
|
||||||
def on_forward_arg(node); end
|
def on_forward_arg(node); end
|
||||||
|
def on_forwarded_kwrestarg(node); end
|
||||||
|
def on_forwarded_restarg(node); end
|
||||||
def on_gvar(node); end
|
def on_gvar(node); end
|
||||||
def on_gvasgn(node); end
|
def on_gvasgn(node); end
|
||||||
def on_hash(node); end
|
def on_hash(node); end
|
||||||
@ -235,6 +237,8 @@ class Parser::Builders::Default
|
|||||||
def forward_arg(dots_t); end
|
def forward_arg(dots_t); end
|
||||||
def forward_only_args(begin_t, dots_t, end_t); end
|
def forward_only_args(begin_t, dots_t, end_t); end
|
||||||
def forwarded_args(dots_t); end
|
def forwarded_args(dots_t); end
|
||||||
|
def forwarded_kwrestarg(dstar_t); end
|
||||||
|
def forwarded_restarg(star_t); end
|
||||||
def gvar(token); end
|
def gvar(token); end
|
||||||
def hash_pattern(lbrace_t, kwargs, rbrace_t); end
|
def hash_pattern(lbrace_t, kwargs, rbrace_t); end
|
||||||
def ident(token); end
|
def ident(token); end
|
||||||
@ -520,6 +524,7 @@ class Parser::Lexer
|
|||||||
def static_env=(_arg0); end
|
def static_env=(_arg0); end
|
||||||
def tokens; end
|
def tokens; end
|
||||||
def tokens=(_arg0); end
|
def tokens=(_arg0); end
|
||||||
|
def version; end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
@ -528,6 +533,7 @@ class Parser::Lexer
|
|||||||
def emit(type, value = T.unsafe(nil), s = T.unsafe(nil), e = T.unsafe(nil)); end
|
def emit(type, value = T.unsafe(nil), s = T.unsafe(nil), e = T.unsafe(nil)); end
|
||||||
def emit_comment(s = T.unsafe(nil), e = T.unsafe(nil)); end
|
def emit_comment(s = T.unsafe(nil), e = T.unsafe(nil)); end
|
||||||
def emit_do(do_block = T.unsafe(nil)); end
|
def emit_do(do_block = T.unsafe(nil)); end
|
||||||
|
def emit_invalid_escapes?; end
|
||||||
def emit_table(table, s = T.unsafe(nil), e = T.unsafe(nil)); end
|
def emit_table(table, s = T.unsafe(nil), e = T.unsafe(nil)); end
|
||||||
def encode_escape(ord); end
|
def encode_escape(ord); end
|
||||||
def eof_codepoint?(point); end
|
def eof_codepoint?(point); end
|
||||||
@ -1610,9 +1616,13 @@ class Parser::StaticEnvironment
|
|||||||
|
|
||||||
def declare(name); end
|
def declare(name); end
|
||||||
def declare_anonymous_blockarg; end
|
def declare_anonymous_blockarg; end
|
||||||
|
def declare_anonymous_kwrestarg; end
|
||||||
|
def declare_anonymous_restarg; end
|
||||||
def declare_forward_args; end
|
def declare_forward_args; end
|
||||||
def declared?(name); end
|
def declared?(name); end
|
||||||
def declared_anonymous_blockarg?; end
|
def declared_anonymous_blockarg?; end
|
||||||
|
def declared_anonymous_kwrestarg?; end
|
||||||
|
def declared_anonymous_restarg?; end
|
||||||
def declared_forward_args?; end
|
def declared_forward_args?; end
|
||||||
def empty?; end
|
def empty?; end
|
||||||
def extend_dynamic; end
|
def extend_dynamic; end
|
||||||
@ -1622,6 +1632,8 @@ class Parser::StaticEnvironment
|
|||||||
end
|
end
|
||||||
|
|
||||||
Parser::StaticEnvironment::ANONYMOUS_BLOCKARG = T.let(T.unsafe(nil), Symbol)
|
Parser::StaticEnvironment::ANONYMOUS_BLOCKARG = T.let(T.unsafe(nil), Symbol)
|
||||||
|
Parser::StaticEnvironment::ANONYMOUS_KWRESTARG = T.let(T.unsafe(nil), Symbol)
|
||||||
|
Parser::StaticEnvironment::ANONYMOUS_RESTARG = T.let(T.unsafe(nil), Symbol)
|
||||||
Parser::StaticEnvironment::FORWARD_ARGS = T.let(T.unsafe(nil), Symbol)
|
Parser::StaticEnvironment::FORWARD_ARGS = T.let(T.unsafe(nil), Symbol)
|
||||||
|
|
||||||
class Parser::SyntaxError < ::StandardError
|
class Parser::SyntaxError < ::StandardError
|
||||||
@ -496,10 +496,13 @@ class Rack::Lint::Wrapper
|
|||||||
def respond_to?(name, *_arg1); end
|
def respond_to?(name, *_arg1); end
|
||||||
def response; end
|
def response; end
|
||||||
def to_ary; end
|
def to_ary; end
|
||||||
|
def to_path; end
|
||||||
def verify_content_length(size); end
|
def verify_content_length(size); end
|
||||||
def verify_to_path; end
|
def verify_to_path; end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Rack::Lint::Wrapper::BODY_METHODS = T.let(T.unsafe(nil), Hash)
|
||||||
|
|
||||||
class Rack::Lint::Wrapper::ErrorWrapper
|
class Rack::Lint::Wrapper::ErrorWrapper
|
||||||
def initialize(error); end
|
def initialize(error); end
|
||||||
|
|
||||||
@ -178,6 +178,7 @@ RuboCop::Cop::Rails::ActionFilter::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array
|
|||||||
class RuboCop::Cop::Rails::ActionOrder < ::RuboCop::Cop::Base
|
class RuboCop::Cop::Rails::ActionOrder < ::RuboCop::Cop::Base
|
||||||
include ::RuboCop::Cop::VisibilityHelp
|
include ::RuboCop::Cop::VisibilityHelp
|
||||||
include ::RuboCop::Cop::DefNode
|
include ::RuboCop::Cop::DefNode
|
||||||
|
include ::RuboCop::Cop::RangeHelp
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
def action_declarations(param0, param1); end
|
def action_declarations(param0, param1); end
|
||||||
@ -186,9 +187,14 @@ class RuboCop::Cop::Rails::ActionOrder < ::RuboCop::Cop::Base
|
|||||||
private
|
private
|
||||||
|
|
||||||
def actions; end
|
def actions; end
|
||||||
|
def add_range(range1, range2); end
|
||||||
|
def correction_target(def_node); end
|
||||||
def expected_order; end
|
def expected_order; end
|
||||||
def find_index(node); end
|
def find_index(node); end
|
||||||
|
def range_with_comments(node); end
|
||||||
|
def range_with_comments_and_lines(node); end
|
||||||
def register_offense(previous, current); end
|
def register_offense(previous, current); end
|
||||||
|
def swap_range(corrector, range1, range2); end
|
||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::Rails::ActionOrder::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::Rails::ActionOrder::MSG = T.let(T.unsafe(nil), String)
|
||||||
@ -695,6 +701,9 @@ class RuboCop::Cop::Rails::DynamicFindBy < ::RuboCop::Cop::Base
|
|||||||
def autocorrect_argument_keywords(corrector, node, keywords); end
|
def autocorrect_argument_keywords(corrector, node, keywords); end
|
||||||
def autocorrect_method_name(corrector, node); end
|
def autocorrect_method_name(corrector, node); end
|
||||||
def column_keywords(method); end
|
def column_keywords(method); end
|
||||||
|
def dynamic_find_by_arguments?(node); end
|
||||||
|
def dynamic_find_by_arguments_count?(node); end
|
||||||
|
def dynamic_find_by_arguments_type?(node); end
|
||||||
def static_method_name(method_name); end
|
def static_method_name(method_name); end
|
||||||
def whitelisted?(node); end
|
def whitelisted?(node); end
|
||||||
end
|
end
|
||||||
@ -921,7 +930,7 @@ class RuboCop::Cop::Rails::FreezeTime < ::RuboCop::Cop::Base
|
|||||||
def current_time_with_convert?(node, method_name); end
|
def current_time_with_convert?(node, method_name); end
|
||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::Rails::FreezeTime::CONV_METHODS = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::Rails::FreezeTime::CONVERT_METHODS = T.let(T.unsafe(nil), Array)
|
||||||
RuboCop::Cop::Rails::FreezeTime::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::Rails::FreezeTime::MSG = T.let(T.unsafe(nil), String)
|
||||||
RuboCop::Cop::Rails::FreezeTime::NOW_METHODS = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::Rails::FreezeTime::NOW_METHODS = T.let(T.unsafe(nil), Array)
|
||||||
RuboCop::Cop::Rails::FreezeTime::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::Rails::FreezeTime::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
@ -1061,6 +1070,7 @@ class RuboCop::Cop::Rails::I18nLazyLookup < ::RuboCop::Cop::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::Rails::I18nLazyLookup::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::Rails::I18nLazyLookup::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::Rails::I18nLazyLookup::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::Rails::I18nLocaleAssignment < ::RuboCop::Cop::Base
|
class RuboCop::Cop::Rails::I18nLocaleAssignment < ::RuboCop::Cop::Base
|
||||||
def i18n_locale_assignment?(param0 = T.unsafe(nil)); end
|
def i18n_locale_assignment?(param0 = T.unsafe(nil)); end
|
||||||
@ -1775,7 +1785,8 @@ class RuboCop::Cop::Rails::RootPathnameMethods < ::RuboCop::Cop::Base
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def build_path_glob(path, method); end
|
def build_path_glob_replacement(path, method); end
|
||||||
|
def build_path_replacement(path, method, args); end
|
||||||
def evidence(node); end
|
def evidence(node); end
|
||||||
def include_interpolation?(arguments); end
|
def include_interpolation?(arguments); end
|
||||||
def join_arguments(arguments); end
|
def join_arguments(arguments); end
|
||||||
@ -2047,8 +2058,13 @@ class RuboCop::Cop::Rails::ToSWithArgument < ::RuboCop::Cop::Base
|
|||||||
|
|
||||||
def on_csend(node); end
|
def on_csend(node); end
|
||||||
def on_send(node); end
|
def on_send(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def rails_extended_to_s?(node); end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::Rails::ToSWithArgument::EXTENDED_FORMAT_TYPES = T.let(T.unsafe(nil), Set)
|
||||||
RuboCop::Cop::Rails::ToSWithArgument::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::Rails::ToSWithArgument::MSG = T.let(T.unsafe(nil), String)
|
||||||
RuboCop::Cop::Rails::ToSWithArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::Rails::ToSWithArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
@ -6723,6 +6723,10 @@ class RuboCop::AST::Node
|
|||||||
|
|
||||||
def cask_block?(param0=T.unsafe(nil)); end
|
def cask_block?(param0=T.unsafe(nil)); end
|
||||||
|
|
||||||
|
def forwarded_kwrestarg_type?(); end
|
||||||
|
|
||||||
|
def forwarded_restarg_type?(); end
|
||||||
|
|
||||||
def key_node(param0=T.unsafe(nil)); end
|
def key_node(param0=T.unsafe(nil)); end
|
||||||
|
|
||||||
def method_node(param0=T.unsafe(nil)); end
|
def method_node(param0=T.unsafe(nil)); end
|
||||||
@ -6742,11 +6746,18 @@ module RuboCop::AST::NodePattern::Sets
|
|||||||
SET_INCLUDE_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
|
SET_INCLUDE_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
|
||||||
SET_ON_INTEL_ON_ARM = ::T.let(nil, ::T.untyped)
|
SET_ON_INTEL_ON_ARM = ::T.let(nil, ::T.untyped)
|
||||||
SET_OR_NEWER_OR_OLDER = ::T.let(nil, ::T.untyped)
|
SET_OR_NEWER_OR_OLDER = ::T.let(nil, ::T.untyped)
|
||||||
|
SET_STDOUT_STDERR = ::T.let(nil, ::T.untyped)
|
||||||
SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped)
|
SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped)
|
||||||
SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
|
SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
|
||||||
SET____ETC_4 = ::T.let(nil, ::T.untyped)
|
SET____ETC_4 = ::T.let(nil, ::T.untyped)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module RuboCop::AST::Traversal
|
||||||
|
def on_forwarded_kwrestarg(node); end
|
||||||
|
|
||||||
|
def on_forwarded_restarg(node); end
|
||||||
|
end
|
||||||
|
|
||||||
class RuboCop::Cask::AST::Stanza
|
class RuboCop::Cask::AST::Stanza
|
||||||
def app?(); end
|
def app?(); end
|
||||||
|
|
||||||
|
|||||||
@ -11,21 +11,6 @@ describe Homebrew::Diagnostic::Checks do
|
|||||||
expect(checks.inject_file_list(%w[/a /b], "foo:\n")).to eq("foo:\n /a\n /b\n")
|
expect(checks.inject_file_list(%w[/a /b], "foo:\n")).to eq("foo:\n /a\n /b\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#check_for_anaconda" do
|
|
||||||
mktmpdir do |path|
|
|
||||||
anaconda = "#{path}/anaconda"
|
|
||||||
python = "#{path}/python"
|
|
||||||
FileUtils.touch anaconda
|
|
||||||
File.write(python, "#! #{`which bash`}\necho -n '#{python}'\n")
|
|
||||||
FileUtils.chmod 0755, anaconda
|
|
||||||
FileUtils.chmod 0755, python
|
|
||||||
|
|
||||||
ENV["PATH"] = "#{path}#{File::PATH_SEPARATOR}#{ENV.fetch("PATH")}"
|
|
||||||
|
|
||||||
expect(checks.check_for_anaconda).to match("Anaconda")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "#check_access_directories" do
|
specify "#check_access_directories" do
|
||||||
skip "User is root so everything is writable." if Process.euid.zero?
|
skip "User is root so everything is writable." if Process.euid.zero?
|
||||||
begin
|
begin
|
||||||
@ -90,19 +75,6 @@ describe Homebrew::Diagnostic::Checks do
|
|||||||
sbin.rmtree
|
sbin.rmtree
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#check_for_config_scripts" do
|
|
||||||
mktmpdir do |tmp|
|
|
||||||
file = "#{tmp}/foo-config"
|
|
||||||
FileUtils.touch file
|
|
||||||
FileUtils.chmod 0755, file
|
|
||||||
homebrew_path = "#{tmp}#{File::PATH_SEPARATOR}#{ENV.fetch("PATH")}"
|
|
||||||
stub_const("ORIGINAL_PATHS", PATH.new(homebrew_path).map { |path| Pathname.new(path).expand_path }.compact)
|
|
||||||
|
|
||||||
expect(checks.check_for_config_scripts)
|
|
||||||
.to match('"config" scripts exist')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "#check_for_symlinked_cellar" do
|
specify "#check_for_symlinked_cellar" do
|
||||||
HOMEBREW_CELLAR.rmtree
|
HOMEBREW_CELLAR.rmtree
|
||||||
|
|
||||||
|
|||||||
@ -556,4 +556,58 @@ describe "Utils::Curl" do
|
|||||||
expect(curl_response_last_location([response_hash[:ok]])).to be_nil
|
expect(curl_response_last_location([response_hash[:ok]])).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#curl_response_follow_redirections" do
|
||||||
|
it "returns the original URL when there are no location headers" do
|
||||||
|
expect(
|
||||||
|
curl_response_follow_redirections(
|
||||||
|
[response_hash[:ok]],
|
||||||
|
"https://brew.sh/test1/test2",
|
||||||
|
),
|
||||||
|
).to eq("https://brew.sh/test1/test2")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns the URL relative to base when locations are relative" do
|
||||||
|
expect(
|
||||||
|
curl_response_follow_redirections(
|
||||||
|
[response_hash[:redirection_root_relative], response_hash[:ok]],
|
||||||
|
"https://brew.sh/test1/test2",
|
||||||
|
),
|
||||||
|
).to eq("https://brew.sh/example/")
|
||||||
|
|
||||||
|
expect(
|
||||||
|
curl_response_follow_redirections(
|
||||||
|
[response_hash[:redirection_parent_relative], response_hash[:ok]],
|
||||||
|
"https://brew.sh/test1/test2",
|
||||||
|
),
|
||||||
|
).to eq("https://brew.sh/test1/example/")
|
||||||
|
|
||||||
|
expect(
|
||||||
|
curl_response_follow_redirections(
|
||||||
|
[
|
||||||
|
response_hash[:redirection_parent_relative],
|
||||||
|
response_hash[:redirection_parent_relative],
|
||||||
|
response_hash[:ok],
|
||||||
|
],
|
||||||
|
"https://brew.sh/test1/test2",
|
||||||
|
),
|
||||||
|
).to eq("https://brew.sh/test1/example/example/")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns new base when there are absolute location(s)" do
|
||||||
|
expect(
|
||||||
|
curl_response_follow_redirections(
|
||||||
|
[response_hash[:redirection], response_hash[:ok]],
|
||||||
|
"https://brew.sh/test1/test2",
|
||||||
|
),
|
||||||
|
).to eq(location_urls[0])
|
||||||
|
|
||||||
|
expect(
|
||||||
|
curl_response_follow_redirections(
|
||||||
|
[response_hash[:redirection], response_hash[:redirection_parent_relative], response_hash[:ok]],
|
||||||
|
"https://brew.sh/test1/test2",
|
||||||
|
),
|
||||||
|
).to eq("#{location_urls[0]}example/")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -506,6 +506,30 @@ module Utils
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns the final URL by following location headers in cURL responses.
|
||||||
|
# @param responses [Array<Hash>] An array of hashes containing response
|
||||||
|
# status information and headers from `#parse_curl_response`.
|
||||||
|
# @param base_url [String] The URL to use as a base.
|
||||||
|
# @return [String] The final absolute URL after redirections.
|
||||||
|
sig {
|
||||||
|
params(
|
||||||
|
responses: T::Array[T::Hash[Symbol, T.untyped]],
|
||||||
|
base_url: String,
|
||||||
|
).returns(String)
|
||||||
|
}
|
||||||
|
def curl_response_follow_redirections(responses, base_url)
|
||||||
|
responses.each do |response|
|
||||||
|
next if response[:headers].blank?
|
||||||
|
|
||||||
|
location = response[:headers]["location"]
|
||||||
|
next if location.blank?
|
||||||
|
|
||||||
|
base_url = URI.join(base_url, location).to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
base_url
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Parses HTTP response text from `curl` output into a hash containing the
|
# Parses HTTP response text from `curl` output into a hash containing the
|
||||||
|
|||||||
10
Library/Homebrew/vendor/bundle/bundler/setup.rb
vendored
10
Library/Homebrew/vendor/bundle/bundler/setup.rb
vendored
@ -35,8 +35,8 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.4.14/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.4.14/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/msgpack-1.6.0")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/msgpack-1.6.0")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/msgpack-1.6.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/msgpack-1.6.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/bootsnap-1.14.0")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/bootsnap-1.15.0")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bootsnap-1.14.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bootsnap-1.15.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/byebug-11.1.3")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/byebug-11.1.3")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/byebug-11.1.3/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/byebug-11.1.3/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/coderay-1.1.3/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/coderay-1.1.3/lib")
|
||||||
@ -76,14 +76,14 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mustache-1.1.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mustache-1.1.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel-1.22.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel-1.22.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel_tests-3.13.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel_tests-3.13.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parser-3.1.2.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parser-3.1.3.0/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/rainbow-3.1.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.10461/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.10461/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parlour-8.0.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parlour-8.0.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/patchelf-1.4.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/patchelf-1.4.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/plist-3.6.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/plist-3.6.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/pry-0.14.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/pry-0.14.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rack-3.0.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rack-3.0.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unparser-0.6.4/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unparser-0.6.4/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.0.14/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.0.14/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/rdiscount-2.2.7")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/rdiscount-2.2.7")
|
||||||
@ -106,7 +106,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.3.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.3.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.35.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.35.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.3/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.15.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.15.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib")
|
||||||
|
|||||||
@ -817,8 +817,14 @@ module Rack
|
|||||||
verify_to_path
|
verify_to_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
BODY_METHODS = {to_ary: true, each: true, call: true, to_path: true}
|
||||||
|
|
||||||
|
def to_path
|
||||||
|
@body.to_path
|
||||||
|
end
|
||||||
|
|
||||||
def respond_to?(name, *)
|
def respond_to?(name, *)
|
||||||
if name == :to_ary
|
if BODY_METHODS.key?(name)
|
||||||
@body.respond_to?(name)
|
@body.respond_to?(name)
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
@ -46,7 +46,7 @@ module Rack
|
|||||||
end
|
end
|
||||||
|
|
||||||
def method_override_param(req)
|
def method_override_param(req)
|
||||||
req.POST[METHOD_OVERRIDE_PARAM_KEY]
|
req.POST[METHOD_OVERRIDE_PARAM_KEY] if req.form_data? || req.parseable_data?
|
||||||
rescue Utils::InvalidParameterError, Utils::ParameterTypeError
|
rescue Utils::InvalidParameterError, Utils::ParameterTypeError
|
||||||
req.get_header(RACK_ERRORS).puts "Invalid or incomplete POST params"
|
req.get_header(RACK_ERRORS).puts "Invalid or incomplete POST params"
|
||||||
rescue EOFError
|
rescue EOFError
|
||||||
@ -25,7 +25,7 @@ module Rack
|
|||||||
VERSION
|
VERSION
|
||||||
end
|
end
|
||||||
|
|
||||||
RELEASE = "3.0.0"
|
RELEASE = "3.0.1"
|
||||||
|
|
||||||
# Return the Rack release as a dotted string.
|
# Return the Rack release as a dotted string.
|
||||||
def self.release
|
def self.release
|
||||||
@ -1,41 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module RuboCop
|
|
||||||
module Cop
|
|
||||||
module Rails
|
|
||||||
# Identifies passing any argument to `#to_s`.
|
|
||||||
#
|
|
||||||
# @safety
|
|
||||||
# This cop is marked as unsafe because it may detect `#to_s` calls
|
|
||||||
# that are not related to Active Support implementation.
|
|
||||||
#
|
|
||||||
# @example
|
|
||||||
#
|
|
||||||
# # bad
|
|
||||||
# obj.to_s(:delimited)
|
|
||||||
#
|
|
||||||
# # good
|
|
||||||
# obj.to_formatted_s(:delimited)
|
|
||||||
#
|
|
||||||
class ToSWithArgument < Base
|
|
||||||
extend AutoCorrector
|
|
||||||
extend TargetRailsVersion
|
|
||||||
|
|
||||||
MSG = 'Use `to_formatted_s` instead.'
|
|
||||||
|
|
||||||
RESTRICT_ON_SEND = %i[to_s].freeze
|
|
||||||
|
|
||||||
minimum_target_rails_version 7.0
|
|
||||||
|
|
||||||
def on_send(node)
|
|
||||||
return if node.arguments.empty?
|
|
||||||
|
|
||||||
add_offense(node.loc.selector) do |corrector|
|
|
||||||
corrector.replace(node.loc.selector, 'to_formatted_s')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
alias on_csend on_send
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -540,7 +540,7 @@ Rails/I18nLazyLookup:
|
|||||||
Enabled: pending
|
Enabled: pending
|
||||||
VersionAdded: '2.14'
|
VersionAdded: '2.14'
|
||||||
Include:
|
Include:
|
||||||
- 'controllers/**/*'
|
- 'app/controllers/**/*.rb'
|
||||||
|
|
||||||
Rails/I18nLocaleAssignment:
|
Rails/I18nLocaleAssignment:
|
||||||
Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.'
|
Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.'
|
||||||
@ -10,8 +10,8 @@ module RuboCop
|
|||||||
|
|
||||||
def_node_matcher :active_record?, <<~PATTERN
|
def_node_matcher :active_record?, <<~PATTERN
|
||||||
{
|
{
|
||||||
(const nil? :ApplicationRecord)
|
(const {nil? cbase} :ApplicationRecord)
|
||||||
(const (const nil? :ActiveRecord) :Base)
|
(const (const {nil? cbase} :ActiveRecord) :Base)
|
||||||
}
|
}
|
||||||
PATTERN
|
PATTERN
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.from_hash_brackets_map(node, match)
|
def self.from_hash_brackets_map(node, match)
|
||||||
new(match, node.children.last, 'Hash['.length, ']'.length)
|
new(match, node.children.last, "#{node.receiver.source}[".length, ']'.length)
|
||||||
end
|
end
|
||||||
|
|
||||||
def strip_prefix_and_suffix(node, corrector)
|
def strip_prefix_and_suffix(node, corrector)
|
||||||
@ -8,7 +8,7 @@ module RuboCop
|
|||||||
|
|
||||||
def_node_matcher :migration_class?, <<~PATTERN
|
def_node_matcher :migration_class?, <<~PATTERN
|
||||||
(class
|
(class
|
||||||
(const nil? _)
|
(const {nil? cbase} _)
|
||||||
(send
|
(send
|
||||||
(const (const {nil? cbase} :ActiveRecord) :Migration)
|
(const (const {nil? cbase} :ActiveRecord) :Migration)
|
||||||
:[]
|
:[]
|
||||||
@ -43,8 +43,8 @@ module RuboCop
|
|||||||
|
|
||||||
def_node_search :action_controller?, <<~PATTERN
|
def_node_search :action_controller?, <<~PATTERN
|
||||||
{
|
{
|
||||||
(const nil? :ApplicationController)
|
(const {nil? cbase} :ApplicationController)
|
||||||
(const (const nil? :ActionController) :Base)
|
(const (const {nil? cbase} :ActionController) :Base)
|
||||||
}
|
}
|
||||||
PATTERN
|
PATTERN
|
||||||
|
|
||||||
@ -69,9 +69,12 @@ module RuboCop
|
|||||||
def followed_by_render?(flash_node)
|
def followed_by_render?(flash_node)
|
||||||
flash_assigment_node = find_ancestor(flash_node, type: :send)
|
flash_assigment_node = find_ancestor(flash_node, type: :send)
|
||||||
context = flash_assigment_node
|
context = flash_assigment_node
|
||||||
context = context.parent if context.parent.if_type?
|
if (if_node = context.each_ancestor(:if).first)
|
||||||
|
context = if_node
|
||||||
|
elsif context.right_siblings.empty?
|
||||||
|
return true
|
||||||
|
end
|
||||||
context = context.right_siblings
|
context = context.right_siblings
|
||||||
return true if context.empty?
|
|
||||||
|
|
||||||
context.compact.any? do |node|
|
context.compact.any? do |node|
|
||||||
render?(node)
|
render?(node)
|
||||||
@ -30,7 +30,7 @@ module RuboCop
|
|||||||
|
|
||||||
def_node_matcher :action_controller_test_case?, <<~PATTERN
|
def_node_matcher :action_controller_test_case?, <<~PATTERN
|
||||||
(class
|
(class
|
||||||
(const nil? _)
|
(const {nil? cbase} _)
|
||||||
(const (const {nil? cbase} :ActionController) :TestCase) _)
|
(const (const {nil? cbase} :ActionController) :TestCase) _)
|
||||||
PATTERN
|
PATTERN
|
||||||
|
|
||||||
@ -6,7 +6,8 @@ module RuboCop
|
|||||||
# Enforces consistent ordering of the standard Rails RESTful controller actions.
|
# Enforces consistent ordering of the standard Rails RESTful controller actions.
|
||||||
#
|
#
|
||||||
# The cop is configurable and can enforce any ordering of the standard actions.
|
# The cop is configurable and can enforce any ordering of the standard actions.
|
||||||
# All other methods are ignored.
|
# All other methods are ignored. So, the actions specified in `ExpectedOrder` should be
|
||||||
|
# defined before actions not specified.
|
||||||
#
|
#
|
||||||
# [source,yaml]
|
# [source,yaml]
|
||||||
# ----
|
# ----
|
||||||
@ -35,6 +36,7 @@ module RuboCop
|
|||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
include VisibilityHelp
|
include VisibilityHelp
|
||||||
include DefNode
|
include DefNode
|
||||||
|
include RangeHelp
|
||||||
|
|
||||||
MSG = 'Action `%<current>s` should appear before `%<previous>s`.'
|
MSG = 'Action `%<current>s` should appear before `%<previous>s`.'
|
||||||
|
|
||||||
@ -71,10 +73,44 @@ module RuboCop
|
|||||||
current: current.method_name
|
current: current.method_name
|
||||||
)
|
)
|
||||||
add_offense(current, message: message) do |corrector|
|
add_offense(current, message: message) do |corrector|
|
||||||
corrector.replace(current, previous.source)
|
current = correction_target(current)
|
||||||
corrector.replace(previous, current.source)
|
previous = correction_target(previous)
|
||||||
|
|
||||||
|
swap_range(corrector, current, previous)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def correction_target(def_node)
|
||||||
|
range_with_comments_and_lines(def_node.each_ancestor(:if).first || def_node)
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_range(range1, range2)
|
||||||
|
range1.with(
|
||||||
|
begin_pos: [range1.begin_pos, range2.begin_pos].min,
|
||||||
|
end_pos: [range1.end_pos, range2.end_pos].max
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def range_with_comments(node)
|
||||||
|
ranges = [
|
||||||
|
node,
|
||||||
|
*processed_source.ast_with_comments[node]
|
||||||
|
].map do |element|
|
||||||
|
element.location.expression
|
||||||
|
end
|
||||||
|
ranges.reduce do |result, range|
|
||||||
|
add_range(result, range)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def range_with_comments_and_lines(node)
|
||||||
|
range_by_whole_lines(range_with_comments(node), include_final_newline: true)
|
||||||
|
end
|
||||||
|
|
||||||
|
def swap_range(corrector, range1, range2)
|
||||||
|
corrector.insert_before(range2, range1.source)
|
||||||
|
corrector.remove(range1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user