diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 371605a34f..0026c0d168 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -11,7 +11,7 @@ on: jobs: analyze: name: Analyze - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: actions: read contents: read diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8bdfb1f8db..1d692b3838 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,7 +14,7 @@ permissions: jobs: ubuntu: if: startsWith(github.repository, 'Homebrew/') - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: diff --git a/.github/workflows/sorbet.yml b/.github/workflows/sorbet.yml index 4944cfdaaa..d87bf16cdc 100644 --- a/.github/workflows/sorbet.yml +++ b/.github/workflows/sorbet.yml @@ -46,12 +46,13 @@ jobs: if git ls-remote --exit-code --heads origin "${BRANCH}" then git checkout "${BRANCH}" - git reset --hard origin/master + git checkout "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet" else git checkout --no-track -B "${BRANCH}" origin/master fi - if brew typecheck --update --fail-if-not-changed + brew typecheck --update + if ! git diff --stat --exit-code "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet" then git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet" git commit -m "sorbet: Update RBI files." \ diff --git a/.github/workflows/spdx.yml b/.github/workflows/spdx.yml index 71ed6a6e6b..444ca4d001 100644 --- a/.github/workflows/spdx.yml +++ b/.github/workflows/spdx.yml @@ -7,12 +7,15 @@ on: - master schedule: - cron: "0 0 * * *" + workflow_dispatch: + permissions: contents: read + jobs: spdx: if: github.repository == 'Homebrew/brew' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew @@ -42,12 +45,12 @@ jobs: if git ls-remote --exit-code --heads origin "${BRANCH}" then git checkout "${BRANCH}" - git reset --hard origin/master + git checkout "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx" else git checkout --no-track -B "${BRANCH}" origin/master fi - if brew update-license-data --fail-if-not-changed + if brew update-license-data then git add "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx" git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)." diff --git a/.github/workflows/update-man-completions.yml b/.github/workflows/sponsors-maintainers-man-completions.yml similarity index 52% rename from .github/workflows/update-man-completions.yml rename to .github/workflows/sponsors-maintainers-man-completions.yml index 548d63be6e..a1187a4832 100644 --- a/.github/workflows/update-man-completions.yml +++ b/.github/workflows/sponsors-maintainers-man-completions.yml @@ -1,9 +1,9 @@ -name: Update maintainers, manpage and completions +name: Update sponsors, maintainers, manpage and completions on: push: paths: - - .github/workflows/update-man-completions.yml + - .github/workflows/sponsors-maintainers-man-completions.yml - README.md - Library/Homebrew/cmd/** - Library/Homebrew/dev-cmd/** @@ -12,8 +12,6 @@ on: - Library/Homebrew/cli/parser.rb - Library/Homebrew/completions.rb - Library/Homebrew/env_config.rb - branches: - - master schedule: - cron: "0 0 * * *" workflow_dispatch: @@ -22,11 +20,12 @@ permissions: contents: read jobs: - update-manpage: - runs-on: ubuntu-latest + updates: + runs-on: ubuntu-22.04 if: github.repository == 'Homebrew/brew' steps: - name: Setup Homebrew + id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master - name: Configure Git user @@ -39,35 +38,68 @@ jobs: with: signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }} - - name: Update maintainers, manpage and completions + - name: Cache Bundler RubyGems + uses: actions/cache@v1 + with: + path: ${{ steps.set-up-homebrew.outputs.gems-path }} + key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} + restore-keys: ${{ runner.os }}-rubygems- + + - name: Update sponsors, maintainers, manpage and completions id: update run: | git fetch origin - BRANCH=update-man-completions + if [[ -n "$GITHUB_REF_NAME" && "$GITHUB_REF_NAME" != "master" ]] + then + BRANCH="$GITHUB_REF_NAME" + else + BRANCH=sponsors-maintainers-man-completions + fi echo "::set-output name=branch::${BRANCH}" if git ls-remote --exit-code --heads origin "${BRANCH}" then git checkout "${BRANCH}" - git reset --hard origin/master + git checkout "${GITHUB_WORKSPACE}/README.md" \ + "${GITHUB_WORKSPACE}/docs/Manpage.md" \ + "${GITHUB_WORKSPACE}/manpages/brew.1" \ + "${GITHUB_WORKSPACE}/completions" else git checkout --no-track -B "${BRANCH}" origin/master fi - if [[ "${{github.event_name}}" != "push" ]] + if brew update-sponsors then - brew update-maintainers + git add "${GITHUB_WORKSPACE}/README.md" + git commit -m "Update sponsors." \ + -m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow." + COMMITTED=true fi - if brew generate-man-completions --fail-if-not-changed + if brew update-maintainers + then + git add "${GITHUB_WORKSPACE}/README.md" \ + "${GITHUB_WORKSPACE}/docs/Manpage.md" \ + "${GITHUB_WORKSPACE}/manpages/brew.1" + git commit -m "Update maintainers." \ + -m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow." + COMMITTED=true + fi + + if brew generate-man-completions then git add "${GITHUB_WORKSPACE}/README.md" \ "${GITHUB_WORKSPACE}/docs/Manpage.md" \ "${GITHUB_WORKSPACE}/manpages/brew.1" \ "${GITHUB_WORKSPACE}/completions" - git commit -m "Update maintainers, manpage and completions." \ - -m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/update-man-completions.yml) workflow." + git commit -m "Update manpage and completions." \ + -m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow." + COMMITTED=true + fi + + if [[ -n "$COMMITTED" ]] + then echo "::set-output name=committed::true" PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")" if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]] @@ -77,7 +109,7 @@ jobs: fi env: GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} - HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_BREW_UPDATE_MAINTAINERS_TOKEN }} + HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_BREW_UPDATE_SPONSORS_MAINTAINERS_TOKEN }} HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} - name: Push commits diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0bc3616251..37f02beceb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ concurrency: jobs: syntax: if: github.repository == 'Homebrew/brew' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew @@ -52,7 +52,7 @@ jobs: name: tap syntax (Linux) needs: syntax if: startsWith(github.repository, 'Homebrew/') - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew @@ -82,13 +82,13 @@ jobs: brew update-test --commit=HEAD - name: Run brew readall on all taps - run: brew readall --aliases + run: brew readall --eval-all --aliases - name: Run brew style on homebrew-core for Linux run: brew style --display-cop-names homebrew/core - name: Run brew audit --skip-style on all taps - run: brew audit --skip-style --except=version --display-failures-only + run: brew audit --eval-all --skip-style --except=version --display-failures-only - name: Set up all Homebrew taps run: | @@ -146,7 +146,7 @@ jobs: vendored-gems: name: vendored gems (Linux) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew @@ -167,31 +167,62 @@ jobs: docker: needs: syntax - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master - name: Build Docker image - run: docker build -t brew --build-arg=version=16.04 . + run: | + docker build -t brew --build-arg=version=22.04 \ + --label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \ + --label org.opencontainers.image.url="https://brew.sh" \ + --label org.opencontainers.image.documentation="https://docs.brew.sh" \ + --label org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}" \ + --label org.opencontainers.image.revision="${GITHUB_SHA}" \ + --label org.opencontainers.image.vendor="${GITHUB_REPOSITORY_OWNER}" \ + --label org.opencontainers.image.licenses="BSD-2-Clause" \ + . - name: Deploy the Docker image to GitHub Packages and Docker Hub if: github.ref == 'refs/heads/master' run: | echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | docker login ghcr.io -u BrewTestBot --password-stdin - docker tag brew "ghcr.io/homebrew/ubuntu16.04:master" - docker push "ghcr.io/homebrew/ubuntu16.04:master" + docker tag brew "ghcr.io/homebrew/ubuntu22.04:master" + docker push "ghcr.io/homebrew/ubuntu22.04:master" echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | docker login -u brewtestbot --password-stdin - docker tag brew "homebrew/ubuntu16.04:master" + docker tag brew "homebrew/ubuntu22.04:master" + docker push "homebrew/ubuntu22.04:master" + + - name: Build deprecated 16.04 Docker image + run: | + echo "homebrew/ubuntu16.04:master is deprecated and will soon be retired. Use homebrew/ubuntu22.04:master or homebrew/ubuntu16.04 or homebrew/brew. For CI, homebrew/ubuntu22.04:master is recommended." > .docker-deprecate + docker build -t brew-deprecated --build-arg=version=16.04 \ + --label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \ + --label org.opencontainers.image.url="https://brew.sh" \ + --label org.opencontainers.image.documentation="https://docs.brew.sh" \ + --label org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}" \ + --label org.opencontainers.image.revision="${GITHUB_SHA}" \ + --label org.opencontainers.image.vendor="${GITHUB_REPOSITORY_OWNER}" \ + --label org.opencontainers.image.licenses="BSD-2-Clause" \ + --label org.opencontainers.image.support.end-of-support="2022-09-07T00:00:00Z" \ + . + + - name: Deploy the deprecated 16.04 Docker image to GitHub Packages and Docker Hub + if: github.ref == 'refs/heads/master' + run: | + docker tag brew-deprecated "ghcr.io/homebrew/ubuntu16.04:master" + docker push "ghcr.io/homebrew/ubuntu16.04:master" + docker tag brew-deprecated "homebrew/ubuntu16.04:master" docker push "homebrew/ubuntu16.04:master" tests: name: ${{ matrix.name }} needs: syntax - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: include: @@ -244,7 +275,7 @@ jobs: test-default-formula-linux: name: test default formula (Linux) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: HOMEBREW_BOOTSNAP: 1 steps: @@ -301,7 +332,7 @@ jobs: Library/Taps/homebrew/homebrew-services - name: Run brew readall on all taps - run: brew readall --aliases + run: brew readall --eval-all --aliases - name: Install brew tests dependencies run: brew install subversion curl diff --git a/.github/workflows/triage-issues.yml b/.github/workflows/triage-issues.yml index 7963be2688..93b7411565 100644 --- a/.github/workflows/triage-issues.yml +++ b/.github/workflows/triage-issues.yml @@ -29,7 +29,7 @@ jobs: contains(github.event.pull_request.labels.*.name, 'stale') ) ) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Mark/Close Stale Issues and Pull Requests uses: actions/stale@v5 @@ -55,7 +55,7 @@ jobs: contains(github.event.pull_request.labels.*.name, 'stale') ) ) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Mark/Close Stale `bump-formula-pr` and `bump-cask-pr` Pull Requests uses: actions/stale@v5 @@ -72,7 +72,7 @@ jobs: lock-threads: if: startsWith(github.repository, 'Homebrew/') && github.event_name != 'issue_comment' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Lock Outdated Threads uses: dessant/lock-threads@e460dfeb36e731f3aeb214be6b0c9a9d9a67eda6 diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 2ef2939e34..1b21dbc19f 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -18,7 +18,7 @@ concurrency: triage-${{ github.head_ref }} jobs: review: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: startsWith(github.repository, 'Homebrew/') steps: - name: Re-run this workflow diff --git a/.github/workflows/vendor-gems.yml b/.github/workflows/vendor-gems.yml index bbe11aeab8..00a12b3127 100644 --- a/.github/workflows/vendor-gems.yml +++ b/.github/workflows/vendor-gems.yml @@ -60,16 +60,12 @@ jobs: GEM_NAME: ${{ steps.checkout.outputs.gem_name }} HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} run: | - set -u - - if brew typecheck --update --fail-if-not-changed + brew typecheck --update + if ! git diff --stat --exit-code "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet" then - if git add Library/Homebrew/sorbet - then - git commit -m "Update RBI files for ${GEM_NAME}." - fi - - git reset --hard + git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet" + git commit -m "Update RBI files for ${GEM_NAME}." \ + -m "Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gemss.yml) workflow." fi - name: Push to pull request diff --git a/Library/.rubocop_rspec.yml b/Library/.rubocop_rspec.yml index 1cc0a316d4..a9fc375d4b 100644 --- a/Library/.rubocop_rspec.yml +++ b/Library/.rubocop_rspec.yml @@ -21,6 +21,8 @@ RSpec/RepeatedDescription: Enabled: false RSpec/StubbedMock: Enabled: false +RSpec/NoExpectationExample: + Enabled: false # TODO: try to reduce these RSpec/ExampleLength: diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 849c8209be..3d09c128b4 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (6.1.6.1) + activesupport (6.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -58,7 +58,7 @@ GEM mime-types-data (3.2022.0105) mini_portile2 (2.8.0) minitest (5.16.3) - msgpack (1.5.5) + msgpack (1.5.6) mustache (1.1.1) net-http-digest_auth (1.4.1) net-http-persistent (4.0.1) @@ -67,7 +67,7 @@ GEM mini_portile2 (~> 2.8.0) racc (~> 1.4) parallel (1.22.1) - parallel_tests (3.11.1) + parallel_tests (3.12.0) parallel parlour (8.0.0) commander (~> 4.5) @@ -84,7 +84,7 @@ GEM method_source (~> 1.0) public_suffix (5.0.0) racc (1.6.0) - rack (2.2.4) + rack (3.0.0) rainbow (3.1.1) rbi (0.0.14) ast @@ -104,7 +104,7 @@ GEM rspec-mocks (~> 3.11.0) rspec-core (3.11.0) rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec-expectations (3.11.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.11.0) rspec-github (2.3.1) @@ -117,9 +117,9 @@ GEM rspec-support (~> 3.11.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-sorbet (1.8.3) + rspec-sorbet (1.9.0) sorbet-runtime - rspec-support (3.11.0) + rspec-support (3.11.1) rspec-wait (0.0.9) rspec (>= 3, < 4) rspec_junit_formatter (0.5.1) @@ -136,15 +136,15 @@ GEM unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.21.0) parser (>= 3.1.1.0) - rubocop-performance (1.14.3) + rubocop-performance (1.15.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.15.2) + rubocop-rails (2.16.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-rspec (2.12.1) - rubocop (~> 1.31) + rubocop (>= 1.33.0, < 2.0) + rubocop-rspec (2.13.1) + rubocop (~> 1.33) rubocop-sorbet (0.6.11) rubocop (>= 0.90.0) ruby-macho (3.0.0) diff --git a/Library/Homebrew/api/formula.rb b/Library/Homebrew/api/formula.rb index cd65bdbe32..4011403a32 100644 --- a/Library/Homebrew/api/formula.rb +++ b/Library/Homebrew/api/formula.rb @@ -33,7 +33,7 @@ module Homebrew if cached_formula_json_file.exist? && !cached_formula_json_file.empty? curl_args.prepend("--time-cond", cached_formula_json_file) end - curl_download(*curl_args, to: HOMEBREW_CACHE_API/"#{formula_api_path}.json", max_time: 5) + curl_download(*curl_args, to: cached_formula_json_file, max_time: 5) json_formulae = JSON.parse(cached_formula_json_file.read) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 7f52b5a483..5894a41b2b 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -7,6 +7,7 @@ if ENV["HOMEBREW_STACKPROF"] end raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"] +raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__ std_trap = trap("INT") { exit! 130 } # no backtrace thanks @@ -86,7 +87,8 @@ begin end if internal_cmd || Commands.external_ruby_v2_cmd_path(cmd) - if Commands::INSTALL_FROM_API_FORBIDDEN_COMMANDS.include?(cmd) && Homebrew::EnvConfig.install_from_api? + if Commands::INSTALL_FROM_API_FORBIDDEN_COMMANDS.include?(cmd) && + Homebrew::EnvConfig.install_from_api? && !Homebrew::EnvConfig.developer? odie "This command cannot be run while HOMEBREW_INSTALL_FROM_API is set!" end @@ -120,8 +122,9 @@ begin # Unset HOMEBREW_HELP to avoid confusing the tap with_env HOMEBREW_HELP: nil do tap_commands = [] - cgroup = Utils.popen_read("cat", "/proc/1/cgroup") - if %w[azpl_job actions_job docker garden kubepods].none? { |container| cgroup.include?(container) } + if File.exist?("/.dockerenv") || + ((cgroup = Utils.popen_read("cat", "/proc/1/cgroup").presence) && + %w[azpl_job actions_job docker garden kubepods].none? { |type| cgroup.include?(type) }) brew_uid = HOMEBREW_BREW_FILE.stat.uid tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}] if Process.uid.zero? && !brew_uid.zero? end diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index cbe08846a2..86b0e855a6 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -197,6 +197,7 @@ check-run-command-as-root() { [[ "$(id -u)" == 0 ]] || return # Allow Azure Pipelines/GitHub Actions/Docker/Concourse/Kubernetes to do everything as root (as it's normal there) + [[ -f /.dockerenv ]] && return [[ -f /proc/1/cgroup ]] && grep -E "azpl_job|actions_job|docker|garden|kubepods" -q /proc/1/cgroup && return # Homebrew Services may need `sudo` for system-wide daemons. @@ -358,6 +359,18 @@ fi ##### Now, do everything else (that may be a bit slower). ##### +# Docker image deprecation +if [[ -f "${HOMEBREW_REPOSITORY}/.docker-deprecate" ]] +then + DOCKER_DEPRECATION_MESSAGE="$(cat "${HOMEBREW_REPOSITORY}/.docker-deprecate")" + if [[ -n "${GITHUB_ACTIONS}" ]] + then + echo "::warning::${DOCKER_DEPRECATION_MESSAGE}" >&2 + else + opoo "${DOCKER_DEPRECATION_MESSAGE}" + fi +fi + # USER isn't always set so provide a fall back for `brew` and subprocesses. export USER="${USER:-$(id -un)}" diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index ec430e04ba..76aec34a1a 100644 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -4,6 +4,8 @@ # This script is loaded by formula_installer as a separate instance. # Thrown exceptions are propagated back to the parent process over a pipe +raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__ + old_trap = trap("INT") { exit! 130 } require_relative "global" diff --git a/Library/Homebrew/build_environment.rb b/Library/Homebrew/build_environment.rb index d63604faa9..9b03f709aa 100644 --- a/Library/Homebrew/build_environment.rb +++ b/Library/Homebrew/build_environment.rb @@ -33,9 +33,17 @@ class BuildEnvironment module DSL extend T::Sig + # Initialise @env for each class which may use this DSL (e.g. each formula subclass). + # `env` may never be called, and it needs to be initialised before the class is frozen. + def inherited(child) + super + child.instance_eval do + @env = BuildEnvironment.new + end + end + sig { params(settings: Symbol).returns(BuildEnvironment) } def env(*settings) - @env ||= BuildEnvironment.new @env.merge(settings) end end diff --git a/Library/Homebrew/cask/artifact/abstract_artifact.rb b/Library/Homebrew/cask/artifact/abstract_artifact.rb index 5c1abb3ffd..25b6f02833 100644 --- a/Library/Homebrew/cask/artifact/abstract_artifact.rb +++ b/Library/Homebrew/cask/artifact/abstract_artifact.rb @@ -1,6 +1,8 @@ # typed: false # frozen_string_literal: true +require "active_support/core_ext/object/deep_dup" + module Cask module Artifact # Abstract superclass for all artifacts. @@ -127,8 +129,9 @@ module Cask attr_reader :cask - def initialize(cask) + def initialize(cask, *dsl_args) @cask = cask + @dsl_args = dsl_args.deep_dup end def config @@ -139,6 +142,10 @@ module Cask def to_s "#{summarize} (#{self.class.english_name})" end + + def to_args + @dsl_args.reject(&:blank?) + end end end end diff --git a/Library/Homebrew/cask/artifact/abstract_flight_block.rb b/Library/Homebrew/cask/artifact/abstract_flight_block.rb index 1695a257a5..eccdb10cab 100644 --- a/Library/Homebrew/cask/artifact/abstract_flight_block.rb +++ b/Library/Homebrew/cask/artifact/abstract_flight_block.rb @@ -32,6 +32,10 @@ module Cask abstract_phase(self.class.uninstall_dsl_key) end + def summarize + directives.keys.map(&:to_s).join(", ") + end + private def class_for_dsl_key(dsl_key) @@ -44,10 +48,6 @@ module Cask class_for_dsl_key(dsl_key).new(cask).instance_eval(&block) end - - def summarize - directives.keys.map(&:to_s).join(", ") - end end end end diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index 2c8489828c..b5100bff15 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -40,7 +40,7 @@ module Cask def initialize(cask, directives) directives.assert_valid_keys!(*ORDERED_DIRECTIVES) - super(cask) + super(cask, **directives) directives[:signal] = Array(directives[:signal]).flatten.each_slice(2).to_a @directives = directives diff --git a/Library/Homebrew/cask/artifact/installer.rb b/Library/Homebrew/cask/artifact/installer.rb index 95c57418f4..2238bc075a 100644 --- a/Library/Homebrew/cask/artifact/installer.rb +++ b/Library/Homebrew/cask/artifact/installer.rb @@ -72,7 +72,7 @@ module Cask attr_reader :path, :args def initialize(cask, **args) - super(cask) + super(cask, **args) if args.key?(:manual) @path = Pathname(args[:manual]) diff --git a/Library/Homebrew/cask/artifact/pkg.rb b/Library/Homebrew/cask/artifact/pkg.rb index dd3a9447bf..9c3ef09a13 100644 --- a/Library/Homebrew/cask/artifact/pkg.rb +++ b/Library/Homebrew/cask/artifact/pkg.rb @@ -23,7 +23,7 @@ module Cask end def initialize(cask, path, **stanza_options) - super(cask) + super(cask, path, **stanza_options) @path = cask.staged_path.join(path) @stanza_options = stanza_options end diff --git a/Library/Homebrew/cask/artifact/relocated.rb b/Library/Homebrew/cask/artifact/relocated.rb index 612a0c7420..d2a6716914 100644 --- a/Library/Homebrew/cask/artifact/relocated.rb +++ b/Library/Homebrew/cask/artifact/relocated.rb @@ -42,12 +42,13 @@ module Cask attr_reader :source, :target sig { - params(cask: Cask, source: T.nilable(T.any(String, Pathname)), target: T.nilable(T.any(String, Pathname))) + params(cask: Cask, source: T.nilable(T.any(String, Pathname)), target_hash: T.any(String, Pathname)) .void } - def initialize(cask, source, target: nil) - super(cask) + def initialize(cask, source, **target_hash) + super(cask, source, **target_hash) + target = target_hash[:target] @source_string = source.to_s @target_string = target.to_s source = cask.staged_path.join(source) diff --git a/Library/Homebrew/cask/artifact/stage_only.rb b/Library/Homebrew/cask/artifact/stage_only.rb index b475b00a86..3c5f10b639 100644 --- a/Library/Homebrew/cask/artifact/stage_only.rb +++ b/Library/Homebrew/cask/artifact/stage_only.rb @@ -14,7 +14,7 @@ module Cask def self.from_args(cask, *args) raise CaskInvalidError.new(cask.token, "'stage_only' takes only a single argument: true") if args != [true] - new(cask) + new(cask, true) end sig { returns(T::Array[T::Boolean]) } diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 677af6e38c..7fd0c55d91 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -581,7 +581,19 @@ module Cask next unless path.exist? result = system_command("codesign", args: ["--verify", path], print_stderr: false) - add_warning result.merged_output unless result.success? + + next if result.success? + + message = "Signature verification failed:\n#{result.merged_output}\nmacOS on ARM requires applications " \ + "to be signed. Please contact the upstream developer to let them know they should " + + message += if result.stderr.include?("not signed at all") + "sign their app." + else + "fix the signature of their app." + end + + add_warning message end end end diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index d347e27ac3..9775e80bd8 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -24,6 +24,11 @@ module Cask attr_accessor :download, :allow_reassignment def self.all + # TODO: uncomment for 3.7.0 and ideally avoid using ARGV by moving to e.g. CLI::Parser + # if !ARGV.include?("--eval-all") && !Homebrew::EnvConfig.eval_all? + # odeprecated "Cask::Cask#all without --all or HOMEBREW_EVAL_ALL" + # end + Tap.flat_map(&:cask_files).map do |f| CaskLoader::FromTapPathLoader.new(f).load(config: nil) rescue CaskUnreadableError => e @@ -235,7 +240,7 @@ module Cask "installed" => versions.last, "outdated" => outdated?, "sha256" => sha256, - "artifacts" => artifacts.map(&method(:to_h_gsubs)), + "artifacts" => artifacts_list, "caveats" => (to_h_string_gsubs(caveats) unless caveats.empty?), "depends_on" => depends_on, "conflicts_with" => conflicts_with, @@ -281,6 +286,18 @@ module Cask private + def artifacts_list + artifacts.map do |artifact| + key, value = if artifact.is_a? Artifact::AbstractFlightBlock + artifact.summarize + else + [artifact.class.dsl_key, to_h_gsubs(artifact.to_args)] + end + + { key => value } + end + end + def to_h_string_gsubs(string) string.to_s .gsub(Dir.home, "$HOME") diff --git a/Library/Homebrew/cask_dependent.rb b/Library/Homebrew/cask_dependent.rb index cb9841fb8b..36c28c5e2c 100644 --- a/Library/Homebrew/cask_dependent.rb +++ b/Library/Homebrew/cask_dependent.rb @@ -1,8 +1,17 @@ # typed: true # frozen_string_literal: true +require "requirement" + # An adapter for casks to provide dependency information in a formula-like interface. class CaskDependent + # Defines a dependency on another cask + class Requirement < ::Requirement + satisfy(build_env: false) do + Cask::CaskLoader.load(cask).installed? + end + end + attr_reader :cask def initialize(cask) @@ -33,11 +42,21 @@ class CaskDependent dsl_reqs = @cask.depends_on dsl_reqs.arch&.each do |arch| - requirements << ArchRequirement.new([:x86_64]) if arch[:bits] == 64 - requirements << ArchRequirement.new([arch[:type]]) + arch = if arch[:bits] == 64 + if arch[:type] == :intel + :x86_64 + else + :"#{arch[:type]}64" + end + elsif arch[:type] == :intel && arch[:bits] == 32 + :i386 + else + arch[:type] + end + requirements << ArchRequirement.new([arch]) end dsl_reqs.cask.each do |cask_ref| - requirements << Requirement.new([{ cask: cask_ref }]) + requirements << CaskDependent::Requirement.new([{ cask: cask_ref }]) end requirements << dsl_reqs.macos if dsl_reqs.macos diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 716a23dfbb..deadc6bd53 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -235,6 +235,7 @@ module Homebrew cleanup_cache cleanup_logs cleanup_lockfiles + cleanup_python_site_packages prune_prefix_symlinks_and_directories unless dry_run? @@ -484,6 +485,55 @@ module Homebrew end end + def cleanup_python_site_packages + pyc_files = Hash.new { |h, k| h[k] = [] } + seen_non_pyc_file = Hash.new { |h, k| h[k] = false } + unused_pyc_files = [] + + HOMEBREW_PREFIX.glob("lib/python*/site-packages").each do |site_packages| + site_packages.each_child do |child| + next unless child.directory? + # TODO: Work out a sensible way to clean up pip's, setuptools', and wheel's + # {dist,site}-info directories. Alternatively, consider always removing + # all `-info` directories, because we may not be making use of them. + next if child.basename.to_s.end_with?("-info") + + # Clean up old *.pyc files in the top-level __pycache__. + if child.basename.to_s == "__pycache__" + child.find do |path| + next unless path.extname == ".pyc" + next unless path.prune?(days) + + unused_pyc_files << path + end + + next + end + + # Look for directories that contain only *.pyc files. + child.find do |path| + next if path.directory? + + if path.extname == ".pyc" + pyc_files[child] << path + else + seen_non_pyc_file[child] = true + break + end + end + end + end + + unused_pyc_files += pyc_files.reject { |k,| seen_non_pyc_file[k] } + .values + .flatten + return if unused_pyc_files.blank? + + unused_pyc_files.each do |pyc| + cleanup_path(pyc) { pyc.unlink } + end + end + def prune_prefix_symlinks_and_directories ObserverPathnameExtension.reset_counts! diff --git a/Library/Homebrew/cli/args.rbi b/Library/Homebrew/cli/args.rbi index 5f9086b21f..cf4265879b 100644 --- a/Library/Homebrew/cli/args.rbi +++ b/Library/Homebrew/cli/args.rbi @@ -135,6 +135,9 @@ module Homebrew sig { returns(T::Boolean) } def all?; end + sig { returns(T::Boolean) } + def eval_all?; end + sig { returns(T::Boolean) } def full?; end diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index e684091929..541f341e4a 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -22,10 +22,10 @@ module Homebrew may be appended to the command. When given multiple formula arguments, show the intersection of dependencies for each formula. EOS - switch "-n", + switch "-n", "--topological", description: "Sort dependencies in topological order." - switch "--1", - description: "Only show dependencies one level down, instead of recursing." + switch "-1", "--direct", "--declared", "--1", + description: "Show only the direct dependencies declared in the formula." switch "--union", description: "Show the union of dependencies for multiple , instead of the intersection." switch "--full-name", @@ -54,20 +54,22 @@ module Homebrew switch "--installed", description: "List dependencies for formulae that are currently installed. If is " \ "specified, list only its dependencies that are currently installed." + switch "--eval-all", + description: "Evaluate all available formulae and casks, whether installed or not, to list " \ + "their dependencies." switch "--all", - description: "List dependencies for all available formulae." + hidden: true switch "--for-each", description: "Switch into the mode used by the `--all` option, but only list dependencies " \ "for each provided , one formula per line. This is used for " \ "debugging the `--installed`/`--all` display mode." switch "--formula", "--formulae", - depends_on: "--installed", description: "Treat all named arguments as formulae." switch "--cask", "--casks", - depends_on: "--installed", description: "Treat all named arguments as casks." conflicts "--tree", "--graph" + conflicts "--installed", "--eval-all" conflicts "--installed", "--all" conflicts "--formula", "--cask" formula_options @@ -79,9 +81,18 @@ module Homebrew def deps args = deps_args.parse + all = args.eval_all? + if args.all? + unless all + odeprecated "brew deps --all", + "brew deps --eval-all or HOMEBREW_EVAL_ALL" + end + all = true + end + Formulary.enable_factory_cache! - recursive = !args.send(:"1?") + recursive = !args.direct? installed = args.installed? || dependents(args.named.to_formulae_and_casks).all?(&:any_version_installed?) @use_runtime_dependencies = installed && recursive && @@ -120,7 +131,7 @@ module Homebrew puts_deps_tree dependents, recursive: recursive, args: args return - elsif args.all? + elsif all puts_deps sorted_dependents(Formula.all + Cask::Cask.all), recursive: recursive, args: args return elsif !args.no_named? && args.for_each? @@ -149,7 +160,7 @@ module Homebrew condense_requirements(all_deps, args: args) all_deps.map! { |d| dep_display_name(d, args: args) } all_deps.uniq! - all_deps.sort! unless args.n? + all_deps.sort! unless args.topological? puts all_deps end @@ -286,8 +297,14 @@ module Homebrew end display_s = "#{tree_lines} #{dep_display_name(dep, args: args)}" + + # Detect circular dependencies and consider them a failure if present. is_circular = dep_stack.include?(dep.name) - display_s = "#{display_s} (CIRCULAR DEPENDENCY)" if is_circular + if is_circular + display_s = "#{display_s} (CIRCULAR DEPENDENCY)" + Homebrew.failed = true + end + puts "#{prefix}#{display_s}" next if !recursive || is_circular diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb index d997619543..19076dc140 100644 --- a/Library/Homebrew/cmd/desc.rb +++ b/Library/Homebrew/cmd/desc.rb @@ -18,8 +18,7 @@ module Homebrew Homebrew::CLI::Parser.new do description <<~EOS Display 's name and one-line description. - Formula descriptions are cached; the cache is created on the - first search, making that search slower than subsequent ones. + The cache is created on the first search, making that search slower than subsequent ones. EOS switch "-s", "--search", description: "Search both names and descriptions for . If is flanked by " \ @@ -30,6 +29,9 @@ module Homebrew switch "-d", "--description", description: "Search just descriptions for . If is flanked by slashes, " \ "it is interpreted as a regular expression." + switch "--eval-all", + description: "Evaluate all available formulae and casks, whether installed or not, to search their " \ + "descriptions. Implied if HOMEBREW_EVAL_ALL is set." switch "--formula", "--formulae", description: "Treat all named arguments as formulae." switch "--cask", "--casks", @@ -44,6 +46,10 @@ module Homebrew def desc args = desc_args.parse + if !args.eval_all? && !Homebrew::EnvConfig.eval_all? + odeprecated "brew desc", "brew desc --eval-all or HOMEBREW_EVAL_ALL" + end + search_type = if args.search? :either elsif args.name? diff --git a/Library/Homebrew/cmd/docs.rb b/Library/Homebrew/cmd/docs.rb new file mode 100644 index 0000000000..31aa410df3 --- /dev/null +++ b/Library/Homebrew/cmd/docs.rb @@ -0,0 +1,24 @@ +# typed: true +# frozen_string_literal: true + +require "cli/parser" + +module Homebrew + extend T::Sig + + module_function + + sig { returns(CLI::Parser) } + def docs_args + Homebrew::CLI::Parser.new do + description <<~EOS + Open Homebrew's online documentation (#{HOMEBREW_DOCS_WWW}) in a browser. + EOS + end + end + + sig { void } + def docs + exec_browser HOMEBREW_DOCS_WWW + end +end diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 8fe94debab..5bbe534ee7 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -13,6 +13,8 @@ module Homebrew module_function + FETCH_MAX_TRIES = 5 + sig { returns(CLI::Parser) } def fetch_args Homebrew::CLI::Parser.new do @@ -31,7 +33,8 @@ module Homebrew "seeing if an existing VCS cache has been updated." switch "--retry", description: "Retry if downloading fails or re-download if the checksum of a previously cached " \ - "version no longer matches." + "version no longer matches. Tries at most #{FETCH_MAX_TRIES} times with " \ + "exponential backoff." switch "--deps", description: "Also download dependencies for any listed ." switch "-s", "--build-from-source", @@ -159,10 +162,17 @@ module Homebrew end def retry_fetch?(f, args:) - @fetch_failed ||= Set.new - if args.retry? && @fetch_failed.add?(f) - ohai "Retrying download" + @fetch_tries ||= Hash.new { |h, k| h[k] = 1 } + if args.retry? && (@fetch_tries[f] < FETCH_MAX_TRIES) + wait = 2 ** @fetch_tries[f] + remaining = FETCH_MAX_TRIES - @fetch_tries[f] + what = "try".pluralize(remaining) + + ohai "Retrying download in #{wait}s... (#{remaining} #{what} left)" + sleep wait + f.clear_cache + @fetch_tries[f] += 1 true else Homebrew.failed = true diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index ba91a20fd0..9495fde636 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -58,9 +58,13 @@ module Homebrew switch "--installed", depends_on: "--json", description: "Print JSON of formulae that are currently installed." - switch "--all", + switch "--eval-all", depends_on: "--json", - description: "Print JSON of all available formulae." + description: "Evaluate all available formulae and casks, whether installed or not, to print their " \ + "JSON. Implied if HOMEBREW_EVAL_ALL is set." + switch "--all", + hidden: true, + depends_on: "--json" switch "--variations", depends_on: "--json", description: "Include the variations hash in each formula's JSON output." @@ -71,6 +75,7 @@ module Homebrew switch "--cask", "--casks", description: "Treat all named arguments as casks." + conflicts "--installed", "--eval-all" conflicts "--installed", "--all" conflicts "--formula", "--cask" @@ -103,7 +108,13 @@ module Homebrew print_analytics(args: args) elsif args.json - print_json(args: args) + all = args.eval_all? + if !all && args.all? && !Homebrew::EnvConfig.eval_all? + odeprecated "brew info --all", "brew info --eval-all or HOMEBREW_EVAL_ALL" + all = true + end + + print_json(all, args: args) elsif args.github? raise FormulaOrCaskUnspecifiedError if args.no_named? @@ -187,15 +198,15 @@ module Homebrew version_hash[version] end - sig { params(args: CLI::Args).void } - def print_json(args:) - raise FormulaOrCaskUnspecifiedError if !(args.all? || args.installed?) && args.no_named? + sig { params(all: T::Boolean, args: CLI::Args).void } + def print_json(all, args:) + raise FormulaOrCaskUnspecifiedError if !(all || args.installed?) && args.no_named? json = case json_version(args.json) when :v1, :default raise UsageError, "cannot specify --cask with --json=v1!" if args.cask? - formulae = if args.all? + formulae = if all Formula.all.sort elsif args.installed? Formula.installed.sort @@ -211,7 +222,7 @@ module Homebrew formulae.map(&:to_hash) end when :v2 - formulae, casks = if args.all? + formulae, casks = if all [Formula.all.sort, Cask::Cask.all.sort_by(&:full_name)] elsif args.installed? [Formula.installed.sort, Cask::Caskroom.casks.sort_by(&:full_name)] diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb index c97d57d528..4b80fa5ad5 100644 --- a/Library/Homebrew/cmd/options.rb +++ b/Library/Homebrew/cmd/options.rb @@ -19,8 +19,11 @@ module Homebrew description: "Show all options on a single line separated by spaces." switch "--installed", description: "Show options for formulae that are currently installed." + switch "--eval-all", + description: "Evaluate all available formulae and casks, whether installed or not, to show their " \ + "options." switch "--all", - description: "Show options for all available formulae." + hidden: true flag "--command=", description: "Show options for the specified ." @@ -33,7 +36,13 @@ module Homebrew def options args = options_args.parse + all = args.eval_all? if args.all? + odeprecated "brew info --all", "brew info --eval-all" if !all && !Homebrew::EnvConfig.eval_all? + all = true + end + + if all puts_options Formula.all.sort, args: args elsif args.installed? puts_options Formula.installed.sort, args: args diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index 7c64d8eb09..6413166dda 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -3,6 +3,7 @@ require "readall" require "cli/parser" +require "env_config" module Homebrew extend T::Sig @@ -22,6 +23,9 @@ module Homebrew description: "Verify any alias symlinks in each tap." switch "--syntax", description: "Syntax-check all of Homebrew's Ruby files (if no `` is passed)." + switch "--eval-all", + description: "Evaluate all available formulae and casks, whether installed or not. " \ + "Implied if HOMEBREW_EVAL_ALL is set." named_args :tap end @@ -39,6 +43,9 @@ module Homebrew options = { aliases: args.aliases? } taps = if args.no_named? + if !args.eval_all? && !Homebrew::EnvConfig.eval_all? + odeprecated "brew readall", "brew readall --eval-all or HOMEBREW_EVAL_ALL" + end Tap else args.named.to_installed_taps diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index c0a7a20f99..962a33ea12 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -44,6 +44,10 @@ module Homebrew switch "--desc", description: "Search for formulae with a description matching and casks with " \ "a name or description matching ." + switch "--eval-all", + depends_on: "--desc", + description: "Evaluate all available formulae and casks, whether installed or not, to search their " \ + "descriptions. Implied if HOMEBREW_EVAL_ALL is set." switch "--pull-request", description: "Search for GitHub pull requests containing ." switch "--open", @@ -75,6 +79,9 @@ module Homebrew string_or_regex = query_regexp(query) if args.desc? + if !args.eval_all? && !Homebrew::EnvConfig.eval_all? + odeprecated "brew search --desc", "brew search --desc --eval-all or HOMEBREW_EVAL_ALL" + end search_descriptions(string_or_regex, args) elsif args.pull_request? search_pull_requests(query, args) diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index 019d70c8d3..7eed84b689 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -43,6 +43,9 @@ module Homebrew description: "Migrate tapped formulae from symlink-based to directory-based structure." switch "--list-pinned", description: "List all pinned taps." + switch "--eval-all", + description: "Evaluate all the formulae, casks and aliases in the new tap to check validity. " \ + "Implied if HOMEBREW_EVAL_ALL is set." named_args :tap, max: 2 end @@ -65,7 +68,8 @@ module Homebrew tap.install clone_target: args.named.second, force_auto_update: args.force_auto_update?, custom_remote: args.custom_remote?, - quiet: args.quiet? + quiet: args.quiet?, + verify: args.eval_all? || Homebrew::EnvConfig.eval_all? rescue TapRemoteMismatchError, TapNoCustomRemoteError => e odie e rescue TapAlreadyTappedError diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 61f7a401b6..83fe382987 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -547,7 +547,7 @@ EOS for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/* do if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] && - [[ -n "${HOMEBREW_UPDATE_AUTO}" ]] && + [[ -z "${HOMEBREW_DEVELOPER}" || -n "${HOMEBREW_UPDATE_AUTO}" ]] && [[ "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" ]] then continue @@ -705,6 +705,7 @@ EOS for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/* do if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] && + [[ -z "${HOMEBREW_DEVELOPER}" || -n "${HOMEBREW_UPDATE_AUTO}" ]] && [[ "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" || "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]] then @@ -748,11 +749,11 @@ EOS if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] then mkdir -p "${HOMEBREW_CACHE}/api" - # TODO: use --header If-Modified-Since curl \ "${CURL_DISABLE_CURLRC_ARGS[@]}" \ --fail --compressed --silent --max-time 5 \ --location --remote-time --output "${HOMEBREW_CACHE}/api/formula.json" \ + --time-cond "${HOMEBREW_CACHE}/api/formula.json" \ --user-agent "${HOMEBREW_USER_AGENT_CURL}" \ "https://formulae.brew.sh/api/formula.json" # TODO: we probably want to print an error if this fails. diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index d5cf623617..c194823d44 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -30,9 +30,11 @@ module Homebrew description: "Resolve more than one level of dependencies." switch "--installed", description: "Only list formulae and casks that are currently installed." + switch "--eval-all", + description: "Evaluate all available formulae and casks, whether installed or not, to show " \ + "their dependents." switch "--all", - description: "List all formulae and casks whether installed or not.", - hidden: true + hidden: true switch "--include-build", description: "Include all formulae that specify as `:build` type dependency." switch "--include-test", @@ -88,8 +90,6 @@ module Homebrew show_formulae_and_casks = !args.formula? && !args.cask? includes, ignores = args_includes_ignores(args) - # TODO: 3.6.0: odeprecate not specifying args.all?, require args.installed? - deps = [] if use_runtime_dependents if show_formulae_and_casks || args.formula? @@ -106,6 +106,18 @@ module Homebrew deps else + all = args.eval_all? + if args.all? + unless all + odeprecated "brew uses --all", + "brew uses --eval-all or HOMEBREW_EVAL_ALL" + end + all = true + end + + if !args.installed? && !(all || Homebrew::EnvConfig.eval_all?) + odeprecated "brew uses", "brew uses --eval-all or HOMEBREW_EVAL_ALL" + end if show_formulae_and_casks || args.formula? deps += args.installed? ? Formula.installed : Formula.all end diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb index b3a12d9bff..3b107e9999 100644 --- a/Library/Homebrew/dependencies.rb +++ b/Library/Homebrew/dependencies.rb @@ -2,7 +2,6 @@ # frozen_string_literal: true require "delegate" -require "cask_dependent" # A collection of dependencies. # diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb index f4864b9051..04dddf24b1 100644 --- a/Library/Homebrew/dependency_collector.rb +++ b/Library/Homebrew/dependency_collector.rb @@ -26,16 +26,25 @@ class DependencyCollector sig { void } def initialize + # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) @deps = Dependencies.new @requirements = Requirements.new + + init_global_dep_tree_if_needed! end - def initialize_copy(other) + def initialize_dup(other) super @deps = @deps.dup @requirements = @requirements.dup end + def freeze + @deps.freeze + @requirements.freeze + super + end + def add(spec) case dep = fetch(spec) when Dependency @@ -68,6 +77,12 @@ class DependencyCollector parse_spec(spec, Array(tags)) end + sig { params(related_formula_names: T::Array[String]).returns(T.nilable(Dependency)) } + def gcc_dep_if_needed(related_formula_names); end + + sig { params(related_formula_names: T::Array[String]).returns(T.nilable(Dependency)) } + def glibc_dep_if_needed(related_formula_names); end + def git_dep_if_needed(tags) return if Utils::Git.available? @@ -110,6 +125,9 @@ class DependencyCollector private + sig { void } + def init_global_dep_tree_if_needed!; end + def parse_spec(spec, tags) case spec when String diff --git a/Library/Homebrew/description_cache_store.rb b/Library/Homebrew/description_cache_store.rb index d94885cbe3..e43f88e1ba 100644 --- a/Library/Homebrew/description_cache_store.rb +++ b/Library/Homebrew/description_cache_store.rb @@ -34,9 +34,9 @@ class DescriptionCacheStore < CacheStore # # @return [nil] def populate_if_empty! + return unless Homebrew::EnvConfig.eval_all? return unless database.empty? - # TODO: 3.6.0: consider if we want to actually read all contents of all formulae or odeprecate. Formula.all.each { |f| update!(f.full_name, f.desc) } end @@ -45,6 +45,7 @@ class DescriptionCacheStore < CacheStore # @param report [Report] an update report generated by cmd/update.rb # @return [nil] def update_from_report!(report) + return unless Homebrew::EnvConfig.eval_all? return populate_if_empty! if database.empty? return if report.empty? @@ -63,6 +64,7 @@ class DescriptionCacheStore < CacheStore # @param formula_names [Array] the formulae to update # @return [nil] def update_from_formula_names!(formula_names) + return unless Homebrew::EnvConfig.eval_all? return populate_if_empty! if database.empty? formula_names.each do |name| @@ -100,9 +102,9 @@ class CaskDescriptionCacheStore < DescriptionCacheStore # # @return [nil] def populate_if_empty! + return unless Homebrew::EnvConfig.eval_all? return unless database.empty? - # TODO: 3.6.0: consider if we want to actually read all contents of all casks or odeprecate. Cask::Cask.all.each { |c| update!(c.full_name, [c.name.join(", "), c.desc.presence]) } end @@ -111,6 +113,7 @@ class CaskDescriptionCacheStore < DescriptionCacheStore # @param report [Report] an update report generated by cmd/update.rb # @return [nil] def update_from_report!(report) + return unless Homebrew::EnvConfig.eval_all? return populate_if_empty! if database.empty? return if report.empty? @@ -126,6 +129,7 @@ class CaskDescriptionCacheStore < DescriptionCacheStore # @param cask_tokens [Array] the casks to update # @return [nil] def update_from_cask_tokens!(cask_tokens) + return unless Homebrew::EnvConfig.eval_all? return populate_if_empty! if database.empty? cask_tokens.each do |token| diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 082e9c01e9..8167e8df0e 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -41,9 +41,11 @@ module Homebrew description: "Run additional, slower style checks that require a network connection." switch "--installed", description: "Only check formulae and casks that are currently installed." + switch "--eval-all", + description: "Evaluate all available formulae and casks, whether installed or not, to audit them. " \ + "Implied if HOMEBREW_EVAL_ALL is set." switch "--all", - description: "Check all formulae and casks whether installed or not.", - hidden: true + hidden: true switch "--new", "--new-formula", "--new-cask", description: "Run various additional style checks to determine if a new formula or cask is eligible " \ "for Homebrew. This should be used when creating new formula and implies " \ @@ -118,8 +120,6 @@ module Homebrew ENV.activate_extensions! ENV.setup_build_environment - # TODO: 3.6.0: odeprecate not specifying args.all?, require args.installed? - audit_formulae, audit_casks = if args.tap Tap.fetch(args.tap).then do |tap| [ @@ -131,6 +131,10 @@ module Homebrew no_named_args = true [Formula.installed, Cask::Caskroom.casks] elsif args.no_named? + if !args.eval_all? && !Homebrew::EnvConfig.eval_all? + odeprecated "brew audit", + "brew audit --eval-all or HOMEBREW_EVAL_ALL" + end no_named_args = true [Formula.all, Cask::Cask.all] else diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index 57a6a707e3..0bb1d7a821 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -121,8 +121,8 @@ module Homebrew if new_version.present? if new_version.latest? opoo "Ignoring specified `--sha256=` argument." if new_hash.present? - new_hash = :no_check - elsif new_hash.nil? || cask.languages.present? + replacement_pairs << [old_hash, ":no_check"] + elsif old_hash != :no_check && (new_hash.nil? || cask.languages.present?) tmp_contents = Utils::Inreplace.inreplace_pairs(cask.sourcefile_path, replacement_pairs.uniq.compact, read_only_run: true, @@ -131,43 +131,34 @@ module Homebrew tmp_cask = Cask::CaskLoader.load(tmp_contents) tmp_config = tmp_cask.config - new_hash = fetch_cask(tmp_contents)[1] if old_hash != :no_check && new_hash.nil? + [:arm, :intel].each do |arch| + Homebrew::SimulateSystem.arch = arch - cask.languages.each do |language| - lang_config = tmp_config.merge(Cask::Config.new(explicit: { languages: [language] })) - replacement_pairs << fetch_cask(tmp_contents, config: lang_config) - end + languages = cask.languages + languages = [nil] if languages.empty? + languages.each do |language| + new_hash_config = if language.blank? + tmp_config + else + tmp_config.merge(Cask::Config.new(explicit: { languages: [language] })) + end - # TODO: remove the `Hardware::CPU.intel?` substitution once no casks use the conditional - other_intel = !Hardware::CPU.intel? - Homebrew::SimulateSystem.arch = other_intel ? :intel : :arm - other_contents = tmp_contents.gsub("Hardware::CPU.intel?", other_intel.to_s) - other_cask = Cask::CaskLoader.load(other_contents) + new_hash_cask = Cask::CaskLoader.load(tmp_contents) + new_hash_cask.config = new_hash_config + old_hash = new_hash_cask.sha256.to_s - if other_cask.url.to_s != tmp_cask.url.to_s - if other_cask.sha256 != :no_check && other_cask.language.blank? - replacement_pairs << fetch_cask(other_contents) + cask_download = Cask::Download.new(new_hash_cask, quarantine: true) + download = cask_download.fetch(verify_download_integrity: false) + Utils::Tar.validate_file(download) + + replacement_pairs << [new_hash_cask.sha256.to_s, download.sha256] end - other_cask.languages.each do |language| - lang_config = other_cask.config.merge(Cask::Config.new(explicit: { languages: [language] })) - replacement_pairs << fetch_cask(other_contents, config: lang_config) - end + Homebrew::SimulateSystem.clear end - - Homebrew::SimulateSystem.clear end end - if new_hash.present? && cask.language.blank? # avoid repeated replacement for multilanguage cask - hash_regex = (old_hash == :no_check) ? ":no_check" : "[\"']#{Regexp.escape(old_hash.to_s)}[\"']" - - replacement_pairs << [ - /#{hash_regex}/m, - ((new_hash == :no_check) ? ":no_check" : "\"#{new_hash}\"").to_s, - ] - end - Utils::Inreplace.inreplace_pairs(cask.sourcefile_path, replacement_pairs.uniq.compact, read_only_run: args.dry_run?, diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index b7715ba306..f4bcff17db 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -18,8 +18,8 @@ module Homebrew Create a pull request to update with a new URL or a new tag. If a is specified, the checksum of the new download should also - be specified. A best effort to determine the and name will - be made if either or both values are not supplied by the user. + be specified. A best effort to determine the will be made if not supplied + by the user. If a is specified, the Git commit corresponding to that tag should also be specified. A best effort to determine the will be made @@ -34,9 +34,6 @@ module Homebrew EOS switch "-n", "--dry-run", description: "Print what would be done rather than doing it." - switch "--all", - description: "Read all formulae if necessary to determine URL.", - hidden: true switch "--write-only", description: "Make the expected file modifications without taking any Git actions." switch "--commit", @@ -89,7 +86,6 @@ module Homebrew conflicts "--no-audit", "--strict" conflicts "--no-audit", "--online" conflicts "--url", "--tag" - conflicts "--installed", "--all" named_args :formula, max: 1 end @@ -110,9 +106,7 @@ module Homebrew ENV["BROWSER"] = Homebrew::EnvConfig.browser formula = args.named.to_formulae.first - new_url = args.url - formula ||= determine_formula_from_url(new_url) if new_url.present? raise FormulaUnspecifiedError if formula.blank? odie "This formula is disabled!" if formula.disabled? @@ -368,27 +362,6 @@ module Homebrew GitHub.create_bump_pr(pr_info, args: args) end - def determine_formula_from_url(url) - # Split the new URL on / and find any formulae that have the same URL - # except for the last component, but don't try to match any more than the - # first five components since sometimes the last component isn't the only - # one to change. - url_split = url.split("/") - maximum_url_components_to_match = 5 - components_to_match = [url_split.count - 1, maximum_url_components_to_match].min - base_url = url_split.first(components_to_match).join("/") - base_url = /#{Regexp.escape(base_url)}/ - guesses = [] - # TODO: 3.6.0: odeprecate not specifying args.all? - Formula.all.each do |f| - guesses << f if f.stable&.url&.match(base_url) - end - return guesses.shift if guesses.count == 1 - return if guesses.count <= 1 - - odie "Couldn't guess formula for sure; could be one of these:\n#{guesses.map(&:name).join(", ")}" - end - def determine_mirror(url) case url when %r{.*ftp\.gnu\.org/gnu.*} diff --git a/Library/Homebrew/dev-cmd/generate-man-completions.rb b/Library/Homebrew/dev-cmd/generate-man-completions.rb index e9c1f628b6..91d9dabc61 100644 --- a/Library/Homebrew/dev-cmd/generate-man-completions.rb +++ b/Library/Homebrew/dev-cmd/generate-man-completions.rb @@ -23,6 +23,7 @@ module Homebrew Generate Homebrew's manpages and shell completions. EOS switch "--fail-if-not-changed", + hidden: true, description: "Return a failing status code if no changes are detected in the manpage outputs. " \ "This can be used to notify CI when the manpages are out of date. Additionally, " \ "the date used in new manpages will match those in the existing manpages (to allow " \ @@ -34,27 +35,30 @@ module Homebrew def generate_man_completions args = generate_man_completions_args.parse + odeprecated "brew generate-man-completions --fail-if-not-changed" if args.fail_if_not_changed? + Commands.rebuild_internal_commands_completion_list - regenerate_man_pages(preserve_date: args.fail_if_not_changed?, quiet: args.quiet?) + regenerate_man_pages(quiet: args.quiet?) Completions.update_shell_completions! diff = system_command "git", args: [ "-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "docs/Manpage.md", "manpages", "completions" ] - - return unless diff.status.success? - - puts "No changes to manpage or completions output detected." - Homebrew.failed = true if args.fail_if_not_changed? + if diff.status.success? + ofail "No changes to manpage or completions." + else + puts "Manpage and completions updated." + end end - def regenerate_man_pages(preserve_date:, quiet:) + # TODO: move this method and all called functions to manpages.rb + def regenerate_man_pages(quiet:) Homebrew.install_bundler_gems! markup = build_man_page(quiet: quiet) - convert_man_page(markup, TARGET_DOC_PATH/"Manpage.md", preserve_date: preserve_date) + convert_man_page(markup, TARGET_DOC_PATH/"Manpage.md") markup = I18n.transliterate(markup, locale: :en) - convert_man_page(markup, TARGET_MAN_PATH/"brew.1", preserve_date: preserve_date) + convert_man_page(markup, TARGET_MAN_PATH/"brew.1") end def build_man_page(quiet:) @@ -94,13 +98,13 @@ module Homebrew path.basename.to_s.sub(/\.(rb|sh)$/, "").sub(/^--/, "~~") end - def convert_man_page(markup, target, preserve_date:) + def convert_man_page(markup, target) manual = target.basename(".1") organisation = "Homebrew" - # Set the manpage date to the existing one if we're checking for changes. + # Set the manpage date to the existing one if we're updating. # This avoids the only change being e.g. a new date. - date = if preserve_date && target.extname == ".1" && target.exist? + date = if target.extname == ".1" && target.exist? /"(\d{1,2})" "([A-Z][a-z]+) (\d{4})" "#{organisation}" "#{manual}"/ =~ target.read Date.parse("#{Regexp.last_match(1)} #{Regexp.last_match(2)} #{Regexp.last_match(3)}") else diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index 9fa4c9bcc5..3b87f7bf13 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -24,13 +24,15 @@ module Homebrew `~/.brew_livecheck_watchlist`. EOS switch "--full-name", - description: "Print formulae/casks with fully-qualified names." + description: "Print formulae and casks with fully-qualified names." flag "--tap=", - description: "Check formulae/casks within the given tap, specified as `/`." + description: "Check formulae and casks within the given tap, specified as `/`." + switch "--eval-all", + description: "Evaluate all available formulae and casks, whether installed or not, to check them." switch "--all", - description: "Check all available formulae/casks." + hidden: true switch "--installed", - description: "Check formulae/casks that are currently installed." + description: "Check formulae and casks that are currently installed." switch "--newer-only", description: "Show the latest version only if it's newer than the formula/cask." switch "--json", @@ -45,7 +47,7 @@ module Homebrew description: "Only check casks." conflicts "--debug", "--json" - conflicts "--tap=", "--all", "--installed" + conflicts "--tap=", "--eval-all", "--installed" conflicts "--cask", "--formula" named_args [:formula, :cask] @@ -55,6 +57,12 @@ module Homebrew def livecheck args = livecheck_args.parse + all = args.eval_all? + if args.all? + odeprecated "brew livecheck --all", "brew livecheck --eval-all" if !all && !Homebrew::EnvConfig.eval_all? + all = true + end + if args.debug? && args.verbose? puts args puts Homebrew::EnvConfig.livecheck_watchlist if Homebrew::EnvConfig.livecheck_watchlist.present? @@ -69,7 +77,7 @@ module Homebrew formulae = args.cask? ? [] : Formula.installed casks = args.formula? ? [] : Cask::Caskroom.casks formulae + casks - elsif args.all? + elsif all formulae = args.cask? ? [] : Formula.all casks = args.formula? ? [] : Cask::Cask.all formulae + casks diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index 9bac23c98c..c8015d3935 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -368,28 +368,32 @@ module Homebrew end end - def pr_check_conflicts(user, repo, pr) - long_build_pr_files = GitHub.search_issues( - "org:#{user}", repo: repo, state: "open", label: "\"no long build conflict\"" + def pr_check_conflicts(repo, pr) + long_build_pr_files = GitHub.issues( + repo: repo, state: "open", labels: "no long build conflict", ).each_with_object({}) do |long_build_pr, hash| + next unless long_build_pr.key?("pull_request") + number = long_build_pr["number"] next if number == pr.to_i - GitHub.get_pull_request_changed_files("#{user}/#{repo}", number).each do |file| + GitHub.get_pull_request_changed_files(repo, number).each do |file| key = file["filename"] hash[key] ||= [] hash[key] << number end end - this_pr_files = GitHub.get_pull_request_changed_files("#{user}/#{repo}", pr) + return if long_build_pr_files.blank? + + this_pr_files = GitHub.get_pull_request_changed_files(repo, pr) conflicts = this_pr_files.each_with_object({}) do |file, hash| filename = file["filename"] next unless long_build_pr_files.key?(filename) long_build_pr_files[filename].each do |pr_number| - key = "#{user}/#{repo}/pull/#{pr_number}" + key = "#{repo}/pull/#{pr_number}" hash[key] ||= [] hash[key] << filename end @@ -440,7 +444,7 @@ module Homebrew opoo "Current branch is #{tap.path.git_branch}: do you need to pull inside #{tap.path.git_origin_branch}?" end - pr_check_conflicts(user, repo, pr) + pr_check_conflicts("#{user}/#{repo}", pr) ohai "Fetching #{tap} pull request ##{pr}" Dir.mktmpdir pr do |dir| diff --git a/Library/Homebrew/dev-cmd/typecheck.rb b/Library/Homebrew/dev-cmd/typecheck.rb index b9f00a5446..f8fa8101c3 100644 --- a/Library/Homebrew/dev-cmd/typecheck.rb +++ b/Library/Homebrew/dev-cmd/typecheck.rb @@ -20,13 +20,13 @@ module Homebrew description: "Silence all non-critical errors." switch "--update", description: "Update RBI files." - switch "--all", - depends_on: "--update", - description: "Regenerate all RBI files rather than just updated gems." + switch "--update-all", + description: "Update all RBI files rather than just updated gems." switch "--suggest-typed", depends_on: "--update", description: "Try upgrading `typed` sigils." switch "--fail-if-not-changed", + hidden: true, description: "Return a failing status code if all gems are up to date " \ "and gem definitions do not need a tapioca update." flag "--dir=", @@ -50,7 +50,9 @@ module Homebrew Homebrew.install_bundler_gems!(groups: ["sorbet"]) HOMEBREW_LIBRARY_PATH.cd do - if args.update? + if args.update? || args.update_all? + odeprecated "brew typecheck --update --fail-if-not-changed" if args.fail_if_not_changed? + excluded_gems = [ "did_you_mean", # RBI file is already provided by Sorbet "webrobots", # RBI file is bugged @@ -60,7 +62,7 @@ module Homebrew "msgpack:false", # Investigate removing this with Tapioca 0.8 ] tapioca_args = ["--exclude", *excluded_gems, "--typed-overrides", *typed_overrides] - tapioca_args << "--all" if args.all? + tapioca_args << "--all" if args.update_all? ohai "Updating Tapioca RBI files..." safe_system "bundle", "exec", "tapioca", "gem", *tapioca_args @@ -100,8 +102,6 @@ module Homebrew end end - Homebrew.failed = system("git", "diff", "--stat", "--exit-code") if args.fail_if_not_changed? - return end diff --git a/Library/Homebrew/dev-cmd/unbottled.rb b/Library/Homebrew/dev-cmd/unbottled.rb index 1880498277..5d8d2bbf96 100644 --- a/Library/Homebrew/dev-cmd/unbottled.rb +++ b/Library/Homebrew/dev-cmd/unbottled.rb @@ -20,11 +20,13 @@ module Homebrew description: "Use the specified bottle tag (e.g. `big_sur`) instead of the current OS." switch "--dependents", description: "Skip getting analytics data and sort by number of dependents instead." - switch "--all", "--total", + switch "--total", description: "Print the number of unbottled and total formulae." + switch "--eval-all", + description: "Evaluate all available formulae and casks, whether installed or not, to check them. " \ + "Implied if HOMEBREW_EVAL_ALL is set." - conflicts "--dependents", "--all" - conflicts "--installed", "--all" + conflicts "--dependents", "--total" named_args :formula end @@ -42,16 +44,22 @@ module Homebrew Utils::Bottles.tag end - # TODO: 3.6.0: odeprecate args.total? + all = args.eval_all? + if args.total? + if !all && !Homebrew::EnvConfig.eval_all? + odeprecated "brew unbottled --total", "brew unbottled --total --eval-all or HOMEBREW_EVAL_ALL" + end + all = true + end if args.named.blank? ohai "Getting formulae..." - elsif args.all? - raise UsageError, "cannot specify `` and `--all`/`--total`." + elsif all + raise UsageError, "cannot specify `` and `--eval-all`/`--total`." end formulae, all_formulae, formula_installs = - formulae_all_installs_from_args(args) + formulae_all_installs_from_args(args, all) deps_hash, uses_hash = deps_uses_from_formulae(all_formulae) if args.dependents? @@ -60,9 +68,7 @@ module Homebrew dependents = uses_hash[f.name]&.length || 0 formula_dependents[f.name] ||= dependents end.reverse - end - - if args.all? + elsif all output_total(formulae) return end @@ -78,16 +84,18 @@ module Homebrew output_unbottled(formulae, deps_hash, noun, hash, args.named.present?) end - def formulae_all_installs_from_args(args) + def formulae_all_installs_from_args(args, all) if args.named.present? formulae = all_formulae = args.named.to_formulae - elsif args.all? - formulae = all_formulae = Formula.all elsif args.dependents? - # TODO: 3.6.0: odeprecate not specifying args.all? for args.dependents? + if !args.all? && !Homebrew::EnvConfig.eval_all? + odeprecated "brew unbottled --dependents", "brew unbottled --all --dependents or HOMEBREW_EVAL_ALL" + end formulae = all_formulae = Formula.all @sort = " (sorted by number of dependents)" + elsif all + formulae = all_formulae = Formula.all else formula_installs = {} diff --git a/Library/Homebrew/dev-cmd/update-license-data.rb b/Library/Homebrew/dev-cmd/update-license-data.rb index 158596937c..a83fe60055 100644 --- a/Library/Homebrew/dev-cmd/update-license-data.rb +++ b/Library/Homebrew/dev-cmd/update-license-data.rb @@ -3,9 +3,11 @@ require "cli/parser" require "utils/spdx" +require "system_command" module Homebrew extend T::Sig + include SystemCommand::Mixin module_function @@ -16,6 +18,7 @@ module Homebrew Update SPDX license data in the Homebrew repository. EOS switch "--fail-if-not-changed", + hidden: true, description: "Return a failing status code if current license data's version is the same as " \ "the upstream. This can be used to notify CI when the SPDX license data is out of date." @@ -25,11 +28,16 @@ module Homebrew def update_license_data args = update_license_data_args.parse - ohai "Updating SPDX license data..." + odeprecated "brew update-license-data --fail-if-not-changed" if args.fail_if_not_changed? SPDX.download_latest_license_data! - return unless args.fail_if_not_changed? - - Homebrew.failed = system("git", "diff", "--stat", "--exit-code", SPDX::DATA_PATH) + diff = system_command "git", args: [ + "-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", SPDX::DATA_PATH + ] + if diff.status.success? + ofail "No changes to SPDX license data." + else + puts "SPDX license data updated." + end end end diff --git a/Library/Homebrew/dev-cmd/update-maintainers.rb b/Library/Homebrew/dev-cmd/update-maintainers.rb index 01d1ff582c..2b66682777 100644 --- a/Library/Homebrew/dev-cmd/update-maintainers.rb +++ b/Library/Homebrew/dev-cmd/update-maintainers.rb @@ -3,6 +3,8 @@ require "cli/parser" require "utils/github" + +# TODO: move function to manpages.rb and require that instead require "dev-cmd/generate-man-completions" module Homebrew @@ -57,9 +59,10 @@ module Homebrew "-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "README.md" ] if diff.status.success? - puts "No changes to list of maintainers." + ofail "No changes to list of maintainers." else - Homebrew.regenerate_man_pages(preserve_date: true, quiet: true) + # TODO: move function to manpages.rb and call that instead + Homebrew.regenerate_man_pages(quiet: true) puts "List of maintainers updated in the README and the generated man pages." end end diff --git a/Library/Homebrew/dev-cmd/sponsors.rb b/Library/Homebrew/dev-cmd/update-sponsors.rb similarity index 52% rename from Library/Homebrew/dev-cmd/sponsors.rb rename to Library/Homebrew/dev-cmd/update-sponsors.rb index 8a51f50f9e..dc5b62b277 100644 --- a/Library/Homebrew/dev-cmd/sponsors.rb +++ b/Library/Homebrew/dev-cmd/update-sponsors.rb @@ -9,11 +9,11 @@ module Homebrew module_function - NAMED_TIER_AMOUNT = 100 - URL_TIER_AMOUNT = 1000 + NAMED_MONTHLY_AMOUNT = 100 + URL_MONTHLY_AMOUNT = 1000 sig { returns(CLI::Parser) } - def sponsors_args + def update_sponsors_args Homebrew::CLI::Parser.new do description <<~EOS Update the list of GitHub Sponsors in the `Homebrew/brew` README. @@ -23,38 +23,36 @@ module Homebrew end end - def sponsor_name(s) - s["name"] || s["login"] + def sponsor_name(sponsor) + sponsor[:name] || sponsor[:login] end - def sponsor_logo(s) - "https://github.com/#{s["login"]}.png?size=64" + def sponsor_logo(sponsor) + "https://github.com/#{sponsor[:login]}.png?size=64" end - def sponsor_url(s) - "https://github.com/#{s["login"]}" + def sponsor_url(sponsor) + "https://github.com/#{sponsor[:login]}" end - def sponsors - sponsors_args.parse + def update_sponsors + update_sponsors_args.parse named_sponsors = [] logo_sponsors = [] + largest_monthly_amount = 0 - GitHub.sponsors_by_tier("Homebrew").each do |tier| - if tier["tier"] >= NAMED_TIER_AMOUNT - named_sponsors += tier["sponsors"].map do |s| - "[#{sponsor_name(s)}](#{sponsor_url(s)})" - end - end + GitHub.sponsorships("Homebrew").each do |s| + largest_monthly_amount = [s[:monthly_amount], s[:closest_tier_monthly_amount]].max + named_sponsors << "[#{sponsor_name(s)}](#{sponsor_url(s)})" if largest_monthly_amount >= NAMED_MONTHLY_AMOUNT - next if tier["tier"] < URL_TIER_AMOUNT + next if largest_monthly_amount < URL_MONTHLY_AMOUNT - logo_sponsors += tier["sponsors"].map do |s| - "[![#{sponsor_name(s)}](#{sponsor_logo(s)})](#{sponsor_url(s)})" - end + logo_sponsors << "[![#{sponsor_name(s)}](#{sponsor_logo(s)})](#{sponsor_url(s)})" end + odie "No sponsorships amounts found! Ensure you have sufficient permissions!" if largest_monthly_amount.zero? + named_sponsors << "many other users and organisations via [GitHub Sponsors](https://github.com/sponsors/Homebrew)" readme = HOMEBREW_REPOSITORY/"README.md" @@ -68,7 +66,7 @@ module Homebrew "-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "README.md" ] if diff.status.success? - puts "No changes to list of sponsors." + ofail "No changes to list of sponsors." else puts "List of sponsors updated in the README." end diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb index 6ccda875a4..e1288c9bcb 100644 --- a/Library/Homebrew/development_tools.rb +++ b/Library/Homebrew/development_tools.rb @@ -98,6 +98,16 @@ class DevelopmentTools @gcc_version = {} end + sig { returns(T::Boolean) } + def build_system_too_old? + false + end + + sig { returns(T::Boolean) } + def system_gcc_too_old? + false + end + sig { returns(T::Boolean) } def ca_file_handles_most_https_certificates? # The system CA file is too old for some modern HTTPS certificates on diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index ef97876392..178b346167 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -591,7 +591,11 @@ module Homebrew def check_coretap_integrity coretap = CoreTap.instance - return if !coretap.installed? && EnvConfig.install_from_api? + unless coretap.installed? + return if EnvConfig.install_from_api? + + CoreTap.ensure_installed! + end broken_tap(coretap) || examine_git_origin(coretap.path, Homebrew::EnvConfig.core_git_remote) end diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index 014b24d27d..0d637caa45 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -153,6 +153,11 @@ module Homebrew "editors will do strange things in this case.", default_text: "`$EDITOR` or `$VISUAL`.", }, + HOMEBREW_EVAL_ALL: { + description: "If set, `brew` commands evaluate all formulae and casks, executing their arbitrary code, by " \ + "default without requiring --eval-all. Required to cache formula and cask descriptions.", + boolean: true, + }, HOMEBREW_FAIL_LOG_LINES: { description: "Output this many lines of output on formula `system` failures.", default: 15, diff --git a/Library/Homebrew/extend/module.rb b/Library/Homebrew/extend/module.rb index 91264a1498..b09433b483 100644 --- a/Library/Homebrew/extend/module.rb +++ b/Library/Homebrew/extend/module.rb @@ -5,11 +5,17 @@ class Module def attr_rw(*attrs) attrs.each do |attr| module_eval <<-EOS, __FILE__, __LINE__+1 - def #{attr}(val=nil) # def prefix(val=nil) - @#{attr} ||= nil # @prefix ||= nil - return @#{attr} if val.nil? # return @prefix if val.nil? - @#{attr} = val # @prefix = val - end # end + def #{attr}(val=nil) # def prefix(val=nil) + if val.nil? # if val.nil? + if instance_variable_defined?(:@#{attr}) # if instance_variable_defined?(:@prefix) + return @#{attr} # return @prefix + else # else + return nil # return nil + end # end + end # end + # + @#{attr} = val # @prefix = val + end # end EOS end end diff --git a/Library/Homebrew/extend/os/dependency_collector.rb b/Library/Homebrew/extend/os/dependency_collector.rb index 32a2466933..58a3f23994 100644 --- a/Library/Homebrew/extend/os/dependency_collector.rb +++ b/Library/Homebrew/extend/os/dependency_collector.rb @@ -1,4 +1,8 @@ # typed: strict # frozen_string_literal: true -require "extend/os/mac/dependency_collector" if OS.mac? +if OS.mac? + require "extend/os/mac/dependency_collector" +elsif OS.linux? + require "extend/os/linux/dependency_collector" +end diff --git a/Library/Homebrew/extend/os/linux/dependency_collector.rb b/Library/Homebrew/extend/os/linux/dependency_collector.rb new file mode 100644 index 0000000000..9c426850a4 --- /dev/null +++ b/Library/Homebrew/extend/os/linux/dependency_collector.rb @@ -0,0 +1,89 @@ +# typed: true +# frozen_string_literal: true + +require "os/linux/glibc" + +class DependencyCollector + extend T::Sig + + undef gcc_dep_if_needed + undef glibc_dep_if_needed + undef init_global_dep_tree_if_needed! + + sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) } + def gcc_dep_if_needed(related_formula_names) + # gcc is required for libgcc_s.so.1 if glibc or gcc are too old + return unless DevelopmentTools.build_system_too_old? + return if building_global_dep_tree? + return if related_formula_names.include?(GCC) + return if global_dep_tree[GCC]&.intersect?(related_formula_names) + + Dependency.new(GCC) + end + + sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) } + def glibc_dep_if_needed(related_formula_names) + return unless OS::Linux::Glibc.below_ci_version? + return if building_global_dep_tree? + return if related_formula_names.include?(GLIBC) + return if global_dep_tree[GLIBC]&.intersect?(related_formula_names) + + Dependency.new(GLIBC) + end + + private + + GLIBC = "glibc" + GCC = CompilerSelector.preferred_gcc.freeze + + sig { void } + def init_global_dep_tree_if_needed! + return unless DevelopmentTools.build_system_too_old? + return if building_global_dep_tree? + return unless global_dep_tree.empty? + + building_global_dep_tree! + global_dep_tree[GLIBC] = Set.new(global_deps_for(GLIBC)) + # gcc depends on glibc + global_dep_tree[GCC] = Set.new([*global_deps_for(GCC), GLIBC, *@@global_dep_tree[GLIBC]]) + built_global_dep_tree! + end + + sig { params(name: String).returns(T::Array[String]) } + def global_deps_for(name) + @global_deps_for ||= {} + # Always strip out glibc and gcc from all parts of dependency tree when + # we're calculating their dependency trees. Other parts of Homebrew will + # catch any circular dependencies. + @global_deps_for[name] ||= Formula[name].deps.map(&:name).flat_map do |dep| + [dep, *global_deps_for(dep)].compact + end.uniq + end + + # Use class variables to avoid this expensive logic needing to be done more + # than once. + # rubocop:disable Style/ClassVars + @@global_dep_tree = {} + @@building_global_dep_tree = false + + sig { returns(T::Hash[String, T::Set[String]]) } + def global_dep_tree + @@global_dep_tree + end + + sig { void } + def building_global_dep_tree! + @@building_global_dep_tree = true + end + + sig { void } + def built_global_dep_tree! + @@building_global_dep_tree = false + end + + sig { returns(T::Boolean) } + def building_global_dep_tree? + @@building_global_dep_tree.present? + end + # rubocop:enable Style/ClassVars +end diff --git a/Library/Homebrew/extend/os/linux/development_tools.rb b/Library/Homebrew/extend/os/linux/development_tools.rb index 2648ebca68..35c83585f9 100644 --- a/Library/Homebrew/extend/os/linux/development_tools.rb +++ b/Library/Homebrew/extend/os/linux/development_tools.rb @@ -21,6 +21,18 @@ class DevelopmentTools :gcc end + sig { returns(T::Boolean) } + def build_system_too_old? + return @build_system_too_old if defined? @build_system_too_old + + @build_system_too_old = (system_gcc_too_old? || OS::Linux::Glibc.below_ci_version?) + end + + sig { returns(T::Boolean) } + def system_gcc_too_old? + gcc_version("gcc") < OS::LINUX_GCC_CI_VERSION + end + sig { returns(T::Hash[String, T.nilable(String)]) } def build_system_info generic_build_system_info.merge({ diff --git a/Library/Homebrew/extend/os/linux/diagnostic.rb b/Library/Homebrew/extend/os/linux/diagnostic.rb index d3d46cd79c..3971c62a65 100644 --- a/Library/Homebrew/extend/os/linux/diagnostic.rb +++ b/Library/Homebrew/extend/os/linux/diagnostic.rb @@ -144,6 +144,7 @@ module Homebrew gcc_dependents = Formula.installed.select do |formula| next false unless formula.tap&.core_tap? + # FIXME: This includes formulae that have no runtime dependency on GCC. formula.recursive_dependencies.map(&:name).include? "gcc" rescue TapFormulaUnavailableError false @@ -153,7 +154,7 @@ module Homebrew badly_linked = gcc_dependents.select do |dependent| keg = Keg.new(dependent.prefix) keg.binary_executable_or_library_files.any? do |binary| - paths = binary.rpath.split(":") + paths = binary.rpaths versioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/\d+$}) } unversioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/current$}) } diff --git a/Library/Homebrew/extend/os/linux/extend/pathname.rbi b/Library/Homebrew/extend/os/linux/extend/pathname.rbi new file mode 100644 index 0000000000..988e9ac4cf --- /dev/null +++ b/Library/Homebrew/extend/os/linux/extend/pathname.rbi @@ -0,0 +1,5 @@ +# typed: strict + +class Pathname + include ELFShim +end diff --git a/Library/Homebrew/extend/os/linux/formula.rb b/Library/Homebrew/extend/os/linux/formula.rb index 5f46e710d0..3385a1e707 100644 --- a/Library/Homebrew/extend/os/linux/formula.rb +++ b/Library/Homebrew/extend/os/linux/formula.rb @@ -5,6 +5,7 @@ class Formula undef shared_library undef loader_path undef deuniversalize_machos + undef add_global_deps_to_spec sig { params(name: String, version: T.nilable(T.any(String, Integer))).returns(String) } def shared_library(name, version = nil) @@ -23,4 +24,22 @@ class Formula sig { params(targets: T.nilable(T.any(Pathname, String))).void } def deuniversalize_machos(*targets); end + + sig { params(spec: SoftwareSpec).void } + def add_global_deps_to_spec(spec) + return unless DevelopmentTools.build_system_too_old? + + @global_deps ||= begin + dependency_collector = spec.dependency_collector + related_formula_names = Set.new([ + name, + *versioned_formulae_names, + ]) + [ + dependency_collector.gcc_dep_if_needed(related_formula_names), + dependency_collector.glibc_dep_if_needed(related_formula_names), + ].compact.freeze + end + @global_deps.each { |dep| spec.dependency_collector.add(dep) } + end end diff --git a/Library/Homebrew/extend/os/linux/install.rb b/Library/Homebrew/extend/os/linux/install.rb index a905cbca7a..e2ef4088ca 100644 --- a/Library/Homebrew/extend/os/linux/install.rb +++ b/Library/Homebrew/extend/os/linux/install.rb @@ -5,21 +5,45 @@ module Homebrew module Install module_function - DYNAMIC_LINKERS = [ - "/lib64/ld-linux-x86-64.so.2", - "/lib64/ld64.so.2", - "/lib/ld-linux.so.3", - "/lib/ld-linux.so.2", - "/lib/ld-linux-aarch64.so.1", - "/lib/ld-linux-armhf.so.3", - "/system/bin/linker64", - "/system/bin/linker", + # This is a list of known paths to the host dynamic linker on Linux if + # the host glibc is new enough. The symlink_ld_so method will fail if + # the host linker cannot be found in this list. + DYNAMIC_LINKERS = %w[ + /lib64/ld-linux-x86-64.so.2 + /lib64/ld64.so.2 + /lib/ld-linux.so.3 + /lib/ld-linux.so.2 + /lib/ld-linux-aarch64.so.1 + /lib/ld-linux-armhf.so.3 + /system/bin/linker64 + /system/bin/linker ].freeze private_constant :DYNAMIC_LINKERS + GCC_VERSION_SUFFIX = OS::LINUX_GCC_CI_VERSION.delete_suffix(".0").freeze + + # We link GCC runtime libraries that are not specificaly used for Fortran, + # which are linked by the GCC formula. We only use the versioned shared libraries + # as the other shared and static libraries are only used at build time where + # GCC can find its own libraries. + GCC_RUNTIME_LIBS = %w[ + libatomic.so.1 + libgcc_s.so.1 + libgomp.so.1 + libstdc++.so.6 + ].freeze + private_constant :GCC_RUNTIME_LIBS + def perform_preinstall_checks(all_fatal: false, cc: nil) generic_perform_preinstall_checks(all_fatal: all_fatal, cc: cc) symlink_ld_so + symlink_gcc_libs + end + + def global_post_install + generic_global_post_install + symlink_ld_so + symlink_gcc_libs end def check_cpu @@ -51,5 +75,24 @@ module Homebrew FileUtils.ln_sf ld_so, brew_ld_so end private_class_method :symlink_ld_so + + def symlink_gcc_libs + gcc_opt_prefix = HOMEBREW_PREFIX/"opt/#{OS::LINUX_PREFERRED_GCC_FORMULA}" + + GCC_RUNTIME_LIBS.each do |library| + gcc_library = gcc_opt_prefix/"lib/gcc/#{GCC_VERSION_SUFFIX}/#{library}" + gcc_library_symlink = HOMEBREW_PREFIX/"lib/#{library}" + # Skip if the link target doesn't exist. + next unless gcc_library.readable? + + # Also skip if the symlink already exists. + next if gcc_library_symlink.readable? && (gcc_library_symlink.readlink == gcc_library) + + odie "#{HOMEBREW_PREFIX}/lib does not exist!" unless (HOMEBREW_PREFIX/"lib").readable? + + FileUtils.ln_sf gcc_library, gcc_library_symlink + end + end + private_class_method :symlink_gcc_libs end end diff --git a/Library/Homebrew/extend/os/linux/linkage_checker.rb b/Library/Homebrew/extend/os/linux/linkage_checker.rb index 95146eb1f4..b708cf23a9 100644 --- a/Library/Homebrew/extend/os/linux/linkage_checker.rb +++ b/Library/Homebrew/extend/os/linux/linkage_checker.rb @@ -80,9 +80,14 @@ class LinkageChecker @unwanted_system_dylibs = @system_dylibs.reject do |s| SYSTEM_LIBRARY_ALLOWLIST.include? File.basename(s) end - # FIXME: Remove this when these dependencies are injected correctly (e.g. through `DependencyCollector`) - # See discussion at - # https://github.com/Homebrew/brew/pull/13577 - @undeclared_deps -= [CompilerSelector.preferred_gcc, "glibc", "gcc"] + + # We build all formulae with an RPATH that includes the gcc formula's runtime lib directory. + # See: https://github.com/Homebrew/brew/blob/e689cc07/Library/Homebrew/extend/os/linux/extend/ENV/super.rb#L53 + # This results in formulae showing linkage with gcc whenever it is installed, even if no dependency is declared. + # See discussions at: + # https://github.com/Homebrew/brew/pull/13659 + # https://github.com/Homebrew/brew/pull/13796 + # TODO: Find a nicer way to handle this. (e.g. examining the ELF file to determine the required libstdc++.) + @undeclared_deps.delete("gcc") end end diff --git a/Library/Homebrew/extend/os/linux/readall.rb b/Library/Homebrew/extend/os/linux/readall.rb index 62c2353250..891761f26e 100644 --- a/Library/Homebrew/extend/os/linux/readall.rb +++ b/Library/Homebrew/extend/os/linux/readall.rb @@ -1,9 +1,9 @@ -# typed: strict +# typed: true # frozen_string_literal: true module Readall class << self - def valid_casks?(*) + def valid_casks?(_casks) true end end diff --git a/Library/Homebrew/extend/os/mac/extend/pathname.rbi b/Library/Homebrew/extend/os/mac/extend/pathname.rbi new file mode 100644 index 0000000000..01f544c3f9 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/extend/pathname.rbi @@ -0,0 +1,5 @@ +# typed: strict + +class Pathname + include MachOShim +end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 1cc59e76d0..269e689c76 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -181,6 +181,14 @@ class Formula # @private def initialize(name, path, spec, alias_path: nil, force_bottle: false) + # Only allow instances of subclasses. The base class does not hold any spec information (URLs etc). + raise "Do not call `Formula.new' directly without a subclass." unless self.class < Formula + + # Stop any subsequent modification of a formula's definition. + # Changes do not propagate to existing instances of formulae. + # Now that we have an instance, it's too late to make any changes to the class-level definition. + self.class.freeze + @name = name @path = path @alias_path = alias_path @@ -262,9 +270,13 @@ class Formula return unless spec.url spec.owner = self + add_global_deps_to_spec(spec) instance_variable_set("@#{name}", spec) end + sig { params(spec: SoftwareSpec).void } + def add_global_deps_to_spec(spec); end + def determine_active_spec(requested) spec = send(requested) || stable || head spec || raise(FormulaSpecificationError, "formulae require at least a URL") @@ -443,7 +455,17 @@ class Formula # Returns any `@`-versioned formulae names for any formula (including versioned formulae). sig { returns(T::Array[String]) } def versioned_formulae_names - @versioned_formulae_names ||= Pathname.glob(path.to_s.gsub(/(@[\d.]+)?\.rb$/, "@*.rb")).map do |versioned_path| + versioned_paths = if tap + # Faster path, due to `tap.versioned_formula_files` caching. + name_prefix = "#{name.gsub(/(@[\d.]+)?$/, "")}@" + tap.versioned_formula_files.select do |file| + file.basename.to_s.start_with?(name_prefix) + end + else + Pathname.glob(path.to_s.gsub(/(@[\d.]+)?\.rb$/, "@*.rb")) + end + + versioned_paths.map do |versioned_path| next if versioned_path == path versioned_path.basename(".rb").to_s @@ -453,7 +475,7 @@ class Formula # Returns any `@`-versioned Formula objects for any Formula (including versioned formulae). sig { returns(T::Array[Formula]) } def versioned_formulae - @versioned_formulae ||= versioned_formulae_names.map do |name| + versioned_formulae_names.map do |name| Formula[name] rescue FormulaUnavailableError nil @@ -1723,14 +1745,14 @@ class Formula elsif shell_parameter_format == :arg "--shell=#{shell}" elsif shell_parameter_format == :none - "" + nil else "#{shell_parameter_format}#{shell}" end popen_read_args = %w[] popen_read_args << commands - popen_read_args << shell_parameter + popen_read_args << shell_parameter if shell_parameter.present? popen_read_args.flatten! script_path.dirname.mkpath @@ -1784,7 +1806,10 @@ class Formula # this should only be used when users specify `--all` to a command # @private def self.all - # TODO: 3.6.0: consider checking ARGV for --all + # TODO: uncomment for 3.7.0 and ideally avoid using ARGV by moving to e.g. CLI::Parser + # if !ARGV.include?("--eval-all") && !Homebrew::EnvConfig.eval_all? + # odeprecated "Formula#all without --all or HOMEBREW_EVAL_ALL" + # end files.map do |file| Formulary.factory(file) @@ -2678,9 +2703,26 @@ class Formula # The methods below define the formula DSL. class << self extend Predicable + extend T::Sig include BuildEnvironment::DSL include OnSystem::MacOSAndLinux + # Initialise instance variables for each subclass. These need to be initialised before the class is frozen, + # and some DSL may never be called so it can't be done lazily. + def inherited(child) + super + child.instance_eval do + # Ensure this is synced with `freeze` + @stable = SoftwareSpec.new(flags: build_flags) + @head = HeadSoftwareSpec.new(flags: build_flags) + @livecheck = Livecheck.new(self) + @conflicts = [] + @skip_clean_paths = Set.new + @link_overwrite_paths = Set.new + @allowed_missing_libraries = Set.new + end + end + def method_added(method) super @@ -2692,6 +2734,16 @@ class Formula end end + def freeze + specs.each(&:freeze) + @livecheck.freeze + @conflicts.freeze + @skip_clean_paths.freeze + @link_overwrite_paths.freeze + @allowed_missing_libraries.freeze + super + end + # Whether this formula contains OS/arch-specific blocks # (e.g. `on_macos`, `on_arm`, `on_monterey :or_older`, `on_system :linux, macos: :big_sur_or_newer`). # @private @@ -2772,6 +2824,18 @@ class Formula # @private attr_reader :plist_manual + # @private + attr_reader :conflicts + + # @private + attr_reader :skip_clean_paths + + # @private + attr_reader :link_overwrite_paths + + # @private + attr_reader :allowed_missing_libraries + # If `pour_bottle?` returns `false` the user-visible reason to display for # why they cannot use the bottle. # @private @@ -2802,7 +2866,7 @@ class Formula # A list of the {.stable} and {.head} {SoftwareSpec}s. # @private def specs - @specs ||= [stable, head].freeze + [stable, head].freeze end # @!attribute [w] url @@ -2886,8 +2950,9 @@ class Formula # # Formulae which should not be bottled should be tagged with: #
bottle :disable, "reasons"
- def bottle(*args, &block) - stable.bottle(*args, &block) + sig { params(block: T.proc.bind(BottleSpecification).void).void } + def bottle(&block) + stable.bottle(&block) end # @private @@ -2918,7 +2983,6 @@ class Formula # depends_on "libffi" # end def stable(&block) - @stable ||= SoftwareSpec.new(flags: build_flags) return @stable unless block @stable.instance_eval(&block) @@ -2937,7 +3001,6 @@ class Formula # or (if autodetect fails): #
head "https://hg.is.awesome.but.git.has.won.example.com/", using: :hg
def head(val = nil, specs = {}, &block) - @head ||= HeadSoftwareSpec.new(flags: build_flags) if block @head.instance_eval(&block) elsif val @@ -3088,11 +3151,6 @@ class Formula @plist_manual = options[:manual] end - # @private - def conflicts - @conflicts ||= [] - end - # One or more formulae that conflict with this one and why. #
conflicts_with "imagemagick", because: "both install `convert` binaries"
def conflicts_with(*names) @@ -3113,11 +3171,6 @@ class Formula skip_clean_paths.merge(paths) end - # @private - def skip_clean_paths - @skip_clean_paths ||= Set.new - end - # Software that will not be symlinked into the `brew --prefix` and will # only live in its Cellar. Other formulae can depend on it and Homebrew # will add the necessary includes, libraries, and other paths while @@ -3221,7 +3274,6 @@ class Formula # regex /foo-(\d+(?:\.\d+)+)\.tar/ # end def livecheck(&block) - @livecheck ||= Livecheck.new(self) return @livecheck unless block @livecheckable = true @@ -3377,11 +3429,6 @@ class Formula link_overwrite_paths.merge(paths) end - # @private - def link_overwrite_paths - @link_overwrite_paths ||= Set.new - end - # Permit links to certain libraries that don't exist. Available on Linux only. def ignore_missing_libraries(*libs) unless Homebrew::SimulateSystem.simulating_or_running_on_linux? @@ -3395,11 +3442,6 @@ class Formula allowed_missing_libraries.merge(libraries) end - - # @private - def allowed_missing_libraries - @allowed_missing_libraries ||= Set.new - end end end diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 21da794564..df955690dc 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -52,14 +52,16 @@ module Homebrew def audit_file if formula.core_formula? && @versioned_formula + unversioned_name = formula.name.gsub(/@.*$/, "") + + # ignore when an unversioned formula doesn't exist after an explicit rename + return if formula.tap.formula_renames.key?(unversioned_name) + + # build this ourselves as we want e.g. homebrew/core to be present + full_name = "#{formula.tap}/#{unversioned_name}" + unversioned_formula = begin - # build this ourselves as we want e.g. homebrew/core to be present - full_name = if formula.tap - "#{formula.tap}/#{formula.name}" - else - formula.name - end - Formulary.factory(full_name.gsub(/@.*$/, "")).path + Formulary.factory(full_name).path rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError Pathname.new formula.path.to_s.gsub(/@.*\.rb$/, ".rb") @@ -194,6 +196,13 @@ module Homebrew if formula.license.present? licenses, exceptions = SPDX.parse_license_expression formula.license + sspl_licensed = licenses.any? { |license| license.to_s.start_with?("SSPL") } + if sspl_licensed && @core_tap + problem <<~EOS + Formula #{formula.name} is SSPL-licensed. Software under the SSPL must not be packaged in homebrew/core. + EOS + end + non_standard_licenses = licenses.reject { |license| SPDX.valid_license? license } if non_standard_licenses.present? problem <<~EOS @@ -263,10 +272,7 @@ module Homebrew next end - # FIXME: Remove `glib-utils` exemption when the following PRs are merged: - # https://github.com/Homebrew/homebrew-core/pull/108307 - # https://github.com/Homebrew/homebrew-core/pull/108497 - if dep_f.oldname && dep.name.split("/").last == dep_f.oldname && dep_f.oldname != "glib-utils" + if dep_f.oldname && dep.name.split("/").last == dep_f.oldname problem "Dependency '#{dep.name}' was renamed; use new name '#{dep_f.name}'." end @@ -335,13 +341,6 @@ module Homebrew end return unless @core_tap - - bad_gcc_dep = linux_only_gcc_dep?(formula) && (@strict || begin - fv = FormulaVersions.new(formula) - fv.formula_at_revision("origin/HEAD") { |prev_f| !linux_only_gcc_dep?(prev_f) } - end) - problem "Formulae in homebrew/core should not have a Linux-only dependency on GCC." if bad_gcc_dep - return if formula.tap&.audit_exception :versioned_dependencies_conflicts_allowlist, formula.name # The number of conflicts on Linux is absurd. @@ -415,6 +414,21 @@ module Homebrew end end + def audit_gcc_dependency + return unless @core_tap + return if !@strict && !(@git && formula.tap.git?) # git log is required for non-strict audit + return unless Homebrew::SimulateSystem.simulating_or_running_on_linux? + return unless linux_only_gcc_dep?(formula) + + bad_gcc_dep = @strict || begin + fv = FormulaVersions.new(formula) + fv.formula_at_revision("origin/HEAD") { |prev_f| !linux_only_gcc_dep?(prev_f) } + end + return unless bad_gcc_dep + + problem "Formulae in homebrew/core should not have a Linux-only dependency on GCC." + end + def audit_postgresql return unless formula.name == "postgresql" return unless @core_tap @@ -477,13 +491,10 @@ module Homebrew return unless DevelopmentTools.curl_handles_most_https_certificates? - use_homebrew_curl = false - %w[Stable HEAD].each do |name| - spec_name = name.downcase.to_sym - next unless (spec = formula.send(spec_name)) + use_homebrew_curl = [:stable, :head].any? do |spec_name| + next false unless (spec = formula.send(spec_name)) - use_homebrew_curl = spec.using == :homebrew_curl - break if use_homebrew_curl + spec.using == :homebrew_curl end if (http_content_problem = curl_check_http_content(homepage, @@ -865,14 +876,30 @@ module Homebrew end def linux_only_gcc_dep?(formula) - # TODO: Make this check work when running on Linux and not simulating macOS too. - return false unless Homebrew::SimulateSystem.simulating_or_running_on_macos? + odie "`#linux_only_gcc_dep?` works only on Linux!" if Homebrew::SimulateSystem.simulating_or_running_on_macos? + return false if formula.deps.map(&:name).exclude?("gcc") - formula_hash = formula.to_hash_with_variations - deps = formula_hash["dependencies"] - linux_deps = formula_hash.dig("variations", :x86_64_linux, "dependencies") + variations = formula.to_hash_with_variations["variations"] + # The formula has no variations, so all OS-version-arch triples depend on GCC. + return false if variations.blank? - deps.exclude?("gcc") && linux_deps&.include?("gcc") + MacOSVersions::SYMBOLS.each_key do |macos_version| + [:arm, :intel].each do |arch| + bottle_tag = Utils::Bottles::Tag.new(system: macos_version, arch: arch) + next unless bottle_tag.valid_combination? + + variation_dependencies = variations.dig(bottle_tag.to_sym, "dependencies") + # This variation either: + # 1. does not exist + # 2. has no variation-specific dependencies + # In either case, it matches Linux. + return false if variation_dependencies.blank? + # We found a non-Linux variation that depends on GCC. + return false if variation_dependencies.include?("gcc") + end + end + + true end end end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index e895c09215..e0a696fd0e 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -581,11 +581,9 @@ class FormulaInstaller end def expand_dependencies_for_formula(formula, inherited_options) - any_bottle_used = false - # Cache for this expansion only. FormulaInstaller has a lot of inputs which can alter expansion. cache_key = "FormulaInstaller-#{formula.full_name}-#{Time.now.to_f}" - expanded_deps = Dependency.expand(formula, cache_key: cache_key) do |dependent, dep| + Dependency.expand(formula, cache_key: cache_key) do |dependent, dep| inherited_options[dep.name] |= inherited_options_for(dep) build = effective_build_options_for( dependent, @@ -601,36 +599,14 @@ class FormulaInstaller Dependency.prune elsif dep.satisfied?(inherited_options[dep.name]) Dependency.skip - else - any_bottle_used ||= install_bottle_for?(dep.to_formula, build) end end - - [expanded_deps, any_bottle_used] end def expand_dependencies inherited_options = Hash.new { |hash, key| hash[key] = Options.new } - any_bottle_used = pour_bottle? - expanded_deps, any_dep_bottle_used = expand_dependencies_for_formula(formula, inherited_options) - any_bottle_used ||= any_dep_bottle_used - - # We require some dependencies (glibc, GCC 5, etc.) if binaries were built. - # Native binaries shouldn't exist in cross-platform `all` bottles. - if any_bottle_used && !formula.bottled?(:all) && !Keg.bottle_dependencies.empty? - all_bottle_deps = Keg.bottle_dependencies.flat_map do |bottle_dep| - bottle_dep.recursive_dependencies.map(&:name) + [bottle_dep.name] - end - - if all_bottle_deps.exclude?(formula.name) - bottle_deps = Keg.bottle_dependencies.flat_map do |bottle_dep| - expanded_bottle_deps, = expand_dependencies_for_formula(bottle_dep, inherited_options) - expanded_bottle_deps - end - expanded_deps = Dependency.merge_repeats(bottle_deps + expanded_deps) - end - end + expanded_deps = expand_dependencies_for_formula(formula, inherited_options) expanded_deps.map { |dep| [dep, inherited_options[dep.name]] } end @@ -799,6 +775,8 @@ class FormulaInstaller fix_dynamic_linkage(keg) if !@poured_bottle || !formula.bottle_specification.skip_relocation? + Homebrew::Install.global_post_install + if build_bottle? ohai "Not running 'post_install' as we're building a bottle" puts "You can run it manually using:" @@ -1187,6 +1165,8 @@ class FormulaInstaller if pour_bottle?(output_warning: true) formula.fetch_bottle_tab + elsif Homebrew::EnvConfig.install_from_api? + odie "Unable to build #{formula.name} from source with HOMEBREW_INSTALL_FROM_API." else formula.fetch_patches formula.resources.each(&:fetch) diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 1a11464f69..0f404ac482 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -45,6 +45,7 @@ HOMEBREW_REQUIRED_RUBY_VERSION = ENV.fetch("HOMEBREW_REQUIRED_RUBY_VERSION").fre HOMEBREW_PRODUCT = ENV.fetch("HOMEBREW_PRODUCT").freeze HOMEBREW_VERSION = ENV.fetch("HOMEBREW_VERSION").freeze HOMEBREW_WWW = "https://brew.sh" +HOMEBREW_DOCS_WWW = "https://docs.brew.sh" HOMEBREW_SYSTEM = ENV.fetch("HOMEBREW_SYSTEM").freeze HOMEBREW_PROCESSOR = ENV.fetch("HOMEBREW_PROCESSOR").freeze diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index 3d838dac3e..be0467fa23 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -30,6 +30,10 @@ module Homebrew Diagnostic.checks(:build_from_source_checks, fatal: all_fatal) end + def global_post_install; end + alias generic_global_post_install global_post_install + module_function :generic_global_post_install + def check_prefix if (Hardware::CPU.intel? || Hardware::CPU.in_rosetta2?) && HOMEBREW_PREFIX.to_s == HOMEBREW_MACOS_ARM_DEFAULT_PREFIX diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index ae3db9de42..961d3f27fc 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -366,17 +366,6 @@ class Keg def self.file_linked_libraries(_file, _string) [] end - - def self.bottle_dependencies - return [] unless Homebrew::SimulateSystem.simulating_or_running_on_linux? - - @bottle_dependencies ||= begin - formulae = [] - gcc = Formulary.factory(CompilerSelector.preferred_gcc) - formulae << gcc if DevelopmentTools.gcc_version("gcc") < gcc.version.to_i - formulae - end - end end require "extend/os/keg_relocate" diff --git a/Library/Homebrew/options.rb b/Library/Homebrew/options.rb index 70c537a0f5..1126ab2260 100644 --- a/Library/Homebrew/options.rb +++ b/Library/Homebrew/options.rb @@ -82,9 +82,20 @@ class Options end def initialize(*args) + # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) @options = Set.new(*args) end + def initialize_dup(other) + super + @options = @options.dup + end + + def freeze + @options.dup + super + end + def each(*args, &block) @options.each(*args, &block) end diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index ac480c374f..0fc42af698 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -45,15 +45,12 @@ module OS ::OS_VERSION = ENV.fetch("HOMEBREW_OS_VERSION").freeze - LINUX_CI_OS_VERSION = "Ubuntu 16.04" - LINUX_GLIBC_CI_VERSION = "2.23" - LINUX_GCC_CI_VERSION = "5.0" - LINUX_PREFERRED_GCC_FORMULA = "gcc@5" - - # Ubuntu 22.04 (see Linux-CI.md) + # See Linux-CI.md + LINUX_CI_OS_VERSION = "Ubuntu 22.04" + LINUX_GLIBC_CI_VERSION = "2.35" LINUX_GLIBC_NEXT_CI_VERSION = "2.35" - # LINUX_GCC_CI_VERSION = "11.0" - # LINUX_PREFERRED_GCC_FORMULA = "gcc@11" + LINUX_GCC_CI_VERSION = "11.0" + LINUX_PREFERRED_GCC_FORMULA = "gcc@11" if OS.mac? require "os/mac" diff --git a/Library/Homebrew/os/linux/elf.rb b/Library/Homebrew/os/linux/elf.rb index 73dd1b016e..cdfc602fba 100644 --- a/Library/Homebrew/os/linux/elf.rb +++ b/Library/Homebrew/os/linux/elf.rb @@ -97,7 +97,7 @@ module ELFShim # An array of runtime search path entries, such as: # ["/lib", "/usr/lib", "/usr/local/lib"] def rpaths - rpath.split(":") + Array(rpath&.split(":")) end def interpreter diff --git a/Library/Homebrew/os/linux/glibc.rb b/Library/Homebrew/os/linux/glibc.rb index 7478701223..476723e741 100644 --- a/Library/Homebrew/os/linux/glibc.rb +++ b/Library/Homebrew/os/linux/glibc.rb @@ -44,6 +44,11 @@ module OS def below_minimum_version? system_version < minimum_version end + + sig { returns(T::Boolean) } + def below_ci_version? + system_version < LINUX_GLIBC_CI_VERSION + end end end end diff --git a/Library/Homebrew/postinstall.rb b/Library/Homebrew/postinstall.rb index bd836db12a..f546df2727 100644 --- a/Library/Homebrew/postinstall.rb +++ b/Library/Homebrew/postinstall.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__ + old_trap = trap("INT") { exit! 130 } require_relative "global" diff --git a/Library/Homebrew/readall.rb b/Library/Homebrew/readall.rb index 47d493d848..c61f0c2027 100644 --- a/Library/Homebrew/readall.rb +++ b/Library/Homebrew/readall.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true require "formula" diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index de890cc9e0..38ebe87721 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -20,6 +20,10 @@ class Requirement attr_reader :tags, :name, :cask, :download def initialize(tags = []) + # Only allow instances of subclasses. This base class enforces no constraints on its own. + # Individual subclasses use the `satisfy` DSL to define those constraints. + raise "Do not call `Requirement.new' directly without a subclass." unless self.class < Requirement + @cask = self.class.cask @download = self.class.download tags.each do |tag| @@ -141,9 +145,9 @@ class Requirement private def infer_name - klass = self.class.name || self.class.to_s - klass = klass.sub(/(Dependency|Requirement)$/, "") - .sub(/^(\w+::)*/, "") + klass = self.class.name + klass = klass&.sub(/(Dependency|Requirement)$/, "") + &.sub(/^(\w+::)*/, "") return klass.downcase if klass.present? return @cask if @cask.present? diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb index b3a127bc59..1c6c5b2342 100644 --- a/Library/Homebrew/resource.rb +++ b/Library/Homebrew/resource.rb @@ -29,6 +29,7 @@ class Resource attr_accessor :name def initialize(name = nil, &block) + # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) @name = name @url = nil @version = nil @@ -37,11 +38,35 @@ class Resource @checksum = nil @using = nil @patches = [] - @livecheck = nil + @livecheck = Livecheck.new(self) @livecheckable = false instance_eval(&block) if block end + def initialize_dup(other) + super + @name = @name.dup + @version = @version.dup + @mirrors = @mirrors.dup + @specs = @specs.dup + @checksum = @checksum.dup + @using = @using.dup + @patches = @patches.dup + @livecheck = @livecheck.dup + end + + def freeze + @name.freeze + @version.freeze + @mirrors.freeze + @specs.freeze + @checksum.freeze + @using.freeze + @patches.freeze + @livecheck.freeze + super + end + def owner=(owner) @owner = owner patches.each { |p| p.owner = owner } @@ -185,7 +210,6 @@ class Resource # regex /foo-(\d+(?:\.\d+)+)\.tar/ # end def livecheck(&block) - @livecheck ||= Livecheck.new(self) if block return @livecheck unless block @livecheckable = true @@ -215,13 +239,13 @@ class Resource @download_strategy = DownloadStrategyDetector.detect(url, using) @specs.merge!(specs) @downloader = nil + @version = detect_version(@version) end def version(val = nil) - @version ||= begin - version = detect_version(val) - version.null? ? nil : version - end + return @version if val.nil? + + @version = detect_version(val) end def mirror(val) @@ -242,15 +266,15 @@ class Resource private def detect_version(val) - return Version::NULL if val.nil? && url.nil? - - case val - when nil then Version.detect(url, **specs) + version = case val + when nil then url.nil? ? Version::NULL : Version.detect(url, **specs) when String then Version.create(val) when Version then val else raise TypeError, "version '#{val.inspect}' should be a string" end + + version unless version.null? end # A resource containing a Go package. diff --git a/Library/Homebrew/rubocops/cask/ast/cask_block.rb b/Library/Homebrew/rubocops/cask/ast/cask_block.rb index c05f109723..4f45f6771c 100644 --- a/Library/Homebrew/rubocops/cask/ast/cask_block.rb +++ b/Library/Homebrew/rubocops/cask/ast/cask_block.rb @@ -49,7 +49,7 @@ module RuboCop stanzas.sort do |s1, s2| i1 = stanza_order_index(s1) i2 = stanza_order_index(s2) - if i1 == i2 + if i1 == i2 || i1.blank? || i2.blank? i1 = stanzas.index(s1) i2 = stanzas.index(s2) end diff --git a/Library/Homebrew/rubocops/cask/constants/stanza.rb b/Library/Homebrew/rubocops/cask/constants/stanza.rb index 5294a1c45f..d8129cc51b 100644 --- a/Library/Homebrew/rubocops/cask/constants/stanza.rb +++ b/Library/Homebrew/rubocops/cask/constants/stanza.rb @@ -55,6 +55,8 @@ module RuboCop end.freeze STANZA_ORDER = STANZA_GROUPS.flatten.freeze + + ON_SYSTEM_METHODS = [:arm, :intel, *MacOSVersions::SYMBOLS.keys].map { |option| :"on_#{option}" }.freeze end end end diff --git a/Library/Homebrew/rubocops/cask/extend/node.rb b/Library/Homebrew/rubocops/cask/extend/node.rb index c0c4f5f993..50e93a5743 100644 --- a/Library/Homebrew/rubocops/cask/extend/node.rb +++ b/Library/Homebrew/rubocops/cask/extend/node.rb @@ -19,8 +19,10 @@ module RuboCop def stanza? return true if arch_variable? + return false if !send_type? && !block_type? + return true if ON_SYSTEM_METHODS.include?(method_name) - (send_type? || block_type?) && STANZA_ORDER.include?(method_name) + STANZA_ORDER.include?(method_name) end def heredoc? diff --git a/Library/Homebrew/rubocops/cask/on_system_conditionals.rb b/Library/Homebrew/rubocops/cask/on_system_conditionals.rb index 42c741aa63..cb3abd0a79 100644 --- a/Library/Homebrew/rubocops/cask/on_system_conditionals.rb +++ b/Library/Homebrew/rubocops/cask/on_system_conditionals.rb @@ -39,6 +39,9 @@ module RuboCop audit_on_system_blocks(stanza.stanza_node, stanza.stanza_name) end + + audit_arch_conditionals(cask_body) + simplify_sha256_stanzas end private @@ -46,6 +49,33 @@ module RuboCop attr_reader :cask_block def_delegators :cask_block, :toplevel_stanzas, :cask_body + + def simplify_sha256_stanzas + nodes = {} + + sha256_on_arch_stanzas(cask_body) do |node, method, value| + nodes[method.to_s.delete_prefix("on_").to_sym] = { node: node, value: value } + end + + return if !nodes.key?(:arm) || !nodes.key?(:intel) + + offending_node(nodes[:arm][:node]) + replacement_string = "sha256 arm: #{nodes[:arm][:value].inspect}, intel: #{nodes[:intel][:value].inspect}" + + problem "Use `#{replacement_string}` instead of nesting the `sha256` stanzas in " \ + "`on_intel` and `on_arm` blocks" do |corrector| + corrector.replace(nodes[:arm][:node].source_range, replacement_string) + corrector.replace(nodes[:intel][:node].source_range, "") + end + end + + def_node_search :sha256_on_arch_stanzas, <<~PATTERN + $(block + (send nil? ${:on_intel :on_arm}) + (args) + (send nil? :sha256 + (str $_))) + PATTERN end end end diff --git a/Library/Homebrew/rubocops/cask/on_system_conditionals.rbi b/Library/Homebrew/rubocops/cask/on_system_conditionals.rbi new file mode 100644 index 0000000000..3ca40d52d9 --- /dev/null +++ b/Library/Homebrew/rubocops/cask/on_system_conditionals.rbi @@ -0,0 +1,17 @@ +# typed: strict + +module RuboCop + module Cop + module Cask + class OnSystemConditionals < Base + sig { + params( + base_node: Parser::AST::Node, + block: T.proc.params(node: Parser::AST::Node, method: Symbol, value: String).void, + ).void + } + def sha256_on_arch_stanzas(base_node, &block); end + end + end + end +end diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 215100829f..683d27f720 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -415,6 +415,151 @@ module RuboCop end end + # This cop makes sure that the `generate_completions_from_executable` DSL is used. + # + # @api private + class GenerateCompletionsDSL < FormulaCop + extend AutoCorrector + + def audit_formula(_node, _class_node, _parent_class_node, body_node) + install = find_method_def(body_node, :install) + return if install.blank? + + correctable_shell_completion_node(install) do |node, shell, base_name, executable, subcmd, shell_parameter| # rubocop:disable Metrics/ParameterLists + # generate_completions_from_executable only applicable if shell is passed + next unless shell_parameter.match?(/(bash|zsh|fish)/) + + base_name = base_name.delete_prefix("_").delete_suffix(".fish") + shell = shell.to_s.delete_suffix("_completion").to_sym + shell_parameter_stripped = shell_parameter + .delete_suffix("bash") + .delete_suffix("zsh") + .delete_suffix("fish") + shell_parameter_format = if shell_parameter_stripped.empty? + nil + elsif shell_parameter_stripped == "--" + :flag + elsif shell_parameter_stripped == "--shell=" + :arg + else + shell_parameter_stripped + end + + replacement_args = %w[] + replacement_args << executable.source + replacement_args << subcmd.source + replacement_args << "base_name: \"#{base_name}\"" unless base_name == @formula_name + replacement_args << "shells: [:#{shell}]" + unless shell_parameter_format.nil? + replacement_args << "shell_parameter_format: #{shell_parameter_format.inspect}" + end + + offending_node(node) + replacement = "generate_completions_from_executable(#{replacement_args.join(", ")})" + + problem "Use `#{replacement}` instead of `#{@offensive_node.source}`." do |corrector| + corrector.replace(@offensive_node.source_range, replacement) + end + end + + shell_completion_node(install) do |node| + next if node.source.include?("<<~") # skip heredoc completion scripts + next if node.source.match?(/{.*=>.*}/) # skip commands needing custom ENV variables + + offending_node(node) + problem "Use `generate_completions_from_executable` DSL instead of `#{@offensive_node.source}`." + end + end + + # match ({bash,zsh,fish}_completion/"_?foo{.fish}?").write Utils.safe_popen_read(foo, subcmd, shell_parameter) + def_node_search :correctable_shell_completion_node, <<~EOS + $(send + (begin + (send + (send nil? ${:bash_completion :zsh_completion :fish_completion}) :/ + (str $_))) :write + (send + (const nil? :Utils) :safe_popen_read + $(send + (send nil? :bin) :/ + (str _)) + $(str _) + (str $_))) + EOS + + # matches ({bash,zsh,fish}_completion/"_?foo{.fish}?").write output + def_node_search :shell_completion_node, <<~EOS + $(send + (begin + (send + (send nil? {:bash_completion :zsh_completion :fish_completion}) :/ + (str _))) :write _) + EOS + end + + # This cop makes sure that the `generate_completions_from_executable` DSL is used with only + # a single, combined call for all shells. + # + # @api private + class SingleGenerateCompletionsDSLCall < FormulaCop + extend AutoCorrector + + def audit_formula(_node, _class_node, _parent_class_node, body_node) + install = find_method_def(body_node, :install) + return if install.blank? + + methods = find_every_method_call_by_name(install, :generate_completions_from_executable) + return if methods.length <= 1 + + offenses = [] + shells = [] + methods.each do |method| + next unless method.source.include?("shells:") + + shells << method.source.match(/shells: \[(:bash|:zsh|:fish)\]/).captures.first + offenses << method + end + + return if offenses.blank? + + T.must(offenses[0...-1]).each_with_index do |node, i| + # commands have to be the same to be combined + # send_type? matches `bin/"foo"`, str_type? matches remaining command parts, + # the rest are kwargs we need to filter out + method_commands = node.arguments.filter { |arg| arg.send_type? || arg.str_type? } + next_method_commands = offenses[i + 1].arguments.filter { |arg| arg.send_type? || arg.str_type? } + unless method_commands == next_method_commands + shells.delete_at(i) + next + end + + offending_node(node) + problem "Use a single `generate_completions_from_executable` " \ + "call combining all specified shells." do |corrector| + # adjust range by -4 and +1 to also include & remove leading spaces and trailing \n + corrector.replace(@offensive_node.source_range.adjust(begin_pos: -4, end_pos: 1), "") + end + end + + return if shells.length <= 1 # no shells to combine left + + offending_node(offenses.last) + replacement = if (%w[:bash :zsh :fish] - shells).empty? + @offensive_node.source.sub(/shells: \[(:bash|:zsh|:fish)\]/, "") + .sub(", )", ")") # clean up dangling trailing comma + .sub("(, ", "(") # clean up dangling leading comma + .sub(", , ", ", ") # clean up dangling enclosed comma + else + @offensive_node.source.sub(/shells: \[(:bash|:zsh|:fish)\]/, + "shells: [#{shells.join(", ")}]") + end + + problem "Use `#{replacement}` instead of `#{@offensive_node.source}`." do |corrector| + corrector.replace(@offensive_node.source_range, replacement) + end + end + end + # This cop checks for other miscellaneous style violations. # # @api private diff --git a/Library/Homebrew/shims/gems/rubocop b/Library/Homebrew/shims/gems/rubocop index 4cfafc2e07..e1e251669e 100755 --- a/Library/Homebrew/shims/gems/rubocop +++ b/Library/Homebrew/shims/gems/rubocop @@ -1,2 +1,3 @@ #!/bin/bash -exec brew rubocop "$@" +HOMEBREW_PREFIX_BIN="$(cd "$(dirname "$0")"/../../../../ && pwd)/bin/" +exec "${HOMEBREW_PREFIX_BIN}"brew rubocop "$@" diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 6b4c15981e..29d1abfc54 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -36,6 +36,7 @@ class SoftwareSpec def_delegators :@resource, :sha256 def initialize(flags: []) + # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) @resource = Resource.new @resources = {} @dependency_collector = DependencyCollector.new @@ -50,6 +51,38 @@ class SoftwareSpec @uses_from_macos_elements = [] end + def initialize_dup(other) + super + @resource = @resource.dup + @resources = @resources.dup + @dependency_collector = @dependency_collector.dup + @bottle_specification = @bottle_specification.dup + @patches = @patches.dup + @options = @options.dup + @flags = @flags.dup + @deprecated_flags = @deprecated_flags.dup + @deprecated_options = @deprecated_options.dup + @build = @build.dup + @compiler_failures = @compiler_failures.dup + @uses_from_macos_elements = @uses_from_macos_elements.dup + end + + def freeze + @resource.freeze + @resources.freeze + @dependency_collector.freeze + @bottle_specification.freeze + @patches.freeze + @options.freeze + @flags.freeze + @deprecated_flags.freeze + @deprecated_options.freeze + @build.freeze + @compiler_failures.freeze + @uses_from_macos_elements.freeze + super + end + def owner=(owner) @name = owner.name @full_name = owner.full_name @@ -321,7 +354,7 @@ class Bottle @cellar = tag_spec.cellar @rebuild = spec.rebuild - @resource.version = formula.pkg_version + @resource.version = formula.pkg_version.to_s @resource.checksum = tag_spec.checksum @fetch_tab_retried = false diff --git a/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.6.1.rbi b/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.6.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.rbi index f6a0423fa5..fcf794e723 100644 --- a/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.6.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.rbi @@ -2784,7 +2784,6 @@ end module ActiveSupport::VERSION; end ActiveSupport::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) ActiveSupport::VERSION::MINOR = T.let(T.unsafe(nil), Integer) -ActiveSupport::VERSION::PRE = T.let(T.unsafe(nil), String) ActiveSupport::VERSION::STRING = T.let(T.unsafe(nil), String) ActiveSupport::VERSION::TINY = T.let(T.unsafe(nil), Integer) diff --git a/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.0.rbi b/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.1.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/addressable@2.8.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/addressable@2.8.1.rbi index 6537967e4f..60b046070b 100644 --- a/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.1.rbi @@ -220,6 +220,7 @@ class Addressable::URI protected + def force_utf8_encoding_if_needed(str); end def remove_composite_values; end def replace_self(uri); end def split_path(path); end diff --git a/Library/Homebrew/sorbet/rbi/gems/bootsnap@1.12.0.rbi b/Library/Homebrew/sorbet/rbi/gems/bootsnap@1.13.0.rbi similarity index 97% rename from Library/Homebrew/sorbet/rbi/gems/bootsnap@1.12.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/bootsnap@1.13.0.rbi index 7d53df97d8..bd2ab408ba 100644 --- a/Library/Homebrew/sorbet/rbi/gems/bootsnap@1.12.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/bootsnap@1.13.0.rbi @@ -51,10 +51,12 @@ class Bootsnap::InvalidConfiguration < ::StandardError; end module Bootsnap::LoadPathCache class << self + def enabled?; end def load_path_cache; end def loaded_features_index; end def setup(cache_path:, development_mode:); end def supported?; end + def unload!; end end end @@ -63,7 +65,7 @@ Bootsnap::LoadPathCache::CACHED_EXTENSIONS = T.let(T.unsafe(nil), Array) class Bootsnap::LoadPathCache::Cache def initialize(store, path_obj, development_mode: T.unsafe(nil)); end - def find(feature, try_extensions: T.unsafe(nil)); end + def find(feature); end def load_dir(dir); end def push_paths(sender, *paths); end def reinitialize(path_obj = T.unsafe(nil)); end @@ -76,7 +78,7 @@ class Bootsnap::LoadPathCache::Cache def maybe_append_extension(feature); end def now; end def push_paths_locked(*paths); end - def search_index(feature, try_extensions: T.unsafe(nil)); end + def search_index(feature); end def stale?; end def try_ext(feature); end def try_index(feature); end @@ -88,7 +90,8 @@ Bootsnap::LoadPathCache::Cache::BUILTIN_FEATURES = T.let(T.unsafe(nil), Hash) module Bootsnap::LoadPathCache::ChangeObserver class << self - def register(observer, arr); end + def register(arr, observer); end + def unregister(arr); end end end diff --git a/Library/Homebrew/sorbet/rbi/gems/minitest@5.16.2.rbi b/Library/Homebrew/sorbet/rbi/gems/minitest@5.16.3.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/minitest@5.16.2.rbi rename to Library/Homebrew/sorbet/rbi/gems/minitest@5.16.3.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/msgpack@1.5.3.rbi b/Library/Homebrew/sorbet/rbi/gems/msgpack@1.5.6.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/msgpack@1.5.3.rbi rename to Library/Homebrew/sorbet/rbi/gems/msgpack@1.5.6.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/nokogiri@1.13.7.rbi b/Library/Homebrew/sorbet/rbi/gems/nokogiri@1.13.8.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/nokogiri@1.13.7.rbi rename to Library/Homebrew/sorbet/rbi/gems/nokogiri@1.13.8.rbi index ef2021b095..f70656d62c 100644 --- a/Library/Homebrew/sorbet/rbi/gems/nokogiri@1.13.7.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/nokogiri@1.13.8.rbi @@ -1288,6 +1288,7 @@ class Nokogiri::XML::Reader def attribute(_arg0); end def attribute_at(_arg0); end def attribute_count; end + def attribute_hash; end def attribute_nodes; end def attributes; end def attributes?; end diff --git a/Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.11.1.rbi b/Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.12.0.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.11.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.12.0.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/parser@3.1.2.0.rbi b/Library/Homebrew/sorbet/rbi/gems/parser@3.1.2.1.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/parser@3.1.2.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/parser@3.1.2.1.rbi index 975e204c51..be9ded832c 100644 --- a/Library/Homebrew/sorbet/rbi/gems/parser@3.1.2.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/parser@3.1.2.1.rbi @@ -1430,6 +1430,7 @@ end class Parser::Source::Range include ::Comparable include ::RuboCop::AST::Ext::Range + include ::RuboCop::Ext::Range def initialize(source_buffer, begin_pos, end_pos); end diff --git a/Library/Homebrew/sorbet/rbi/gems/public_suffix@4.0.7.rbi b/Library/Homebrew/sorbet/rbi/gems/public_suffix@5.0.0.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/public_suffix@4.0.7.rbi rename to Library/Homebrew/sorbet/rbi/gems/public_suffix@5.0.0.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/rack@2.2.4.rbi b/Library/Homebrew/sorbet/rbi/gems/rack@3.0.0.rbi similarity index 77% rename from Library/Homebrew/sorbet/rbi/gems/rack@2.2.4.rbi rename to Library/Homebrew/sorbet/rbi/gems/rack@3.0.0.rbi index bcd16f3d6d..f1fb8f41b8 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rack@2.2.4.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rack@3.0.0.rbi @@ -150,7 +150,7 @@ class Rack::Builder def call(env); end def freeze_app; end def map(path, &block); end - def run(app); end + def run(app = T.unsafe(nil), &block); end def to_app; end def use(middleware, *args, &block); end def warmup(prc = T.unsafe(nil), &block); end @@ -161,9 +161,9 @@ class Rack::Builder class << self def app(default_app = T.unsafe(nil), &block); end - def load_file(path, opts = T.unsafe(nil)); end + def load_file(path); end def new_from_string(builder_script, file = T.unsafe(nil)); end - def parse_file(config, opts = T.unsafe(nil)); end + def parse_file(path); end end end @@ -221,7 +221,7 @@ class Rack::CommonLogger private def extract_content_length(headers); end - def log(env, status, header, began_at); end + def log(env, status, response_headers, began_at); end end Rack::CommonLogger::FORMAT = T.let(T.unsafe(nil), String) @@ -281,6 +281,8 @@ class Rack::Deflater::GzipStream def write(data); end end +Rack::Deflater::GzipStream::BUFFER_LENGTH = T.let(T.unsafe(nil), Integer) + class Rack::Directory def initialize(root, app = T.unsafe(nil)); end @@ -319,7 +321,6 @@ class Rack::ETag private def digest_body(body); end - def etag_body?(body); end def etag_status?(status); end def skip_caching?(headers); end end @@ -381,10 +382,6 @@ class Rack::Files def fail(status, body, headers = T.unsafe(nil)); end def filesize(path); end def mime_type(path, default_mime); end - - class << self - def method_added(name); end - end end Rack::Files::ALLOWED_VERBS = T.let(T.unsafe(nil), Array) @@ -426,40 +423,6 @@ Rack::HTTPS = T.let(T.unsafe(nil), String) Rack::HTTP_COOKIE = T.let(T.unsafe(nil), String) Rack::HTTP_HOST = T.let(T.unsafe(nil), String) Rack::HTTP_PORT = T.let(T.unsafe(nil), String) -Rack::HTTP_VERSION = T.let(T.unsafe(nil), String) - -module Rack::Handler - class << self - def default; end - def get(server); end - def pick(server_names); end - def register(server, klass); end - def try_require(prefix, const_name); end - end -end - -class Rack::Handler::CGI - class << self - def run(app, **options); end - def send_body(body); end - def send_headers(status, headers); end - def serve(app); end - end -end - -Rack::Handler::SERVER_NAMES = T.let(T.unsafe(nil), Array) - -class Rack::Handler::WEBrick < ::WEBrick::HTTPServlet::AbstractServlet - def initialize(server, app); end - - def service(req, res); end - - class << self - def run(app, **options); end - def shutdown; end - def valid_options; end - end -end class Rack::Head def initialize(app); end @@ -467,36 +430,77 @@ class Rack::Head def call(env); end end +class Rack::Headers < ::Hash + def [](key); end + def []=(key, value); end + def assoc(key); end + def compare_by_identity; end + def delete(key); end + def dig(key, *a); end + def fetch(key, *default, &block); end + def fetch_values(*a); end + def has_key?(key); end + def include?(key); end + def invert; end + def key?(key); end + def member?(key); end + def merge(hash, &block); end + def merge!(hash, &block); end + def reject(&block); end + def replace(hash); end + def select(&block); end + def slice(*a); end + def store(key, value); end + def to_proc; end + def transform_keys(&block); end + def transform_keys!; end + def transform_values(&block); end + def update(hash, &block); end + def values_at(*keys); end + + private + + def downcase_key(key); end + + class << self + def [](*items); end + end +end + Rack::LINK = T.let(T.unsafe(nil), String) class Rack::Lint - include ::Rack::Lint::Assertion - def initialize(app); end - def _call(env); end def call(env = T.unsafe(nil)); end +end + +class Rack::Lint::LintError < ::RuntimeError; end + +class Rack::Lint::Wrapper + def initialize(app, env); end + + def call(stream); end def check_content_length(status, headers); end def check_content_type(status, headers); end - def check_env(env); end + def check_environment(env); end def check_error(error); end - def check_headers(header); end + def check_header_value(key, value); end + def check_headers(headers); end def check_hijack(env); end def check_hijack_response(headers, env); end def check_input(input); end def check_status(status); end def close; end def each; end - def verify_content_length(bytes); end + def respond_to?(name, *_arg1); end + def response; end + def to_ary; end + def verify_content_length(size); end + def verify_to_path; end end -module Rack::Lint::Assertion - def assert(message); end -end - -class Rack::Lint::ErrorWrapper - include ::Rack::Lint::Assertion - +class Rack::Lint::Wrapper::ErrorWrapper def initialize(error); end def close(*args); end @@ -505,38 +509,31 @@ class Rack::Lint::ErrorWrapper def write(str); end end -class Rack::Lint::HijackWrapper - include ::Rack::Lint::Assertion - extend ::Forwardable - - def initialize(io); end - - def close(*args, &block); end - def close_read(*args, &block); end - def close_write(*args, &block); end - def closed?(*args, &block); end - def flush(*args, &block); end - def read(*args, &block); end - def read_nonblock(*args, &block); end - def write(*args, &block); end - def write_nonblock(*args, &block); end -end - -Rack::Lint::HijackWrapper::REQUIRED_METHODS = T.let(T.unsafe(nil), Array) - -class Rack::Lint::InputWrapper - include ::Rack::Lint::Assertion - +class Rack::Lint::Wrapper::InputWrapper def initialize(input); end def close(*args); end def each(*args); end def gets(*args); end def read(*args); end - def rewind(*args); end end -class Rack::Lint::LintError < ::RuntimeError; end +class Rack::Lint::Wrapper::StreamWrapper + extend ::Forwardable + + def initialize(stream); end + + def <<(*args, &block); end + def close(*args, &block); end + def close_read(*args, &block); end + def close_write(*args, &block); end + def closed?(*args, &block); end + def flush(*args, &block); end + def read(*args, &block); end + def write(*args, &block); end +end + +Rack::Lint::Wrapper::StreamWrapper::REQUIRED_METHODS = T.let(T.unsafe(nil), Array) class Rack::Lock def initialize(app, mutex = T.unsafe(nil)); end @@ -653,7 +650,7 @@ end module Rack::Multipart class << self def build_multipart(params, first = T.unsafe(nil)); end - def extract_multipart(req, params = T.unsafe(nil)); end + def extract_multipart(request, params = T.unsafe(nil)); end def parse_multipart(env, params = T.unsafe(nil)); end end end @@ -671,6 +668,8 @@ Rack::Multipart::EXTENDED_OTHER_NAME = T.let(T.unsafe(nil), Regexp) Rack::Multipart::EXTENDED_OTHER_PARAMETER = T.let(T.unsafe(nil), Regexp) Rack::Multipart::EXTENDED_OTHER_VALUE = T.let(T.unsafe(nil), Regexp) Rack::Multipart::EXTENDED_PARAMETER = T.let(T.unsafe(nil), Regexp) +class Rack::Multipart::EmptyContentError < ::EOFError; end +class Rack::Multipart::Error < ::StandardError; end class Rack::Multipart::Generator def initialize(params, first = T.unsafe(nil)); end @@ -695,21 +694,21 @@ class Rack::Multipart::MultipartPartLimitError < ::Errno::EMFILE; end class Rack::Multipart::Parser def initialize(boundary, tempfile, bufsize, query_parser); end - def on_read(content); end + def parse(io); end def result; end def state; end private def consume_boundary; end - def full_boundary; end + def dequote(str); end def get_filename(head); end def handle_consume_token; end def handle_empty_content!(content); end def handle_fast_forward; end def handle_mime_body; end def handle_mime_head; end - def run_parser; end + def read_data(io, outbuf); end def tag_multipart_encoding(filename, content_type, name, body); end class << self @@ -718,14 +717,12 @@ class Rack::Multipart::Parser end end -Rack::Multipart::Parser::BOUNDARY_REGEX = T.let(T.unsafe(nil), Regexp) Rack::Multipart::Parser::BUFSIZE = T.let(T.unsafe(nil), Integer) class Rack::Multipart::Parser::BoundedIO def initialize(io, content_length); end def read(size, outbuf = T.unsafe(nil)); end - def rewind; end end Rack::Multipart::Parser::CHARSET = T.let(T.unsafe(nil), String) @@ -807,23 +804,30 @@ class Rack::NullLogger def datetime_format; end def datetime_format=(datetime_format); end def debug(progname = T.unsafe(nil), &block); end + def debug!; end def debug?; end def error(progname = T.unsafe(nil), &block); end + def error!; end def error?; end def fatal(progname = T.unsafe(nil), &block); end + def fatal!; end def fatal?; end def formatter; end def formatter=(formatter); end def info(progname = T.unsafe(nil), &block); end + def info!; end def info?; end def level; end def level=(level); end + def log(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &block); end def progname; end def progname=(progname); end + def reopen(logdev = T.unsafe(nil)); end def sev_threshold; end def sev_threshold=(sev_threshold); end def unknown(progname = T.unsafe(nil), &block); end def warn(progname = T.unsafe(nil), &block); end + def warn!; end def warn?; end end @@ -835,25 +839,24 @@ Rack::PUT = T.let(T.unsafe(nil), String) Rack::QUERY_STRING = T.let(T.unsafe(nil), String) class Rack::QueryParser - def initialize(params_class, key_space_limit, param_depth_limit); end + def initialize(params_class, _key_space_limit = T.unsafe(nil), param_depth_limit); end - def key_space_limit; end def make_params; end def new_depth_limit(param_depth_limit); end - def new_space_limit(key_space_limit); end - def normalize_params(params, name, v, depth); end + def normalize_params(params, name, v, _depth = T.unsafe(nil)); end def param_depth_limit; end - def parse_nested_query(qs, d = T.unsafe(nil)); end - def parse_query(qs, d = T.unsafe(nil), &unescaper); end + def parse_nested_query(qs, separator = T.unsafe(nil)); end + def parse_query(qs, separator = T.unsafe(nil), &unescaper); end private + def _normalize_params(params, name, v, depth); end def params_hash_has_key?(hash, key); end def params_hash_type?(obj); end def unescape(s); end class << self - def make_default(key_space_limit, param_depth_limit); end + def make_default(_key_space_limit = T.unsafe(nil), param_depth_limit); end end end @@ -863,7 +866,7 @@ class Rack::QueryParser::InvalidParameterError < ::ArgumentError; end class Rack::QueryParser::ParameterTypeError < ::TypeError; end class Rack::QueryParser::Params - def initialize(limit); end + def initialize; end def [](key); end def []=(key, value); end @@ -875,15 +878,12 @@ end class Rack::QueryParser::ParamsTooDeepError < ::RangeError; end Rack::RACK_ERRORS = T.let(T.unsafe(nil), String) Rack::RACK_HIJACK = T.let(T.unsafe(nil), String) -Rack::RACK_HIJACK_IO = T.let(T.unsafe(nil), String) Rack::RACK_INPUT = T.let(T.unsafe(nil), String) Rack::RACK_IS_HIJACK = T.let(T.unsafe(nil), String) Rack::RACK_LOGGER = T.let(T.unsafe(nil), String) Rack::RACK_METHODOVERRIDE_ORIGINAL_METHOD = T.let(T.unsafe(nil), String) Rack::RACK_MULTIPART_BUFFER_SIZE = T.let(T.unsafe(nil), String) Rack::RACK_MULTIPART_TEMPFILE_FACTORY = T.let(T.unsafe(nil), String) -Rack::RACK_MULTIPROCESS = T.let(T.unsafe(nil), String) -Rack::RACK_MULTITHREAD = T.let(T.unsafe(nil), String) Rack::RACK_RECURSIVE_INCLUDE = T.let(T.unsafe(nil), String) Rack::RACK_REQUEST_COOKIE_HASH = T.let(T.unsafe(nil), String) Rack::RACK_REQUEST_COOKIE_STRING = T.let(T.unsafe(nil), String) @@ -892,10 +892,9 @@ Rack::RACK_REQUEST_FORM_INPUT = T.let(T.unsafe(nil), String) Rack::RACK_REQUEST_FORM_VARS = T.let(T.unsafe(nil), String) Rack::RACK_REQUEST_QUERY_HASH = T.let(T.unsafe(nil), String) Rack::RACK_REQUEST_QUERY_STRING = T.let(T.unsafe(nil), String) -Rack::RACK_RUNONCE = T.let(T.unsafe(nil), String) +Rack::RACK_RESPONSE_FINISHED = T.let(T.unsafe(nil), String) Rack::RACK_SESSION = T.let(T.unsafe(nil), String) Rack::RACK_SESSION_OPTIONS = T.let(T.unsafe(nil), String) -Rack::RACK_SESSION_UNPACKED_COOKIE_DATA = T.let(T.unsafe(nil), String) Rack::RACK_SHOWSTATUS_DETAIL = T.let(T.unsafe(nil), String) Rack::RACK_TEMPFILES = T.let(T.unsafe(nil), String) Rack::RACK_URL_SCHEME = T.let(T.unsafe(nil), String) @@ -941,8 +940,12 @@ class Rack::Request def xhr?; end class << self + def forwarded_priority; end + def forwarded_priority=(_arg0); end def ip_filter; end def ip_filter=(_arg0); end + def x_forwarded_proto_priority; end + def x_forwarded_proto_priority=(_arg0); end end end @@ -997,7 +1000,6 @@ module Rack::Request::Helpers def logger; end def media_type; end def media_type_params; end - def multithread?; end def options?; end def params; end def parseable_data?; end @@ -1034,8 +1036,9 @@ module Rack::Request::Helpers def allowed_scheme(header); end def default_session; end - def extract_proto_header(header); end + def forwarded_priority; end def forwarded_scheme; end + def get_http_forwarded(token); end def parse_http_accept_header(header); end def parse_multipart; end def parse_query(qs, d = T.unsafe(nil)); end @@ -1044,11 +1047,14 @@ module Rack::Request::Helpers def split_authority(authority); end def split_header(value); end def wrap_ipv6(host); end + def x_forwarded_proto_priority; end end Rack::Request::Helpers::AUTHORITY = T.let(T.unsafe(nil), Regexp) Rack::Request::Helpers::DEFAULT_PORTS = T.let(T.unsafe(nil), Hash) Rack::Request::Helpers::FORM_DATA_MEDIA_TYPES = T.let(T.unsafe(nil), Array) +Rack::Request::Helpers::FORWARDED_SCHEME_HEADERS = T.let(T.unsafe(nil), Hash) +Rack::Request::Helpers::HTTP_FORWARDED = T.let(T.unsafe(nil), String) Rack::Request::Helpers::HTTP_X_FORWARDED_FOR = T.let(T.unsafe(nil), String) Rack::Request::Helpers::HTTP_X_FORWARDED_HOST = T.let(T.unsafe(nil), String) Rack::Request::Helpers::HTTP_X_FORWARDED_PORT = T.let(T.unsafe(nil), String) @@ -1056,7 +1062,6 @@ Rack::Request::Helpers::HTTP_X_FORWARDED_PROTO = T.let(T.unsafe(nil), String) Rack::Request::Helpers::HTTP_X_FORWARDED_SCHEME = T.let(T.unsafe(nil), String) Rack::Request::Helpers::HTTP_X_FORWARDED_SSL = T.let(T.unsafe(nil), String) Rack::Request::Helpers::PARSEABLE_DATA_MEDIA_TYPES = T.let(T.unsafe(nil), Array) -Rack::Request::SCHEME_WHITELIST = T.let(T.unsafe(nil), Array) class Rack::Response include ::Rack::Response::Helpers @@ -1064,7 +1069,7 @@ class Rack::Response def initialize(body = T.unsafe(nil), status = T.unsafe(nil), headers = T.unsafe(nil)); end def [](key); end - def []=(key, v); end + def []=(key, value); end def body; end def body=(_arg0); end def chunked?; end @@ -1080,7 +1085,7 @@ class Rack::Response def length; end def length=(_arg0); end def redirect(target, status = T.unsafe(nil)); end - def set_header(key, v); end + def set_header(key, value); end def status; end def status=(_arg0); end def to_a(&block); end @@ -1095,11 +1100,11 @@ Rack::Response::CHUNKED = T.let(T.unsafe(nil), String) module Rack::Response::Helpers def accepted?; end - def add_header(key, v); end + def add_header(key, value); end def bad_request?; end def cache!(duration = T.unsafe(nil), directive: T.unsafe(nil)); end def cache_control; end - def cache_control=(v); end + def cache_control=(value); end def client_error?; end def content_length; end def content_type; end @@ -1108,7 +1113,7 @@ module Rack::Response::Helpers def delete_cookie(key, value = T.unsafe(nil)); end def do_not_cache!; end def etag; end - def etag=(v); end + def etag=(value); end def forbidden?; end def include?(header); end def informational?; end @@ -1120,15 +1125,17 @@ module Rack::Response::Helpers def method_not_allowed?; end def moved_permanently?; end def no_content?; end + def not_acceptable?; end def not_found?; end def ok?; end def precondition_failed?; end def redirect?; end def redirection?; end + def request_timeout?; end def server_error?; end def set_cookie(key, value); end def set_cookie_header; end - def set_cookie_header=(v); end + def set_cookie_header=(value); end def successful?; end def unauthorized?; end def unprocessable?; end @@ -1148,7 +1155,7 @@ class Rack::Response::Raw def get_header(key); end def has_header?(key); end def headers; end - def set_header(key, v); end + def set_header(key, value); end def status; end def status=(_arg0); end end @@ -1163,6 +1170,7 @@ class Rack::RewindableInput def gets; end def read(*args); end def rewind; end + def size; end private @@ -1170,6 +1178,12 @@ class Rack::RewindableInput def make_rewindable; end end +class Rack::RewindableInput::Middleware + def initialize(app); end + + def call(env); end +end + class Rack::Runtime def initialize(app, name = T.unsafe(nil)); end @@ -1195,238 +1209,6 @@ class Rack::Sendfile def variation(env); end end -class Rack::Server - def initialize(options = T.unsafe(nil)); end - - def app; end - def default_options; end - def middleware; end - def options; end - def options=(_arg0); end - def server; end - def start(&block); end - - private - - def build_app(app); end - def build_app_and_options_from_config; end - def build_app_from_string; end - def check_pid!; end - def daemonize_app; end - def handle_profiling(heapfile, profile_mode, filename); end - def make_profile_name(filename); end - def opt_parser; end - def parse_options(args); end - def pidfile_process_status; end - def wrapped_app; end - def write_pid; end - - class << self - def default_middleware_by_environment; end - def logging_middleware; end - def middleware; end - def start(options = T.unsafe(nil)); end - end -end - -class Rack::Server::Options - def handler_opts(options); end - def parse!(args); end -end - -module Rack::Session; end -module Rack::Session::Abstract; end - -class Rack::Session::Abstract::ID < ::Rack::Session::Abstract::Persisted - def delete_session(req, sid, options); end - def find_session(req, sid); end - def write_session(req, sid, session, options); end - - class << self - def inherited(klass); end - end -end - -class Rack::Session::Abstract::Persisted - def initialize(app, options = T.unsafe(nil)); end - - def call(env); end - def commit_session(req, res); end - def context(env, app = T.unsafe(nil)); end - def default_options; end - def key; end - def sid_secure; end - - private - - def commit_session?(req, session, options); end - def cookie_value(data); end - def current_session_id(req); end - def delete_session(req, sid, options); end - def extract_session_id(request); end - def find_session(env, sid); end - def force_options?(options); end - def forced_session_update?(session, options); end - def generate_sid(secure = T.unsafe(nil)); end - def initialize_sid; end - def load_session(req); end - def loaded_session?(session); end - def make_request(env); end - def prepare_session(req); end - def security_matches?(request, options); end - def session_class; end - def session_exists?(req); end - def set_cookie(request, res, cookie); end - def write_session(req, sid, session, options); end -end - -Rack::Session::Abstract::Persisted::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash) - -class Rack::Session::Abstract::PersistedSecure < ::Rack::Session::Abstract::Persisted - def extract_session_id(*_arg0); end - def generate_sid(*_arg0); end - - private - - def cookie_value(data); end - def session_class; end -end - -class Rack::Session::Abstract::PersistedSecure::SecureSessionHash < ::Rack::Session::Abstract::SessionHash - def [](key); end -end - -class Rack::Session::Abstract::SessionHash - include ::Enumerable - - def initialize(store, req); end - - def [](key); end - def []=(key, value); end - def clear; end - def delete(key); end - def destroy; end - def dig(key, *keys); end - def each(&block); end - def empty?; end - def exists?; end - def fetch(key, default = T.unsafe(nil), &block); end - def has_key?(key); end - def id; end - def id=(_arg0); end - def include?(key); end - def inspect; end - def key?(key); end - def keys; end - def loaded?; end - def merge!(hash); end - def options; end - def replace(hash); end - def store(key, value); end - def to_hash; end - def update(hash); end - def values; end - - private - - def load!; end - def load_for_read!; end - def load_for_write!; end - def stringify_keys(other); end - - class << self - def find(req); end - def set(req, session); end - def set_options(req, options); end - end -end - -Rack::Session::Abstract::SessionHash::Unspecified = T.let(T.unsafe(nil), Object) - -class Rack::Session::Cookie < ::Rack::Session::Abstract::PersistedSecure - def initialize(app, options = T.unsafe(nil)); end - - def coder; end - - private - - def delete_session(req, session_id, options); end - def digest_match?(data, digest); end - def extract_session_id(request); end - def find_session(req, sid); end - def generate_hmac(data, secret); end - def persistent_session_id!(data, sid = T.unsafe(nil)); end - def secure?(options); end - def unpacked_cookie_data(request); end - def write_session(req, session_id, session, options); end -end - -class Rack::Session::Cookie::Base64 - def decode(str); end - def encode(str); end -end - -class Rack::Session::Cookie::Base64::JSON < ::Rack::Session::Cookie::Base64 - def decode(str); end - def encode(obj); end -end - -class Rack::Session::Cookie::Base64::Marshal < ::Rack::Session::Cookie::Base64 - def decode(str); end - def encode(str); end -end - -class Rack::Session::Cookie::Base64::ZipJSON < ::Rack::Session::Cookie::Base64 - def decode(str); end - def encode(obj); end -end - -class Rack::Session::Cookie::Identity - def decode(str); end - def encode(str); end -end - -class Rack::Session::Cookie::SessionId - def initialize(session_id, cookie_value); end - - def cookie_value; end -end - -class Rack::Session::Pool < ::Rack::Session::Abstract::PersistedSecure - def initialize(app, options = T.unsafe(nil)); end - - def delete_session(req, session_id, options); end - def find_session(req, sid); end - def generate_sid; end - def mutex; end - def pool; end - def with_lock(req); end - def write_session(req, session_id, new_session, options); end - - private - - def get_session_with_fallback(sid); end -end - -Rack::Session::Pool::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash) - -class Rack::Session::SessionId - def initialize(public_id); end - - def cookie_value; end - def empty?; end - def inspect; end - def private_id; end - def public_id; end - def to_s; end - - private - - def hash_sid(sid); end -end - -Rack::Session::SessionId::ID_VERSION = T.let(T.unsafe(nil), Integer) - class Rack::ShowExceptions def initialize(app); end @@ -1498,22 +1280,25 @@ module Rack::Utils def byte_ranges(env, size); end def clean_path_info(path_info); end def clock_time; end - def delete_cookie_header!(header, key, value = T.unsafe(nil)); end + def delete_cookie_header!(headers, key, value = T.unsafe(nil)); end + def delete_set_cookie_header(key, value = T.unsafe(nil)); end + def delete_set_cookie_header!(header, key, value = T.unsafe(nil)); end def escape(s); end def escape_html(string); end def escape_path(s); end + def forwarded_values(forwarded_header); end def get_byte_ranges(http_range, size); end def make_delete_cookie_header(header, key, value); end def parse_cookies(env); end - def parse_cookies_header(header); end + def parse_cookies_header(value); end def parse_nested_query(qs, d = T.unsafe(nil)); end def parse_query(qs, d = T.unsafe(nil), &unescaper); end def q_values(q_value_header); end - def rfc2109(time); end def rfc2822(time); end def secure_compare(a, b); end def select_best_encoding(available_encodings, accept_encoding); end - def set_cookie_header!(header, key, value); end + def set_cookie_header(key, value); end + def set_cookie_header!(headers, key, value); end def status_code(status); end def unescape(s, encoding = T.unsafe(nil)); end def unescape_path(s); end @@ -1530,10 +1315,13 @@ module Rack::Utils def clock_time; end def default_query_parser; end def default_query_parser=(_arg0); end - def delete_cookie_header!(header, key, value = T.unsafe(nil)); end + def delete_cookie_header!(headers, key, value = T.unsafe(nil)); end + def delete_set_cookie_header(key, value = T.unsafe(nil)); end + def delete_set_cookie_header!(header, key, value = T.unsafe(nil)); end def escape(s); end def escape_html(string); end def escape_path(s); end + def forwarded_values(forwarded_header); end def get_byte_ranges(http_range, size); end def key_space_limit; end def key_space_limit=(v); end @@ -1543,15 +1331,15 @@ module Rack::Utils def param_depth_limit; end def param_depth_limit=(v); end def parse_cookies(env); end - def parse_cookies_header(header); end + def parse_cookies_header(value); end def parse_nested_query(qs, d = T.unsafe(nil)); end def parse_query(qs, d = T.unsafe(nil), &unescaper); end def q_values(q_value_header); end - def rfc2109(time); end def rfc2822(time); end def secure_compare(a, b); end def select_best_encoding(available_encodings, accept_encoding); end - def set_cookie_header!(header, key, value); end + def set_cookie_header(key, value); end + def set_cookie_header!(headers, key, value); end def status_code(status); end def unescape(s, encoding = T.unsafe(nil)); end def unescape_path(s); end @@ -1577,32 +1365,10 @@ Rack::Utils::ESCAPE_HTML_PATTERN = T.let(T.unsafe(nil), Regexp) Rack::Utils::HTTP_STATUS_CODES = T.let(T.unsafe(nil), Hash) class Rack::Utils::HeaderHash < ::Hash - def initialize(hash = T.unsafe(nil)); end - - def [](k); end - def []=(k, v); end - def clear; end - def delete(k); end - def each; end - def has_key?(k); end - def include?(k); end - def key?(k); end - def member?(k); end - def merge(other); end - def merge!(other); end - def replace(other); end - def to_hash; end - - protected - - def names; end - - private - - def initialize_copy(other); end - class << self def [](headers); end + def allocate; end + def new(hash = T.unsafe(nil)); end end end @@ -1611,14 +1377,8 @@ Rack::Utils::KeySpaceConstrainedParams = Rack::QueryParser::Params Rack::Utils::NULL_BYTE = T.let(T.unsafe(nil), String) Rack::Utils::PATH_SEPS = T.let(T.unsafe(nil), Regexp) Rack::Utils::ParameterTypeError = Rack::QueryParser::ParameterTypeError -Rack::Utils::RFC2822_DAY_NAME = T.let(T.unsafe(nil), Array) -Rack::Utils::RFC2822_MONTH_NAME = T.let(T.unsafe(nil), Array) +Rack::Utils::ParamsTooDeepError = Rack::QueryParser::ParamsTooDeepError Rack::Utils::STATUS_WITH_NO_ENTITY_BODY = T.let(T.unsafe(nil), Hash) Rack::Utils::SYMBOL_TO_STATUS_CODE = T.let(T.unsafe(nil), Hash) Rack::VERSION = T.let(T.unsafe(nil), Array) - -class WEBrick::HTTPResponse - def rack; end - def rack=(_arg0); end - def setup_header; end -end +Rack::VERSION_STRING = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rspec-expectations@3.11.1.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rspec-expectations@3.11.1.rbi index 4d3323534f..6501bff9a9 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rspec-expectations@3.11.1.rbi @@ -875,6 +875,7 @@ class RSpec::Matchers::BuiltIn::ContainExactly < ::RSpec::Matchers::BuiltIn::Bas def description; end def failure_message; end def failure_message_when_negated; end + def matches?(actual); end private diff --git a/Library/Homebrew/sorbet/rbi/gems/rspec-sorbet@1.8.3.rbi b/Library/Homebrew/sorbet/rbi/gems/rspec-sorbet@1.9.0.rbi similarity index 94% rename from Library/Homebrew/sorbet/rbi/gems/rspec-sorbet@1.8.3.rbi rename to Library/Homebrew/sorbet/rbi/gems/rspec-sorbet@1.9.0.rbi index e0a60bf71f..43ad10d5c8 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rspec-sorbet@1.8.3.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rspec-sorbet@1.9.0.rbi @@ -47,8 +47,9 @@ module RSpec::Sorbet::Doubles private - def call_validation_error_handler(_signature, opts); end + def call_validation_error_handler(signature, opts); end def double_message_with_ellipsis?(message); end + def handle_call_validation_error(signature, opts); end def inline_type_error_handler(error); end def typed_array_message?(message); end def unable_to_check_type_for_message?(message); end diff --git a/Library/Homebrew/sorbet/rbi/gems/rspec-support@3.11.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rspec-support@3.11.1.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/rspec-support@3.11.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rspec-support@3.11.1.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.19.1.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.19.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi index bc0c467c00..c5ac2977f2 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.19.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi @@ -1679,6 +1679,7 @@ class RuboCop::AST::RegexpNode < ::RuboCop::AST::Node def delimiter?(char); end def delimiters; end def extended?; end + def fixed_encoding?; end def ignore_case?; end def interpolation?; end def multiline_mode?; end @@ -1771,6 +1772,7 @@ class RuboCop::AST::Token def column; end def comma?; end def comment?; end + def dot?; end def end?; end def end_pos; end def equal_sign?; end diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.15.0.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.15.0.rbi index 377295ca1c..488fd4ddad 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.15.0.rbi @@ -6,6 +6,7 @@ module RuboCop; end module RuboCop::Cop; end +RuboCop::Cop::IgnoredMethods = RuboCop::Cop::AllowedMethods RuboCop::Cop::IgnoredPattern = RuboCop::Cop::AllowedPattern module RuboCop::Cop::Performance; end @@ -494,6 +495,7 @@ class RuboCop::Cop::Performance::RedundantMatch < ::RuboCop::Cop::Base private def autocorrect(corrector, node); end + def autocorrectable?(node); end end RuboCop::Cop::Performance::RedundantMatch::MSG = T.let(T.unsafe(nil), String) @@ -552,10 +554,11 @@ class RuboCop::Cop::Performance::RedundantSortBlock < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end private - def message(var_a, var_b); end + def register_offense(send, node); end end RuboCop::Cop::Performance::RedundantSortBlock::MSG = T.let(T.unsafe(nil), String) @@ -704,10 +707,11 @@ class RuboCop::Cop::Performance::SortReverse < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end private - def message(var_a, var_b); end + def register_offense(send, node); end end RuboCop::Cop::Performance::SortReverse::MSG = T.let(T.unsafe(nil), String) @@ -834,6 +838,7 @@ class RuboCop::Cop::Performance::TimesMap < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end def on_send(node); end def times_map_call(param0 = T.unsafe(nil)); end @@ -892,6 +897,7 @@ module RuboCop::Cop::SortBlock def replaceable_body?(param0 = T.unsafe(nil), param1, param2); end def sort_with_block?(param0 = T.unsafe(nil)); end + def sort_with_numblock?(param0 = T.unsafe(nil)); end private diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.15.2.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.16.0.rbi similarity index 93% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.15.2.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.16.0.rbi index fe2e98a76f..3a793a7d83 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.15.2.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.16.0.rbi @@ -53,6 +53,7 @@ module RuboCop::Cop::EnforceSuperclass end end +RuboCop::Cop::IgnoredMethods = RuboCop::Cop::AllowedMethods RuboCop::Cop::IgnoredPattern = RuboCop::Cop::AllowedPattern module RuboCop::Cop::IndexMethod @@ -125,6 +126,25 @@ end module RuboCop::Cop::Rails; end +class RuboCop::Cop::Rails::ActionControllerFlashBeforeRender < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def action_controller?(param0); end + def flash_assignment?(param0); end + def on_send(flash_node); end + def render?(param0); end + + private + + def find_ancestor(node, type:); end + def followed_by_render?(flash_node); end + def inherit_action_controller_base?(node); end + def instance_method_or_block?(node); end +end + +RuboCop::Cop::Rails::ActionControllerFlashBeforeRender::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::ActionControllerFlashBeforeRender::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::ActionControllerTestCase < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector extend ::RuboCop::Cop::TargetRailsVersion @@ -217,6 +237,16 @@ RuboCop::Cop::Rails::ActiveSupportAliases::ALIASES = T.let(T.unsafe(nil), Hash) RuboCop::Cop::Rails::ActiveSupportAliases::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::ActiveSupportAliases::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::ActiveSupportOnLoad < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_send(node); end +end + +RuboCop::Cop::Rails::ActiveSupportOnLoad::LOAD_HOOKS = T.let(T.unsafe(nil), Hash) +RuboCop::Cop::Rails::ActiveSupportOnLoad::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::ActiveSupportOnLoad::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::AddColumnIndex < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector @@ -545,7 +575,7 @@ class RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods < ::RuboCop::Cop:: extend ::RuboCop::Cop::AutoCorrector def any_manipulation?(param0 = T.unsafe(nil)); end - def errors_keys?(param0 = T.unsafe(nil)); end + def errors_deprecated?(param0 = T.unsafe(nil)); end def messages_details_assignment?(param0 = T.unsafe(nil)); end def messages_details_manipulation?(param0 = T.unsafe(nil)); end def on_send(node); end @@ -561,9 +591,11 @@ class RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods < ::RuboCop::Cop:: def offense_range(node, receiver); end def receiver_matcher(node); end def replacement(node, receiver); end + def skip_autocorrect?(node); end end -RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::AUTOCORECTABLE_METHODS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::AUTOCORRECTABLE_METHODS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::INCOMPATIBLE_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::MANIPULATIVE_METHODS = T.let(T.unsafe(nil), Set) RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::MSG = T.let(T.unsafe(nil), String) @@ -837,6 +869,8 @@ RuboCop::Cop::Rails::FindById::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Rails::FindEach < ::RuboCop::Cop::Base include ::RuboCop::Cop::ActiveRecordHelper + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector def on_send(node); end @@ -852,6 +886,24 @@ RuboCop::Cop::Rails::FindEach::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::FindEach::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) RuboCop::Cop::Rails::FindEach::SCOPE_METHODS = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::FreezeTime < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_send(node); end + def time_now?(param0 = T.unsafe(nil)); end + def zoned_time_now?(param0 = T.unsafe(nil)); end + + private + + def current_time?(node, method_name); end + def current_time_with_convert?(node, method_name); end +end + +RuboCop::Cop::Rails::FreezeTime::CONV_METHODS = T.let(T.unsafe(nil), Array) +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::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::HasAndBelongsToMany < ::RuboCop::Cop::Base def on_send(node); end end @@ -1486,12 +1538,13 @@ class RuboCop::Cop::Rails::RedundantReceiverInWithOptions < ::RuboCop::Cop::Base def all_block_nodes_in(param0); end def all_send_nodes_in(param0); end def on_block(node); end - def with_options?(param0 = T.unsafe(nil)); end + def on_numblock(node); end private - def autocorrect(corrector, node); end + def autocorrect(corrector, send_node, node); end def block_argument_range(node); end + def redundant_receiver?(send_nodes, node); end def same_value?(arg_node, recv_node); end def search_begin_pos_of_space_before_block_argument(begin_pos); end end @@ -1517,6 +1570,7 @@ class RuboCop::Cop::Rails::ReflectionClassName < ::RuboCop::Cop::Base private def reflection_class_value?(class_value); end + def str_assigned?(reflection_class_name); end end RuboCop::Cop::Rails::ReflectionClassName::ALLOWED_REFLECTION_CLASS_TYPES = T.let(T.unsafe(nil), Array) @@ -1621,6 +1675,7 @@ class RuboCop::Cop::Rails::ReversibleMigration < ::RuboCop::Cop::Base def drop_table_call(param0 = T.unsafe(nil)); end def irreversible_schema_statement_call(param0 = T.unsafe(nil)); end def on_block(node); end + def on_numblock(node); end def on_send(node); end def remove_column_call(param0 = T.unsafe(nil)); end def remove_columns_call(param0 = T.unsafe(nil)); end @@ -1672,6 +1727,26 @@ end RuboCop::Cop::Rails::RootJoinChain::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::RootJoinChain::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) +class RuboCop::Cop::Rails::RootPathnameMethods < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_send(node); end + def pathname_method(param0 = T.unsafe(nil)); end + def rails_root?(param0 = T.unsafe(nil)); end + def rails_root_pathname?(param0 = T.unsafe(nil)); end + + private + + def evidence(node); end +end + +RuboCop::Cop::Rails::RootPathnameMethods::DIR_METHODS = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Rails::RootPathnameMethods::FILE_METHODS = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Rails::RootPathnameMethods::FILE_TEST_METHODS = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Rails::RootPathnameMethods::FILE_UTILS_METHODS = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Rails::RootPathnameMethods::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::RootPathnameMethods::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) + class RuboCop::Cop::Rails::RootPublicPath < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector @@ -1925,6 +2000,31 @@ end RuboCop::Cop::Rails::ToFormattedS::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::ToFormattedS::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::ToSWithArgument < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRailsVersion + + def on_csend(node); end + def on_send(node); end +end + +RuboCop::Cop::Rails::ToSWithArgument::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::ToSWithArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + +class RuboCop::Cop::Rails::TopLevelHashWithIndifferentAccess < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRailsVersion + + def on_const(node); end + def top_level_hash_with_indifferent_access?(param0 = T.unsafe(nil)); end + + private + + def autocorrect(corrector, node); end +end + +RuboCop::Cop::Rails::TopLevelHashWithIndifferentAccess::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Rails::TransactionExitStatement < ::RuboCop::Cop::Base def exit_statements(param0); end def on_send(node); end @@ -2084,6 +2184,31 @@ end RuboCop::Cop::Rails::WhereExists::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::WhereExists::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::WhereMissing < ::RuboCop::Cop::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRailsVersion + + def missing_relationship(param0); end + def on_send(node); end + def where_node_and_argument(param0); end + + private + + def message(node, where_argument); end + def multi_condition?(where_arg); end + def register_offense(node, where_node, where_argument, range); end + def remove_where_method(corrector, node, where_node); end + def replace_range(child); end + def replace_where_method(corrector, where_node); end + def root_receiver(node); end + def same_line?(left_joins_node, where_node); end + def same_relationship?(where, left_joins); end +end + +RuboCop::Cop::Rails::WhereMissing::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::WhereMissing::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::WhereNot < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@2.12.1.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@2.13.1.rbi similarity index 92% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@2.12.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@2.13.1.rbi index 40930f07a2..1f301591ab 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@2.12.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@2.13.1.rbi @@ -6,6 +6,7 @@ module RuboCop; end module RuboCop::Cop; end +RuboCop::Cop::IgnoredMethods = RuboCop::Cop::AllowedMethods RuboCop::Cop::IgnoredPattern = RuboCop::Cop::AllowedPattern module RuboCop::Cop::RSpec; end @@ -50,12 +51,15 @@ RuboCop::Cop::RSpec::AnyInstance::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::RSpec::AroundBlock < ::RuboCop::Cop::RSpec::Base def find_arg_usage(param0); end - def hook(param0 = T.unsafe(nil)); end + def hook_block(param0 = T.unsafe(nil)); end + def hook_numblock(param0 = T.unsafe(nil)); end def on_block(node); end + def on_numblock(node); end private def add_no_arg_offense(node); end + def check_for_numblock(block); end def check_for_unused_proxy(block, proxy); end end @@ -168,21 +172,50 @@ end RuboCop::Cop::RSpec::Capybara::FeatureMethods::MAP = T.let(T.unsafe(nil), Hash) RuboCop::Cop::RSpec::Capybara::FeatureMethods::MSG = T.let(T.unsafe(nil), String) -class RuboCop::Cop::RSpec::Capybara::SpecificMatcher < ::RuboCop::Cop::RSpec::Base - def first_argument(param0 = T.unsafe(nil)); end +class RuboCop::Cop::RSpec::Capybara::SpecificFinders < ::RuboCop::Cop::RSpec::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + + def find_argument(param0 = T.unsafe(nil)); end def on_send(node); end private - def acceptable_pattern?(arg); end + def attribute?(arg); end + def offense_range(node); end + def on_attr(node, arg); end + def on_id(node, arg); end + def register_offense(node, arg_replacement); end + def replaced_arguments(arg, id); end + def to_options(attrs); end +end + +RuboCop::Cop::RSpec::Capybara::SpecificFinders::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::RSpec::Capybara::SpecificFinders::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + +class RuboCop::Cop::RSpec::Capybara::SpecificMatcher < ::RuboCop::Cop::RSpec::Base + def first_argument(param0 = T.unsafe(nil)); end + def on_send(node); end + def option?(param0, param1); end + + private + def good_matcher(node, matcher); end def message(node, matcher); end + def replaceable_matcher?(node, matcher, attrs); end + def replaceable_pseudo_class?(pseudo_class, arg); end + def replaceable_pseudo_class_not?(arg); end + def replaceable_to_have_link?(node, attrs); end def specific_matcher(arg); end + def specific_matcher_option?(node, arg, matcher); end + def specific_matcher_pseudo_classes?(arg); end end RuboCop::Cop::RSpec::Capybara::SpecificMatcher::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::RSpec::Capybara::SpecificMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) RuboCop::Cop::RSpec::Capybara::SpecificMatcher::SPECIFIC_MATCHER = T.let(T.unsafe(nil), Hash) +RuboCop::Cop::RSpec::Capybara::SpecificMatcher::SPECIFIC_MATCHER_OPTIONS = T.let(T.unsafe(nil), Hash) +RuboCop::Cop::RSpec::Capybara::SpecificMatcher::SPECIFIC_MATCHER_PSEUDO_CLASSES = T.let(T.unsafe(nil), Array) class RuboCop::Cop::RSpec::Capybara::VisibilityMatcher < ::RuboCop::Cop::RSpec::Base def on_send(node); end @@ -202,6 +235,7 @@ RuboCop::Cop::RSpec::Capybara::VisibilityMatcher::RESTRICT_ON_SEND = T.let(T.uns class RuboCop::Cop::RSpec::ChangeByZero < ::RuboCop::Cop::RSpec::Base extend ::RuboCop::Cop::AutoCorrector + def change_nodes(param0); end def expect_change_with_arguments(param0 = T.unsafe(nil)); end def expect_change_with_block(param0 = T.unsafe(nil)); end def on_send(node); end @@ -209,14 +243,40 @@ class RuboCop::Cop::RSpec::ChangeByZero < ::RuboCop::Cop::RSpec::Base private def autocorrect(corrector, node); end + def autocorrect_compound(corrector, node); end def check_offense(node); end def compound_expectations?(node); end + def message_compound; end + def negated_matcher; end + def preferred_method; end end RuboCop::Cop::RSpec::ChangeByZero::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::RSpec::ChangeByZero::MSG_COMPOUND = T.let(T.unsafe(nil), String) RuboCop::Cop::RSpec::ChangeByZero::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::RSpec::ClassCheck < ::RuboCop::Cop::RSpec::Base + include ::RuboCop::Cop::ConfigurableEnforcedStyle + extend ::RuboCop::Cop::AutoCorrector + + def on_send(node); end + + private + + def autocorrect(corrector, node); end + def format_message(node); end + def offending?(node); end + def preferred_method_name; end + def preferred_method_name?(method_name); end + def preferred_method_names; end +end + +RuboCop::Cop::RSpec::ClassCheck::METHOD_NAMES_FOR_BE_A = T.let(T.unsafe(nil), Set) +RuboCop::Cop::RSpec::ClassCheck::METHOD_NAMES_FOR_KIND_OF = T.let(T.unsafe(nil), Set) +RuboCop::Cop::RSpec::ClassCheck::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::RSpec::ClassCheck::PREFERRED_METHOD_NAME_BY_STYLE = T.let(T.unsafe(nil), Hash) +RuboCop::Cop::RSpec::ClassCheck::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + module RuboCop::Cop::RSpec::CommentsHelp include ::RuboCop::Cop::RSpec::FinalEndLocation @@ -241,19 +301,46 @@ end RuboCop::Cop::RSpec::ContextMethod::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::ContextWording < ::RuboCop::Cop::RSpec::Base + include ::RuboCop::Cop::AllowedPattern + def context_wording(param0 = T.unsafe(nil)); end def on_block(node); end private - def bad_prefix?(description); end - def joined_prefixes; end - def prefix_regex; end + def allowed_patterns; end + def bad_pattern?(description); end + def expect_patterns; end + def prefix_regexes; end def prefixes; end end RuboCop::Cop::RSpec::ContextWording::MSG = T.let(T.unsafe(nil), String) +module RuboCop::Cop::RSpec::CssSelector + private + + def attribute?(selector); end + def attributes(selector); end + def common_attributes?(selector); end + def id?(selector); end + def multiple_selectors?(selector); end + def normalize_value(value); end + def pseudo_classes(selector); end + + class << self + def attribute?(selector); end + def attributes(selector); end + def common_attributes?(selector); end + def id?(selector); end + def multiple_selectors?(selector); end + def normalize_value(value); end + def pseudo_classes(selector); end + end +end + +RuboCop::Cop::RSpec::CssSelector::COMMON_OPTIONS = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::RSpec::DescribeClass < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::RSpec::TopLevelGroup @@ -290,6 +377,7 @@ RuboCop::Cop::RSpec::DescribeSymbol::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Arr class RuboCop::Cop::RSpec::DescribedClass < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle + include ::RuboCop::Cop::RSpec::Namespace extend ::RuboCop::Cop::AutoCorrector def common_instance_exec_closure?(param0 = T.unsafe(nil)); end @@ -307,7 +395,6 @@ class RuboCop::Cop::RSpec::DescribedClass < ::RuboCop::Cop::RSpec::Base def find_usage(node, &block); end def full_const_name(node); end def message(offense); end - def namespace(node); end def offensive?(node); end def offensive_described_class?(node); end def scope_change?(node); end @@ -335,6 +422,9 @@ end RuboCop::Cop::RSpec::Dialect::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::EmptyExampleGroup < ::RuboCop::Cop::RSpec::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + def example_group_body(param0 = T.unsafe(nil)); end def example_or_group_or_include?(param0 = T.unsafe(nil)); end def examples?(param0 = T.unsafe(nil)); end @@ -347,6 +437,7 @@ class RuboCop::Cop::RSpec::EmptyExampleGroup < ::RuboCop::Cop::RSpec::Base def conditionals_with_examples?(body); end def examples_in_branches?(condition_node); end def offensive?(body); end + def removed_range(node); end end RuboCop::Cop::RSpec::EmptyExampleGroup::MSG = T.let(T.unsafe(nil), String) @@ -371,7 +462,6 @@ class RuboCop::Cop::RSpec::EmptyLineAfterExample < ::RuboCop::Cop::RSpec::Base def allowed_one_liner?(node); end def consecutive_one_liner?(node); end def next_one_line_example?(node); end - def next_sibling(node); end def on_block(node); end end @@ -400,12 +490,18 @@ end RuboCop::Cop::RSpec::EmptyLineAfterFinalLet::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::EmptyLineAfterHook < ::RuboCop::Cop::RSpec::Base + include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::RSpec::FinalEndLocation include ::RuboCop::Cop::RangeHelp include ::RuboCop::Cop::RSpec::EmptyLineSeparation extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end + + private + + def chained_single_line_hooks?(node); end end RuboCop::Cop::RSpec::EmptyLineAfterHook::MSG = T.let(T.unsafe(nil), String) @@ -533,6 +629,7 @@ RuboCop::Cop::RSpec::ExpectChange::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array class RuboCop::Cop::RSpec::ExpectInHook < ::RuboCop::Cop::RSpec::Base def expectation(param0); end def on_block(node); end + def on_numblock(node); end private @@ -604,10 +701,10 @@ class RuboCop::Cop::RSpec::FactoryBot::CreateList < ::RuboCop::Cop::RSpec::Base extend ::RuboCop::Cop::AutoCorrector def arguments_include_method_call?(param0 = T.unsafe(nil)); end + def array_new_or_n_times_block?(param0 = T.unsafe(nil)); end + def block_with_arg_and_used?(param0 = T.unsafe(nil)); end def factory_call(param0 = T.unsafe(nil)); end def factory_list_call(param0 = T.unsafe(nil)); end - def n_times_block?(param0 = T.unsafe(nil)); end - def n_times_block_with_arg_and_used?(param0 = T.unsafe(nil)); end def on_block(node); end def on_send(node); end @@ -636,6 +733,7 @@ class RuboCop::Cop::RSpec::FactoryBot::CreateList::CreateListCorrector def build_arguments(node, count); end def call_replacement(node); end def call_with_block_replacement(node); end + def count_from(node); end def format_block(node); end def format_multiline_block(node); end def format_singleline_block(node); end @@ -693,6 +791,7 @@ RuboCop::Cop::RSpec::FactoryBot::SyntaxMethods::RESTRICT_ON_SEND = T.let(T.unsaf class RuboCop::Cop::RSpec::FilePath < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::RSpec::TopLevelGroup + include ::RuboCop::Cop::RSpec::Namespace def example_group(param0 = T.unsafe(nil)); end def on_top_level_example_group(node); end @@ -708,7 +807,7 @@ class RuboCop::Cop::RSpec::FilePath < ::RuboCop::Cop::RSpec::Base def ignore_methods?; end def name_pattern(method_name); end def pattern_for(example_group, method_name); end - def pattern_for_spec_suffix_only?; end + def pattern_for_spec_suffix_only; end def relevant_rubocop_rspec_file?(_file); end def routing_spec?(args); end def spec_suffix_only?; end @@ -743,6 +842,7 @@ class RuboCop::Cop::RSpec::HookArgument < ::RuboCop::Cop::RSpec::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end def scoped_hook(param0 = T.unsafe(nil)); end def unscoped_hook(param0 = T.unsafe(nil)); end @@ -763,6 +863,7 @@ class RuboCop::Cop::RSpec::HooksBeforeExamples < ::RuboCop::Cop::RSpec::Base def example_or_group?(param0 = T.unsafe(nil)); end def on_block(node); end + def on_numblock(node); end private @@ -911,8 +1012,10 @@ RuboCop::Cop::RSpec::ItBehavesLike::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Arra class RuboCop::Cop::RSpec::IteratedExpectation < ::RuboCop::Cop::RSpec::Base def each?(param0 = T.unsafe(nil)); end + def each_numblock?(param0 = T.unsafe(nil)); end def expectation?(param0 = T.unsafe(nil), param1); end def on_block(node); end + def on_numblock(node); end private @@ -1104,6 +1207,12 @@ end RuboCop::Cop::RSpec::NamedSubject::MSG = T.let(T.unsafe(nil), String) +module RuboCop::Cop::RSpec::Namespace + private + + def namespace(node); end +end + class RuboCop::Cop::RSpec::NestedGroups < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::ConfigurableMax include ::RuboCop::Cop::RSpec::TopLevelGroup @@ -1112,6 +1221,8 @@ class RuboCop::Cop::RSpec::NestedGroups < ::RuboCop::Cop::RSpec::Base private + def allowed_groups; end + def count_up_nesting?(node, example_group); end def find_nested_example_groups(node, nesting: T.unsafe(nil), &block); end def max_nesting; end def max_nesting_config; end @@ -1122,6 +1233,15 @@ RuboCop::Cop::RSpec::NestedGroups::DEPRECATED_MAX_KEY = T.let(T.unsafe(nil), Str RuboCop::Cop::RSpec::NestedGroups::DEPRECATION_WARNING = T.let(T.unsafe(nil), String) RuboCop::Cop::RSpec::NestedGroups::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::RSpec::NoExpectationExample < ::RuboCop::Cop::RSpec::Base + def including_any_expectation?(param0); end + def on_block(node); end + def on_numblock(node); end + def regular_or_focused_example?(param0 = T.unsafe(nil)); end +end + +RuboCop::Cop::RSpec::NoExpectationExample::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::RSpec::NotToNot < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle extend ::RuboCop::Cop::AutoCorrector @@ -1411,7 +1531,6 @@ class RuboCop::Cop::RSpec::ScatteredLet < ::RuboCop::Cop::RSpec::Base private def check_let_declarations(body); end - def find_first_let(node); end end RuboCop::Cop::RSpec::ScatteredLet::MSG = T.let(T.unsafe(nil), String) @@ -1688,6 +1807,8 @@ class RuboCop::RSpec::AlignLetBrace def token; end end +RuboCop::RSpec::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname) + class RuboCop::RSpec::Concept include ::RuboCop::RSpec::Language extend ::RuboCop::AST::NodePattern::Macros @@ -1872,6 +1993,7 @@ end module RuboCop::RSpec::Language::NodePattern def block_pattern(string); end + def numblock_pattern(string); end def send_pattern(string); end end @@ -1899,6 +2021,7 @@ module RuboCop::RSpec::Node def recursive_literal_or_const?; end end +RuboCop::RSpec::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname) module RuboCop::RSpec::Version; end RuboCop::RSpec::Version::STRING = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.32.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.35.1.rbi similarity index 97% rename from Library/Homebrew/sorbet/rbi/gems/rubocop@1.32.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop@1.35.1.rbi index fb54326192..cc9bf4b727 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.32.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.35.1.rbi @@ -134,11 +134,19 @@ class RuboCop::CLI::Command::SuggestExtensions < ::RuboCop::CLI::Command::Base private + def all_extensions; end def current_formatter; end def dependent_gems; end def extensions; end + def installed_and_not_loaded_extensions; end + def installed_extensions; end def installed_gems; end + def loaded_extensions; end def lockfile; end + def not_installed_extensions; end + def print_install_suggestions; end + def print_load_suggestions; end + def print_opt_out_instruction; end def puts(*args); end def skip?; end end @@ -166,6 +174,12 @@ RuboCop::CLI::STATUS_INTERRUPTED = T.let(T.unsafe(nil), Integer) RuboCop::CLI::STATUS_OFFENSES = T.let(T.unsafe(nil), Integer) RuboCop::CLI::STATUS_SUCCESS = T.let(T.unsafe(nil), Integer) +class RuboCop::CacheConfig + class << self + def root_dir; end + end +end + class RuboCop::CachedData def initialize(filename); end @@ -300,6 +314,29 @@ end RuboCop::Config::DEFAULT_RAILS_VERSION = T.let(T.unsafe(nil), Float) +class RuboCop::ConfigFinder + extend ::RuboCop::FileFinder + + class << self + def find_config_path(target_dir); end + def project_root; end + def project_root=(_arg0); end + + private + + def expand_path(path); end + def find_project_dotfile(target_dir); end + def find_project_root; end + def find_user_dotfile; end + def find_user_xdg_config; end + end +end + +RuboCop::ConfigFinder::DEFAULT_FILE = T.let(T.unsafe(nil), String) +RuboCop::ConfigFinder::DOTFILE = T.let(T.unsafe(nil), String) +RuboCop::ConfigFinder::RUBOCOP_HOME = T.let(T.unsafe(nil), String) +RuboCop::ConfigFinder::XDG_CONFIG = T.let(T.unsafe(nil), String) + class RuboCop::ConfigLoader extend ::RuboCop::FileFinder @@ -331,19 +368,13 @@ class RuboCop::ConfigLoader def merge_with_default(config, config_file, unset_nil: T.unsafe(nil)); end def possible_new_cops?(config); end def project_root; end - def project_root=(_arg0); end def warn_on_pending_cops(pending_cops); end def warn_pending_cop(cop); end private def check_duplication(yaml_code, absolute_path); end - def expand_path(path); end def file_path(file); end - def find_project_dotfile(target_dir); end - def find_project_root; end - def find_user_dotfile; end - def find_user_xdg_config; end def read_file(absolute_path); end def resolver; end def yaml_safe_load(yaml_code, filename); end @@ -354,7 +385,6 @@ end RuboCop::ConfigLoader::DEFAULT_FILE = T.let(T.unsafe(nil), String) RuboCop::ConfigLoader::DOTFILE = T.let(T.unsafe(nil), String) RuboCop::ConfigLoader::RUBOCOP_HOME = T.let(T.unsafe(nil), String) -RuboCop::ConfigLoader::XDG_CONFIG = T.let(T.unsafe(nil), String) class RuboCop::ConfigLoaderResolver def fix_include_paths(base_config_path, hash, path, key, value); end @@ -467,6 +497,7 @@ class RuboCop::ConfigObsoletion::ParameterRule < ::RuboCop::ConfigObsoletion::Ru private def alternative; end + def alternatives; end def reason; end def severity; end end @@ -642,6 +673,8 @@ module RuboCop::Cop::AllowedMethods def allowed_method?(name); end def allowed_methods; end + def cop_config_deprecated_values; end + def ignored_method?(name); end end module RuboCop::Cop::AllowedPattern @@ -649,6 +682,7 @@ module RuboCop::Cop::AllowedPattern def allowed_line?(line); end def allowed_patterns; end + def cop_config_deprecated_methods_values; end def ignored_line?(line); end def matches_allowed_pattern?(line); end def matches_ignored_pattern?(line); end @@ -1029,6 +1063,7 @@ end RuboCop::Cop::CodeLength::MSG = T.let(T.unsafe(nil), String) module RuboCop::Cop::CommentsHelp + def comments_in_range(node); end def contains_comments?(node); end def source_range_with_comment(node); end @@ -1724,7 +1759,7 @@ class RuboCop::Cop::Generator::RequireFileInjector def require_entries; end def require_exists?; end def require_path; end - def require_path_fragments(require_directove); end + def require_path_fragments(require_directive); end def root_file_path; end def source_path; end def target_line; end @@ -1789,12 +1824,21 @@ module RuboCop::Cop::HashAlignmentStyles::ValueAlignment end module RuboCop::Cop::HashShorthandSyntax + def on_hash_for_mixed_shorthand(hash_node); end def on_pair(node); end private + def breakdown_value_types_of_hash(hash_node); end + def each_omittable_value_pair(hash_value_type_breakdown, &block); end + def each_omitted_value_pair(hash_value_type_breakdown, &block); end def enforced_shorthand_syntax; end + def hash_with_mixed_shorthand_syntax?(hash_value_type_breakdown); end + def hash_with_values_that_cant_be_omitted?(hash_value_type_breakdown); end def ignore_hash_shorthand_syntax?(pair_node); end + def ignore_mixed_hash_shorthand_syntax?(hash_node); end + def mixed_shorthand_syntax_check(hash_value_type_breakdown); end + def no_mixed_shorthand_syntax_check(hash_value_type_breakdown); end def register_offense(node, message, replacement); end def require_hash_value?(hash_key_source, node); end def require_hash_value_for_around_hash_literal?(node); end @@ -1803,6 +1847,9 @@ module RuboCop::Cop::HashShorthandSyntax def without_parentheses_call_expr_follows?(ancestor); end end +RuboCop::Cop::HashShorthandSyntax::DO_NOT_MIX_EXPLICIT_VALUE_MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::HashShorthandSyntax::DO_NOT_MIX_MSG_PREFIX = T.let(T.unsafe(nil), String) +RuboCop::Cop::HashShorthandSyntax::DO_NOT_MIX_OMIT_VALUE_MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::HashShorthandSyntax::EXPLICIT_HASH_VALUE_MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::HashShorthandSyntax::OMIT_HASH_VALUE_MSG = T.let(T.unsafe(nil), String) @@ -1903,27 +1950,7 @@ class RuboCop::Cop::IfThenCorrector end RuboCop::Cop::IfThenCorrector::DEFAULT_INDENTATION_WIDTH = T.let(T.unsafe(nil), Integer) - -module RuboCop::Cop::IgnoredMethods - mixes_in_class_methods ::RuboCop::Cop::IgnoredMethods::Config - - def ignored_method?(name); end - def ignored_methods; end - - private - - def deprecated_key; end - - class << self - def included(base); end - end -end - -module RuboCop::Cop::IgnoredMethods::Config - def deprecated_key; end - def deprecated_key=(_arg0); end - def ignored_methods(**config); end -end +RuboCop::Cop::IgnoredMethods = RuboCop::Cop::AllowedMethods module RuboCop::Cop::IgnoredNode def ignore_node(node); end @@ -2088,6 +2115,7 @@ class RuboCop::Cop::Layout::BlockAlignment < ::RuboCop::Cop::Base def block_end_align_target?(param0 = T.unsafe(nil), param1); end def on_block(node); end + def on_numblock(node); end def style_parameter_name; end private @@ -2116,11 +2144,15 @@ class RuboCop::Cop::Layout::BlockEndNewline < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end private - def delimiter_range(node); end + def end_of_method_chain(node); end + def last_heredoc_argument(node); end def message(node); end + def offense_range(node); end + def register_offense(node); end end RuboCop::Cop::Layout::BlockEndNewline::MSG = T.let(T.unsafe(nil), String) @@ -2494,6 +2526,7 @@ class RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier < ::RuboCop::Cop::Bas def on_block(node); end def on_class(node); end def on_module(node); end + def on_numblock(node); end def on_sclass(node); end def on_send(node); end @@ -2584,6 +2617,7 @@ class RuboCop::Cop::Layout::EmptyLinesAroundBlockBody < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end end RuboCop::Cop::Layout::EmptyLinesAroundBlockBody::KIND = T.let(T.unsafe(nil), String) @@ -2771,6 +2805,7 @@ class RuboCop::Cop::Layout::FirstArgumentIndentation < ::RuboCop::Cop::Base def base_range(send_node, arg_node); end def column_of(range); end def comment_lines; end + def enable_layout_first_method_argument_line_break?; end def enforce_first_argument_with_fixed_indentation?; end def message(arg_node); end def on_new_investigation; end @@ -3068,6 +3103,7 @@ class RuboCop::Cop::Layout::IndentationWidth < ::RuboCop::Cop::Base def on_if(node, base = T.unsafe(nil)); end def on_kwbegin(node); end def on_module(node); end + def on_numblock(node); end def on_resbody(node); end def on_rescue(node); end def on_sclass(node); end @@ -3222,6 +3258,7 @@ class RuboCop::Cop::Layout::LineLength < ::RuboCop::Cop::Base def on_hash(node); end def on_investigation_end; end def on_new_investigation; end + def on_numblock(node); end def on_potential_breakable_node(node); end def on_send(node); end @@ -3300,6 +3337,7 @@ class RuboCop::Cop::Layout::MultilineBlockLayout < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end private @@ -3779,6 +3817,7 @@ class RuboCop::Cop::Layout::SpaceBeforeBlockBraces < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end private @@ -4196,15 +4235,15 @@ RuboCop::Cop::Lint::AmbiguousAssignment::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Lint::AmbiguousAssignment::SIMPLE_ASSIGNMENT_TYPES = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Lint::AmbiguousBlockAssociation < ::RuboCop::Cop::Base - include ::RuboCop::Cop::IgnoredMethods - extend ::RuboCop::Cop::IgnoredMethods::Config + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern def on_csend(node); end def on_send(node); end private - def allowed_method?(node); end + def allowed_method_pattern?(node); end def ambiguous_block_association?(send_node); end def message(send_node); end end @@ -4386,15 +4425,14 @@ end RuboCop::Cop::Lint::ConstantResolution::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::Debugger < ::RuboCop::Cop::Base - def kernel?(param0 = T.unsafe(nil)); end def on_send(node); end - def valid_receiver?(param0 = T.unsafe(nil), param1); end private def debugger_method?(send_node); end def debugger_methods; end def message(node); end + def receiver_chain(send_node); end end RuboCop::Cop::Lint::Debugger::MSG = T.let(T.unsafe(nil), String) @@ -4410,7 +4448,7 @@ class RuboCop::Cop::Lint::DeprecatedClassMethods < ::RuboCop::Cop::Base def replacement(deprecated); end end -RuboCop::Cop::Lint::DeprecatedClassMethods::CLASS_METHOD_DELIMETER = T.let(T.unsafe(nil), String) +RuboCop::Cop::Lint::DeprecatedClassMethods::CLASS_METHOD_DELIMITER = T.let(T.unsafe(nil), String) RuboCop::Cop::Lint::DeprecatedClassMethods::DEPRECATED_METHODS_OBJECT = T.let(T.unsafe(nil), Hash) class RuboCop::Cop::Lint::DeprecatedClassMethods::DeprecatedClassMethod @@ -4429,7 +4467,7 @@ class RuboCop::Cop::Lint::DeprecatedClassMethods::DeprecatedClassMethod def delimiter; end end -RuboCop::Cop::Lint::DeprecatedClassMethods::INSTANCE_METHOD_DELIMETER = T.let(T.unsafe(nil), String) +RuboCop::Cop::Lint::DeprecatedClassMethods::INSTANCE_METHOD_DELIMITER = T.let(T.unsafe(nil), String) RuboCop::Cop::Lint::DeprecatedClassMethods::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Lint::DeprecatedClassMethods::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) @@ -4658,8 +4696,19 @@ RuboCop::Cop::Lint::EmptyClass::METACLASS_MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::EmptyConditionalBody < ::RuboCop::Cop::Base include ::RuboCop::Cop::CommentsHelp + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector def on_if(node); end + + private + + def autocorrect(corrector, node); end + def branch_range(node); end + def correct_other_branches(corrector, node); end + def deletion_range(range); end + def remove_comments(corrector, node); end + def remove_empty_branch(corrector, node); end end RuboCop::Cop::Lint::EmptyConditionalBody::MSG = T.let(T.unsafe(nil), String) @@ -5108,11 +5157,14 @@ RuboCop::Cop::Lint::NestedPercentLiteral::REGEXES = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Lint::NextWithoutAccumulator < ::RuboCop::Cop::Base def on_block(node); end - def on_body_of_reduce(param0 = T.unsafe(nil)); end + def on_block_body_of_reduce(param0 = T.unsafe(nil)); end + def on_numblock(node); end + def on_numblock_body_of_reduce(param0 = T.unsafe(nil)); end private def parent_block_node(node); end + def parent_numblock_node(node); end end RuboCop::Cop::Lint::NextWithoutAccumulator::MSG = T.let(T.unsafe(nil), String) @@ -5145,6 +5197,7 @@ class RuboCop::Cop::Lint::NonAtomicFileOperation < ::RuboCop::Cop::Base def force_method_name?(node); end def force_option?(node); end def if_node_child?(node); end + def message_change_force_method(node); end def message_remove_file_exist_check(node); end def register_offense(node, exist_node); end def replacement_method(node); end @@ -5165,6 +5218,7 @@ class RuboCop::Cop::Lint::NonDeterministicRequireOrder < ::RuboCop::Cop::Base def method_require?(param0 = T.unsafe(nil)); end def on_block(node); end def on_block_pass(node); end + def on_numblock(node); end def unsorted_dir_block?(param0 = T.unsafe(nil)); end def unsorted_dir_each?(param0 = T.unsafe(nil)); end def unsorted_dir_each_pass?(param0 = T.unsafe(nil)); end @@ -5196,9 +5250,9 @@ end RuboCop::Cop::Lint::NonLocalExitFromIterator::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::NumberConversion < ::RuboCop::Cop::Base - include ::RuboCop::Cop::IgnoredMethods + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::IgnoredMethods::Config def on_send(node); end def to_method(param0 = T.unsafe(nil)); end @@ -5206,12 +5260,13 @@ class RuboCop::Cop::Lint::NumberConversion < ::RuboCop::Cop::Base private + def allow_receiver?(receiver); end + def allowed_method_name?(name); end def conversion_method?(method_name); end def correct_method(node, receiver); end def correct_sym_method(to_method); end def handle_as_symbol(node); end def handle_conversion_method(node); end - def ignore_receiver?(receiver); end def ignored_class?(name); end def ignored_classes; end def remove_parentheses(corrector, node); end @@ -5515,6 +5570,7 @@ class RuboCop::Cop::Lint::RedundantWithIndex < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end def redundant_with_index?(param0 = T.unsafe(nil)); end private @@ -5531,6 +5587,7 @@ class RuboCop::Cop::Lint::RedundantWithObject < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end def redundant_with_object?(param0 = T.unsafe(nil)); end private @@ -5770,6 +5827,7 @@ RuboCop::Cop::Lint::ShadowedException::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::ShadowingOuterLocalVariable < ::RuboCop::Cop::Base def before_declaring_variable(variable, variable_table); end + def find_conditional_node_from_ascendant(node); end def ractor_block?(param0 = T.unsafe(nil)); end def same_conditions_node_different_branch?(variable, outer_local_variable); end @@ -5976,6 +6034,7 @@ class RuboCop::Cop::Lint::UnreachableLoop < ::RuboCop::Cop::Base def break_command?(param0 = T.unsafe(nil)); end def on_block(node); end def on_for(node); end + def on_numblock(node); end def on_until(node); end def on_until_post(node); end def on_while(node); end @@ -6082,6 +6141,7 @@ class RuboCop::Cop::Lint::UselessAccessModifier < ::RuboCop::Cop::Base def on_block(node); end def on_class(node); end def on_module(node); end + def on_numblock(node); end def on_sclass(node); end def static_method_definition?(param0 = T.unsafe(nil)); end @@ -6211,6 +6271,7 @@ class RuboCop::Cop::Lint::Void < ::RuboCop::Cop::Base def on_begin(node); end def on_block(node); end def on_kwbegin(node); end + def on_numblock(node); end private @@ -6273,28 +6334,23 @@ class RuboCop::Cop::MessageAnnotator end module RuboCop::Cop::MethodComplexity - include ::RuboCop::Cop::IgnoredMethods + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern include ::RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount - extend ::RuboCop::Cop::IgnoredMethods::Config extend ::RuboCop::AST::NodePattern::Macros extend ::RuboCop::ExcludeLimit - mixes_in_class_methods ::RuboCop::Cop::IgnoredMethods::Config - def define_method?(param0 = T.unsafe(nil)); end def max=(value); end def on_block(node); end def on_def(node); end def on_defs(node); end + def on_numblock(node); end private def check_complexity(node, method_name); end def complexity(body); end - - class << self - def included(base); end - end end module RuboCop::Cop::MethodPreference @@ -6308,10 +6364,10 @@ end module RuboCop::Cop::Metrics; end class RuboCop::Cop::Metrics::AbcSize < ::RuboCop::Cop::Base - include ::RuboCop::Cop::IgnoredMethods + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern include ::RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount include ::RuboCop::Cop::MethodComplexity - extend ::RuboCop::Cop::IgnoredMethods::Config private @@ -6322,8 +6378,8 @@ RuboCop::Cop::Metrics::AbcSize::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Metrics::BlockLength < ::RuboCop::Cop::Base include ::RuboCop::Cop::CodeLength - include ::RuboCop::Cop::IgnoredMethods - extend ::RuboCop::Cop::IgnoredMethods::Config + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern def on_block(node); end def on_numblock(node); end @@ -6362,11 +6418,11 @@ class RuboCop::Cop::Metrics::ClassLength < ::RuboCop::Cop::Base end class RuboCop::Cop::Metrics::CyclomaticComplexity < ::RuboCop::Cop::Base - include ::RuboCop::Cop::IgnoredMethods + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern include ::RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount include ::RuboCop::Cop::MethodComplexity include ::RuboCop::Cop::Metrics::Utils::IteratingBlock - extend ::RuboCop::Cop::IgnoredMethods::Config private @@ -6379,8 +6435,8 @@ RuboCop::Cop::Metrics::CyclomaticComplexity::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Metrics::MethodLength < ::RuboCop::Cop::Base include ::RuboCop::Cop::CodeLength - include ::RuboCop::Cop::IgnoredMethods - extend ::RuboCop::Cop::IgnoredMethods::Config + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern def on_block(node); end def on_def(node); end @@ -6758,7 +6814,7 @@ class RuboCop::Cop::Naming::ConstantName < ::RuboCop::Cop::Base def allowed_assignment?(value); end def allowed_conditional_expression_on_rhs?(node); end def allowed_method_call_on_rhs?(node); end - def contains_contant?(node); end + def contains_constant?(node); end end RuboCop::Cop::Naming::ConstantName::MSG = T.let(T.unsafe(nil), String) @@ -7142,12 +7198,20 @@ module RuboCop::Cop::Parentheses end class RuboCop::Cop::ParenthesesCorrector + extend ::RuboCop::Cop::RangeHelp + class << self def correct(corrector, node); end private + def add_heredoc_comma(corrector, node); end + def extend_range_for_heredoc(node, range); end + def handle_orphaned_comma(corrector, node); end + def heredoc?(node); end def next_char_is_question_mark?(node); end + def only_closing_paren_before_comma?(node); end + def parens_range(node); end def ternary_condition?(node); end end end @@ -7268,9 +7332,9 @@ module RuboCop::Cop::RangeHelp def move_pos(src, pos, step, condition, regexp); end def move_pos_str(src, pos, step, condition, needle); end def range_between(start_pos, end_pos); end - def range_by_whole_lines(range, include_final_newline: T.unsafe(nil)); end + def range_by_whole_lines(range, include_final_newline: T.unsafe(nil), buffer: T.unsafe(nil)); end def range_with_surrounding_comma(range, side = T.unsafe(nil)); end - def range_with_surrounding_space(range_positional = T.unsafe(nil), range: T.unsafe(nil), side: T.unsafe(nil), newlines: T.unsafe(nil), whitespace: T.unsafe(nil), continuations: T.unsafe(nil)); end + def range_with_surrounding_space(range_positional = T.unsafe(nil), range: T.unsafe(nil), side: T.unsafe(nil), newlines: T.unsafe(nil), whitespace: T.unsafe(nil), continuations: T.unsafe(nil), buffer: T.unsafe(nil)); end def source_range(source_buffer, line_number, column, length = T.unsafe(nil)); end end @@ -7849,9 +7913,9 @@ RuboCop::Cop::Style::BlockComments::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::BlockDelimiters < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle - include ::RuboCop::Cop::IgnoredMethods + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::IgnoredMethods::Config extend ::RuboCop::Cop::AutoCorrector def on_block(node); end @@ -8021,8 +8085,8 @@ RuboCop::Cop::Style::ClassCheck::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Style::ClassEqualityComparison < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp - include ::RuboCop::Cop::IgnoredMethods - extend ::RuboCop::Cop::IgnoredMethods::Config + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector def class_comparison_candidate?(param0 = T.unsafe(nil)); end @@ -8106,6 +8170,7 @@ class RuboCop::Cop::Style::CollectionMethods < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end def on_send(node); end private @@ -8142,6 +8207,7 @@ RuboCop::Cop::Style::ColonMethodDefinition::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::CombinableLoops < ::RuboCop::Cop::Base def on_block(node); end def on_for(node); end + def on_numblock(node); end private @@ -8512,13 +8578,16 @@ class RuboCop::Cop::Style::EachWithObject < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - def each_with_object_candidate?(param0 = T.unsafe(nil)); end + def each_with_object_block_candidate?(param0 = T.unsafe(nil)); end + def each_with_object_numblock_candidate?(param0 = T.unsafe(nil)); end def on_block(node); end + def on_numblock(node); end private def accumulator_param_assigned_to?(body, args); end - def autocorrect(corrector, node, return_value); end + def autocorrect_block(corrector, node, return_value); end + def autocorrect_numblock(corrector, node); end def first_argument_returned?(args, return_value); end def return_value(body); end def return_value_occupies_whole_line?(node); end @@ -8591,6 +8660,12 @@ class RuboCop::Cop::Style::EmptyHeredoc < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_heredoc(node); end + + private + + def enforce_double_quotes?; end + def preferred_string_literal; end + def string_literals_config; end end RuboCop::Cop::Style::EmptyHeredoc::MSG = T.let(T.unsafe(nil), String) @@ -8929,6 +9004,7 @@ class RuboCop::Cop::Style::For < ::RuboCop::Cop::Base def on_block(node); end def on_for(node); end + def on_numblock(node); end private @@ -8962,8 +9038,8 @@ RuboCop::Cop::Style::FormatString::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array class RuboCop::Cop::Style::FormatStringToken < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle - include ::RuboCop::Cop::IgnoredMethods - extend ::RuboCop::Cop::IgnoredMethods::Config + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector def format_string_in_typical_context?(param0 = T.unsafe(nil)); end @@ -8984,7 +9060,7 @@ class RuboCop::Cop::Style::FormatStringToken < ::RuboCop::Cop::Base def token_ranges(contents); end def tokens(str_node, &block); end def unannotated_format?(node, detected_style); end - def use_ignored_method?(node); end + def use_allowed_method?(node); end end class RuboCop::Cop::Style::FrozenStringLiteralComment < ::RuboCop::Cop::Base @@ -9119,6 +9195,7 @@ class RuboCop::Cop::Style::HashEachMethods < ::RuboCop::Cop::Base def kv_each(param0 = T.unsafe(nil)); end def on_block(node); end + def on_numblock(node); end private @@ -9441,6 +9518,7 @@ class RuboCop::Cop::Style::InverseMethods < ::RuboCop::Cop::Base def inverse_block?(param0 = T.unsafe(nil)); end def inverse_candidate?(param0 = T.unsafe(nil)); end def on_block(node); end + def on_numblock(node); end def on_send(node); end private @@ -9571,6 +9649,54 @@ RuboCop::Cop::Style::LineEndConcatenation::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::LineEndConcatenation::QUOTE_DELIMITERS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Style::LineEndConcatenation::SIMPLE_STRING_TOKEN_TYPE = T.let(T.unsafe(nil), Symbol) +class RuboCop::Cop::Style::MagicCommentFormat < ::RuboCop::Cop::Base + include ::RuboCop::Cop::ConfigurableEnforcedStyle + extend ::RuboCop::Cop::AutoCorrector + + def on_new_investigation; end + + private + + def correct_separator; end + def directive_capitalization; end + def directive_offends?(directive); end + def expected_style; end + def find_issues(comment); end + def fix_directives(issues); end + def fix_values(issues); end + def incorrect_separator?(text); end + def leading_comment_lines; end + def line_range(line); end + def magic_comments; end + def register_offenses(issues); end + def replace_capitalization(text, style); end + def replace_separator(text); end + def supported_capitalizations; end + def valid_capitalization?(style); end + def value_capitalization; end + def wrong_capitalization?(text, expected_case); end + def wrong_separator; end +end + +class RuboCop::Cop::Style::MagicCommentFormat::CommentRange + extend ::Forwardable + + def initialize(comment); end + + def comment; end + def directives; end + def loc(*args, &block); end + def text(*args, &block); end + def values; end +end + +RuboCop::Cop::Style::MagicCommentFormat::CommentRange::DIRECTIVE_REGEXP = T.let(T.unsafe(nil), Regexp) +RuboCop::Cop::Style::MagicCommentFormat::CommentRange::VALUE_REGEXP = T.let(T.unsafe(nil), Regexp) +RuboCop::Cop::Style::MagicCommentFormat::KEBAB_SEPARATOR = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::MagicCommentFormat::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::MagicCommentFormat::MSG_VALUE = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::MagicCommentFormat::SNAKE_SEPARATOR = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::MapCompactWithConditionalBlock < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector @@ -9606,11 +9732,10 @@ RuboCop::Cop::Style::MapToHash::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Style::MethodCallWithArgsParentheses < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle - include ::RuboCop::Cop::IgnoredMethods + include ::RuboCop::Cop::AllowedMethods include ::RuboCop::Cop::AllowedPattern include ::RuboCop::Cop::Style::MethodCallWithArgsParentheses::RequireParentheses include ::RuboCop::Cop::Style::MethodCallWithArgsParentheses::OmitParentheses - extend ::RuboCop::Cop::IgnoredMethods::Config extend ::RuboCop::Cop::AutoCorrector def on_csend(node); end @@ -9636,7 +9761,7 @@ module RuboCop::Cop::Style::MethodCallWithArgsParentheses::OmitParentheses def allowed_chained_call_with_parentheses?(node); end def allowed_multiline_call_with_parentheses?(node); end def allowed_string_interpolation_method_call?(node); end - def ambigious_literal?(node); end + def ambiguous_literal?(node); end def assigned_before?(node, target); end def autocorrect(corrector, node); end def call_as_argument_or_chain?(node); end @@ -9672,6 +9797,7 @@ RuboCop::Cop::Style::MethodCallWithArgsParentheses::OmitParentheses::TRAILING_WH module RuboCop::Cop::Style::MethodCallWithArgsParentheses::RequireParentheses private + def allowed_method_name?(name); end def eligible_for_parentheses_omission?(node); end def ignored_macro?(node); end def included_macros_list; end @@ -9681,14 +9807,15 @@ end RuboCop::Cop::Style::MethodCallWithArgsParentheses::RequireParentheses::REQUIRE_MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::MethodCallWithoutArgsParentheses < ::RuboCop::Cop::Base - include ::RuboCop::Cop::IgnoredMethods - extend ::RuboCop::Cop::IgnoredMethods::Config + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector def on_send(node); end private + def allowed_method_name?(name); end def any_assignment?(node); end def default_argument?(node); end def ineligible_node?(node); end @@ -9705,6 +9832,7 @@ class RuboCop::Cop::Style::MethodCalledOnDoEndBlock < ::RuboCop::Cop::Base def on_block(node); end def on_csend(node); end + def on_numblock(node); end def on_send(node); end end @@ -9842,6 +9970,7 @@ class RuboCop::Cop::Style::MultilineBlockChain < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp def on_block(node); end + def on_numblock(node); end end RuboCop::Cop::Style::MultilineBlockChain::MSG = T.let(T.unsafe(nil), String) @@ -10176,6 +10305,7 @@ class RuboCop::Cop::Style::Next < ::RuboCop::Cop::Base def on_block(node); end def on_for(node); end def on_new_investigation; end + def on_numblock(node); end def on_until(node); end def on_while(node); end @@ -10346,6 +10476,7 @@ RuboCop::Cop::Style::NumericLiteralPrefix::OCTAL_ZERO_ONLY_REGEX = T.let(T.unsaf class RuboCop::Cop::Style::NumericLiterals < ::RuboCop::Cop::Base include ::RuboCop::Cop::IntegerNode + include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector def min_digits=(value); end @@ -10355,6 +10486,7 @@ class RuboCop::Cop::Style::NumericLiterals < ::RuboCop::Cop::Base private def allowed_numbers; end + def allowed_patterns; end def check(node); end def format_int_part(int_part); end def format_number(node); end @@ -10368,8 +10500,8 @@ RuboCop::Cop::Style::NumericLiterals::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::NumericPredicate < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle - include ::RuboCop::Cop::IgnoredMethods - extend ::RuboCop::Cop::IgnoredMethods::Config + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector def comparison(param0 = T.unsafe(nil)); end @@ -10379,6 +10511,7 @@ class RuboCop::Cop::Style::NumericPredicate < ::RuboCop::Cop::Base private + def allowed_method_name?(name); end def check(node); end def invert; end def parenthesized_source(node); end @@ -10396,6 +10529,7 @@ class RuboCop::Cop::Style::ObjectThen < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end def on_send(node); end private @@ -10681,6 +10815,7 @@ class RuboCop::Cop::Style::Proc < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end + def on_numblock(node); end def proc_new?(param0 = T.unsafe(nil)); end end @@ -10797,6 +10932,7 @@ class RuboCop::Cop::Style::RedundantBegin < ::RuboCop::Cop::Base def on_def(node); end def on_defs(node); end def on_kwbegin(node); end + def on_numblock(node); end private @@ -10843,10 +10979,10 @@ class RuboCop::Cop::Style::RedundantCondition < ::RuboCop::Cop::Base def branches_have_assignment?(node); end def branches_have_method?(node); end def correct_ternary(corrector, node); end - def else_source(else_branch); end + def else_source(else_branch, arithmetic_operation); end def else_source_if_has_assignment(else_branch); end def else_source_if_has_method(else_branch); end - def if_source(if_branch); end + def if_source(if_branch, arithmetic_operation); end def make_ternary_form(node); end def message(node); end def offense?(node); end @@ -10856,6 +10992,7 @@ class RuboCop::Cop::Style::RedundantCondition < ::RuboCop::Cop::Base def require_parentheses?(node); end def same_method?(if_branch, else_branch); end def synonymous_condition_and_branch?(node); end + def use_arithmetic_operation?(node); end def use_hash_key_access?(node); end def use_hash_key_assignment?(else_branch); end def use_if_branch?(else_branch); end @@ -11019,10 +11156,10 @@ class RuboCop::Cop::Style::RedundantParentheses < ::RuboCop::Cop::Base private def allowed_ancestor?(node); end - def allowed_array_or_hash_element?(node); end def allowed_expression?(node); end def allowed_method_call?(node); end def allowed_multiple_expression?(node); end + def allowed_ternary?(node); end def call_chain_starts_with_int?(begin_node, send_node); end def check(begin_node); end def check_send(begin_node, node); end @@ -11031,7 +11168,6 @@ class RuboCop::Cop::Style::RedundantParentheses < ::RuboCop::Cop::Base def empty_parentheses?(node); end def first_arg_begins_with_hash_literal?(node); end def first_argument?(node); end - def hash_or_array_element?(node); end def ignore_syntax?(node); end def keyword_ancestor?(node); end def keyword_with_redundant_parentheses?(node); end @@ -11040,10 +11176,10 @@ class RuboCop::Cop::Style::RedundantParentheses < ::RuboCop::Cop::Base def method_chain_begins_with_hash_literal?(node); end def offense(node, msg); end def only_begin_arg?(args); end - def only_closing_paren_before_comma?(node); end def parens_allowed?(node); end def raised_to_power_negative_numeric?(begin_node, node); end def suspect_unary?(node); end + def ternary_parentheses_required?; end end class RuboCop::Cop::Style::RedundantPercentQ < ::RuboCop::Cop::Base @@ -11157,6 +11293,7 @@ class RuboCop::Cop::Style::RedundantSelf < ::RuboCop::Cop::Base def on_in_pattern(node); end def on_lvasgn(node); end def on_masgn(node); end + def on_numblock(node); end def on_op_asgn(node); end def on_or_asgn(node); end def on_send(node); end @@ -11232,13 +11369,16 @@ class RuboCop::Cop::Style::RedundantSort < ::RuboCop::Cop::Base def accessor_start(node); end def arg_node(node); end def arg_value(node); end + def autocorrect(corrector, node, sort_node, sorter, accessor); end def base(accessor, arg); end def find_redundant_sort(*nodes); end def message(node, sorter, accessor); end def offense_range(sort_node, node); end def register_offense(node, sort_node, sorter, accessor); end + def replace_with_logical_operator(corrector, node); end def suffix(sorter); end def suggestion(sorter, accessor, arg); end + def with_logical_operator?(node); end end RuboCop::Cop::Style::RedundantSort::MSG = T.let(T.unsafe(nil), String) @@ -11249,14 +11389,17 @@ class RuboCop::Cop::Style::RedundantSortBy < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_block(node); end - def redundant_sort_by(param0 = T.unsafe(nil)); end + def on_numblock(node); end + def redundant_sort_by_block(param0 = T.unsafe(nil)); end + def redundant_sort_by_numblock(param0 = T.unsafe(nil)); end private def sort_by_range(send, node); end end -RuboCop::Cop::Style::RedundantSortBy::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::RedundantSortBy::MSG_BLOCK = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::RedundantSortBy::MSG_NUMBLOCK = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::RegexpLiteral < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle @@ -11614,6 +11757,7 @@ class RuboCop::Cop::Style::SoleNestedConditional < ::RuboCop::Cop::Base def replace_condition(condition); end def require_parentheses?(condition); end def use_variable_assignment_in_condition?(condition, if_branch); end + def wrap_condition(corrector, condition); end def wrap_condition?(node); end class << self @@ -11895,8 +12039,8 @@ RuboCop::Cop::Style::SymbolLiteral::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::SymbolProc < ::RuboCop::Cop::Base include ::RuboCop::Cop::CommentsHelp include ::RuboCop::Cop::RangeHelp - include ::RuboCop::Cop::IgnoredMethods - extend ::RuboCop::Cop::IgnoredMethods::Config + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector def destructuring_block_argument?(argument_node); end @@ -11910,12 +12054,15 @@ class RuboCop::Cop::Style::SymbolProc < ::RuboCop::Cop::Base def allow_comments?; end def allow_if_method_has_argument?(send_node); end + def allowed_method_name?(name); end def autocorrect(corrector, node); end def autocorrect_with_args(corrector, node, args, method_name); end def autocorrect_without_args(corrector, node); end def begin_pos_for_replacement(node); end def block_range_with_space(node); end def register_offense(node, method_name, block_method_name); end + def unsafe_array_usage?(node); end + def unsafe_hash_usage?(node); end class << self def autocorrect_incompatible_with; end @@ -11962,14 +12109,12 @@ class RuboCop::Cop::Style::TernaryParentheses < ::RuboCop::Cop::Base def condition_as_parenthesized_one_line_pattern_matching?(condition); end def correct_parenthesized(corrector, condition); end def correct_unparenthesized(corrector, condition); end - def infinite_loop?; end def message(node); end def non_complex_expression?(condition); end def non_complex_send?(node); end def offense?(node); end def only_closing_parenthesis_is_last_line?(condition); end def parenthesized?(node); end - def redundant_parentheses_enabled?; end def require_parentheses?; end def require_parentheses_when_complex?; end def unparenthesized_method_call?(child); end @@ -11987,6 +12132,7 @@ class RuboCop::Cop::Style::TopLevelMethodDefinition < ::RuboCop::Cop::Base def on_block(node); end def on_def(node); end def on_defs(node); end + def on_numblock(node); end def on_send(node); end private @@ -12484,7 +12630,7 @@ module RuboCop::Cop::Util def same_line?(node1, node2); end def to_string_literal(string); end def to_supported_styles(enforced_style); end - def trim_string_interporation_escape_character(str); end + def trim_string_interpolation_escape_character(str); end class << self def add_parentheses(node, corrector); end @@ -12506,7 +12652,7 @@ module RuboCop::Cop::Util def same_line?(node1, node2); end def to_string_literal(string); end def to_supported_styles(enforced_style); end - def trim_string_interporation_escape_character(str); end + def trim_string_interpolation_escape_character(str); end end end @@ -12981,6 +13127,10 @@ module RuboCop::Ext::ProcessedSource def disabled_line_ranges; end end +module RuboCop::Ext::Range + def single_line?; end +end + module RuboCop::Ext::RegexpNode def assign_properties(*_arg0); end def each_capture(named: T.unsafe(nil)); end @@ -13019,6 +13169,25 @@ class RuboCop::Ext::RegexpParser::Map < ::Parser::Source::Map def quantifier; end end +class RuboCop::FeatureLoader + def initialize(config_directory_path:, feature:); end + + def load; end + + private + + def namespaced_feature; end + def namespaced_target; end + def relative(feature); end + def relative?; end + def seems_cannot_load_such_file_error?(error); end + def target; end + + class << self + def load(config_directory_path:, feature:); end + end +end + module RuboCop::FileFinder def find_file_upwards(filename, start_dir, stop_dir = T.unsafe(nil)); end def find_last_file_upwards(filename, start_dir, stop_dir = T.unsafe(nil)); end @@ -13221,8 +13390,8 @@ class RuboCop::Formatter::HTMLFormatter::ERBContext def decorated_message(offense); end def escape(string); end def files; end + def highlight_source_tag(offense); end def highlighted_source_line(offense); end - def hightlight_source_tag(offense); end def possible_ellipses(location); end def source_after_highlight(offense); end def source_before_highlight(offense); end @@ -13346,8 +13515,8 @@ end RuboCop::Formatter::PacmanFormatter::FALLBACK_TERMINAL_WIDTH = T.let(T.unsafe(nil), Integer) RuboCop::Formatter::PacmanFormatter::GHOST = T.let(T.unsafe(nil), String) -RuboCop::Formatter::PacmanFormatter::PACDOT = T.let(T.unsafe(nil), Rainbow::NullPresenter) -RuboCop::Formatter::PacmanFormatter::PACMAN = T.let(T.unsafe(nil), Rainbow::NullPresenter) +RuboCop::Formatter::PacmanFormatter::PACDOT = T.let(T.unsafe(nil), Rainbow::Presenter) +RuboCop::Formatter::PacmanFormatter::PACMAN = T.let(T.unsafe(nil), Rainbow::Presenter) class RuboCop::Formatter::ProgressFormatter < ::RuboCop::Formatter::ClangStyleFormatter include ::RuboCop::Formatter::TextUtil @@ -13670,6 +13839,7 @@ class RuboCop::ResultCache def any_symlink?(path); end def context_checksum(team, options); end + def digest(path); end def file_checksum(file, config_store); end def relevant_options_digest(options); end def rubocop_checksum; end @@ -13696,6 +13866,7 @@ class RuboCop::ResultCache end end +RuboCop::ResultCache::DL_EXTENSIONS = T.let(T.unsafe(nil), Array) RuboCop::ResultCache::NON_CHANGING = T.let(T.unsafe(nil), Array) class RuboCop::Runner diff --git a/Library/Homebrew/sorbet/rbi/gems/sorbet-runtime-stub@0.2.0.rbi b/Library/Homebrew/sorbet/rbi/gems/sorbet-runtime-stub@0.2.0.rbi deleted file mode 100644 index 6f0613cfb3..0000000000 --- a/Library/Homebrew/sorbet/rbi/gems/sorbet-runtime-stub@0.2.0.rbi +++ /dev/null @@ -1,8 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `sorbet-runtime-stub` gem. -# Please instead update this file by running `bin/tapioca gem sorbet-runtime-stub`. - -# THIS IS AN EMPTY RBI FILE. -# see https://github.com/Shopify/tapioca/wiki/Manual-Gem-Requires diff --git a/Library/Homebrew/sorbet/rbi/gems/tapioca@0.7.2.rbi b/Library/Homebrew/sorbet/rbi/gems/tapioca@0.7.3.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/tapioca@0.7.2.rbi rename to Library/Homebrew/sorbet/rbi/gems/tapioca@0.7.3.rbi index 5ac4bf25cd..867bd4fdae 100644 --- a/Library/Homebrew/sorbet/rbi/gems/tapioca@0.7.2.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/tapioca@0.7.3.rbi @@ -151,8 +151,8 @@ RBI::VERSION = T.let(T.unsafe(nil), String) module T::Generic::TypeStoragePatch def [](*types); end - def type_member(variance = T.unsafe(nil), fixed: T.unsafe(nil), lower: T.unsafe(nil), upper: T.unsafe(nil), &blk); end - def type_template(variance = T.unsafe(nil), fixed: T.unsafe(nil), lower: T.unsafe(nil), upper: T.unsafe(nil), &blk); end + def type_member(variance = T.unsafe(nil), fixed: T.unsafe(nil), lower: T.unsafe(nil), upper: T.unsafe(nil), &bounds_proc); end + def type_template(variance = T.unsafe(nil), fixed: T.unsafe(nil), lower: T.unsafe(nil), upper: T.unsafe(nil), &bounds_proc); end end module T::Types::Simple::GenericPatch @@ -1678,10 +1678,11 @@ class Tapioca::TypeVariableModule < ::Module variance: ::Symbol, fixed: T.untyped, lower: T.untyped, - upper: T.untyped + upper: T.untyped, + bounds_proc: T.nilable(T.proc.returns(T::Hash[::Symbol, T.untyped])) ).void end - def initialize(context, type, variance, fixed: T.unsafe(nil), lower: T.unsafe(nil), upper: T.unsafe(nil)); end + def initialize(context, type, variance, fixed, lower, upper, bounds_proc); end sig { returns(::Tapioca::TypeVariable) } def coerce_to_type_variable; end @@ -1694,6 +1695,15 @@ class Tapioca::TypeVariableModule < ::Module private + sig do + params( + fixed: T.untyped, + lower: T.untyped, + upper: T.untyped + ).returns(T.proc.returns(T::Hash[::Symbol, T.untyped])) + end + def build_bounds_proc(fixed, lower, upper); end + sig do type_parameters(:Result) .params( diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index f22b19bd3a..5b933bf983 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -7,11 +7,6 @@ class AbstractDownloadStrategy include ::FileUtils::StreamUtils_ end -class AbstractDownloadStrategy - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class ActiveSupport::Deprecation def self.deprecation_warning(*args, &block); end @@ -24,6 +19,10 @@ module ActiveSupport::ForkTracker::CoreExtPrivate include ::ActiveSupport::ForkTracker::CoreExt end +module ActiveSupport::VERSION + PRE = ::T.let(nil, ::T.untyped) +end + class Addrinfo def connect_internal(local_addrinfo, timeout=T.unsafe(nil)); end end @@ -122,6 +121,11 @@ module Bootsnap::LoadPathCache DLEXT2 = ::T.let(nil, ::T.untyped) end +class BottleSpecification + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + module BuildEnvironment::DSL extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks @@ -845,24 +849,65 @@ class Cask::AbstractCaskErrorWithToken extend ::T::Private::Methods::SingletonMethodHooks end -class Cask::Artifact::AbstractArtifact - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - module Cask::Cache extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks end -class Cask::CaskLoader::FromURILoader - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end +class Cask::Cask + def app(&block); end -class Cask::CaskLoader::NullLoader - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks + def artifact(&block); end + + def audio_unit_plugin(&block); end + + def binary(&block); end + + def colorpicker(&block); end + + def dictionary(&block); end + + def font(&block); end + + def input_method(&block); end + + def installer(&block); end + + def internet_plugin(&block); end + + def manpage(&block); end + + def mdimporter(&block); end + + def pkg(&block); end + + def postflight(&block); end + + def preflight(&block); end + + def prefpane(&block); end + + def qlplugin(&block); end + + def screen_saver(&block); end + + def service(&block); end + + def stage_only(&block); end + + def suite(&block); end + + def uninstall(&block); end + + def uninstall_postflight(&block); end + + def uninstall_preflight(&block); end + + def vst3_plugin(&block); end + + def vst_plugin(&block); end + + def zap(&block); end end class Cask::CaskQuarantineError @@ -875,9 +920,8 @@ class Cask::CaskUnspecifiedError extend ::T::Private::Methods::SingletonMethodHooks end -module Cask::Caskroom - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class Cask::Cmd::AbstractCommand + include ::Homebrew::Search::Extension end class Cask::Config @@ -938,9 +982,82 @@ class Cask::Config def vst_plugindir=(path); end end -class Cask::Config - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class Cask::DSL + def app(*args); end + + def artifact(*args); end + + def audio_unit_plugin(*args); end + + def binary(*args); end + + def colorpicker(*args); end + + def dictionary(*args); end + + def font(*args); end + + def input_method(*args); end + + def installer(*args); end + + def internet_plugin(*args); end + + def manpage(*args); end + + def mdimporter(*args); end + + def on_arch_conditional(arm: T.unsafe(nil), intel: T.unsafe(nil)); end + + def on_arm(&block); end + + def on_big_sur(or_condition=T.unsafe(nil), &block); end + + def on_catalina(or_condition=T.unsafe(nil), &block); end + + def on_el_capitan(or_condition=T.unsafe(nil), &block); end + + def on_high_sierra(or_condition=T.unsafe(nil), &block); end + + def on_intel(&block); end + + def on_mojave(or_condition=T.unsafe(nil), &block); end + + def on_monterey(or_condition=T.unsafe(nil), &block); end + + def on_sierra(or_condition=T.unsafe(nil), &block); end + + def on_ventura(or_condition=T.unsafe(nil), &block); end + + def pkg(*args); end + + def postflight(&block); end + + def preflight(&block); end + + def prefpane(*args); end + + def qlplugin(*args); end + + def screen_saver(*args); end + + def service(*args); end + + def stage_only(*args); end + + def suite(*args); end + + def uninstall(*args); end + + def uninstall_postflight(&block); end + + def uninstall_preflight(&block); end + + def vst3_plugin(*args); end + + def vst_plugin(*args); end + + def zap(*args); end end class Cask::DSL::Caveats @@ -1003,6 +1120,11 @@ class Cask::DSL::Version def underscores_to_hyphens(); end end +class Cask::DSL::Version + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + module Cask::Denylist extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks @@ -1013,19 +1135,10 @@ class Cask::MultipleCaskErrors extend ::T::Private::Methods::SingletonMethodHooks end -module Cask::Quarantine - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end +class Caveats + def empty?(*args, &block); end -module Cask::Staged - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Cask::Utils - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks + def to_s(*args, &block); end end class Checksum @@ -1042,17 +1155,17 @@ class Class def any_instance(); end end +class Cleaner + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class CompilerSelector::Compiler def self.[](*arg); end def self.members(); end end -class CompilerSelector - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class Concurrent::RubyThreadPoolExecutor DEFAULT_SYNCHRONOUS = ::T.let(nil, ::T.untyped) end @@ -1074,11 +1187,6 @@ module CopHelper extend ::RSpec::Its end -class CxxStdlib - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class Date def compare_without_coercion(arg); end @@ -1095,24 +1203,6 @@ class Date::Infinity def initialize(d=T.unsafe(nil)); end end -class Debrew::Menu::Entry - def self.[](*arg); end - - def self.members(); end -end - -module Debrew - def self.lock(); end - - def self.locked?(); end - - def self.synchronize(&block); end - - def self.try_lock(); end - - def self.unlock(); end -end - class Delegator include ::ActiveSupport::Tryable end @@ -1122,19 +1212,8 @@ class Dependencies extend ::T::Private::Methods::SingletonMethodHooks end -class Dependency - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class DependencyCollector - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class DeprecatedOption - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class Descriptions + extend ::Homebrew::Search::Extension end class DevelopmentTools @@ -1302,11 +1381,6 @@ class Dir def self.exists?(arg); end end -module DiskUsageExtension - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class ELFTools::Structs::ELF32_PhdrBe end @@ -1438,11 +1512,6 @@ class ERB::Compiler::Scanner DEFAULT_STAGS = ::T.let(nil, ::T.untyped) end -class EmbeddedPatch - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class Encoding def _dump(*arg); end end @@ -1747,11 +1816,6 @@ end class ExitCalledError end -class ExternalPatch - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class Fiber def transfer(*arg); end end @@ -1760,6 +1824,14 @@ class Fiber def self.current(); end end +module Fiddle + NULL = ::T.let(nil, ::T.untyped) + RTLD_GLOBAL = ::T.let(nil, ::T.untyped) + RTLD_LAZY = ::T.let(nil, ::T.untyped) + RTLD_NOW = ::T.let(nil, ::T.untyped) + WINDOWS = ::T.let(nil, ::T.untyped) +end + class File def self.atomic_write(file_name, temp_dir=T.unsafe(nil)); end @@ -1813,22 +1885,78 @@ module FileUtils extend ::FileUtils::StreamUtils_ end +class Formula + include ::FileUtils::StreamUtils_ + def on_arch_conditional(arm: T.unsafe(nil), intel: T.unsafe(nil)); end + + def on_arm(&block); end + + def on_big_sur(or_condition=T.unsafe(nil), &block); end + + def on_catalina(or_condition=T.unsafe(nil), &block); end + + def on_el_capitan(or_condition=T.unsafe(nil), &block); end + + def on_high_sierra(or_condition=T.unsafe(nil), &block); end + + def on_intel(&block); end + + def on_linux(&block); end + + def on_macos(&block); end + + def on_mojave(or_condition=T.unsafe(nil), &block); end + + def on_monterey(or_condition=T.unsafe(nil), &block); end + + def on_sierra(or_condition=T.unsafe(nil), &block); end + + def on_system(linux, macos:, &block); end + + def on_ventura(or_condition=T.unsafe(nil), &block); end + + def uses_from_macos_names(*args, &block); end +end + +class Formula + def self.on_arch_conditional(arm: T.unsafe(nil), intel: T.unsafe(nil)); end + + def self.on_arm(&block); end + + def self.on_big_sur(or_condition=T.unsafe(nil), &block); end + + def self.on_catalina(or_condition=T.unsafe(nil), &block); end + + def self.on_el_capitan(or_condition=T.unsafe(nil), &block); end + + def self.on_high_sierra(or_condition=T.unsafe(nil), &block); end + + def self.on_intel(&block); end + + def self.on_linux(&block); end + + def self.on_mojave(or_condition=T.unsafe(nil), &block); end + + def self.on_monterey(or_condition=T.unsafe(nil), &block); end + + def self.on_sierra(or_condition=T.unsafe(nil), &block); end + + def self.on_system(linux, macos:, &block); end + + def self.on_ventura(or_condition=T.unsafe(nil), &block); end +end + +module FormulaCellarChecks + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class FormulaConflict def self.[](*arg); end def self.members(); end end -class Formulary::FromUrlLoader - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Formulary - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - module Forwardable VERSION = ::T.let(nil, ::T.untyped) end @@ -2351,32 +2479,11 @@ module Gem def self.remove_unresolved_default_spec(spec); end end -module GitHub::API - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class GitHub::Actions::Annotation - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module GitHub::Actions - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class GitHubPackages - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class HTTP::Cookie def self.parse(set_cookie, origin, options=T.unsafe(nil), &block); end end class Hardware::CPU - extend ::T::Private::Methods::SingletonMethodHooks def self.lm?(); end end @@ -2416,24 +2523,12 @@ module Homebrew::API::Versions extend ::T::Private::Methods::SingletonMethodHooks end -module Homebrew::API - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Homebrew::BundleVersion - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Homebrew::Completions +class Homebrew::CLI::Args extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks end module Homebrew::EnvConfig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks def self.additional_google_analytics_id(); end def self.all_proxy(); end @@ -2442,10 +2537,10 @@ module Homebrew::EnvConfig def self.artifact_domain(); end - def self.autoremove?(); end - def self.auto_update_secs(); end + def self.autoremove?(); end + def self.bat?(); end def self.bat_config_path(); end @@ -2492,6 +2587,8 @@ module Homebrew::EnvConfig def self.editor(); end + def self.eval_all?(); end + def self.fail_log_lines(); end def self.forbidden_licenses(); end @@ -2583,93 +2680,71 @@ module Homebrew::EnvConfig def self.verbose_using_dots?(); end end -class Homebrew::Livecheck::LivecheckVersion +module Homebrew::Fetch extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks end -module Homebrew::Livecheck::SkipConditions +class Homebrew::FormulaCreator extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks end -class Homebrew::Livecheck::Strategy::Apache - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class Homebrew::Livecheck::Strategy::ExtractPlist::Item + def short_version(*args, &block); end + + def version(*args, &block); end end -class Homebrew::Livecheck::Strategy::Bitbucket - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class Homebrew::Livecheck::Strategy::ExtractPlist::Item + def self.[](*arg); end + + def self.members(); end end -class Homebrew::Livecheck::Strategy::Cpan - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class Homebrew::Livecheck::Strategy::Sparkle::Item + def nice_version(*args, &block); end + + def short_version(*args, &block); end + + def version(*args, &block); end end -class Homebrew::Livecheck::Strategy::ElectronBuilder - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class Homebrew::Livecheck::Strategy::Sparkle::Item + def self.[](*arg); end + + def self.members(); end end -class Homebrew::Livecheck::Strategy::GithubLatest - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +module Homebrew::Search + include ::Homebrew::Search::Extension end -class Homebrew::Livecheck::Strategy::Gnome - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class Homebrew::Service + def bin(*args, &block); end + + def etc(*args, &block); end + + def libexec(*args, &block); end + + def opt_bin(*args, &block); end + + def opt_libexec(*args, &block); end + + def opt_pkgshare(*args, &block); end + + def opt_prefix(*args, &block); end + + def opt_sbin(*args, &block); end + + def var(*args, &block); end end -class Homebrew::Livecheck::Strategy::Gnu - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Homebrew::Livecheck::Strategy::Hackage - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Homebrew::Livecheck::Strategy::Launchpad - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Homebrew::Livecheck::Strategy::Npm - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Homebrew::Livecheck::Strategy::Sourceforge - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Homebrew::Livecheck::Strategy::Xorg - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Homebrew::Livecheck::Strategy - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Homebrew::SimulateSystem - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Homebrew::Style::LineLocation - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Homebrew::TapAuditor +module Homebrew extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks + extend ::FileUtils::StreamUtils_ + extend ::Homebrew::Search::Extension end module HostEnvironmentSimulatorHelper @@ -2959,26 +3034,6 @@ class JSON::Ext::Parser def initialize(*arg); end end -class Keg::ConflictError - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Keg::DirectoryNotWritableError - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Keg::Relocation - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Keg - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class KegOnlyReason extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks @@ -2999,41 +3054,19 @@ module Kernel end module Kernel - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks def self.at_exit(); end def self.fork(); end - def self.gem(dep, *reqs); end - def self.load(*arg); end + + def self.method_added(name); end end class KeyError include ::DidYouMean::Correctable end -module Language::Java - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Language::Node - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Language::Python::Virtualenv - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Locale - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class Logger SEV_LABEL = ::T.let(nil, ::T.untyped) end @@ -3070,11 +3103,6 @@ class MessagePack::Unpacker def freeze?(); end end -class Messages - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class Method include ::MethodSource::SourceLocation::MethodExtensions include ::MethodSource::MethodExtensions @@ -3272,11 +3300,6 @@ class Mktemp include ::FileUtils::StreamUtils_ end -class Mktemp - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class MockExpectationError end @@ -3485,39 +3508,42 @@ class Nokogiri::CSS::Parser Racc_debug_parser = ::T.let(nil, ::T.untyped) end -module OS::Mac::CLT - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class OS::Mac::BaseSDKLocator + def initialize(*args, &blk); end end -module OS::Mac::Xcode - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module OS - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class OS::Mac::BaseSDKLocator + extend ::T::Private::Abstract::Hooks + extend ::T::InterfaceWrapper::Helpers end class Object include ::Minitest::Expectations - include ::SystemCommand::Mixin include ::Utils::Curl + include ::SystemCommand::Mixin def __send(*arg); end def __send!(*arg); end + def deep_dup(); end + + def duplicable?(); end + def stub(name, val_or_callable, *block_args, **block_kwargs, &block); end def to_yaml(options=T.unsafe(nil)); end + APPLY_A = ::T.let(nil, ::T.untyped) + APPLY_B = ::T.let(nil, ::T.untyped) + APPLY_C = ::T.let(nil, ::T.untyped) ARGF = ::T.let(nil, ::T.untyped) ARGV = ::T.let(nil, ::T.untyped) BUG_REPORTS_URL = ::T.let(nil, ::T.untyped) + COMMAND_DESC_WIDTH = ::T.let(nil, ::T.untyped) CROSS_COMPILING = ::T.let(nil, ::T.untyped) DEPRECATED_OFFICIAL_TAPS = ::T.let(nil, ::T.untyped) ENV = ::T.let(nil, ::T.untyped) FORMULA_COMPONENT_PRECEDENCE_LIST = ::T.let(nil, ::T.untyped) + HIDDEN_DESC_PLACEHOLDER = ::T.let(nil, ::T.untyped) HOMEBREW_BOTTLES_EXTNAME_REGEX = ::T.let(nil, ::T.untyped) HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ::T.let(nil, ::T.untyped) HOMEBREW_BREWED_CURL_PATH = ::T.let(nil, ::T.untyped) @@ -3534,6 +3560,7 @@ class Object HOMEBREW_DEFAULT_PREFIX = ::T.let(nil, ::T.untyped) HOMEBREW_DEFAULT_REPOSITORY = ::T.let(nil, ::T.untyped) HOMEBREW_DEFAULT_TEMP = ::T.let(nil, ::T.untyped) + HOMEBREW_DOCS_WWW = ::T.let(nil, ::T.untyped) HOMEBREW_GITHUB_PACKAGES_AUTH = ::T.let(nil, ::T.untyped) HOMEBREW_LIBRARY = ::T.let(nil, ::T.untyped) HOMEBREW_LIBRARY_PATH = ::T.let(nil, ::T.untyped) @@ -3569,11 +3596,15 @@ class Object LINUXBREW_CORE_MIGRATION_LIST = ::T.let(nil, ::T.untyped) OFFICIAL_CASK_TAPS = ::T.let(nil, ::T.untyped) OFFICIAL_CMD_TAPS = ::T.let(nil, ::T.untyped) + OPTION_DESC_WIDTH = ::T.let(nil, ::T.untyped) + ORIGINAL_PATHS = ::T.let(nil, ::T.untyped) OS_VERSION = ::T.let(nil, ::T.untyped) + PATCH_A_CONTENTS = ::T.let(nil, ::T.untyped) PATCH_A_SHA256 = ::T.let(nil, ::T.untyped) + PATCH_B_CONTENTS = ::T.let(nil, ::T.untyped) PATCH_B_SHA256 = ::T.let(nil, ::T.untyped) - REQUIRED_RUBY_X = ::T.let(nil, ::T.untyped) - REQUIRED_RUBY_Y = ::T.let(nil, ::T.untyped) + PATCH_URL_A = ::T.let(nil, ::T.untyped) + PATCH_URL_B = ::T.let(nil, ::T.untyped) RUBY18 = ::T.let(nil, ::T.untyped) RUBY19 = ::T.let(nil, ::T.untyped) RUBY_BIN = ::T.let(nil, ::T.untyped) @@ -3587,13 +3618,14 @@ class Object RUBY_RELEASE_DATE = ::T.let(nil, ::T.untyped) RUBY_REVISION = ::T.let(nil, ::T.untyped) RUBY_VERSION = ::T.let(nil, ::T.untyped) - RUBY_X = ::T.let(nil, ::T.untyped) - RUBY_Y = ::T.let(nil, ::T.untyped) STDERR = ::T.let(nil, ::T.untyped) STDIN = ::T.let(nil, ::T.untyped) STDOUT = ::T.let(nil, ::T.untyped) TESTBALL_PATCHES_SHA256 = ::T.let(nil, ::T.untyped) + TESTBALL_PATCHES_URL = ::T.let(nil, ::T.untyped) TESTBALL_SHA256 = ::T.let(nil, ::T.untyped) + TESTBALL_URL = ::T.let(nil, ::T.untyped) + TEST_DIRECTORIES = ::T.let(nil, ::T.untyped) TEST_FIXTURE_DIR = ::T.let(nil, ::T.untyped) TEST_SHA1 = ::T.let(nil, ::T.untyped) TEST_SHA256 = ::T.let(nil, ::T.untyped) @@ -3605,21 +3637,6 @@ class Object def self.yaml_tag(url); end end -module OnSystem::MacOSAndLinux - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module OnSystem::MacOSOnly - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module OnSystem - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class OpenSSL::ASN1::ASN1Data def indefinite_length(); end @@ -3795,16 +3812,6 @@ module OpenURI def self.scan_open_optional_arguments(*rest); end end -class Option - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Options - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class PATH def each(*args, &block); end end @@ -3820,8 +3827,6 @@ end class Parlour::ConflictResolver extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::Conversion::Converter @@ -3829,46 +3834,32 @@ class Parlour::Conversion::Converter extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::Debugging::Tree extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Parlour::Debugging extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::Generator extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Parlour::Mixin::Searchable extend ::T::Sig extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::Options extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::ParseError extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::Plugin @@ -3876,56 +3867,38 @@ class Parlour::Plugin extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::RbiGenerator::Parameter extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::RbiGenerator::StructProp extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::RbsGenerator::Block extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::RbsGenerator::MethodSignature extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::RbsGenerator::Parameter extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Parlour::TypeLoader extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::TypeParser::NodePath extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::TypeParser extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::TypedObject @@ -3933,14 +3906,10 @@ class Parlour::TypedObject extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::Types::Proc::Parameter extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parlour::Types::Type @@ -3948,24 +3917,12 @@ class Parlour::Types::Type extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Parser::Ruby26 Racc_debug_parser = ::T.let(nil, ::T.untyped) end -class Pathname - include ::ELFShim - include ::MachOShim -end - -class Pathname - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class PkgVersion def major(*args, &block); end @@ -3978,6 +3935,36 @@ class PkgVersion def patch(*args, &block); end end +class PourBottleCheck + def on_arch_conditional(arm: T.unsafe(nil), intel: T.unsafe(nil)); end + + def on_arm(&block); end + + def on_big_sur(or_condition=T.unsafe(nil), &block); end + + def on_catalina(or_condition=T.unsafe(nil), &block); end + + def on_el_capitan(or_condition=T.unsafe(nil), &block); end + + def on_high_sierra(or_condition=T.unsafe(nil), &block); end + + def on_intel(&block); end + + def on_linux(&block); end + + def on_macos(&block); end + + def on_mojave(or_condition=T.unsafe(nil), &block); end + + def on_monterey(or_condition=T.unsafe(nil), &block); end + + def on_sierra(or_condition=T.unsafe(nil), &block); end + + def on_system(linux, macos:, &block); end + + def on_ventura(or_condition=T.unsafe(nil), &block); end +end + class Proc include ::MethodSource::SourceLocation::ProcExtensions include ::MethodSource::MethodExtensions @@ -4025,35 +4012,19 @@ module Psych def self.remove_type(type_tag); end end -class PyPI::Package - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module PyPI - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class RBI::ASTVisitor extend ::T::Helpers extend ::T::Sig extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::File extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::Formatter extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::Index @@ -4065,14 +4036,10 @@ module RBI::Indexable extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::Loc extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::Node @@ -4080,44 +4047,30 @@ class RBI::Node extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::ParseError extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::Parser extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::Rewriters::Merge::Conflict extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::Rewriters::Merge extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::Rewriters::RemoveKnownDefinitions::Operation extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::UnexpectedParserError extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class RBI::Visitor @@ -4125,8 +4078,6 @@ class RBI::Visitor extend ::T::Sig extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class REXML::XPathParser @@ -4160,6 +4111,10 @@ module RSpec::Core::HashImitatable def deep_transform_keys!(*args, &block); end + def deep_transform_values(*args, &block); end + + def deep_transform_values!(*args, &block); end + def exclude?(*args, &block); end def excluding(*args, &block); end @@ -4226,6 +4181,22 @@ class RSpec::Expectations::MultipleExpectationsNotMetError include ::RSpec::Core::MultipleExceptionError::InterfaceTag end +module RSpec::Matchers + def a_json_string(*expected, &block_arg); end + + def a_string_containing(*args, &block); end + + def array_including_cons(*expected, &block_arg); end + + def be_a_failure(*args, &block); end + + def have_failed(*args, &block); end + + def not_raise_error(*args, &block); end + + def not_to_output(*args, &block); end +end + module Racc Racc_No_Extensions = ::T.let(nil, ::T.untyped) end @@ -4260,9 +4231,8 @@ module Readline def self.completion_quote_character(); end end -class Requirement - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class ReporterHub + def empty?(*args, &block); end end class Requirements @@ -4336,6 +4306,8 @@ end class Resource include ::FileUtils::StreamUtils_ + def on_arch_conditional(arm: T.unsafe(nil), intel: T.unsafe(nil)); end + def on_arm(&block); end def on_big_sur(or_condition=T.unsafe(nil), &block); end @@ -4369,11 +4341,6 @@ class Resource::Partial def self.members(); end end -class ResourceStageContext - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class Ripper def column(); end @@ -4939,6 +4906,8 @@ module RuboCop::AST::CollectionNode end class RuboCop::AST::Node + def arch_variable?(param0=T.unsafe(nil)); end + def block_args(param0=T.unsafe(nil)); end def block_body(param0=T.unsafe(nil)); end @@ -4957,16 +4926,18 @@ class RuboCop::AST::NodePattern::Parser end module RuboCop::AST::NodePattern::Sets + SET_ARM_INTEL = ::T.let(nil, ::T.untyped) + SET_BASH_COMPLETION_ZSH_COMPLETION_FISH_COMPLETION = ::T.let(nil, ::T.untyped) SET_BUILD_RECOMMENDED_TEST_OPTIONAL = ::T.let(nil, ::T.untyped) SET_DEPENDS_ON_USES_FROM_MACOS = ::T.let(nil, ::T.untyped) SET_INCLUDE_WITH_WITHOUT = ::T.let(nil, ::T.untyped) + SET_KEYS_VALUES_TO_H_TO_XML = ::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_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped) + SET_TIME_DATETIME = ::T.let(nil, ::T.untyped) SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped) -end - -class RuboCop::Cask::AST::CaskHeader - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks + SET____ETC_4 = ::T.let(nil, ::T.untyped) end class RuboCop::Cask::AST::Stanza @@ -4974,6 +4945,8 @@ class RuboCop::Cask::AST::Stanza def appcast?(); end + def arch?(); end + def artifact?(); end def audio_unit_plugin?(); end @@ -5016,6 +4989,8 @@ class RuboCop::Cask::AST::Stanza def name?(); end + def on_arch_conditional?(); end + def pkg?(); end def postflight?(); end @@ -5053,9 +5028,8 @@ class RuboCop::Cask::AST::Stanza def zap?(); end end -class RuboCop::Cop::Cask::NoDslVersion - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +class RuboCop::Cop::Cask::Variables + def variable_assignment(param0); end end class RuboCop::Cop::Cop @@ -5096,6 +5070,12 @@ class RuboCop::Cop::FormulaAudit::DeprecateDisableReason def reason(param0); end end +class RuboCop::Cop::FormulaAudit::GenerateCompletionsDSL + def correctable_shell_completion_node(param0); end + + def shell_completion_node(param0); end +end + class RuboCop::Cop::FormulaAudit::GitUrls def url_has_revision?(param0=T.unsafe(nil)); end end @@ -5124,16 +5104,6 @@ class RuboCop::Cop::FormulaAudit::Patches def patch_data?(param0); end end -class RuboCop::Cop::FormulaAudit::Patches - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class RuboCop::Cop::FormulaAudit::PyPiUrls - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class RuboCop::Cop::FormulaAudit::Test def test_calls(param0); end end @@ -5162,6 +5132,18 @@ class RuboCop::Cop::FormulaCop def required_dependency_name?(param0, param1); end end +module RuboCop::Cop::OnSystemConditionalsHelper + def if_arch_node_search(param0, arch:); end + + def if_base_os_node_search(param0, base_os:); end + + def if_macos_version_node_search(param0, os_version:); end + + def on_macos_version_method_call(param0=T.unsafe(nil), on_method:); end + + def on_system_method_call(param0=T.unsafe(nil)); end +end + module RuboCop::RSpec::ExpectOffense def expect_correction(correction, loop: T.unsafe(nil), source: T.unsafe(nil)); end @@ -6186,11 +6168,6 @@ class RubyVM def self.resolve_feature_path(arg); end end -class Sandbox - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - ScanError = StringScanner::Error class Set @@ -6212,6 +6189,14 @@ class Set InspectKey = ::T.let(nil, ::T.untyped) end +module SharedEnvExtension + def clang(); end + + def gcc(); end + + def llvm_clang(); end +end + module SharedEnvExtension extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks @@ -6421,10 +6406,38 @@ module Socket::Constants TCP_NOPUSH = ::T.let(nil, ::T.untyped) end +class SoftwareSpec + def on_arch_conditional(arm: T.unsafe(nil), intel: T.unsafe(nil)); end + + def on_arm(&block); end + + def on_big_sur(or_condition=T.unsafe(nil), &block); end + + def on_catalina(or_condition=T.unsafe(nil), &block); end + + def on_el_capitan(or_condition=T.unsafe(nil), &block); end + + def on_high_sierra(or_condition=T.unsafe(nil), &block); end + + def on_intel(&block); end + + def on_linux(&block); end + + def on_macos(&block); end + + def on_mojave(or_condition=T.unsafe(nil), &block); end + + def on_monterey(or_condition=T.unsafe(nil), &block); end + + def on_sierra(or_condition=T.unsafe(nil), &block); end + + def on_system(linux, macos:, &block); end + + def on_ventura(or_condition=T.unsafe(nil), &block); end +end + class Spoom::Cli::Bump extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Spoom::Cli::Helper @@ -6434,8 +6447,6 @@ end module Spoom::Cli::Helper extend ::T::Sig extend ::T::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::Cli::Main @@ -6444,8 +6455,6 @@ end module Spoom::Colorize extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::Coverage::D3::Base @@ -6453,20 +6462,14 @@ class Spoom::Coverage::D3::Base extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Spoom::Coverage::D3 extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::Coverage::Snapshot extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::Coverage::Template @@ -6474,80 +6477,54 @@ class Spoom::Coverage::Template extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Spoom::Coverage extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::FileTree::Node extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::FileTree extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Spoom::Git extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::Client extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::Diagnostic extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::DocumentSymbol extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::Error::Diagnostics extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::Hover extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::Location extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::Message extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::Position extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Spoom::LSP::PrintableSymbol @@ -6555,26 +6532,18 @@ module Spoom::LSP::PrintableSymbol extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::Range extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::ResponseError extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::LSP::SignatureHelp extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::Printer @@ -6582,60 +6551,44 @@ class Spoom::Printer extend ::T::Helpers extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::Sorbet::Config extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::Sorbet::Errors::Error extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::Sorbet::Errors::Parser extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Spoom::Sorbet::Errors extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Spoom::Sorbet::MetricsParser extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Spoom::Sorbet::Sigils extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Spoom::Sorbet - extend ::T::Private::Methods::SingletonMethodHooks end class Spoom::Timeline extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module Spoom extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks +end + +module Stdenv + def O0(); end + + def O1(); end end class String @@ -6660,16 +6613,6 @@ class String def to_nfkd(); end end -class String - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class StringInreplaceExtension - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class StringScanner def bol?(); end @@ -6682,34 +6625,17 @@ class Struct def filter(*arg); end end +module Superenv + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class Symbol def to_msgpack_ext(); end end -class SystemCommand::Result - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class SystemCommand - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Tab - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Tap - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - module Tapioca extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Tempfile @@ -6754,7 +6680,6 @@ class TracePoint end module Tty - extend ::T::Private::Methods::SingletonMethodHooks def self.blue(); end def self.bold(); end @@ -6895,6 +6820,26 @@ class URITemplate::RFC6570::Expression::PathParameters PAIR_IF_EMPTY = ::T.let(nil, ::T.untyped) end +module URL::BlockDSL::PageWithURL + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class URL::BlockDSL + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class URL::DSL + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class URL + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class UnboundMethod include ::MethodSource::SourceLocation::UnboundMethodExtensions include ::MethodSource::MethodExtensions @@ -6906,199 +6851,23 @@ end module UnicodeNormalize end -class UnpackStrategy::Air - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Bzip2 - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Cab - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Directory - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Dmg - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Fossil - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::GenericUnar - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Gzip - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Lha - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Lzip - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Lzma - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::P7Zip - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Pax - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Rar - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Tar - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Uncompressed - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Xar - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Xz - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class UnpackStrategy::Zip include ::UnpackStrategy::Zip::MacOSZipExtension end -module UnpackStrategy::Zip::MacOSZipExtension - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Zip - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class UnpackStrategy::Zstd - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - module UnpackStrategy extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class User - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Utils::AST::FormulaAST def process(*args, &block); end end -class Utils::AST::FormulaAST - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Utils::AST - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - module Utils::Analytics extend ::T::Private::Methods::SingletonMethodHooks end -class Utils::Bottles::Collector - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Utils::Bottles::Tag - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Utils::Bottles::TagSpecification - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Utils::Curl - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Utils::Inreplace - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Utils::Shebang::RewriteInfo - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Utils::Shebang - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Utils::Shell - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Utils::Svn - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Utils::TopologicalHash - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -module Utils - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - class Version::Parser def initialize(*args, &blk); end end @@ -7106,20 +6875,11 @@ end class Version::Parser extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Version::Token extend ::T::Private::Abstract::Hooks extend ::T::InterfaceWrapper::Helpers - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks -end - -class Version - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class WeakRef @@ -7335,68 +7095,46 @@ end module YARDSorbet::Directives extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class YARDSorbet::Handlers::AbstractDSLHandler extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class YARDSorbet::Handlers::EnumsHandler extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class YARDSorbet::Handlers::IncludeHandler extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class YARDSorbet::Handlers::MixesInClassMethodsHandler extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class YARDSorbet::Handlers::SigHandler extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module YARDSorbet::Handlers::StructClassHandler extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class YARDSorbet::Handlers::StructPropHandler extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module YARDSorbet::NodeUtils extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module YARDSorbet::SigToYARD extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end module YARDSorbet::TagUtils extend ::T::Sig - extend ::T::Private::Methods::MethodHooks - extend ::T::Private::Methods::SingletonMethodHooks end class Zlib::Deflate diff --git a/Library/Homebrew/sorbet/rbi/parlour.rbi b/Library/Homebrew/sorbet/rbi/parlour.rbi index df1375eeee..acda8f7fdc 100644 --- a/Library/Homebrew/sorbet/rbi/parlour.rbi +++ b/Library/Homebrew/sorbet/rbi/parlour.rbi @@ -18,6 +18,9 @@ module Debrew end class Formula + sig { returns(T::Boolean) } + def self.on_system_blocks_exist?; end + sig { params(arg: T.untyped).returns(T.untyped) } def self.desc(arg = T.unsafe(nil)); end @@ -68,6 +71,9 @@ class FormulaInstaller sig { returns(T::Boolean) } def keep_tmp?; end + sig { returns(T::Boolean) } + def debug_symbols?; end + sig { returns(T::Boolean) } def verbose?; end @@ -122,6 +128,9 @@ module Cask sig { returns(T::Boolean) } def strict?; end + sig { returns(T::Boolean) } + def signing?; end + sig { returns(T::Boolean) } def online?; end diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index c41753c6e7..452c136aca 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -245,7 +245,8 @@ class Tap # logic that skips non-GitHub repositories during auto-updates. # @param quiet [Boolean] If set, suppress all output. # @param custom_remote [Boolean] If set, change the tap's remote if already installed. - def install(quiet: false, clone_target: nil, force_auto_update: nil, custom_remote: false) + # @param verify [Boolean] If set, verify all the formula, casks and aliases in the tap are valid. + def install(quiet: false, clone_target: nil, force_auto_update: nil, custom_remote: false, verify: false) require "descriptions" require "readall" @@ -306,9 +307,8 @@ class Tap begin safe_system "git", *args - # TODO: 3.6.0: consider if we want to actually read all contents of tap or odeprecate. - if !Readall.valid_tap?(self, aliases: true) && !Homebrew::EnvConfig.developer? + if verify && !Readall.valid_tap?(self, aliases: true) && !Homebrew::EnvConfig.developer? raise "Cannot tap #{name}: invalid syntax in tap!" end rescue Interrupt, RuntimeError @@ -491,6 +491,13 @@ class Tap end end + # An array of all versioned {Formula} files of this {Tap}. + def versioned_formula_files + @versioned_formula_files ||= formula_files.select do |file| + file.basename(".rb").to_s =~ /@[\d.]+$/ + end + end + # An array of all {Cask} files of this {Tap}. def cask_files @cask_files ||= if cask_dir.directory? @@ -800,7 +807,7 @@ class CoreTap < Tap end # CoreTap never allows shallow clones (on request from GitHub). - def install(quiet: false, clone_target: nil, force_auto_update: nil, custom_remote: false) + def install(quiet: false, clone_target: nil, force_auto_update: nil, custom_remote: false, verify: false) remote = Homebrew::EnvConfig.core_git_remote # set by HOMEBREW_CORE_GIT_REMOTE requested_remote = clone_target || remote diff --git a/Library/Homebrew/test.rb b/Library/Homebrew/test.rb index 41a095c41a..b22b8c218a 100644 --- a/Library/Homebrew/test.rb +++ b/Library/Homebrew/test.rb @@ -1,6 +1,8 @@ # typed: false # frozen_string_literal: true +raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__ + old_trap = trap("INT") { exit! 130 } require_relative "global" diff --git a/Library/Homebrew/test/build_environment_spec.rb b/Library/Homebrew/test/build_environment_spec.rb index b073335a7e..51ae23af7e 100644 --- a/Library/Homebrew/test/build_environment_spec.rb +++ b/Library/Homebrew/test/build_environment_spec.rb @@ -30,11 +30,16 @@ describe BuildEnvironment do end describe BuildEnvironment::DSL do - subject(:build_environment_dsl) { double.extend(described_class) } + let(:build_environment_dsl) do + klass = described_class + Class.new do + extend(klass) + end + end context "with a single argument" do - before do - build_environment_dsl.instance_eval do + subject do + Class.new(build_environment_dsl) do env :std end end diff --git a/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb b/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb index 21957b37dc..f8f589cb2d 100644 --- a/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb +++ b/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb @@ -19,7 +19,7 @@ describe Cask::Artifact::PostflightBlock, :cask do end expect(called).to be true - expect(yielded_arg).to be_kind_of(Cask::DSL::Postflight) + expect(yielded_arg).to be_a(Cask::DSL::Postflight) end end @@ -40,7 +40,7 @@ describe Cask::Artifact::PostflightBlock, :cask do end expect(called).to be true - expect(yielded_arg).to be_kind_of(Cask::DSL::UninstallPostflight) + expect(yielded_arg).to be_a(Cask::DSL::UninstallPostflight) end end end diff --git a/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb b/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb index 543ff90b4d..f10b22ed8b 100644 --- a/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb +++ b/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb @@ -19,7 +19,7 @@ describe Cask::Artifact::PreflightBlock, :cask do end expect(called).to be true - expect(yielded_arg).to be_kind_of Cask::DSL::Preflight + expect(yielded_arg).to be_a Cask::DSL::Preflight end end @@ -40,7 +40,7 @@ describe Cask::Artifact::PreflightBlock, :cask do end expect(called).to be true - expect(yielded_arg).to be_kind_of Cask::DSL::UninstallPreflight + expect(yielded_arg).to be_a Cask::DSL::UninstallPreflight end end end diff --git a/Library/Homebrew/test/cask/cask_spec.rb b/Library/Homebrew/test/cask/cask_spec.rb index 7ee9b84115..a6c563d012 100644 --- a/Library/Homebrew/test/cask/cask_spec.rb +++ b/Library/Homebrew/test/cask/cask_spec.rb @@ -31,19 +31,19 @@ describe Cask::Cask, :cask do it "returns an instance of the Cask for the given token" do c = Cask::CaskLoader.load("local-caffeine") - expect(c).to be_kind_of(described_class) + expect(c).to be_a(described_class) expect(c.token).to eq("local-caffeine") end it "returns an instance of the Cask from a specific file location" do c = Cask::CaskLoader.load("#{tap_path}/Casks/local-caffeine.rb") - expect(c).to be_kind_of(described_class) + expect(c).to be_a(described_class) expect(c.token).to eq("local-caffeine") end it "returns an instance of the Cask from a URL" do c = Cask::CaskLoader.load("file://#{tap_path}/Casks/local-caffeine.rb") - expect(c).to be_kind_of(described_class) + expect(c).to be_a(described_class) expect(c.token).to eq("local-caffeine") end @@ -57,7 +57,7 @@ describe Cask::Cask, :cask do it "returns an instance of the Cask from a relative file location" do c = Cask::CaskLoader.load(relative_tap_path/"Casks/local-caffeine.rb") - expect(c).to be_kind_of(described_class) + expect(c).to be_a(described_class) expect(c.token).to eq("local-caffeine") end diff --git a/Library/Homebrew/test/cask/cmd/list_spec.rb b/Library/Homebrew/test/cask/cmd/list_spec.rb index 0ce95eb216..dc3c4a6609 100644 --- a/Library/Homebrew/test/cask/cmd/list_spec.rb +++ b/Library/Homebrew/test/cask/cmd/list_spec.rb @@ -106,13 +106,17 @@ describe Cask::Cmd::List, :cask do "outdated": false, "sha256": "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94", "artifacts": [ - [ - "Caffeine.app" - ], { - "trash": "$HOME/support/fixtures/cask/caffeine/org.example.caffeine.plist", - "signal": { - } + "app": [ + "Caffeine.app" + ] + }, + { + "zap": [ + { + "trash": "$HOME/support/fixtures/cask/caffeine/org.example.caffeine.plist" + } + ] } ], "caveats": null, @@ -140,9 +144,11 @@ describe Cask::Cmd::List, :cask do "outdated": false, "sha256": "e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68", "artifacts": [ - [ - "Transmission.app" - ] + { + "app": [ + "Transmission.app" + ] + } ], "caveats": null, "depends_on": { @@ -172,9 +178,11 @@ describe Cask::Cmd::List, :cask do "outdated": false, "sha256": "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94", "artifacts": [ - [ - "Caffeine.app" - ] + { + "app": [ + "Caffeine.app" + ] + } ], "caveats": null, "depends_on": { @@ -201,9 +209,11 @@ describe Cask::Cmd::List, :cask do "outdated": false, "sha256": "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", "artifacts": [ - [ - "ThirdParty.app" - ] + { + "app": [ + "ThirdParty.app" + ] + } ], "caveats": null, "depends_on": { diff --git a/Library/Homebrew/test/cleaner_spec.rb b/Library/Homebrew/test/cleaner_spec.rb index a9c3d1f667..9e2c76e5f1 100644 --- a/Library/Homebrew/test/cleaner_spec.rb +++ b/Library/Homebrew/test/cleaner_spec.rb @@ -7,15 +7,15 @@ require "formula" describe Cleaner do include FileUtils - subject(:cleaner) { described_class.new(f) } - - let(:f) { formula("cleaner_test") { url "foo-1.0" } } - - before do - f.prefix.mkpath - end - describe "#clean" do + subject(:cleaner) { described_class.new(f) } + + let(:f) { formula("cleaner_test") { url "foo-1.0" } } + + before do + f.prefix.mkpath + end + it "cleans files" do f.bin.mkpath f.lib.mkpath @@ -159,45 +159,54 @@ describe Cleaner do end describe "::skip_clean" do + def stub_formula_skip_clean(skip_paths) + formula("cleaner_test") do + url "foo-1.0" + + skip_clean skip_paths + end + end + it "adds paths that should be skipped" do - f.class.skip_clean "bin" + f = stub_formula_skip_clean("bin") f.bin.mkpath - cleaner.clean + described_class.new(f).clean expect(f.bin).to be_a_directory end it "also skips empty sub-directories under the added paths" do - f.class.skip_clean "bin" + f = stub_formula_skip_clean("bin") subdir = f.bin/"subdir" subdir.mkpath - cleaner.clean + described_class.new(f).clean expect(f.bin).to be_a_directory expect(subdir).to be_a_directory end it "allows skipping broken symlinks" do - f.class.skip_clean "symlink" + f = stub_formula_skip_clean("symlink") + f.prefix.mkpath symlink = f.prefix/"symlink" ln_s "target", symlink - cleaner.clean + described_class.new(f).clean expect(symlink).to be_a_symlink end it "allows skipping symlinks pointing to an empty directory" do - f.class.skip_clean "c" + f = stub_formula_skip_clean("c") dir = f.prefix/"b" symlink = f.prefix/"c" dir.mkpath ln_s dir.basename, symlink - cleaner.clean + described_class.new(f).clean expect(dir).not_to exist expect(symlink).to be_a_symlink @@ -205,14 +214,14 @@ describe Cleaner do end it "allows skipping symlinks whose target was pruned before" do - f.class.skip_clean "a" + f = stub_formula_skip_clean("a") dir = f.prefix/"b" symlink = f.prefix/"a" dir.mkpath ln_s dir.basename, symlink - cleaner.clean + described_class.new(f).clean expect(dir).not_to exist expect(symlink).to be_a_symlink @@ -220,37 +229,40 @@ describe Cleaner do end it "allows skipping '.la' files" do + f = stub_formula_skip_clean(:la) + file = f.lib/"foo.la" - f.class.skip_clean :la f.lib.mkpath touch file - cleaner.clean + described_class.new(f).clean expect(file).to exist end it "allows skipping sub-directories" do + f = stub_formula_skip_clean("lib/subdir") + dir = f.lib/"subdir" - f.class.skip_clean "lib/subdir" dir.mkpath - cleaner.clean + described_class.new(f).clean expect(dir).to be_a_directory end it "allows skipping paths relative to prefix" do + f = stub_formula_skip_clean("bin/a") + dir1 = f.bin/"a" dir2 = f.lib/"bin/a" - f.class.skip_clean "bin/a" dir1.mkpath dir2.mkpath - cleaner.clean + described_class.new(f).clean expect(dir1).to exist expect(dir2).not_to exist diff --git a/Library/Homebrew/test/cleanup_spec.rb b/Library/Homebrew/test/cleanup_spec.rb index 477de25fcd..007b64753e 100644 --- a/Library/Homebrew/test/cleanup_spec.rb +++ b/Library/Homebrew/test/cleanup_spec.rb @@ -364,4 +364,41 @@ describe Homebrew::Cleanup do end end end + + describe "::cleanup_python_site_packages" do + context "when cleaning up Python modules" do + let(:foo_module) { (HOMEBREW_PREFIX/"lib/python3.99/site-packages/foo") } + let(:foo_pycache) { (foo_module/"__pycache__") } + let(:foo_pyc) { (foo_pycache/"foo.cypthon-399.pyc") } + + before do + foo_pycache.mkpath + FileUtils.touch foo_pyc + end + + it "cleans up stray `*.pyc` files" do + cleanup.cleanup_python_site_packages + expect(foo_pyc).not_to exist + end + + it "retains `*.pyc` files of installed modules" do + FileUtils.touch foo_module/"__init__.py" + + cleanup.cleanup_python_site_packages + expect(foo_pyc).to exist + end + end + + it "cleans up stale `*.pyc` files in the top-level `__pycache__`" do + pycache = HOMEBREW_PREFIX/"lib/python3.99/site-packages/__pycache__" + foo_pyc = pycache/"foo.cypthon-3.99.pyc" + pycache.mkpath + FileUtils.touch foo_pyc + + allow_any_instance_of(Pathname).to receive(:ctime).and_return(Time.now - (2 * 60 * 60 * 24)) + allow_any_instance_of(Pathname).to receive(:mtime).and_return(Time.now - (2 * 60 * 60 * 24)) + described_class.new(days: 1).cleanup_python_site_packages + expect(foo_pyc).not_to exist + end + end end diff --git a/Library/Homebrew/test/cmd/desc_spec.rb b/Library/Homebrew/test/cmd/desc_spec.rb index efb364b17b..bbc35d702c 100644 --- a/Library/Homebrew/test/cmd/desc_spec.rb +++ b/Library/Homebrew/test/cmd/desc_spec.rb @@ -9,7 +9,7 @@ describe "brew desc" do it "shows a given Formula's description", :integration_test do setup_test_formula "testball" - expect { brew "desc", "testball" } + expect { brew "desc", "--eval-all", "testball" } .to output("testball: Some test\n").to_stdout .and not_to_output.to_stderr .and be_a_success diff --git a/Library/Homebrew/test/cmd/docs_spec.rb b/Library/Homebrew/test/cmd/docs_spec.rb new file mode 100644 index 0000000000..eade3c152b --- /dev/null +++ b/Library/Homebrew/test/cmd/docs_spec.rb @@ -0,0 +1,11 @@ +# typed: false +# frozen_string_literal: true + +describe "brew docs" do + it "opens the docs page", :integration_test do + expect { brew "docs", "HOMEBREW_BROWSER" => "echo" } + .to output("https://docs.brew.sh\n").to_stdout + .and not_to_output.to_stderr + .and be_a_success + end +end diff --git a/Library/Homebrew/test/cmd/uses_spec.rb b/Library/Homebrew/test/cmd/uses_spec.rb index c0526538a9..7ba3786342 100644 --- a/Library/Homebrew/test/cmd/uses_spec.rb +++ b/Library/Homebrew/test/cmd/uses_spec.rb @@ -14,7 +14,7 @@ describe "brew uses" do depends_on "bar" RUBY - expect { brew "uses", "--recursive", "foo" } + expect { brew "uses", "--eval-all", "--recursive", "foo" } .to output(/(bar\nbaz|baz\nbar)/).to_stdout .and not_to_output.to_stderr .and be_a_success diff --git a/Library/Homebrew/test/compiler_selector_spec.rb b/Library/Homebrew/test/compiler_selector_spec.rb index 5ee6d0c2eb..afedc9d8b1 100644 --- a/Library/Homebrew/test/compiler_selector_spec.rb +++ b/Library/Homebrew/test/compiler_selector_spec.rb @@ -52,7 +52,7 @@ describe CompilerSelector do it "returns gcc-5 if gcc formula offers gcc-5 on linux", :needs_linux do software_spec.fails_with(:clang) - allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: Version.new("5.0"))) + allow(Formulary).to receive(:factory).with("gcc@11").and_return(double(version: Version.new("5.0"))) expect(selector.compiler).to eq("gcc-5") end @@ -60,14 +60,14 @@ describe CompilerSelector do software_spec.fails_with(:clang) software_spec.fails_with(gcc: "5") software_spec.fails_with(gcc: "7") - allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: Version.new("5.0"))) + allow(Formulary).to receive(:factory).with("gcc@11").and_return(double(version: Version.new("5.0"))) expect(selector.compiler).to eq("gcc-6") end it "returns gcc-7 if gcc formula offers gcc-5 and fails with gcc <= 6 on linux", :needs_linux do software_spec.fails_with(:clang) software_spec.fails_with(:gcc) { version "6" } - allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: Version.new("5.0"))) + allow(Formulary).to receive(:factory).with("gcc@11").and_return(double(version: Version.new("5.0"))) expect(selector.compiler).to eq("gcc-7") end diff --git a/Library/Homebrew/test/description_cache_store_spec.rb b/Library/Homebrew/test/description_cache_store_spec.rb index bff74dfa29..c82649d954 100644 --- a/Library/Homebrew/test/description_cache_store_spec.rb +++ b/Library/Homebrew/test/description_cache_store_spec.rb @@ -10,6 +10,8 @@ describe DescriptionCacheStore do let(:formula_name) { "test_name" } let(:description) { "test_description" } + before { allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) } + describe "#update!" do it "sets the formula description" do expect(database).to receive(:set).with(formula_name, description) diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index 4d401712c0..f05566a10e 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -150,7 +150,7 @@ module Homebrew RUBY fa.audit_license - expect(fa.problems.first[:message]).to match <<~EOS + expect(fa.problems.first[:message]).to eq <<~EOS Formula foo contains deprecated SPDX licenses: ["GPL-1.0"]. You may need to add `-only` or `-or-later` for GNU licenses (e.g. `GPL`, `LGPL`, `AGPL`, `GFDL`). For a list of valid licenses check: https://spdx.org/licenses/ @@ -196,7 +196,7 @@ module Homebrew RUBY fa.audit_license - expect(fa.problems.first[:message]).to match <<~EOS + expect(fa.problems.first[:message]).to eq <<~EOS Formula foo contains deprecated SPDX licenses: ["GPL-1.0"]. You may need to add `-only` or `-or-later` for GNU licenses (e.g. `GPL`, `LGPL`, `AGPL`, `GFDL`). For a list of valid licenses check: https://spdx.org/licenses/ diff --git a/Library/Homebrew/test/dev-cmd/sponsors_spec.rb b/Library/Homebrew/test/dev-cmd/update-sponsors_spec.rb similarity index 79% rename from Library/Homebrew/test/dev-cmd/sponsors_spec.rb rename to Library/Homebrew/test/dev-cmd/update-sponsors_spec.rb index cc50843f3e..80e57b309f 100644 --- a/Library/Homebrew/test/dev-cmd/sponsors_spec.rb +++ b/Library/Homebrew/test/dev-cmd/update-sponsors_spec.rb @@ -3,6 +3,6 @@ require "cmd/shared_examples/args_parse" -describe "brew sponsors" do +describe "brew update-sponsors" do it_behaves_like "parseable arguments" end diff --git a/Library/Homebrew/test/download_strategies/abstract_spec.rb b/Library/Homebrew/test/download_strategies/abstract_spec.rb index 00fe1a146f..c964074fe0 100644 --- a/Library/Homebrew/test/download_strategies/abstract_spec.rb +++ b/Library/Homebrew/test/download_strategies/abstract_spec.rb @@ -25,13 +25,13 @@ describe AbstractDownloadStrategy do let(:specs) { { bottle: true } } it "extends Pourable" do - expect(strategy).to be_a_kind_of(AbstractDownloadStrategy::Pourable) + expect(strategy).to be_a(AbstractDownloadStrategy::Pourable) end end context "without specs[:bottle]" do it "is does not extend Pourable" do - expect(strategy).not_to be_a_kind_of(AbstractDownloadStrategy::Pourable) + expect(strategy).not_to be_a(AbstractDownloadStrategy::Pourable) end end end diff --git a/Library/Homebrew/test/formula_installer_bottle_spec.rb b/Library/Homebrew/test/formula_installer_bottle_spec.rb index 143fc03dcf..1cc7037b93 100644 --- a/Library/Homebrew/test/formula_installer_bottle_spec.rb +++ b/Library/Homebrew/test/formula_installer_bottle_spec.rb @@ -24,7 +24,7 @@ describe FormulaInstaller do stub_formula_loader formula stub_formula_loader formula("gcc") { url "gcc-1.0" } - stub_formula_loader formula("gcc@5") { url "gcc-5.0" } + stub_formula_loader formula("gcc@11") { url "gcc-11.0" } fi = FormulaInstaller.new(formula) fi.fetch diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index 7b2de44182..a125919c33 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -149,11 +149,15 @@ describe Formula do end end + before do + allow(Formulary).to receive(:load_formula_from_path).with(f2.name, f2.path).and_return(f2) + allow(Formulary).to receive(:factory).with(f2.name).and_return(f2) + allow(f.tap).to receive(:versioned_formula_files).and_return([f2.path]) + end + it "returns array with versioned formulae" do FileUtils.touch f.path FileUtils.touch f2.path - allow(Formulary).to receive(:load_formula_from_path).with(f2.name, f2.path).and_return(f2) - allow(Formulary).to receive(:factory).with(f2.name).and_return(f2) expect(f.versioned_formulae).to eq [f2] end @@ -237,7 +241,7 @@ describe Formula do specify "#prefix" do f = Testball.new expect(f.prefix).to eq(HOMEBREW_CELLAR/f.name/"0.1") - expect(f.prefix).to be_kind_of(Pathname) + expect(f.prefix).to be_a(Pathname) end example "revised prefix" do @@ -666,8 +670,8 @@ describe Formula do url "foo-1.0" end - expect(f.class.stable).to be_kind_of(SoftwareSpec) - expect(f.class.head).to be_kind_of(SoftwareSpec) + expect(f.class.stable).to be_a(SoftwareSpec) + expect(f.class.head).to be_a(SoftwareSpec) end specify "instance specs have different references" do @@ -828,15 +832,15 @@ describe Formula do specify "service complicated" do f = formula do url "https://brew.sh/test-1.0.tbz" - end - f.class.service do - run [opt_bin/"beanstalkd"] - run_type :immediate - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - working_dir var - keep_alive true + service do + run [opt_bin/"beanstalkd"] + run_type :immediate + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + working_dir var + keep_alive true + end end expect(f.service).not_to be_nil end diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb index 0fc043fe6b..546d5fb87d 100644 --- a/Library/Homebrew/test/formulary_spec.rb +++ b/Library/Homebrew/test/formulary_spec.rb @@ -62,11 +62,11 @@ describe Formulary do end it "returns a Formula" do - expect(described_class.factory(formula_name)).to be_kind_of(Formula) + expect(described_class.factory(formula_name)).to be_a(Formula) end it "returns a Formula when given a fully qualified name" do - expect(described_class.factory("homebrew/core/#{formula_name}")).to be_kind_of(Formula) + expect(described_class.factory("homebrew/core/#{formula_name}")).to be_a(Formula) end it "raises an error if the Formula cannot be found" do @@ -98,19 +98,19 @@ describe Formulary do end it "returns a Formula when given a path" do - expect(described_class.factory(formula_path)).to be_kind_of(Formula) + expect(described_class.factory(formula_path)).to be_a(Formula) end it "returns a Formula when given a URL" do formula = described_class.factory("file://#{formula_path}") - expect(formula).to be_kind_of(Formula) + expect(formula).to be_a(Formula) end context "when given a bottle" do subject(:formula) { described_class.factory(bottle) } it "returns a Formula" do - expect(formula).to be_kind_of(Formula) + expect(formula).to be_a(Formula) end it "calling #local_bottle_path on the returned Formula returns the bottle path" do @@ -130,7 +130,7 @@ describe Formulary do end it "returns a Formula" do - expect(formula).to be_kind_of(Formula) + expect(formula).to be_a(Formula) end it "calling #alias_path on the returned Formula returns the alias path" do @@ -142,7 +142,7 @@ describe Formulary do before do allow(described_class).to receive(:loader_for).and_call_original stub_formula_loader formula("gcc") { url "gcc-1.0" } - stub_formula_loader formula("gcc@5") { url "gcc-5.0" } + stub_formula_loader formula("gcc@11") { url "gcc-11.0" } end let(:installed_formula) { described_class.factory(formula_path) } @@ -153,7 +153,7 @@ describe Formulary do installer.install f = described_class.from_rack(installed_formula.rack) - expect(f).to be_kind_of(Formula) + expect(f).to be_a(Formula) end it "returns a Formula when given a Keg" do @@ -162,7 +162,7 @@ describe Formulary do keg = Keg.new(installed_formula.prefix) f = described_class.from_keg(keg) - expect(f).to be_kind_of(Formula) + expect(f).to be_a(Formula) end end @@ -172,14 +172,14 @@ describe Formulary do let(:formula_path) { tap.path/"#{formula_name}.rb" } it "returns a Formula when given a name" do - expect(described_class.factory(formula_name)).to be_kind_of(Formula) + expect(described_class.factory(formula_name)).to be_a(Formula) end it "returns a Formula from an Alias path" do alias_dir = tap.path/"Aliases" alias_dir.mkpath FileUtils.ln_s formula_path, alias_dir/"bar" - expect(described_class.factory("bar")).to be_kind_of(Formula) + expect(described_class.factory("bar")).to be_a(Formula) end it "raises an error when the Formula cannot be found" do @@ -189,7 +189,7 @@ describe Formulary do end it "returns a Formula when given a fully qualified name" do - expect(described_class.factory("#{tap}/#{formula_name}")).to be_kind_of(Formula) + expect(described_class.factory("#{tap}/#{formula_name}")).to be_a(Formula) end it "raises an error if a Formula is in multiple Taps" do @@ -288,7 +288,7 @@ describe Formulary do allow(Homebrew::API::Formula).to receive(:all_formulae).and_return formula_json_contents formula = described_class.factory(formula_name) - expect(formula).to be_kind_of(Formula) + expect(formula).to be_a(Formula) expect(formula.keg_only_reason.reason).to eq :provided_by_macos if OS.mac? expect(formula.deps.count).to eq 4 @@ -306,7 +306,7 @@ describe Formulary do allow(Homebrew::API::Formula).to receive(:all_formulae).and_return formula_json_contents(deprecate_json) formula = described_class.factory(formula_name) - expect(formula).to be_kind_of(Formula) + expect(formula).to be_a(Formula) expect(formula.deprecated?).to be true expect { formula.install @@ -317,7 +317,7 @@ describe Formulary do allow(Homebrew::API::Formula).to receive(:all_formulae).and_return formula_json_contents(disable_json) formula = described_class.factory(formula_name) - expect(formula).to be_kind_of(Formula) + expect(formula).to be_a(Formula) expect(formula.disabled?).to be true expect { formula.install @@ -328,7 +328,7 @@ describe Formulary do allow(Homebrew::API::Formula).to receive(:all_formulae).and_return formula_json_contents(variations_json) formula = described_class.factory(formula_name) - expect(formula).to be_kind_of(Formula) + expect(formula).to be_a(Formula) expect(formula.deps.count).to eq 5 expect(formula.deps.map(&:name).include?("variations_dep")).to be true end @@ -338,7 +338,7 @@ describe Formulary do .to receive(:all_formulae).and_return formula_json_contents(linux_variations_json) formula = described_class.factory(formula_name) - expect(formula).to be_kind_of(Formula) + expect(formula).to be_a(Formula) expect(formula.deps.count).to eq 5 expect(formula.deps.map(&:name).include?("uses_from_macos_dep")).to be true end @@ -346,7 +346,7 @@ describe Formulary do end specify "::from_contents" do - expect(described_class.from_contents(formula_name, formula_path, formula_content)).to be_kind_of(Formula) + expect(described_class.from_contents(formula_name, formula_path, formula_content)).to be_a(Formula) end describe "::to_rack" do diff --git a/Library/Homebrew/test/installed_dependents_spec.rb b/Library/Homebrew/test/installed_dependents_spec.rb index 6326584b09..29be0cf17d 100644 --- a/Library/Homebrew/test/installed_dependents_spec.rb +++ b/Library/Homebrew/test/installed_dependents_spec.rb @@ -6,7 +6,20 @@ require "installed_dependents" describe InstalledDependents do include FileUtils - def setup_test_keg(name, version) + def stub_formula(name, version = "1.0", &block) + f = formula(name) do + url "#{name}-#{version}" + + instance_eval(&block) if block + end + stub_formula_loader f + stub_formula_loader f, "homebrew/core/#{f}" + f + end + + def setup_test_keg(name, version, &block) + stub_formula(name, version, &block) + path = HOMEBREW_CELLAR/name/version (path/"bin").mkpath @@ -18,27 +31,25 @@ describe InstalledDependents do end let!(:keg) { setup_test_keg("foo", "1.0") } + let!(:keg_only_keg) do + setup_test_keg("foo-keg-only", "1.0") do + keg_only "a good reason" + end + end describe "::find_some_installed_dependents" do - def stub_formula_name(name) - f = formula(name) { url "foo-1.0" } - stub_formula_loader f - stub_formula_loader f, "homebrew/core/#{f}" - f - end - - def setup_test_keg(name, version) - f = stub_formula_name(name) + def setup_test_keg(name, version, &block) keg = super - Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write + Tab.create(keg.to_formula, DevelopmentTools.default_compiler, :libcxx).write keg end before do keg.link + keg_only_keg.optlink end - def alter_tab(keg = dependent) + def alter_tab(keg) tab = Tab.for_keg(keg) yield tab tab.write @@ -46,24 +57,26 @@ describe InstalledDependents do # 1.1.6 is the earliest version of Homebrew that generates correct runtime # dependency lists in {Tab}s. - def dependencies(deps, homebrew_version: "1.1.6") - alter_tab do |tab| + def tab_dependencies(keg, deps, homebrew_version: "1.1.6") + alter_tab(keg) do |tab| tab.homebrew_version = homebrew_version - tab.tabfile = dependent/Tab::FILENAME + tab.tabfile = keg/Tab::FILENAME tab.runtime_dependencies = deps end end - def unreliable_dependencies(deps) + def unreliable_tab_dependencies(keg, deps) # 1.1.5 is (hopefully!) the last version of Homebrew that generates # incorrect runtime dependency lists in {Tab}s. - dependencies(deps, homebrew_version: "1.1.5") + tab_dependencies(keg, deps, homebrew_version: "1.1.5") end - let(:dependent) { setup_test_keg("bar", "1.0") } - specify "a dependency with no Tap in Tab" do tap_dep = setup_test_keg("baz", "1.0") + dependent = setup_test_keg("bar", "1.0") do + depends_on "foo" + depends_on "baz" + end # allow tap_dep to be linked too FileUtils.rm_r tap_dep/"bin" @@ -71,83 +84,93 @@ describe InstalledDependents do alter_tab(keg) { |t| t.source["tap"] = nil } - dependencies nil - Formula["bar"].class.depends_on "foo" - Formula["bar"].class.depends_on "baz" + tab_dependencies dependent, nil result = described_class.find_some_installed_dependents([keg, tap_dep]) expect(result).to eq([[keg, tap_dep], ["bar"]]) end specify "no dependencies anywhere" do - dependencies nil + dependent = setup_test_keg("bar", "1.0") + tab_dependencies dependent, nil expect(described_class.find_some_installed_dependents([keg])).to be_nil end specify "missing Formula dependency" do - dependencies nil - Formula["bar"].class.depends_on "foo" + dependent = setup_test_keg("bar", "1.0") do + depends_on "foo" + end + tab_dependencies dependent, nil expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) end specify "uninstalling dependent and dependency" do - dependencies nil - Formula["bar"].class.depends_on "foo" + dependent = setup_test_keg("bar", "1.0") do + depends_on "foo" + end + tab_dependencies dependent, nil expect(described_class.find_some_installed_dependents([keg, dependent])).to be_nil end specify "renamed dependency" do - dependencies nil + dependent = setup_test_keg("bar", "1.0") do + depends_on "foo" + end + tab_dependencies dependent, nil stub_formula_loader Formula["foo"], "homebrew/core/foo-old" renamed_path = HOMEBREW_CELLAR/"foo-old" (HOMEBREW_CELLAR/"foo").rename(renamed_path) - renamed_keg = Keg.new(renamed_path/"1.0") - - Formula["bar"].class.depends_on "foo" + renamed_keg = Keg.new(renamed_path/keg.version.to_s) result = described_class.find_some_installed_dependents([renamed_keg]) expect(result).to eq([[renamed_keg], ["bar"]]) end specify "empty dependencies in Tab" do - dependencies [] + dependent = setup_test_keg("bar", "1.0") + tab_dependencies dependent, [] expect(described_class.find_some_installed_dependents([keg])).to be_nil end specify "same name but different version in Tab" do - dependencies [{ "full_name" => "foo", "version" => "1.1" }] + dependent = setup_test_keg("bar", "1.0") + tab_dependencies dependent, [{ "full_name" => keg.name, "version" => "1.1" }] expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) end specify "different name and same version in Tab" do - stub_formula_name("baz") - dependencies [{ "full_name" => "baz", "version" => keg.version.to_s }] + stub_formula("baz") + dependent = setup_test_keg("bar", "1.0") + tab_dependencies dependent, [{ "full_name" => "baz", "version" => keg.version.to_s }] expect(described_class.find_some_installed_dependents([keg])).to be_nil end specify "same name and version in Tab" do - dependencies [{ "full_name" => "foo", "version" => "1.0" }] + dependent = setup_test_keg("bar", "1.0") + tab_dependencies dependent, [{ "full_name" => keg.name, "version" => keg.version.to_s }] expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) end specify "fallback for old versions" do - unreliable_dependencies [{ "full_name" => "baz", "version" => "1.0" }] - Formula["bar"].class.depends_on "foo" + dependent = setup_test_keg("bar", "1.0") do + depends_on "foo" + end + unreliable_tab_dependencies dependent, [{ "full_name" => "baz", "version" => "1.0" }] expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) end specify "non-opt-linked" do keg.remove_opt_record - dependencies [{ "full_name" => "foo", "version" => "1.0" }] + dependent = setup_test_keg("bar", "1.0") + tab_dependencies dependent, [{ "full_name" => keg.name, "version" => keg.version.to_s }] expect(described_class.find_some_installed_dependents([keg])).to be_nil end specify "keg-only" do - keg.unlink - Formula["foo"].class.keg_only "a good reason" - dependencies [{ "full_name" => "foo", "version" => "1.1" }] # different version - expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) + dependent = setup_test_keg("bar", "1.0") + tab_dependencies dependent, [{ "full_name" => keg_only_keg.name, "version" => "1.1" }] # different version + expect(described_class.find_some_installed_dependents([keg_only_keg])).to eq([[keg_only_keg], ["bar"]]) end def stub_cask_name(name, version, dependency) diff --git a/Library/Homebrew/test/livecheck/livecheck_spec.rb b/Library/Homebrew/test/livecheck/livecheck_spec.rb index a9f31774fa..bb43d2b7da 100644 --- a/Library/Homebrew/test/livecheck/livecheck_spec.rb +++ b/Library/Homebrew/test/livecheck/livecheck_spec.rb @@ -113,11 +113,15 @@ describe Homebrew::Livecheck do describe "::livecheck_url_to_string" do let(:f_livecheck_url) do + homepage_url_s = homepage_url + stable_url_s = stable_url + head_url_s = head_url + formula("test_livecheck_url") do desc "Test Livecheck URL formula" - homepage "https://brew.sh" - url "https://brew.sh/test-0.0.1.tgz" - head "https://github.com/Homebrew/brew.git" + homepage homepage_url_s + url stable_url_s + head head_url_s resource "foo" do url "https://brew.sh/foo-1.0.tar.gz" @@ -147,30 +151,19 @@ describe Homebrew::Livecheck do end it "returns a URL string when given a livecheck_url string for formula" do - f_livecheck_url.livecheck.url(livecheck_url) expect(livecheck.livecheck_url_to_string(livecheck_url, f_livecheck_url)).to eq(livecheck_url) end it "returns a URL string when given a livecheck_url string for resource" do - r_livecheck_url.livecheck.url(livecheck_url) expect(livecheck.livecheck_url_to_string(livecheck_url, r_livecheck_url)).to eq(livecheck_url) end it "returns a URL symbol when given a valid livecheck_url symbol" do - f_livecheck_url.livecheck.url(:head) - expect(livecheck.livecheck_url_to_string(head_url, f_livecheck_url)).to eq(head_url) - - f_livecheck_url.livecheck.url(:homepage) - expect(livecheck.livecheck_url_to_string(homepage_url, f_livecheck_url)).to eq(homepage_url) - - c_livecheck_url.livecheck.url(:homepage) - expect(livecheck.livecheck_url_to_string(homepage_url, c_livecheck_url)).to eq(homepage_url) - - f_livecheck_url.livecheck.url(:stable) - expect(livecheck.livecheck_url_to_string(stable_url, f_livecheck_url)).to eq(stable_url) - - c_livecheck_url.livecheck.url(:url) - expect(livecheck.livecheck_url_to_string(cask_url, c_livecheck_url)).to eq(cask_url) + expect(livecheck.livecheck_url_to_string(:head, f_livecheck_url)).to eq(head_url) + expect(livecheck.livecheck_url_to_string(:homepage, f_livecheck_url)).to eq(homepage_url) + expect(livecheck.livecheck_url_to_string(:homepage, c_livecheck_url)).to eq(homepage_url) + expect(livecheck.livecheck_url_to_string(:stable, f_livecheck_url)).to eq(stable_url) + expect(livecheck.livecheck_url_to_string(:url, c_livecheck_url)).to eq(cask_url) r_livecheck_url.livecheck.url(:url) expect(livecheck.livecheck_url_to_string(cask_url, r_livecheck_url)).to eq(cask_url) diff --git a/Library/Homebrew/test/patch_spec.rb b/Library/Homebrew/test/patch_spec.rb index f39f22553a..aede0c7382 100644 --- a/Library/Homebrew/test/patch_spec.rb +++ b/Library/Homebrew/test/patch_spec.rb @@ -8,7 +8,7 @@ describe Patch do context "with a simple patch" do subject { described_class.create(:p2, nil) } - it { is_expected.to be_kind_of ExternalPatch } + it { is_expected.to be_a ExternalPatch } it { is_expected.to be_external } its(:strip) { is_expected.to eq(:p2) } end @@ -16,28 +16,28 @@ describe Patch do context "with a string patch" do subject { described_class.create(:p0, "foo") } - it { is_expected.to be_kind_of StringPatch } + it { is_expected.to be_a StringPatch } its(:strip) { is_expected.to eq(:p0) } end context "with a string patch without strip" do subject { described_class.create("foo", nil) } - it { is_expected.to be_kind_of StringPatch } + it { is_expected.to be_a StringPatch } its(:strip) { is_expected.to eq(:p1) } end context "with a data patch" do subject { described_class.create(:p0, :DATA) } - it { is_expected.to be_kind_of DATAPatch } + it { is_expected.to be_a DATAPatch } its(:strip) { is_expected.to eq(:p0) } end context "with a data patch without strip" do subject { described_class.create(:DATA, nil) } - it { is_expected.to be_kind_of DATAPatch } + it { is_expected.to be_a DATAPatch } its(:strip) { is_expected.to eq(:p1) } end @@ -56,7 +56,7 @@ describe Patch do subject(:patch) { described_class.create(:p2, nil) } context "when the patch is empty" do - its(:resource) { is_expected.to be_kind_of Resource::PatchResource } + its(:resource) { is_expected.to be_a Resource::PatchResource } its(:patch_files) { is_expected.to eq(patch.resource.patch_files) } its(:patch_files) { is_expected.to eq([]) } end diff --git a/Library/Homebrew/test/requirement_spec.rb b/Library/Homebrew/test/requirement_spec.rb index 0cd1c0db19..0daefeecef 100644 --- a/Library/Homebrew/test/requirement_spec.rb +++ b/Library/Homebrew/test/requirement_spec.rb @@ -12,7 +12,7 @@ describe Requirement do let(:klass) { Class.new(described_class) } describe "#tags" do - subject { described_class.new(tags) } + subject { klass.new(tags) } context "with a single tag" do let(:tags) { ["bar"] } @@ -149,7 +149,7 @@ describe Requirement do describe "#build?" do context "when the :build tag is specified" do - subject { described_class.new([:build]) } + subject { klass.new([:build]) } it { is_expected.to be_a_build_requirement } end @@ -186,24 +186,24 @@ describe Requirement do end describe "#eql? and #==" do - subject(:requirement) { described_class.new } + subject(:requirement) { klass.new } it "returns true if the names and tags are equal" do - other = described_class.new + other = klass.new expect(requirement).to eql(other) expect(requirement).to eq(other) end it "returns false if names differ" do - other = described_class.new + other = klass.new allow(other).to receive(:name).and_return("foo") expect(requirement).not_to eql(other) expect(requirement).not_to eq(other) end it "returns false if tags differ" do - other = described_class.new([:optional]) + other = klass.new([:optional]) expect(requirement).not_to eql(other) expect(requirement).not_to eq(other) @@ -211,21 +211,21 @@ describe Requirement do end describe "#hash" do - subject(:requirement) { described_class.new } + subject(:requirement) { klass.new } it "is equal if names and tags are equal" do - other = described_class.new + other = klass.new expect(requirement.hash).to eq(other.hash) end it "differs if names differ" do - other = described_class.new + other = klass.new allow(other).to receive(:name).and_return("foo") expect(requirement.hash).not_to eq(other.hash) end it "differs if tags differ" do - other = described_class.new([:optional]) + other = klass.new([:optional]) expect(requirement.hash).not_to eq(other.hash) end end diff --git a/Library/Homebrew/test/requirements_spec.rb b/Library/Homebrew/test/requirements_spec.rb index a915c926cd..e271a0073e 100644 --- a/Library/Homebrew/test/requirements_spec.rb +++ b/Library/Homebrew/test/requirements_spec.rb @@ -12,7 +12,8 @@ describe Requirements do end it "merges duplicate requirements" do - requirements << Requirement.new << Requirement.new + klass = Class.new(Requirement) + requirements << klass.new << klass.new expect(requirements.count).to eq(1) end end diff --git a/Library/Homebrew/test/resource_spec.rb b/Library/Homebrew/test/resource_spec.rb index 96541c3183..da3206393a 100644 --- a/Library/Homebrew/test/resource_spec.rb +++ b/Library/Homebrew/test/resource_spec.rb @@ -66,10 +66,6 @@ describe Resource do end describe "#livecheck" do - it "returns nil if livecheck block is not set in resource" do - expect(resource.livecheck).to be_nil - end - specify "when livecheck block is set" do expect(livecheck_resource.livecheck.url).to eq("https://brew.sh/test/releases") expect(livecheck_resource.livecheck.regex).to eq(/foo[._-]v?(\d+(?:\.\d+)+)\.t/i) diff --git a/Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb b/Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb index c1c7b1aa33..a815225b27 100644 --- a/Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb @@ -13,8 +13,10 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do context "when there are no on_system blocks" do let(:source) do <<-CASK.undent - postflight do - foobar + cask 'foo' do + postflight do + foobar + end end CASK end @@ -137,4 +139,127 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do include_examples "autocorrects source" end end + + context "when auditing `sha256` stanzas inside on_arch blocks" do + context "when there are no on_arch blocks" do + let(:source) do + <<-CASK.undent + cask 'foo' do + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" + end + CASK + end + + include_examples "does not report any offenses" + end + + context "when the proper `sha256` stanza is used" do + let(:source) do + <<-CASK.undent + cask 'foo' do + sha256 arm: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94", + intel: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" + end + CASK + end + + include_examples "does not report any offenses" + end + + context "when the `sha256` stanza needs to be removed from the on_arch blocks" do + let(:source) do + <<-CASK.undent + cask 'foo' do + on_intel do + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" + end + on_arm do + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" + end + end + CASK + end + let(:correct_source) do + <<-CASK.undent + cask 'foo' do + #{" "} + sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" + end + CASK + end + let(:offense_source) do + <<-CASK.undent + on_arm do + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" + end + CASK + end + let(:expected_offenses) do + [{ + message: 'Use `sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", ' \ + 'intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"` instead of ' \ + "nesting the `sha256` stanzas in `on_intel` and `on_arm` blocks", + severity: :convention, + line: 5, + column: 2, + source: offense_source.strip, + }] + end + + include_examples "reports offenses" + + include_examples "autocorrects source" + end + + context "when there is only one on_arch block" do + let(:source) do + <<-CASK.undent + cask 'foo' do + on_intel do + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" + end + end + CASK + end + + include_examples "does not report any offenses" + end + + context "when there is also a `version` stanza inside the on_arch blocks" do + let(:source) do + <<-CASK.undent + cask 'foo' do + on_intel do + version "1.0.0" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" + end + on_arm do + version "2.0.0" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" + end + end + CASK + end + + include_examples "does not report any offenses" + end + + context "when there is also a `version` stanza inside only a single on_arch block" do + let(:source) do + <<-CASK.undent + cask 'foo' do + on_intel do + version "2.0.0" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" + end + on_arm do + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" + end + end + CASK + end + + include_examples "does not report any offenses" + end + end end diff --git a/Library/Homebrew/test/rubocops/lines/generate_completions_spec.rb b/Library/Homebrew/test/rubocops/lines/generate_completions_spec.rb new file mode 100644 index 0000000000..2a04add73e --- /dev/null +++ b/Library/Homebrew/test/rubocops/lines/generate_completions_spec.rb @@ -0,0 +1,147 @@ +# typed: false +# frozen_string_literal: true + +require "rubocops/lines" + +describe RuboCop::Cop::FormulaAudit do + describe RuboCop::Cop::FormulaAudit::GenerateCompletionsDSL do + subject(:cop) { described_class.new } + + it "reports an offense when writing to a shell completions file directly" do + expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") + class Foo < Formula + name "foo" + + def install + (bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash") + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions", shells: [:bash])` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash")`. + end + end + RUBY + + expect_correction(<<~RUBY) + class Foo < Formula + name "foo" + + def install + generate_completions_from_executable(bin/"foo", "completions", shells: [:bash]) + end + end + RUBY + end + + it "reports an offense when writing to a shell completions file differing from the formula name" do + expect_offense(<<~RUBY, "/homebrew-core/Formula/foo-cli.rb") + class FooCli < Formula + name "foo-cli" + + def install + (bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash") + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions", base_name: "foo", shells: [:bash])` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "bash")`. + end + end + RUBY + + expect_correction(<<~RUBY) + class FooCli < Formula + name "foo-cli" + + def install + generate_completions_from_executable(bin/"foo", "completions", base_name: "foo", shells: [:bash]) + end + end + RUBY + end + + it "reports an offense when writing to a shell completions file using an arg for the shell parameter" do + expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") + class Foo < Formula + name "foo" + + def install + (bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--shell=bash") + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions", shells: [:bash], shell_parameter_format: :arg)` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--shell=bash")`. + end + end + RUBY + + expect_correction(<<~RUBY) + class Foo < Formula + name "foo" + + def install + generate_completions_from_executable(bin/"foo", "completions", shells: [:bash], shell_parameter_format: :arg) + end + end + RUBY + end + + it "reports an offense when writing to a shell completions file using a custom flag for the shell parameter" do + expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") + class Foo < Formula + name "foo" + + def install + (bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--completion-script-bash") + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions", shells: [:bash], shell_parameter_format: "--completion-script-")` instead of `(bash_completion/"foo").write Utils.safe_popen_read(bin/"foo", "completions", "--completion-script-bash")`. + end + end + RUBY + + expect_correction(<<~RUBY) + class Foo < Formula + name "foo" + + def install + generate_completions_from_executable(bin/"foo", "completions", shells: [:bash], shell_parameter_format: "--completion-script-") + end + end + RUBY + end + + it "reports an offense when writing to a completions file indirectly" do + expect_offense(<<~RUBY) + class Foo < Formula + name "foo" + + def install + output = Utils.safe_popen_read(bin/"foo", "completions", "bash") + (bash_completion/"foo").write output + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable` DSL instead of `(bash_completion/"foo").write output`. + end + end + RUBY + end + end + + describe RuboCop::Cop::FormulaAudit::SingleGenerateCompletionsDSLCall do + subject(:cop) { described_class.new } + + it "reports an offense when using multiple #generate_completions_from_executable calls for different shells" do + expect_offense(<<~RUBY) + class Foo < Formula + name "foo" + + def install + generate_completions_from_executable(bin/"foo", "completions", shells: [:bash]) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a single `generate_completions_from_executable` call combining all specified shells. + generate_completions_from_executable(bin/"foo", "completions", shells: [:zsh]) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a single `generate_completions_from_executable` call combining all specified shells. + generate_completions_from_executable(bin/"foo", "completions", shells: [:fish]) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `generate_completions_from_executable(bin/"foo", "completions")` instead of `generate_completions_from_executable(bin/"foo", "completions", shells: [:fish])`. + end + end + RUBY + + expect_correction(<<~RUBY) + class Foo < Formula + name "foo" + + def install + generate_completions_from_executable(bin/"foo", "completions") + end + end + RUBY + end + end +end diff --git a/Library/Homebrew/test/service_spec.rb b/Library/Homebrew/test/service_spec.rb index e35f0f4cb9..e3fab49f3a 100644 --- a/Library/Homebrew/test/service_spec.rb +++ b/Library/Homebrew/test/service_spec.rb @@ -5,26 +5,28 @@ require "formula" require "service" describe Homebrew::Service do - let(:klass) do - Class.new(Formula) do + let(:name) { "formula_name" } + + def stub_formula(&block) + formula(name) do url "https://brew.sh/test-1.0.tbz" + + instance_eval(&block) if block end end - let(:name) { "formula_name" } - let(:path) { Formulary.core_path(name) } - let(:spec) { :stable } - let(:f) { klass.new(name, path, spec) } describe "#std_service_path_env" do it "returns valid std_service_path_env" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate - environment_variables PATH: std_service_path_env - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - working_dir var - keep_alive true + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + environment_variables PATH: std_service_path_env + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + working_dir var + keep_alive true + end end path = f.service.std_service_path_env @@ -34,9 +36,11 @@ describe Homebrew::Service do describe "#process_type" do it "throws for unexpected type" do - f.class.service do - run opt_bin/"beanstalkd" - process_type :cow + f = stub_formula do + service do + run opt_bin/"beanstalkd" + process_type :cow + end end expect { @@ -47,9 +51,11 @@ describe Homebrew::Service do describe "#keep_alive" do it "throws for unexpected keys" do - f.class.service do - run opt_bin/"beanstalkd" - keep_alive test: "key" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + keep_alive test: "key" + end end expect { @@ -60,9 +66,11 @@ describe Homebrew::Service do describe "#run_type" do it "throws for unexpected type" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :cow + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :cow + end end expect { @@ -73,9 +81,11 @@ describe Homebrew::Service do describe "#sockets" do it "throws for missing type" do - f.class.service do - run opt_bin/"beanstalkd" - sockets "127.0.0.1:80" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + sockets "127.0.0.1:80" + end end expect { @@ -84,9 +94,11 @@ describe Homebrew::Service do end it "throws for missing host" do - f.class.service do - run opt_bin/"beanstalkd" - sockets "tcp://:80" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + sockets "tcp://:80" + end end expect { @@ -95,9 +107,11 @@ describe Homebrew::Service do end it "throws for missing port" do - f.class.service do - run opt_bin/"beanstalkd" - sockets "tcp://127.0.0.1" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + sockets "tcp://127.0.0.1" + end end expect { @@ -108,14 +122,16 @@ describe Homebrew::Service do describe "#manual_command" do it "returns valid manual_command" do - f.class.service do - run "#{HOMEBREW_PREFIX}/bin/beanstalkd" - run_type :immediate - environment_variables PATH: std_service_path_env, ETC_DIR: etc/"beanstalkd" - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - working_dir var - keep_alive true + f = stub_formula do + service do + run "#{HOMEBREW_PREFIX}/bin/beanstalkd" + run_type :immediate + environment_variables PATH: std_service_path_env, ETC_DIR: etc/"beanstalkd" + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + working_dir var + keep_alive true + end end path = f.service.manual_command @@ -123,14 +139,16 @@ describe Homebrew::Service do end it "returns valid manual_command without variables" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate - environment_variables PATH: std_service_path_env - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - working_dir var - keep_alive true + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + environment_variables PATH: std_service_path_env + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + working_dir var + keep_alive true + end end path = f.service.manual_command @@ -140,21 +158,23 @@ describe Homebrew::Service do describe "#to_plist" do it "returns valid plist" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :immediate - environment_variables PATH: std_service_path_env, FOO: "BAR", ETC_DIR: etc/"beanstalkd" - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - input_path var/"in/beanstalkd" - root_dir var - working_dir var - keep_alive true - launch_only_once true - process_type :interactive - restart_delay 30 - interval 5 - macos_legacy_timers true + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :immediate + environment_variables PATH: std_service_path_env, FOO: "BAR", ETC_DIR: etc/"beanstalkd" + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + input_path var/"in/beanstalkd" + root_dir var + working_dir var + keep_alive true + launch_only_once true + process_type :interactive + restart_delay 30 + interval 5 + macos_legacy_timers true + end end plist = f.service.to_plist @@ -216,9 +236,11 @@ describe Homebrew::Service do end it "returns valid plist with socket" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - sockets "tcp://127.0.0.1:80" + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + sockets "tcp://127.0.0.1:80" + end end plist = f.service.to_plist @@ -265,9 +287,11 @@ describe Homebrew::Service do end it "returns valid partial plist" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + end end plist = f.service.to_plist @@ -299,10 +323,12 @@ describe Homebrew::Service do end it "returns valid interval plist" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :interval - interval 5 + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :interval + interval 5 + end end plist = f.service.to_plist @@ -336,10 +362,12 @@ describe Homebrew::Service do end it "returns valid cron plist" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :cron - cron "@daily" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :cron + cron "@daily" + end end plist = f.service.to_plist @@ -378,9 +406,11 @@ describe Homebrew::Service do end it "returns valid keepalive-exit plist" do - f.class.service do - run opt_bin/"beanstalkd" - keep_alive successful_exit: false + f = stub_formula do + service do + run opt_bin/"beanstalkd" + keep_alive successful_exit: false + end end plist = f.service.to_plist @@ -417,9 +447,11 @@ describe Homebrew::Service do end it "returns valid keepalive-crashed plist" do - f.class.service do - run opt_bin/"beanstalkd" - keep_alive crashed: true + f = stub_formula do + service do + run opt_bin/"beanstalkd" + keep_alive crashed: true + end end plist = f.service.to_plist @@ -456,9 +488,11 @@ describe Homebrew::Service do end it "returns valid keepalive-path plist" do - f.class.service do - run opt_bin/"beanstalkd" - keep_alive path: opt_pkgshare/"test-path" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + keep_alive path: opt_pkgshare/"test-path" + end end plist = f.service.to_plist @@ -497,19 +531,21 @@ describe Homebrew::Service do describe "#to_systemd_unit" do it "returns valid unit" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :immediate - environment_variables PATH: std_service_path_env, FOO: "BAR" - error_log_path var/"log/beanstalkd.error.log" - log_path var/"log/beanstalkd.log" - input_path var/"in/beanstalkd" - root_dir var - working_dir var - keep_alive true - process_type :interactive - restart_delay 30 - macos_legacy_timers true + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :immediate + environment_variables PATH: std_service_path_env, FOO: "BAR" + error_log_path var/"log/beanstalkd.error.log" + log_path var/"log/beanstalkd.log" + input_path var/"in/beanstalkd" + root_dir var + working_dir var + keep_alive true + process_type :interactive + restart_delay 30 + macos_legacy_timers true + end end unit = f.service.to_systemd_unit @@ -538,10 +574,12 @@ describe Homebrew::Service do end it "returns valid partial oneshot unit" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate - launch_only_once true + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + launch_only_once true + end end unit = f.service.to_systemd_unit @@ -562,10 +600,12 @@ describe Homebrew::Service do describe "#to_systemd_timer" do it "returns valid timer" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :interval - interval 5 + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :interval + interval 5 + end end unit = f.service.to_systemd_timer @@ -584,9 +624,11 @@ describe Homebrew::Service do end it "returns valid partial timer" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :immediate + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :immediate + end end unit = f.service.to_systemd_timer @@ -604,10 +646,12 @@ describe Homebrew::Service do end it "throws on incomplete cron" do - f.class.service do - run opt_bin/"beanstalkd" - run_type :cron - cron "1 2 3 4" + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :cron + cron "1 2 3 4" + end end expect { @@ -627,10 +671,12 @@ describe Homebrew::Service do } styles.each do |cron, calendar| - f.class.service do - run opt_bin/"beanstalkd" - run_type :cron - cron cron.to_s + f = stub_formula do + service do + run opt_bin/"beanstalkd" + run_type :cron + cron cron.to_s + end end unit = f.service.to_systemd_timer @@ -653,18 +699,22 @@ describe Homebrew::Service do describe "#timed?" do it "returns false for immediate" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :immediate + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :immediate + end end expect(f.service.timed?).to be(false) end it "returns true for interval" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :interval + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :interval + end end expect(f.service.timed?).to be(true) @@ -673,35 +723,43 @@ describe Homebrew::Service do describe "#keep_alive?" do it "returns true when keep_alive set to hash" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - keep_alive crashed: true + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + keep_alive crashed: true + end end expect(f.service.keep_alive?).to be(true) end it "returns true when keep_alive set to true" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - keep_alive true + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + keep_alive true + end end expect(f.service.keep_alive?).to be(true) end it "returns false when keep_alive not set" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + end end expect(f.service.keep_alive?).to be(false) end it "returns false when keep_alive set to false" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - keep_alive false + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + keep_alive false + end end expect(f.service.keep_alive?).to be(false) @@ -710,9 +768,11 @@ describe Homebrew::Service do describe "#command" do it "returns @run data" do - f.class.service do - run [opt_bin/"beanstalkd", "test"] - run_type :immediate + f = stub_formula do + service do + run [opt_bin/"beanstalkd", "test"] + run_type :immediate + end end command = f.service.command diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/multiple-versions.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/multiple-versions.rb index 05a29fd20f..02a9e28fc1 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/multiple-versions.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/multiple-versions.rb @@ -9,7 +9,6 @@ cask "multiple-versions" do version "1.2.0" sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" end - on_catalina :or_older do version "1.0.0" sha256 "1866dfa833b123bb8fe7fa7185ebf24d28d300d0643d75798bc23730af734216" diff --git a/Library/Homebrew/test/support/fixtures/failball.rb b/Library/Homebrew/test/support/fixtures/failball.rb index 1b396a721e..4995d94f55 100644 --- a/Library/Homebrew/test/support/fixtures/failball.rb +++ b/Library/Homebrew/test/support/fixtures/failball.rb @@ -4,13 +4,22 @@ class Failball < Formula def initialize(name = "failball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil, force_bottle: false) - self.class.instance_eval do - stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" - stable.sha256 TESTBALL_SHA256 - end super end + DSL_PROC = proc do + url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" + sha256 TESTBALL_SHA256 + end.freeze + private_constant :DSL_PROC + + DSL_PROC.call + + def self.inherited(other) + super + other.instance_eval(&DSL_PROC) + end + def install prefix.install "bin" prefix.install "libexec" diff --git a/Library/Homebrew/test/support/fixtures/testball.rb b/Library/Homebrew/test/support/fixtures/testball.rb index 1a99de2914..a2f23923a0 100644 --- a/Library/Homebrew/test/support/fixtures/testball.rb +++ b/Library/Homebrew/test/support/fixtures/testball.rb @@ -4,13 +4,22 @@ class Testball < Formula def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil, force_bottle: false) - self.class.instance_eval do - stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" - stable.sha256 TESTBALL_SHA256 - end super end + DSL_PROC = proc do + url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" + sha256 TESTBALL_SHA256 + end.freeze + private_constant :DSL_PROC + + DSL_PROC.call + + def self.inherited(other) + super + other.instance_eval(&DSL_PROC) + end + def install prefix.install "bin" prefix.install "libexec" diff --git a/Library/Homebrew/test/support/fixtures/testball_bottle.rb b/Library/Homebrew/test/support/fixtures/testball_bottle.rb index d6b777996a..33d4093ef9 100644 --- a/Library/Homebrew/test/support/fixtures/testball_bottle.rb +++ b/Library/Homebrew/test/support/fixtures/testball_bottle.rb @@ -4,18 +4,29 @@ class TestballBottle < Formula def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil, force_bottle: false) - self.class.instance_eval do - stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" - stable.sha256 TESTBALL_SHA256 - stable.bottle do - root_url "file://#{TEST_FIXTURE_DIR}/bottles" - sha256 cellar: :any_skip_relocation, Utils::Bottles.tag.to_sym => "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" - end - cxxstdlib_check :skip - end super end + DSL_PROC = proc do + url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" + sha256 TESTBALL_SHA256 + + bottle do + root_url "file://#{TEST_FIXTURE_DIR}/bottles" + sha256 cellar: :any_skip_relocation, Utils::Bottles.tag.to_sym => "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" + end + + cxxstdlib_check :skip + end.freeze + private_constant :DSL_PROC + + DSL_PROC.call + + def self.inherited(other) + super + other.instance_eval(&DSL_PROC) + end + def install prefix.install "bin" prefix.install "libexec" diff --git a/Library/Homebrew/test/support/fixtures/testball_bottle_cellar.rb b/Library/Homebrew/test/support/fixtures/testball_bottle_cellar.rb index 58bd8edfeb..85ea087b19 100644 --- a/Library/Homebrew/test/support/fixtures/testball_bottle_cellar.rb +++ b/Library/Homebrew/test/support/fixtures/testball_bottle_cellar.rb @@ -4,19 +4,29 @@ class TestballBottleCellar < Formula def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil, force_bottle: false) - self.class.instance_eval do - stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" - stable.sha256 TESTBALL_SHA256 - hexdigest = "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" - stable.bottle do - root_url "file://#{TEST_FIXTURE_DIR}/bottles" - sha256 cellar: :any_skip_relocation, Utils::Bottles.tag.to_sym => hexdigest - end - cxxstdlib_check :skip - end super end + DSL_PROC = proc do + url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" + sha256 TESTBALL_SHA256 + + bottle do + root_url "file://#{TEST_FIXTURE_DIR}/bottles" + sha256 cellar: :any_skip_relocation, Utils::Bottles.tag.to_sym => "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" + end + + cxxstdlib_check :skip + end.freeze + private_constant :DSL_PROC + + DSL_PROC.call + + def self.inherited(other) + super + other.instance_eval(&DSL_PROC) + end + def install prefix.install "bin" prefix.install "libexec" diff --git a/Library/Homebrew/test/tab_spec.rb b/Library/Homebrew/test/tab_spec.rb index 85b6ec12d0..059a590d39 100644 --- a/Library/Homebrew/test/tab_spec.rb +++ b/Library/Homebrew/test/tab_spec.rb @@ -99,7 +99,7 @@ describe Tab do tab = described_class.new(homebrew_version: "1.2.3") expect(tab.parsed_homebrew_version).to eq("1.2.3") expect(tab.parsed_homebrew_version).to be < "1.2.3-1-g12789abdf" - expect(tab.parsed_homebrew_version).to be_kind_of(Version) + expect(tab.parsed_homebrew_version).to be_a(Version) tab.homebrew_version = "1.2.4-567-g12789abdf" expect(tab.parsed_homebrew_version).to be > "1.2.4" diff --git a/Library/Homebrew/test/tap_spec.rb b/Library/Homebrew/test/tap_spec.rb index 10ba903b50..355cd497bd 100644 --- a/Library/Homebrew/test/tap_spec.rb +++ b/Library/Homebrew/test/tap_spec.rb @@ -96,10 +96,10 @@ describe Tap do end specify "::fetch" do - expect(described_class.fetch("Homebrew", "core")).to be_kind_of(CoreTap) - expect(described_class.fetch("Homebrew", "homebrew")).to be_kind_of(CoreTap) + expect(described_class.fetch("Homebrew", "core")).to be_a(CoreTap) + expect(described_class.fetch("Homebrew", "homebrew")).to be_a(CoreTap) tap = described_class.fetch("Homebrew", "foo") - expect(tap).to be_kind_of(described_class) + expect(tap).to be_a(described_class) expect(tap.name).to eq("homebrew/foo") expect { @@ -173,7 +173,7 @@ describe Tap do expect(homebrew_foo_tap.formula_renames).to eq("oldname" => "foo") expect(homebrew_foo_tap.tap_migrations).to eq("removed-formula" => "homebrew/foo") expect(homebrew_foo_tap.command_files).to eq([cmd_file]) - expect(homebrew_foo_tap.to_hash).to be_kind_of(Hash) + expect(homebrew_foo_tap.to_hash).to be_a(Hash) expect(homebrew_foo_tap).to have_formula_file(formula_file) expect(homebrew_foo_tap).to have_formula_file("Formula/foo.rb") expect(homebrew_foo_tap).not_to have_formula_file("bar.rb") diff --git a/Library/Homebrew/test/unpack_strategy/zstd_spec.rb b/Library/Homebrew/test/unpack_strategy/zstd_spec.rb index 6e9198b996..270db9ce40 100644 --- a/Library/Homebrew/test/unpack_strategy/zstd_spec.rb +++ b/Library/Homebrew/test/unpack_strategy/zstd_spec.rb @@ -6,5 +6,12 @@ require_relative "shared_examples" describe UnpackStrategy::Zstd do let(:path) { TEST_FIXTURE_DIR/"cask/container.tar.zst" } - include_examples "UnpackStrategy::detect" + it "is correctly detected" do + # UnpackStrategy.detect(path) for a .tar.XXX file returns either UnpackStrategy::Tar if + # the host's tar is able to extract that compressed file or UnpackStrategy::XXX otherwise, + # such as UnpackStrategy::Zstd. On macOS UnpackStrategy.detect("container.tar.zst") + # returns UnpackStrategy::Zstd, and on ubuntu-22.04 it returns UnpackStrategy::Tar, + # because the host's version of tar is recent enough and zstd is installed. + expect(UnpackStrategy.detect(path)).to(be_a(described_class).or(be_a(UnpackStrategy::Tar))) + end end diff --git a/Library/Homebrew/test/utils/github_spec.rb b/Library/Homebrew/test/utils/github_spec.rb index 8221b76b2f..da72e7e90c 100644 --- a/Library/Homebrew/test/utils/github_spec.rb +++ b/Library/Homebrew/test/utils/github_spec.rb @@ -15,19 +15,19 @@ describe GitHub do end end - describe "::query_string" do + describe "::search_query_string" do it "builds a query with the given hash parameters formatted as key:value" do - query = described_class.query_string(user: "Homebrew", repo: "brew") + query = described_class.search_query_string(user: "Homebrew", repo: "brew") expect(query).to eq("q=user%3AHomebrew+repo%3Abrew&per_page=100") end it "adds a variable number of top-level string parameters to the query when provided" do - query = described_class.query_string("value1", "value2", user: "Homebrew") + query = described_class.search_query_string("value1", "value2", user: "Homebrew") expect(query).to eq("q=value1+value2+user%3AHomebrew&per_page=100") end it "turns array values into multiple key:value parameters" do - query = described_class.query_string(user: ["Homebrew", "caskroom"]) + query = described_class.search_query_string(user: ["Homebrew", "caskroom"]) expect(query).to eq("q=user%3AHomebrew+user%3Acaskroom&per_page=100") end end @@ -57,14 +57,6 @@ describe GitHub do end end - describe "::sponsors_by_tier", :needs_network do - it "errors on an unauthenticated token" do - expect { - described_class.sponsors_by_tier("Homebrew") - }.to raise_error(/INSUFFICIENT_SCOPES|FORBIDDEN|token needs the 'admin:org' scope/) - end - end - describe "::get_artifact_url", :needs_network do it "fails to find a nonexistent workflow" do expect { diff --git a/Library/Homebrew/test/utils/tty_spec.rb b/Library/Homebrew/test/utils/tty_spec.rb index 948306a645..1a717f569d 100644 --- a/Library/Homebrew/test/utils/tty_spec.rb +++ b/Library/Homebrew/test/utils/tty_spec.rb @@ -10,7 +10,7 @@ describe Tty do describe "::width" do it "returns an Integer" do - expect(described_class.width).to be_kind_of(Integer) + expect(described_class.width).to be_a(Integer) end it "cannot be negative" do diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index c521ad2891..0fb623d7c5 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -364,8 +364,8 @@ module Kernel editor = Homebrew::EnvConfig.editor return editor if editor - # Find Atom, Sublime Text, VS Code, Textmate, BBEdit / TextWrangler, or vim - editor = %w[atom subl code mate edit vim].find do |candidate| + # Find Atom, Sublime Text, VS Code, Textmate, BBEdit, or vim + editor = %w[atom subl code mate bbedit vim].find do |candidate| candidate if which(candidate, ORIGINAL_PATHS) end editor ||= "vim" diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index d3d956bd55..0d7472784b 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -30,6 +30,12 @@ module GitHub API.open_rest(url_to("repos", repo, "check-runs"), data: data) end + def issues(repo:, **filters) + uri = url_to("repos", repo, "issues") + uri.query = URI.encode_www_form(filters) + API.open_rest(uri) + end + def search_issues(query, **qualifiers) search("issues", query, **qualifiers) end @@ -153,7 +159,7 @@ module GitHub API.open_rest(uri) { |json| json["private"] } end - def query_string(*main_params, **qualifiers) + def search_query_string(*main_params, **qualifiers) params = main_params params += qualifiers.flat_map do |key, value| @@ -169,7 +175,7 @@ module GitHub def search(entity, *queries, **qualifiers) uri = url_to "search", entity - uri.query = query_string(*queries, **qualifiers) + uri.query = search_query_string(*queries, **qualifiers) API.open_rest(uri) { |json| json.fetch("items", []) } end @@ -397,59 +403,78 @@ module GitHub result["organization"]["team"]["members"]["nodes"].to_h { |member| [member["login"], member["name"]] } end - def sponsors_by_tier(user) - query = <<~EOS - { organization(login: "#{user}") { - sponsorsListing { - tiers(first: 10, orderBy: {field: MONTHLY_PRICE_IN_CENTS, direction: DESC}) { + def sponsorships(user) + has_next_page = true + after = "" + sponsorships = [] + errors = [] + while has_next_page + query = <<~EOS + { organization(login: "#{user}") { + sponsorshipsAsMaintainer(first: 100 #{after}) { + pageInfo { + startCursor + hasNextPage + endCursor + } + totalCount nodes { - monthlyPriceInDollars - adminInfo { - sponsorships(first: 100, includePrivate: true) { - totalCount - nodes { - privacyLevel - sponsorEntity { - __typename - ... on Organization { login name } - ... on User { login name } - } - } + tier { + monthlyPriceInDollars + closestLesserValueTier { + monthlyPriceInDollars } } + sponsorEntity { + __typename + ... on Organization { login name } + ... on User { login name } + } } } } } - } - EOS - result = API.open_graphql(query, scopes: ["admin:org", "user"]) + EOS + # Some organisations do not permit themselves to be queried through the + # API like this and raise an error so handle these errors later. + # This has been reported to GitHub. + result = API.open_graphql(query, scopes: ["user"], raise_errors: false) + errors += result["errors"] if result["errors"].present? - tiers = result["organization"]["sponsorsListing"]["tiers"]["nodes"] + current_sponsorships = result["data"]["organization"]["sponsorshipsAsMaintainer"] - tiers.map do |t| - tier = t["monthlyPriceInDollars"] - raise API::Error, "Your token needs the 'admin:org' scope to access this API" if t["adminInfo"].nil? + # The organisations mentioned above will show up as nil nodes. + if (nodes = current_sponsorships["nodes"].compact.presence) + sponsorships += nodes + end - sponsorships = t["adminInfo"]["sponsorships"] - count = sponsorships["totalCount"] - sponsors = sponsorships["nodes"].map do |sponsor| - next unless sponsor["privacyLevel"] == "PUBLIC" + if (page_info = current_sponsorships["pageInfo"].presence) && + page_info["hasNextPage"].presence + after = %Q(, after: "#{page_info["endCursor"]}") + else + has_next_page = false + end + end - se = sponsor["sponsorEntity"] - { - "name" => se["name"].presence || sponsor["login"], - "login" => se["login"], - "type" => se["__typename"].downcase, - } - end.compact + # Only raise errors if we didn't get any sponsorships. + if sponsorships.blank? && errors.present? + raise API::Error, errors.map { |e| "#{e["type"]}: #{e["message"]}" }.join("\n") + end + + sponsorships.map do |sponsorship| + sponsor = sponsorship["sponsorEntity"] + tier = sponsorship["tier"].presence || {} + monthly_amount = tier["monthlyPriceInDollars"].presence || 0 + closest_tier = tier["closestLesserValueTier"].presence || {} + closest_tier_monthly_amount = closest_tier["monthlyPriceInDollars"].presence || 0 { - "tier" => tier, - "count" => count, - "sponsors" => sponsors, + name: sponsor["name"].presence || sponsor["login"], + login: sponsor["login"], + monthly_amount: monthly_amount, + closest_tier_monthly_amount: closest_tier_monthly_amount, } - end.compact + end end def get_repo_license(user, repo) diff --git a/Library/Homebrew/utils/github/api.rb b/Library/Homebrew/utils/github/api.rb index 005f5baf7b..b802a4af24 100644 --- a/Library/Homebrew/utils/github/api.rb +++ b/Library/Homebrew/utils/github/api.rb @@ -252,17 +252,19 @@ module GitHub end end - def open_graphql(query, variables: nil, scopes: [].freeze) + def open_graphql(query, variables: nil, scopes: [].freeze, raise_errors: true) data = { query: query, variables: variables } result = open_rest("#{API_URL}/graphql", scopes: scopes, data: data, request_method: "POST") - if result["errors"].present? - raise Error, result["errors"].map { |e| - "#{e["type"]}: #{e["message"]}" - }.join("\n") - end + if raise_errors + if result["errors"].present? + raise Error, result["errors"].map { |e| "#{e["type"]}: #{e["message"]}" }.join("\n") + end - result["data"] + result["data"] + else + result + end end def raise_error(output, errors, http_code, headers, scopes) diff --git a/Library/Homebrew/utils/ruby.sh b/Library/Homebrew/utils/ruby.sh index 51e1f9eab0..a7bb83c4a0 100644 --- a/Library/Homebrew/utils/ruby.sh +++ b/Library/Homebrew/utils/ruby.sh @@ -13,30 +13,54 @@ test_ruby() { "${HOMEBREW_REQUIRED_RUBY_VERSION}" 2>/dev/null } +can_use_ruby_from_path() { + if [[ -n "${HOMEBREW_DEVELOPER}" && -n "${HOMEBREW_USE_RUBY_FROM_PATH}" ]] + then + return 0 + fi + + return 1 +} + +find_first_valid_ruby() { + local ruby_exec + while IFS= read -r ruby_exec + do + if test_ruby "${ruby_exec}" + then + echo "${ruby_exec}" + break + fi + done +} + # HOMEBREW_MACOS is set by brew.sh # HOMEBREW_PATH is set by global.rb # shellcheck disable=SC2154 find_ruby() { - if [[ -n "${HOMEBREW_MACOS}" && -z "${HOMEBREW_USE_RUBY_FROM_PATH}" ]] + if [[ -n "${HOMEBREW_MACOS}" ]] && ! can_use_ruby_from_path then echo "/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby" else - local ruby_exec - while read -r ruby_exec - do - if test_ruby "${ruby_exec}" - then - echo "${ruby_exec}" - break - fi - done < <( + local valid_ruby + + # Prioritise rubies from the filtered path (/usr/bin etc) unless explicitly overridden. + if ! can_use_ruby_from_path + then # function which() is set by brew.sh # it is aliased to `type -P` # shellcheck disable=SC2230 - which -a ruby + valid_ruby=$(find_first_valid_ruby < <(which -a ruby)) + fi + + if [[ -z "${valid_ruby}" ]] + then + # Same as above # shellcheck disable=SC2230 - PATH="${HOMEBREW_PATH}" which -a ruby - ) + valid_ruby=$(find_first_valid_ruby < <(PATH="${HOMEBREW_PATH}" which -a ruby)) + fi + + echo "${valid_ruby}" fi } @@ -47,10 +71,10 @@ need_vendored_ruby() { if [[ -n "${HOMEBREW_FORCE_VENDOR_RUBY}" ]] then return 0 - elif [[ -n "${HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH}" && -z "${HOMEBREW_USE_RUBY_FROM_PATH}" ]] + elif [[ -n "${HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH}" ]] && ! can_use_ruby_from_path then return 1 - elif [[ -z "${HOMEBREW_MACOS}" || -n "${HOMEBREW_USE_RUBY_FROM_PATH}" ]] && test_ruby "${HOMEBREW_RUBY_PATH}" + elif ([[ -z "${HOMEBREW_MACOS}" ]] || can_use_ruby_from_path) && test_ruby "${HOMEBREW_RUBY_PATH}" then return 1 else diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 22e96e5aef..0576bd78c8 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -8,13 +8,13 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.12.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.16.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.6.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.6.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.7/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/public_suffix-5.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/addressable-2.8.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/bindata-2.4.10/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-15/2.6.0-static/msgpack-1.5.5" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/msgpack-1.5.5/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-15/2.6.0-static/msgpack-1.5.6" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/msgpack-1.5.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-15/2.6.0-static/bootsnap-1.13.0" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/bootsnap-1.13.0/lib" $:.unshift "#{path}/" @@ -57,7 +57,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.8.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/method_source-1.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mustache-1.1.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.22.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-3.11.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-3.12.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-3.1.2.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.1.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-0.5.10175/lib" @@ -65,31 +65,31 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parlour-8.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/patchelf-1.3.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.6.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/pry-0.14.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rack-2.2.4/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rack-3.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unparser-0.6.4/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rbi-0.0.14/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-15/2.6.0-static/rdiscount-2.2.0.2" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rdiscount-2.2.0.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rexml-3.2.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ronn-0.7.3/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-support-3.11.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-support-3.11.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-core-3.11.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-expectations-3.11.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-expectations-3.11.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-mocks-3.11.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-3.11.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-github-2.3.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-its-1.3.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-retry-0.6.2/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-sorbet-1.8.3/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-sorbet-1.9.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec_junit_formatter-0.5.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.21.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.2.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.35.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.14.3/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.15.2/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.12.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.15.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.16.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.13.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.11/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-3.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/actionable_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/actionable_error.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/actionable_error.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/actionable_error.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/array_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/array_inquirer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/array_inquirer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/array_inquirer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/backtrace_cleaner.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/backtrace_cleaner.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/backtrace_cleaner.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/backtrace_cleaner.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/benchmarkable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/benchmarkable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/benchmarkable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/benchmarkable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/builder.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/builder.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/builder.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/builder.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/callbacks.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/concern.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/concern.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/concern.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/concern.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/configurable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/configurable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/configurable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/configurable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/configuration_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/configuration_file.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/configuration_file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/configuration_file.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/extract.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/extract.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/extract.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/extract.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/extract_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/extract_options.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/extract_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/extract_options.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/grouping.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/grouping.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/grouping.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/grouping.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/wrap.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/wrap.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/array/wrap.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/array/wrap.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/benchmark.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/benchmark.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/benchmark.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/benchmark.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/big_decimal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/big_decimal.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/big_decimal.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/big_decimal.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/big_decimal/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/big_decimal/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/big_decimal/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/big_decimal/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/class.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/class.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/class/attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/class/attribute.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/class/attribute.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/class/attribute.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/class/attribute_accessors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/class/attribute_accessors.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/class/attribute_accessors.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/class/attribute_accessors.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/class/subclasses.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/class/subclasses.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/class/subclasses.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/class/subclasses.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/calculations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/calculations.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_and_time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_and_time/calculations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_and_time/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_and_time/calculations.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_and_time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_and_time/compatibility.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_and_time/compatibility.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_and_time/compatibility.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_and_time/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_and_time/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_and_time/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_and_time/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/calculations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/calculations.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/compatibility.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/compatibility.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/compatibility.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/date_time/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/date_time/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/digest.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/digest.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/digest.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/digest/uuid.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/digest/uuid.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/digest/uuid.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/digest/uuid.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/enumerable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/enumerable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/enumerable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/enumerable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/file.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/file.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/file/atomic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/file/atomic.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/file/atomic.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/file/atomic.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/deep_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/deep_merge.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/deep_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/deep_merge.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/deep_transform_values.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/deep_transform_values.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/deep_transform_values.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/deep_transform_values.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/except.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/except.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/except.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/except.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/indifferent_access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/indifferent_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/indifferent_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/keys.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/keys.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/keys.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/keys.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/reverse_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/reverse_merge.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/reverse_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/reverse_merge.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/slice.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/slice.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/hash/slice.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/hash/slice.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/integer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/integer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/integer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/integer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/integer/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/integer/inflections.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/integer/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/integer/inflections.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/integer/multiple.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/integer/multiple.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/integer/multiple.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/integer/multiple.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/integer/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/integer/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/integer/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/integer/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/kernel.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/kernel.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/kernel.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/kernel.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/kernel/concern.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/kernel/concern.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/kernel/concern.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/kernel/concern.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/kernel/reporting.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/kernel/reporting.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/kernel/reporting.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/kernel/reporting.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/kernel/singleton_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/kernel/singleton_class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/kernel/singleton_class.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/kernel/singleton_class.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/load_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/load_error.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/load_error.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/load_error.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/marshal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/marshal.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/marshal.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/marshal.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/aliasing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/aliasing.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/aliasing.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/aliasing.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/anonymous.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/anonymous.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/anonymous.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/anonymous.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/attr_internal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/attr_internal.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/attr_internal.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/attr_internal.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/attribute_accessors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/attribute_accessors.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/attribute_accessors.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/attribute_accessors.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/concerning.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/concerning.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/concerning.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/concerning.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/delegation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/delegation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/delegation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/delegation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/deprecation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/deprecation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/deprecation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/deprecation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/introspection.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/introspection.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/introspection.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/introspection.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/redefine_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/redefine_method.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/redefine_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/redefine_method.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/remove_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/remove_method.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/module/remove_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/module/remove_method.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/name_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/name_error.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/name_error.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/name_error.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/numeric.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/numeric.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/numeric.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/numeric.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/numeric/bytes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/numeric/bytes.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/numeric/bytes.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/numeric/bytes.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/numeric/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/numeric/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/numeric/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/numeric/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/numeric/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/numeric/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/numeric/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/numeric/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/deep_dup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/deep_dup.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/deep_dup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/deep_dup.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/duplicable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/duplicable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/duplicable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/duplicable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/inclusion.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/inclusion.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/inclusion.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/inclusion.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/instance_variables.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/instance_variables.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/instance_variables.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/instance_variables.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/json.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/json.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/json.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/json.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/to_param.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/to_param.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/to_param.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/to_param.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/to_query.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/to_query.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/to_query.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/to_query.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/try.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/try.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/try.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/try.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/with_options.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/object/with_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/object/with_options.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/compare_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/compare_range.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/compare_range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/compare_range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/each.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/each.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/include_time_with_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/include_time_with_zone.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/include_time_with_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/include_time_with_zone.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/overlaps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/overlaps.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/range/overlaps.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/range/overlaps.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/regexp.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/regexp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/regexp.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/securerandom.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/securerandom.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/securerandom.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/securerandom.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/behavior.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/behavior.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/behavior.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/behavior.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/exclude.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/exclude.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/exclude.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/exclude.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/filters.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/filters.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/filters.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/filters.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/indent.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/indent.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/indent.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/indent.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/inflections.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/inflections.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/multibyte.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/multibyte.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/multibyte.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/multibyte.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/output_safety.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/output_safety.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/output_safety.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/starts_ends_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/starts_ends_with.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/starts_ends_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/starts_ends_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/strip.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/strip.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/strip.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/strip.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/string/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/string/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/symbol.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/symbol.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/symbol.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/symbol.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/symbol/starts_ends_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/symbol/starts_ends_with.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/symbol/starts_ends_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/symbol/starts_ends_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/calculations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/calculations.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/compatibility.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/compatibility.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/compatibility.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/time/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/uri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/uri.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/uri.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/core_ext/uri.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/current_attributes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/current_attributes.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/current_attributes.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/current_attributes.rb index 9be8f881c0..ec487725d4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/current_attributes.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/current_attributes.rb @@ -164,6 +164,7 @@ module ActiveSupport send(name, *args, &block) end + ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true) end attr_accessor :attributes diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/current_attributes/test_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/current_attributes/test_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/current_attributes/test_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/current_attributes/test_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/behaviors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/behaviors.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/behaviors.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/behaviors.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/constant_accessor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/constant_accessor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/constant_accessor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/constant_accessor.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/disallowed.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/disallowed.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/disallowed.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/disallowed.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/instance_delegator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/instance_delegator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/instance_delegator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/instance_delegator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/method_wrappers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/method_wrappers.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/method_wrappers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/method_wrappers.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/proxy_wrappers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/proxy_wrappers.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/proxy_wrappers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/proxy_wrappers.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/reporting.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/reporting.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/deprecation/reporting.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/deprecation/reporting.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/descendants_tracker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/descendants_tracker.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/descendants_tracker.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/descendants_tracker.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/digest.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/digest.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/digest.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/duration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/duration.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/duration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/duration.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/encrypted_configuration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/encrypted_configuration.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/encrypted_configuration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/encrypted_configuration.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/encrypted_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/encrypted_file.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/encrypted_file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/encrypted_file.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/environment_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/environment_inquirer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/environment_inquirer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/environment_inquirer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/evented_file_update_checker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/evented_file_update_checker.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/evented_file_update_checker.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/evented_file_update_checker.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/execution_wrapper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/execution_wrapper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/execution_wrapper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/execution_wrapper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/executor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/executor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/executor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/executor.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/file_update_checker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/file_update_checker.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/file_update_checker.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/file_update_checker.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/fork_tracker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/fork_tracker.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/gem_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/gem_version.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/gem_version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/gem_version.rb index 5df143a859..be787bfa2f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/gem_version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/gem_version.rb @@ -9,8 +9,8 @@ module ActiveSupport module VERSION MAJOR = 6 MINOR = 1 - TINY = 6 - PRE = "1" + TINY = 7 + PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/gzip.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/gzip.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/gzip.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/gzip.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/hash_with_indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/hash_with_indifferent_access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/hash_with_indifferent_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/hash_with_indifferent_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/i18n.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/i18n.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/i18n_railtie.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/i18n_railtie.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/i18n_railtie.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/i18n_railtie.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflections.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflections.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflector.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflector.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflector.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflector/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflector/inflections.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflector/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflector/inflections.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflector/methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflector/methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflector/methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflector/methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflector/transliterate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflector/transliterate.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/inflector/transliterate.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/inflector/transliterate.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/key_generator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/key_generator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/key_generator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/key_generator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/lazy_load_hooks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/lazy_load_hooks.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/lazy_load_hooks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/lazy_load_hooks.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/locale/en.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/locale/en.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/locale/en.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/locale/en.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/locale/en.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/locale/en.yml similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/locale/en.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/locale/en.yml diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/logger.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/logger.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/logger.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/logger_silence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/logger_silence.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/logger_silence.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/logger_silence.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/logger_thread_safe_level.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/logger_thread_safe_level.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/logger_thread_safe_level.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/logger_thread_safe_level.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/message_encryptor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/message_encryptor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/message_encryptor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/message_encryptor.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/message_verifier.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/message_verifier.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/message_verifier.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/message_verifier.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/multibyte.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/multibyte.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/multibyte.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/multibyte.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/notifications.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/notifications.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/fanout.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/notifications/fanout.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/fanout.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/notifications/fanout.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/notifications/instrumenter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/notifications/instrumenter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/option_merger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/option_merger.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/option_merger.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/option_merger.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/ordered_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/ordered_hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/ordered_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/ordered_hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/ordered_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/ordered_options.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/ordered_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/ordered_options.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/parameter_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/parameter_filter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/parameter_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/parameter_filter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/per_thread_registry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/per_thread_registry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/per_thread_registry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/per_thread_registry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/proxy_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/proxy_object.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/proxy_object.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/proxy_object.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/rails.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/rails.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/railtie.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/railtie.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/railtie.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/railtie.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/reloader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/reloader.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/reloader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/reloader.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/rescuable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/rescuable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/rescuable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/rescuable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/secure_compare_rotator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/secure_compare_rotator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/secure_compare_rotator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/secure_compare_rotator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/security_utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/security_utils.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/security_utils.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/security_utils.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/string_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/string_inquirer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/string_inquirer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/string_inquirer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/subscriber.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/subscriber.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/subscriber.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/subscriber.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/tagged_logging.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/tagged_logging.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/tagged_logging.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/tagged_logging.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/test_case.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/test_case.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/test_case.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/time_with_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/time_with_zone.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/time_with_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/time_with_zone.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/values/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/values/time_zone.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/values/time_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/values/time_zone.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/version.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/version.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/jdom.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/jdom.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/jdom.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/jdom.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/libxml.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/libxml.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/libxml.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/libxml.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/libxmlsax.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/libxmlsax.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/libxmlsax.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/libxmlsax.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/nokogiri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/nokogiri.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/nokogiri.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/nokogiri.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/nokogirisax.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/nokogirisax.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/nokogirisax.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/nokogirisax.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/rexml.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/rexml.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.6.1/lib/active_support/xml_mini/rexml.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7/lib/active_support/xml_mini/rexml.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack.rb deleted file mode 100644 index e4494e5bac..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack.rb +++ /dev/null @@ -1,141 +0,0 @@ -# frozen_string_literal: true - -# Copyright (C) 2007-2019 Leah Neukirchen -# -# Rack is freely distributable under the terms of an MIT-style license. -# See MIT-LICENSE or https://opensource.org/licenses/MIT. - -# The Rack main module, serving as a namespace for all core Rack -# modules and classes. -# -# All modules meant for use in your application are autoloaded here, -# so it should be enough just to require 'rack' in your code. - -require_relative 'rack/version' - -module Rack - HTTP_HOST = 'HTTP_HOST' - HTTP_PORT = 'HTTP_PORT' - HTTP_VERSION = 'HTTP_VERSION' - HTTPS = 'HTTPS' - PATH_INFO = 'PATH_INFO' - REQUEST_METHOD = 'REQUEST_METHOD' - REQUEST_PATH = 'REQUEST_PATH' - SCRIPT_NAME = 'SCRIPT_NAME' - QUERY_STRING = 'QUERY_STRING' - SERVER_PROTOCOL = 'SERVER_PROTOCOL' - SERVER_NAME = 'SERVER_NAME' - SERVER_PORT = 'SERVER_PORT' - CACHE_CONTROL = 'Cache-Control' - EXPIRES = 'Expires' - CONTENT_LENGTH = 'Content-Length' - CONTENT_TYPE = 'Content-Type' - SET_COOKIE = 'Set-Cookie' - TRANSFER_ENCODING = 'Transfer-Encoding' - HTTP_COOKIE = 'HTTP_COOKIE' - ETAG = 'ETag' - - # HTTP method verbs - GET = 'GET' - POST = 'POST' - PUT = 'PUT' - PATCH = 'PATCH' - DELETE = 'DELETE' - HEAD = 'HEAD' - OPTIONS = 'OPTIONS' - LINK = 'LINK' - UNLINK = 'UNLINK' - TRACE = 'TRACE' - - # Rack environment variables - RACK_VERSION = 'rack.version' - RACK_TEMPFILES = 'rack.tempfiles' - RACK_ERRORS = 'rack.errors' - RACK_LOGGER = 'rack.logger' - RACK_INPUT = 'rack.input' - RACK_SESSION = 'rack.session' - RACK_SESSION_OPTIONS = 'rack.session.options' - RACK_SHOWSTATUS_DETAIL = 'rack.showstatus.detail' - RACK_MULTITHREAD = 'rack.multithread' - RACK_MULTIPROCESS = 'rack.multiprocess' - RACK_RUNONCE = 'rack.run_once' - RACK_URL_SCHEME = 'rack.url_scheme' - RACK_HIJACK = 'rack.hijack' - RACK_IS_HIJACK = 'rack.hijack?' - RACK_HIJACK_IO = 'rack.hijack_io' - RACK_RECURSIVE_INCLUDE = 'rack.recursive.include' - RACK_MULTIPART_BUFFER_SIZE = 'rack.multipart.buffer_size' - RACK_MULTIPART_TEMPFILE_FACTORY = 'rack.multipart.tempfile_factory' - RACK_REQUEST_FORM_INPUT = 'rack.request.form_input' - RACK_REQUEST_FORM_HASH = 'rack.request.form_hash' - RACK_REQUEST_FORM_VARS = 'rack.request.form_vars' - RACK_REQUEST_COOKIE_HASH = 'rack.request.cookie_hash' - RACK_REQUEST_COOKIE_STRING = 'rack.request.cookie_string' - RACK_REQUEST_QUERY_HASH = 'rack.request.query_hash' - RACK_REQUEST_QUERY_STRING = 'rack.request.query_string' - RACK_METHODOVERRIDE_ORIGINAL_METHOD = 'rack.methodoverride.original_method' - RACK_SESSION_UNPACKED_COOKIE_DATA = 'rack.session.unpacked_cookie_data' - - autoload :Builder, "rack/builder" - autoload :BodyProxy, "rack/body_proxy" - autoload :Cascade, "rack/cascade" - autoload :Chunked, "rack/chunked" - autoload :CommonLogger, "rack/common_logger" - autoload :ConditionalGet, "rack/conditional_get" - autoload :Config, "rack/config" - autoload :ContentLength, "rack/content_length" - autoload :ContentType, "rack/content_type" - autoload :ETag, "rack/etag" - autoload :Events, "rack/events" - autoload :File, "rack/file" - autoload :Files, "rack/files" - autoload :Deflater, "rack/deflater" - autoload :Directory, "rack/directory" - autoload :ForwardRequest, "rack/recursive" - autoload :Handler, "rack/handler" - autoload :Head, "rack/head" - autoload :Lint, "rack/lint" - autoload :Lock, "rack/lock" - autoload :Logger, "rack/logger" - autoload :MediaType, "rack/media_type" - autoload :MethodOverride, "rack/method_override" - autoload :Mime, "rack/mime" - autoload :NullLogger, "rack/null_logger" - autoload :Recursive, "rack/recursive" - autoload :Reloader, "rack/reloader" - autoload :RewindableInput, "rack/rewindable_input" - autoload :Runtime, "rack/runtime" - autoload :Sendfile, "rack/sendfile" - autoload :Server, "rack/server" - autoload :ShowExceptions, "rack/show_exceptions" - autoload :ShowStatus, "rack/show_status" - autoload :Static, "rack/static" - autoload :TempfileReaper, "rack/tempfile_reaper" - autoload :URLMap, "rack/urlmap" - autoload :Utils, "rack/utils" - autoload :Multipart, "rack/multipart" - - autoload :MockRequest, "rack/mock" - autoload :MockResponse, "rack/mock" - - autoload :Request, "rack/request" - autoload :Response, "rack/response" - - module Auth - autoload :Basic, "rack/auth/basic" - autoload :AbstractRequest, "rack/auth/abstract/request" - autoload :AbstractHandler, "rack/auth/abstract/handler" - module Digest - autoload :MD5, "rack/auth/digest/md5" - autoload :Nonce, "rack/auth/digest/nonce" - autoload :Params, "rack/auth/digest/params" - autoload :Request, "rack/auth/digest/request" - end - end - - module Session - autoload :Cookie, "rack/session/cookie" - autoload :Pool, "rack/session/pool" - autoload :Memcache, "rack/session/memcache" - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/md5.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/md5.rb deleted file mode 100644 index 04b103e258..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/md5.rb +++ /dev/null @@ -1,131 +0,0 @@ -# frozen_string_literal: true - -require_relative '../abstract/handler' -require_relative 'request' -require_relative 'params' -require_relative 'nonce' -require 'digest/md5' - -module Rack - module Auth - module Digest - # Rack::Auth::Digest::MD5 implements the MD5 algorithm version of - # HTTP Digest Authentication, as per RFC 2617. - # - # Initialize with the [Rack] application that you want protecting, - # and a block that looks up a plaintext password for a given username. - # - # +opaque+ needs to be set to a constant base64/hexadecimal string. - # - class MD5 < AbstractHandler - - attr_accessor :opaque - - attr_writer :passwords_hashed - - def initialize(app, realm = nil, opaque = nil, &authenticator) - @passwords_hashed = nil - if opaque.nil? and realm.respond_to? :values_at - realm, opaque, @passwords_hashed = realm.values_at :realm, :opaque, :passwords_hashed - end - super(app, realm, &authenticator) - @opaque = opaque - end - - def passwords_hashed? - !!@passwords_hashed - end - - def call(env) - auth = Request.new(env) - - unless auth.provided? - return unauthorized - end - - if !auth.digest? || !auth.correct_uri? || !valid_qop?(auth) - return bad_request - end - - if valid?(auth) - if auth.nonce.stale? - return unauthorized(challenge(stale: true)) - else - env['REMOTE_USER'] = auth.username - - return @app.call(env) - end - end - - unauthorized - end - - - private - - QOP = 'auth' - - def params(hash = {}) - Params.new do |params| - params['realm'] = realm - params['nonce'] = Nonce.new.to_s - params['opaque'] = H(opaque) - params['qop'] = QOP - - hash.each { |k, v| params[k] = v } - end - end - - def challenge(hash = {}) - "Digest #{params(hash)}" - end - - def valid?(auth) - valid_opaque?(auth) && valid_nonce?(auth) && valid_digest?(auth) - end - - def valid_qop?(auth) - QOP == auth.qop - end - - def valid_opaque?(auth) - H(opaque) == auth.opaque - end - - def valid_nonce?(auth) - auth.nonce.valid? - end - - def valid_digest?(auth) - pw = @authenticator.call(auth.username) - pw && Rack::Utils.secure_compare(digest(auth, pw), auth.response) - end - - def md5(data) - ::Digest::MD5.hexdigest(data) - end - - alias :H :md5 - - def KD(secret, data) - H "#{secret}:#{data}" - end - - def A1(auth, password) - "#{auth.username}:#{auth.realm}:#{password}" - end - - def A2(auth) - "#{auth.method}:#{auth.uri}" - end - - def digest(auth, password) - password_hash = passwords_hashed? ? password : H(A1(auth, password)) - - KD password_hash, "#{auth.nonce}:#{auth.nc}:#{auth.cnonce}:#{QOP}:#{H A2(auth)}" - end - - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/nonce.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/nonce.rb deleted file mode 100644 index 3216d973e0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/nonce.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -require 'digest/md5' -require 'base64' - -module Rack - module Auth - module Digest - # Rack::Auth::Digest::Nonce is the default nonce generator for the - # Rack::Auth::Digest::MD5 authentication handler. - # - # +private_key+ needs to set to a constant string. - # - # +time_limit+ can be optionally set to an integer (number of seconds), - # to limit the validity of the generated nonces. - - class Nonce - - class << self - attr_accessor :private_key, :time_limit - end - - def self.parse(string) - new(*Base64.decode64(string).split(' ', 2)) - end - - def initialize(timestamp = Time.now, given_digest = nil) - @timestamp, @given_digest = timestamp.to_i, given_digest - end - - def to_s - Base64.encode64("#{@timestamp} #{digest}").strip - end - - def digest - ::Digest::MD5.hexdigest("#{@timestamp}:#{self.class.private_key}") - end - - def valid? - digest == @given_digest - end - - def stale? - !self.class.time_limit.nil? && (Time.now.to_i - @timestamp) > self.class.time_limit - end - - def fresh? - !stale? - end - - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/params.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/params.rb deleted file mode 100644 index f611b3c35e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/params.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -module Rack - module Auth - module Digest - class Params < Hash - - def self.parse(str) - Params[*split_header_value(str).map do |param| - k, v = param.split('=', 2) - [k, dequote(v)] - end.flatten] - end - - def self.dequote(str) # From WEBrick::HTTPUtils - ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup - ret.gsub!(/\\(.)/, "\\1") - ret - end - - def self.split_header_value(str) - str.scan(/\w+\=(?:"[^\"]+"|[^,]+)/n) - end - - def initialize - super() - - yield self if block_given? - end - - def [](k) - super k.to_s - end - - def []=(k, v) - super k.to_s, v.to_s - end - - UNQUOTED = ['nc', 'stale'] - - def to_s - map do |k, v| - "#{k}=#{(UNQUOTED.include?(k) ? v.to_s : quote(v))}" - end.join(', ') - end - - def quote(str) # From WEBrick::HTTPUtils - '"' + str.gsub(/[\\\"]/o, "\\\1") + '"' - end - - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/request.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/request.rb deleted file mode 100644 index 7b89b76052..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/digest/request.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -require_relative '../abstract/request' -require_relative 'params' -require_relative 'nonce' - -module Rack - module Auth - module Digest - class Request < Auth::AbstractRequest - def method - @env[RACK_METHODOVERRIDE_ORIGINAL_METHOD] || @env[REQUEST_METHOD] - end - - def digest? - "digest" == scheme - end - - def correct_uri? - request.fullpath == uri - end - - def nonce - @nonce ||= Nonce.parse(params['nonce']) - end - - def params - @params ||= Params.parse(parts.last) - end - - def respond_to?(sym, *) - super or params.has_key? sym.to_s - end - - def method_missing(sym, *args) - return super unless params.has_key?(key = sym.to_s) - return params[key] if args.size == 0 - raise ArgumentError, "wrong number of arguments (#{args.size} for 0)" - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/content_length.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/content_length.rb deleted file mode 100644 index 9e2b5fc42a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/content_length.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module Rack - - # Sets the Content-Length header on responses that do not specify - # a Content-Length or Transfer-Encoding header. Note that this - # does not fix responses that have an invalid Content-Length - # header specified. - class ContentLength - include Rack::Utils - - def initialize(app) - @app = app - end - - def call(env) - status, headers, body = @app.call(env) - headers = HeaderHash[headers] - - if !STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) && - !headers[CONTENT_LENGTH] && - !headers[TRANSFER_ENCODING] - - obody = body - body, length = [], 0 - obody.each { |part| body << part; length += part.bytesize } - - body = BodyProxy.new(body) do - obody.close if obody.respond_to?(:close) - end - - headers[CONTENT_LENGTH] = length.to_s - end - - [status, headers, body] - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/core_ext/regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/core_ext/regexp.rb deleted file mode 100644 index a32fcdf629..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/core_ext/regexp.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -# Regexp has `match?` since Ruby 2.4 -# so to support Ruby < 2.4 we need to define this method - -module Rack - module RegexpExtensions - refine Regexp do - def match?(string, pos = 0) - !!match(string, pos) - end - end unless //.respond_to?(:match?) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler.rb deleted file mode 100644 index df17b238dd..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler.rb +++ /dev/null @@ -1,104 +0,0 @@ -# frozen_string_literal: true - -module Rack - # *Handlers* connect web servers with Rack. - # - # Rack includes Handlers for Thin, WEBrick, FastCGI, CGI, SCGI - # and LiteSpeed. - # - # Handlers usually are activated by calling MyHandler.run(myapp). - # A second optional hash can be passed to include server-specific - # configuration. - module Handler - def self.get(server) - return unless server - server = server.to_s - - unless @handlers.include? server - load_error = try_require('rack/handler', server) - end - - if klass = @handlers[server] - const_get(klass) - else - const_get(server, false) - end - - rescue NameError => name_error - raise load_error || name_error - end - - # Select first available Rack handler given an `Array` of server names. - # Raises `LoadError` if no handler was found. - # - # > pick ['thin', 'webrick'] - # => Rack::Handler::WEBrick - def self.pick(server_names) - server_names = Array(server_names) - server_names.each do |server_name| - begin - return get(server_name.to_s) - rescue LoadError, NameError - end - end - - raise LoadError, "Couldn't find handler for: #{server_names.join(', ')}." - end - - SERVER_NAMES = %w(puma thin falcon webrick).freeze - private_constant :SERVER_NAMES - - def self.default - # Guess. - if ENV.include?("PHP_FCGI_CHILDREN") - Rack::Handler::FastCGI - elsif ENV.include?(REQUEST_METHOD) - Rack::Handler::CGI - elsif ENV.include?("RACK_HANDLER") - self.get(ENV["RACK_HANDLER"]) - else - pick SERVER_NAMES - end - end - - # Transforms server-name constants to their canonical form as filenames, - # then tries to require them but silences the LoadError if not found - # - # Naming convention: - # - # Foo # => 'foo' - # FooBar # => 'foo_bar.rb' - # FooBAR # => 'foobar.rb' - # FOObar # => 'foobar.rb' - # FOOBAR # => 'foobar.rb' - # FooBarBaz # => 'foo_bar_baz.rb' - def self.try_require(prefix, const_name) - file = const_name.gsub(/^[A-Z]+/) { |pre| pre.downcase }. - gsub(/[A-Z]+[^A-Z]/, '_\&').downcase - - require(::File.join(prefix, file)) - nil - rescue LoadError => error - error - end - - def self.register(server, klass) - @handlers ||= {} - @handlers[server.to_s] = klass.to_s - end - - autoload :CGI, "rack/handler/cgi" - autoload :FastCGI, "rack/handler/fastcgi" - autoload :WEBrick, "rack/handler/webrick" - autoload :LSWS, "rack/handler/lsws" - autoload :SCGI, "rack/handler/scgi" - autoload :Thin, "rack/handler/thin" - - register 'cgi', 'Rack::Handler::CGI' - register 'fastcgi', 'Rack::Handler::FastCGI' - register 'webrick', 'Rack::Handler::WEBrick' - register 'lsws', 'Rack::Handler::LSWS' - register 'scgi', 'Rack::Handler::SCGI' - register 'thin', 'Rack::Handler::Thin' - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/cgi.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/cgi.rb deleted file mode 100644 index 1c11ab3606..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/cgi.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -module Rack - module Handler - class CGI - def self.run(app, **options) - $stdin.binmode - serve app - end - - def self.serve(app) - env = ENV.to_hash - env.delete "HTTP_CONTENT_LENGTH" - - env[SCRIPT_NAME] = "" if env[SCRIPT_NAME] == "/" - - env.update( - RACK_VERSION => Rack::VERSION, - RACK_INPUT => Rack::RewindableInput.new($stdin), - RACK_ERRORS => $stderr, - RACK_MULTITHREAD => false, - RACK_MULTIPROCESS => true, - RACK_RUNONCE => true, - RACK_URL_SCHEME => ["yes", "on", "1"].include?(ENV[HTTPS]) ? "https" : "http" - ) - - env[QUERY_STRING] ||= "" - env[HTTP_VERSION] ||= env[SERVER_PROTOCOL] - env[REQUEST_PATH] ||= "/" - - status, headers, body = app.call(env) - begin - send_headers status, headers - send_body body - ensure - body.close if body.respond_to? :close - end - end - - def self.send_headers(status, headers) - $stdout.print "Status: #{status}\r\n" - headers.each { |k, vs| - vs.split("\n").each { |v| - $stdout.print "#{k}: #{v}\r\n" - } - } - $stdout.print "\r\n" - $stdout.flush - end - - def self.send_body(body) - body.each { |part| - $stdout.print part - $stdout.flush - } - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/fastcgi.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/fastcgi.rb deleted file mode 100644 index 1df123e02a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/fastcgi.rb +++ /dev/null @@ -1,100 +0,0 @@ -# frozen_string_literal: true - -require 'fcgi' -require 'socket' - -if defined? FCGI::Stream - class FCGI::Stream - alias _rack_read_without_buffer read - - def read(n, buffer = nil) - buf = _rack_read_without_buffer n - buffer.replace(buf.to_s) if buffer - buf - end - end -end - -module Rack - module Handler - class FastCGI - def self.run(app, **options) - if options[:File] - STDIN.reopen(UNIXServer.new(options[:File])) - elsif options[:Port] - STDIN.reopen(TCPServer.new(options[:Host], options[:Port])) - end - FCGI.each { |request| - serve request, app - } - end - - def self.valid_options - environment = ENV['RACK_ENV'] || 'development' - default_host = environment == 'development' ? 'localhost' : '0.0.0.0' - - { - "Host=HOST" => "Hostname to listen on (default: #{default_host})", - "Port=PORT" => "Port to listen on (default: 8080)", - "File=PATH" => "Creates a Domain socket at PATH instead of a TCP socket. Ignores Host and Port if set.", - } - end - - def self.serve(request, app) - env = request.env - env.delete "HTTP_CONTENT_LENGTH" - - env[SCRIPT_NAME] = "" if env[SCRIPT_NAME] == "/" - - rack_input = RewindableInput.new(request.in) - - env.update( - RACK_VERSION => Rack::VERSION, - RACK_INPUT => rack_input, - RACK_ERRORS => request.err, - RACK_MULTITHREAD => false, - RACK_MULTIPROCESS => true, - RACK_RUNONCE => false, - RACK_URL_SCHEME => ["yes", "on", "1"].include?(env[HTTPS]) ? "https" : "http" - ) - - env[QUERY_STRING] ||= "" - env[HTTP_VERSION] ||= env[SERVER_PROTOCOL] - env[REQUEST_PATH] ||= "/" - env.delete "CONTENT_TYPE" if env["CONTENT_TYPE"] == "" - env.delete "CONTENT_LENGTH" if env["CONTENT_LENGTH"] == "" - - begin - status, headers, body = app.call(env) - begin - send_headers request.out, status, headers - send_body request.out, body - ensure - body.close if body.respond_to? :close - end - ensure - rack_input.close - request.finish - end - end - - def self.send_headers(out, status, headers) - out.print "Status: #{status}\r\n" - headers.each { |k, vs| - vs.split("\n").each { |v| - out.print "#{k}: #{v}\r\n" - } - } - out.print "\r\n" - out.flush - end - - def self.send_body(out, body) - body.each { |part| - out.print part - out.flush - } - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/lsws.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/lsws.rb deleted file mode 100644 index f12090bd62..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/lsws.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -require 'lsapi' - -module Rack - module Handler - class LSWS - def self.run(app, **options) - while LSAPI.accept != nil - serve app - end - end - def self.serve(app) - env = ENV.to_hash - env.delete "HTTP_CONTENT_LENGTH" - env[SCRIPT_NAME] = "" if env[SCRIPT_NAME] == "/" - - rack_input = RewindableInput.new($stdin.read.to_s) - - env.update( - RACK_VERSION => Rack::VERSION, - RACK_INPUT => rack_input, - RACK_ERRORS => $stderr, - RACK_MULTITHREAD => false, - RACK_MULTIPROCESS => true, - RACK_RUNONCE => false, - RACK_URL_SCHEME => ["yes", "on", "1"].include?(ENV[HTTPS]) ? "https" : "http" - ) - - env[QUERY_STRING] ||= "" - env[HTTP_VERSION] ||= env[SERVER_PROTOCOL] - env[REQUEST_PATH] ||= "/" - status, headers, body = app.call(env) - begin - send_headers status, headers - send_body body - ensure - body.close if body.respond_to? :close - end - ensure - rack_input.close - end - def self.send_headers(status, headers) - print "Status: #{status}\r\n" - headers.each { |k, vs| - vs.split("\n").each { |v| - print "#{k}: #{v}\r\n" - } - } - print "\r\n" - STDOUT.flush - end - def self.send_body(body) - body.each { |part| - print part - STDOUT.flush - } - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/scgi.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/scgi.rb deleted file mode 100644 index e3b8d3c6f2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/scgi.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -require 'scgi' -require 'stringio' - -module Rack - module Handler - class SCGI < ::SCGI::Processor - attr_accessor :app - - def self.run(app, **options) - options[:Socket] = UNIXServer.new(options[:File]) if options[:File] - new(options.merge(app: app, - host: options[:Host], - port: options[:Port], - socket: options[:Socket])).listen - end - - def self.valid_options - environment = ENV['RACK_ENV'] || 'development' - default_host = environment == 'development' ? 'localhost' : '0.0.0.0' - - { - "Host=HOST" => "Hostname to listen on (default: #{default_host})", - "Port=PORT" => "Port to listen on (default: 8080)", - } - end - - def initialize(settings = {}) - @app = settings[:app] - super(settings) - end - - def process_request(request, input_body, socket) - env = Hash[request] - env.delete "HTTP_CONTENT_TYPE" - env.delete "HTTP_CONTENT_LENGTH" - env[REQUEST_PATH], env[QUERY_STRING] = env["REQUEST_URI"].split('?', 2) - env[HTTP_VERSION] ||= env[SERVER_PROTOCOL] - env[PATH_INFO] = env[REQUEST_PATH] - env[QUERY_STRING] ||= "" - env[SCRIPT_NAME] = "" - - rack_input = StringIO.new(input_body) - rack_input.set_encoding(Encoding::BINARY) - - env.update( - RACK_VERSION => Rack::VERSION, - RACK_INPUT => rack_input, - RACK_ERRORS => $stderr, - RACK_MULTITHREAD => true, - RACK_MULTIPROCESS => true, - RACK_RUNONCE => false, - RACK_URL_SCHEME => ["yes", "on", "1"].include?(env[HTTPS]) ? "https" : "http" - ) - - status, headers, body = app.call(env) - begin - socket.write("Status: #{status}\r\n") - headers.each do |k, vs| - vs.split("\n").each { |v| socket.write("#{k}: #{v}\r\n")} - end - socket.write("\r\n") - body.each {|s| socket.write(s)} - ensure - body.close if body.respond_to? :close - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/thin.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/thin.rb deleted file mode 100644 index 393a6e9869..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/thin.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require "thin" -require "thin/server" -require "thin/logging" -require "thin/backends/tcp_server" - -module Rack - module Handler - class Thin - def self.run(app, **options) - environment = ENV['RACK_ENV'] || 'development' - default_host = environment == 'development' ? 'localhost' : '0.0.0.0' - - host = options.delete(:Host) || default_host - port = options.delete(:Port) || 8080 - args = [host, port, app, options] - # Thin versions below 0.8.0 do not support additional options - args.pop if ::Thin::VERSION::MAJOR < 1 && ::Thin::VERSION::MINOR < 8 - server = ::Thin::Server.new(*args) - yield server if block_given? - server.start - end - - def self.valid_options - environment = ENV['RACK_ENV'] || 'development' - default_host = environment == 'development' ? 'localhost' : '0.0.0.0' - - { - "Host=HOST" => "Hostname to listen on (default: #{default_host})", - "Port=PORT" => "Port to listen on (default: 8080)", - } - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/webrick.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/webrick.rb deleted file mode 100644 index d2f389758a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/handler/webrick.rb +++ /dev/null @@ -1,129 +0,0 @@ -# frozen_string_literal: true - -require 'webrick' -require 'stringio' - -# This monkey patch allows for applications to perform their own chunking -# through WEBrick::HTTPResponse if rack is set to true. -class WEBrick::HTTPResponse - attr_accessor :rack - - alias _rack_setup_header setup_header - def setup_header - app_chunking = rack && @header['transfer-encoding'] == 'chunked' - - @chunked = app_chunking if app_chunking - - _rack_setup_header - - @chunked = false if app_chunking - end -end - -module Rack - module Handler - class WEBrick < ::WEBrick::HTTPServlet::AbstractServlet - def self.run(app, **options) - environment = ENV['RACK_ENV'] || 'development' - default_host = environment == 'development' ? 'localhost' : nil - - if !options[:BindAddress] || options[:Host] - options[:BindAddress] = options.delete(:Host) || default_host - end - options[:Port] ||= 8080 - if options[:SSLEnable] - require 'webrick/https' - end - - @server = ::WEBrick::HTTPServer.new(options) - @server.mount "/", Rack::Handler::WEBrick, app - yield @server if block_given? - @server.start - end - - def self.valid_options - environment = ENV['RACK_ENV'] || 'development' - default_host = environment == 'development' ? 'localhost' : '0.0.0.0' - - { - "Host=HOST" => "Hostname to listen on (default: #{default_host})", - "Port=PORT" => "Port to listen on (default: 8080)", - } - end - - def self.shutdown - if @server - @server.shutdown - @server = nil - end - end - - def initialize(server, app) - super server - @app = app - end - - def service(req, res) - res.rack = true - env = req.meta_vars - env.delete_if { |k, v| v.nil? } - - rack_input = StringIO.new(req.body.to_s) - rack_input.set_encoding(Encoding::BINARY) - - env.update( - RACK_VERSION => Rack::VERSION, - RACK_INPUT => rack_input, - RACK_ERRORS => $stderr, - RACK_MULTITHREAD => true, - RACK_MULTIPROCESS => false, - RACK_RUNONCE => false, - RACK_URL_SCHEME => ["yes", "on", "1"].include?(env[HTTPS]) ? "https" : "http", - RACK_IS_HIJACK => true, - RACK_HIJACK => lambda { raise NotImplementedError, "only partial hijack is supported."}, - RACK_HIJACK_IO => nil - ) - - env[HTTP_VERSION] ||= env[SERVER_PROTOCOL] - env[QUERY_STRING] ||= "" - unless env[PATH_INFO] == "" - path, n = req.request_uri.path, env[SCRIPT_NAME].length - env[PATH_INFO] = path[n, path.length - n] - end - env[REQUEST_PATH] ||= [env[SCRIPT_NAME], env[PATH_INFO]].join - - status, headers, body = @app.call(env) - begin - res.status = status.to_i - io_lambda = nil - headers.each { |k, vs| - if k == RACK_HIJACK - io_lambda = vs - elsif k.downcase == "set-cookie" - res.cookies.concat vs.split("\n") - else - # Since WEBrick won't accept repeated headers, - # merge the values per RFC 1945 section 4.2. - res[k] = vs.split("\n").join(", ") - end - } - - if io_lambda - rd, wr = IO.pipe - res.body = rd - res.chunked = true - io_lambda.call wr - elsif body.respond_to?(:to_path) - res.body = ::File.open(body.to_path, 'rb') - else - body.each { |part| - res.body << part - } - end - ensure - body.close if body.respond_to? :close - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/lint.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/lint.rb deleted file mode 100644 index 67d2eb1294..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/lint.rb +++ /dev/null @@ -1,806 +0,0 @@ -# frozen_string_literal: true - -require 'forwardable' - -module Rack - # Rack::Lint validates your application and the requests and - # responses according to the Rack spec. - - class Lint - def initialize(app) - @app = app - @content_length = nil - end - - # :stopdoc: - - class LintError < RuntimeError; end - module Assertion - def assert(message) - unless yield - raise LintError, message - end - end - end - include Assertion - - ## This specification aims to formalize the Rack protocol. You - ## can (and should) use Rack::Lint to enforce it. - ## - ## When you develop middleware, be sure to add a Lint before and - ## after to catch all mistakes. - - ## = Rack applications - - ## A Rack application is a Ruby object (not a class) that - ## responds to +call+. - def call(env = nil) - dup._call(env) - end - - def _call(env) - ## It takes exactly one argument, the *environment* - assert("No env given") { env } - check_env env - - env[RACK_INPUT] = InputWrapper.new(env[RACK_INPUT]) - env[RACK_ERRORS] = ErrorWrapper.new(env[RACK_ERRORS]) - - ## and returns an Array of exactly three values: - ary = @app.call(env) - assert("response is not an Array, but #{ary.class}") { - ary.kind_of? Array - } - assert("response array has #{ary.size} elements instead of 3") { - ary.size == 3 - } - - status, headers, @body = ary - ## The *status*, - check_status status - ## the *headers*, - check_headers headers - - hijack_proc = check_hijack_response headers, env - if hijack_proc && headers.is_a?(Hash) - headers[RACK_HIJACK] = hijack_proc - end - - ## and the *body*. - check_content_type status, headers - check_content_length status, headers - @head_request = env[REQUEST_METHOD] == HEAD - [status, headers, self] - end - - ## == The Environment - def check_env(env) - ## The environment must be an unfrozen instance of Hash that includes - ## CGI-like headers. The application is free to modify the - ## environment. - assert("env #{env.inspect} is not a Hash, but #{env.class}") { - env.kind_of? Hash - } - assert("env should not be frozen, but is") { - !env.frozen? - } - - ## - ## The environment is required to include these variables - ## (adopted from PEP333), except when they'd be empty, but see - ## below. - - ## REQUEST_METHOD:: The HTTP request method, such as - ## "GET" or "POST". This cannot ever - ## be an empty string, and so is - ## always required. - - ## SCRIPT_NAME:: The initial portion of the request - ## URL's "path" that corresponds to the - ## application object, so that the - ## application knows its virtual - ## "location". This may be an empty - ## string, if the application corresponds - ## to the "root" of the server. - - ## PATH_INFO:: The remainder of the request URL's - ## "path", designating the virtual - ## "location" of the request's target - ## within the application. This may be an - ## empty string, if the request URL targets - ## the application root and does not have a - ## trailing slash. This value may be - ## percent-encoded when originating from - ## a URL. - - ## QUERY_STRING:: The portion of the request URL that - ## follows the ?, if any. May be - ## empty, but is always required! - - ## SERVER_NAME:: When combined with SCRIPT_NAME and - ## PATH_INFO, these variables can be - ## used to complete the URL. Note, however, - ## that HTTP_HOST, if present, - ## should be used in preference to - ## SERVER_NAME for reconstructing - ## the request URL. - ## SERVER_NAME can never be an empty - ## string, and so is always required. - - ## SERVER_PORT:: An optional +Integer+ which is the port the - ## server is running on. Should be specified if - ## the server is running on a non-standard port. - - ## HTTP_ Variables:: Variables corresponding to the - ## client-supplied HTTP request - ## headers (i.e., variables whose - ## names begin with HTTP_). The - ## presence or absence of these - ## variables should correspond with - ## the presence or absence of the - ## appropriate HTTP header in the - ## request. See - ## {RFC3875 section 4.1.18}[https://tools.ietf.org/html/rfc3875#section-4.1.18] - ## for specific behavior. - - ## In addition to this, the Rack environment must include these - ## Rack-specific variables: - - ## rack.version:: The Array representing this version of Rack - ## See Rack::VERSION, that corresponds to - ## the version of this SPEC. - - ## rack.url_scheme:: +http+ or +https+, depending on the - ## request URL. - - ## rack.input:: See below, the input stream. - - ## rack.errors:: See below, the error stream. - - ## rack.multithread:: true if the application object may be - ## simultaneously invoked by another thread - ## in the same process, false otherwise. - - ## rack.multiprocess:: true if an equivalent application object - ## may be simultaneously invoked by another - ## process, false otherwise. - - ## rack.run_once:: true if the server expects - ## (but does not guarantee!) that the - ## application will only be invoked this one - ## time during the life of its containing - ## process. Normally, this will only be true - ## for a server based on CGI - ## (or something similar). - - ## rack.hijack?:: present and true if the server supports - ## connection hijacking. See below, hijacking. - - ## rack.hijack:: an object responding to #call that must be - ## called at least once before using - ## rack.hijack_io. - ## It is recommended #call return rack.hijack_io - ## as well as setting it in env if necessary. - - ## rack.hijack_io:: if rack.hijack? is true, and rack.hijack - ## has received #call, this will contain - ## an object resembling an IO. See hijacking. - - ## Additional environment specifications have approved to - ## standardized middleware APIs. None of these are required to - ## be implemented by the server. - - ## rack.session:: A hash like interface for storing - ## request session data. - ## The store must implement: - if session = env[RACK_SESSION] - ## store(key, value) (aliased as []=); - assert("session #{session.inspect} must respond to store and []=") { - session.respond_to?(:store) && session.respond_to?(:[]=) - } - - ## fetch(key, default = nil) (aliased as []); - assert("session #{session.inspect} must respond to fetch and []") { - session.respond_to?(:fetch) && session.respond_to?(:[]) - } - - ## delete(key); - assert("session #{session.inspect} must respond to delete") { - session.respond_to?(:delete) - } - - ## clear; - assert("session #{session.inspect} must respond to clear") { - session.respond_to?(:clear) - } - - ## to_hash (returning unfrozen Hash instance); - assert("session #{session.inspect} must respond to to_hash and return unfrozen Hash instance") { - session.respond_to?(:to_hash) && session.to_hash.kind_of?(Hash) && !session.to_hash.frozen? - } - end - - ## rack.logger:: A common object interface for logging messages. - ## The object must implement: - if logger = env[RACK_LOGGER] - ## info(message, &block) - assert("logger #{logger.inspect} must respond to info") { - logger.respond_to?(:info) - } - - ## debug(message, &block) - assert("logger #{logger.inspect} must respond to debug") { - logger.respond_to?(:debug) - } - - ## warn(message, &block) - assert("logger #{logger.inspect} must respond to warn") { - logger.respond_to?(:warn) - } - - ## error(message, &block) - assert("logger #{logger.inspect} must respond to error") { - logger.respond_to?(:error) - } - - ## fatal(message, &block) - assert("logger #{logger.inspect} must respond to fatal") { - logger.respond_to?(:fatal) - } - end - - ## rack.multipart.buffer_size:: An Integer hint to the multipart parser as to what chunk size to use for reads and writes. - if bufsize = env[RACK_MULTIPART_BUFFER_SIZE] - assert("rack.multipart.buffer_size must be an Integer > 0 if specified") { - bufsize.is_a?(Integer) && bufsize > 0 - } - end - - ## rack.multipart.tempfile_factory:: An object responding to #call with two arguments, the filename and content_type given for the multipart form field, and returning an IO-like object that responds to #<< and optionally #rewind. This factory will be used to instantiate the tempfile for each multipart form file upload field, rather than the default class of Tempfile. - if tempfile_factory = env[RACK_MULTIPART_TEMPFILE_FACTORY] - assert("rack.multipart.tempfile_factory must respond to #call") { tempfile_factory.respond_to?(:call) } - env[RACK_MULTIPART_TEMPFILE_FACTORY] = lambda do |filename, content_type| - io = tempfile_factory.call(filename, content_type) - assert("rack.multipart.tempfile_factory return value must respond to #<<") { io.respond_to?(:<<) } - io - end - end - - ## The server or the application can store their own data in the - ## environment, too. The keys must contain at least one dot, - ## and should be prefixed uniquely. The prefix rack. - ## is reserved for use with the Rack core distribution and other - ## accepted specifications and must not be used otherwise. - ## - - %w[REQUEST_METHOD SERVER_NAME QUERY_STRING - rack.version rack.input rack.errors - rack.multithread rack.multiprocess rack.run_once].each { |header| - assert("env missing required key #{header}") { env.include? header } - } - - ## The SERVER_PORT must be an Integer if set. - assert("env[SERVER_PORT] is not an Integer") do - server_port = env["SERVER_PORT"] - server_port.nil? || (Integer(server_port) rescue false) - end - - ## The SERVER_NAME must be a valid authority as defined by RFC7540. - assert("#{env[SERVER_NAME]} must be a valid authority") do - URI.parse("http://#{env[SERVER_NAME]}/") rescue false - end - - ## The HTTP_HOST must be a valid authority as defined by RFC7540. - assert("#{env[HTTP_HOST]} must be a valid authority") do - URI.parse("http://#{env[HTTP_HOST]}/") rescue false - end - - ## The environment must not contain the keys - ## HTTP_CONTENT_TYPE or HTTP_CONTENT_LENGTH - ## (use the versions without HTTP_). - %w[HTTP_CONTENT_TYPE HTTP_CONTENT_LENGTH].each { |header| - assert("env contains #{header}, must use #{header[5, -1]}") { - not env.include? header - } - } - - ## The CGI keys (named without a period) must have String values. - ## If the string values for CGI keys contain non-ASCII characters, - ## they should use ASCII-8BIT encoding. - env.each { |key, value| - next if key.include? "." # Skip extensions - assert("env variable #{key} has non-string value #{value.inspect}") { - value.kind_of? String - } - next if value.encoding == Encoding::ASCII_8BIT - assert("env variable #{key} has value containing non-ASCII characters and has non-ASCII-8BIT encoding #{value.inspect} encoding: #{value.encoding}") { - value.b !~ /[\x80-\xff]/n - } - } - - ## There are the following restrictions: - - ## * rack.version must be an array of Integers. - assert("rack.version must be an Array, was #{env[RACK_VERSION].class}") { - env[RACK_VERSION].kind_of? Array - } - ## * rack.url_scheme must either be +http+ or +https+. - assert("rack.url_scheme unknown: #{env[RACK_URL_SCHEME].inspect}") { - %w[http https].include?(env[RACK_URL_SCHEME]) - } - - ## * There must be a valid input stream in rack.input. - check_input env[RACK_INPUT] - ## * There must be a valid error stream in rack.errors. - check_error env[RACK_ERRORS] - ## * There may be a valid hijack stream in rack.hijack_io - check_hijack env - - ## * The REQUEST_METHOD must be a valid token. - assert("REQUEST_METHOD unknown: #{env[REQUEST_METHOD].dump}") { - env[REQUEST_METHOD] =~ /\A[0-9A-Za-z!\#$%&'*+.^_`|~-]+\z/ - } - - ## * The SCRIPT_NAME, if non-empty, must start with / - assert("SCRIPT_NAME must start with /") { - !env.include?(SCRIPT_NAME) || - env[SCRIPT_NAME] == "" || - env[SCRIPT_NAME] =~ /\A\// - } - ## * The PATH_INFO, if non-empty, must start with / - assert("PATH_INFO must start with /") { - !env.include?(PATH_INFO) || - env[PATH_INFO] == "" || - env[PATH_INFO] =~ /\A\// - } - ## * The CONTENT_LENGTH, if given, must consist of digits only. - assert("Invalid CONTENT_LENGTH: #{env["CONTENT_LENGTH"]}") { - !env.include?("CONTENT_LENGTH") || env["CONTENT_LENGTH"] =~ /\A\d+\z/ - } - - ## * One of SCRIPT_NAME or PATH_INFO must be - ## set. PATH_INFO should be / if - ## SCRIPT_NAME is empty. - assert("One of SCRIPT_NAME or PATH_INFO must be set (make PATH_INFO '/' if SCRIPT_NAME is empty)") { - env[SCRIPT_NAME] || env[PATH_INFO] - } - ## SCRIPT_NAME never should be /, but instead be empty. - assert("SCRIPT_NAME cannot be '/', make it '' and PATH_INFO '/'") { - env[SCRIPT_NAME] != "/" - } - end - - ## === The Input Stream - ## - ## The input stream is an IO-like object which contains the raw HTTP - ## POST data. - def check_input(input) - ## When applicable, its external encoding must be "ASCII-8BIT" and it - ## must be opened in binary mode, for Ruby 1.9 compatibility. - assert("rack.input #{input} does not have ASCII-8BIT as its external encoding") { - input.external_encoding == Encoding::ASCII_8BIT - } if input.respond_to?(:external_encoding) - assert("rack.input #{input} is not opened in binary mode") { - input.binmode? - } if input.respond_to?(:binmode?) - - ## The input stream must respond to +gets+, +each+, +read+ and +rewind+. - [:gets, :each, :read, :rewind].each { |method| - assert("rack.input #{input} does not respond to ##{method}") { - input.respond_to? method - } - } - end - - class InputWrapper - include Assertion - - def initialize(input) - @input = input - end - - ## * +gets+ must be called without arguments and return a string, - ## or +nil+ on EOF. - def gets(*args) - assert("rack.input#gets called with arguments") { args.size == 0 } - v = @input.gets - assert("rack.input#gets didn't return a String") { - v.nil? or v.kind_of? String - } - v - end - - ## * +read+ behaves like IO#read. - ## Its signature is read([length, [buffer]]). - ## - ## If given, +length+ must be a non-negative Integer (>= 0) or +nil+, - ## and +buffer+ must be a String and may not be nil. - ## - ## If +length+ is given and not nil, then this method reads at most - ## +length+ bytes from the input stream. - ## - ## If +length+ is not given or nil, then this method reads - ## all data until EOF. - ## - ## When EOF is reached, this method returns nil if +length+ is given - ## and not nil, or "" if +length+ is not given or is nil. - ## - ## If +buffer+ is given, then the read data will be placed - ## into +buffer+ instead of a newly created String object. - def read(*args) - assert("rack.input#read called with too many arguments") { - args.size <= 2 - } - if args.size >= 1 - assert("rack.input#read called with non-integer and non-nil length") { - args.first.kind_of?(Integer) || args.first.nil? - } - assert("rack.input#read called with a negative length") { - args.first.nil? || args.first >= 0 - } - end - if args.size >= 2 - assert("rack.input#read called with non-String buffer") { - args[1].kind_of?(String) - } - end - - v = @input.read(*args) - - assert("rack.input#read didn't return nil or a String") { - v.nil? or v.kind_of? String - } - if args[0].nil? - assert("rack.input#read(nil) returned nil on EOF") { - !v.nil? - } - end - - v - end - - ## * +each+ must be called without arguments and only yield Strings. - def each(*args) - assert("rack.input#each called with arguments") { args.size == 0 } - @input.each { |line| - assert("rack.input#each didn't yield a String") { - line.kind_of? String - } - yield line - } - end - - ## * +rewind+ must be called without arguments. It rewinds the input - ## stream back to the beginning. It must not raise Errno::ESPIPE: - ## that is, it may not be a pipe or a socket. Therefore, handler - ## developers must buffer the input data into some rewindable object - ## if the underlying input stream is not rewindable. - def rewind(*args) - assert("rack.input#rewind called with arguments") { args.size == 0 } - assert("rack.input#rewind raised Errno::ESPIPE") { - begin - @input.rewind - true - rescue Errno::ESPIPE - false - end - } - end - - ## * +close+ must never be called on the input stream. - def close(*args) - assert("rack.input#close must not be called") { false } - end - end - - ## === The Error Stream - def check_error(error) - ## The error stream must respond to +puts+, +write+ and +flush+. - [:puts, :write, :flush].each { |method| - assert("rack.error #{error} does not respond to ##{method}") { - error.respond_to? method - } - } - end - - class ErrorWrapper - include Assertion - - def initialize(error) - @error = error - end - - ## * +puts+ must be called with a single argument that responds to +to_s+. - def puts(str) - @error.puts str - end - - ## * +write+ must be called with a single argument that is a String. - def write(str) - assert("rack.errors#write not called with a String") { str.kind_of? String } - @error.write str - end - - ## * +flush+ must be called without arguments and must be called - ## in order to make the error appear for sure. - def flush - @error.flush - end - - ## * +close+ must never be called on the error stream. - def close(*args) - assert("rack.errors#close must not be called") { false } - end - end - - class HijackWrapper - include Assertion - extend Forwardable - - REQUIRED_METHODS = [ - :read, :write, :read_nonblock, :write_nonblock, :flush, :close, - :close_read, :close_write, :closed? - ] - - def_delegators :@io, *REQUIRED_METHODS - - def initialize(io) - @io = io - REQUIRED_METHODS.each do |meth| - assert("rack.hijack_io must respond to #{meth}") { io.respond_to? meth } - end - end - end - - ## === Hijacking - # - # AUTHORS: n.b. The trailing whitespace between paragraphs is important and - # should not be removed. The whitespace creates paragraphs in the RDoc - # output. - # - ## ==== Request (before status) - def check_hijack(env) - if env[RACK_IS_HIJACK] - ## If rack.hijack? is true then rack.hijack must respond to #call. - original_hijack = env[RACK_HIJACK] - assert("rack.hijack must respond to call") { original_hijack.respond_to?(:call) } - env[RACK_HIJACK] = proc do - ## rack.hijack must return the io that will also be assigned (or is - ## already present, in rack.hijack_io. - io = original_hijack.call - HijackWrapper.new(io) - ## - ## rack.hijack_io must respond to: - ## read, write, read_nonblock, write_nonblock, flush, close, - ## close_read, close_write, closed? - ## - ## The semantics of these IO methods must be a best effort match to - ## those of a normal ruby IO or Socket object, using standard - ## arguments and raising standard exceptions. Servers are encouraged - ## to simply pass on real IO objects, although it is recognized that - ## this approach is not directly compatible with SPDY and HTTP 2.0. - ## - ## IO provided in rack.hijack_io should preference the - ## IO::WaitReadable and IO::WaitWritable APIs wherever supported. - ## - ## There is a deliberate lack of full specification around - ## rack.hijack_io, as semantics will change from server to server. - ## Users are encouraged to utilize this API with a knowledge of their - ## server choice, and servers may extend the functionality of - ## hijack_io to provide additional features to users. The purpose of - ## rack.hijack is for Rack to "get out of the way", as such, Rack only - ## provides the minimum of specification and support. - env[RACK_HIJACK_IO] = HijackWrapper.new(env[RACK_HIJACK_IO]) - io - end - else - ## - ## If rack.hijack? is false, then rack.hijack should not be set. - assert("rack.hijack? is false, but rack.hijack is present") { env[RACK_HIJACK].nil? } - ## - ## If rack.hijack? is false, then rack.hijack_io should not be set. - assert("rack.hijack? is false, but rack.hijack_io is present") { env[RACK_HIJACK_IO].nil? } - end - end - - ## ==== Response (after headers) - ## It is also possible to hijack a response after the status and headers - ## have been sent. - def check_hijack_response(headers, env) - - # this check uses headers like a hash, but the spec only requires - # headers respond to #each - headers = Rack::Utils::HeaderHash[headers] - - ## In order to do this, an application may set the special header - ## rack.hijack to an object that responds to call - ## accepting an argument that conforms to the rack.hijack_io - ## protocol. - ## - ## After the headers have been sent, and this hijack callback has been - ## called, the application is now responsible for the remaining lifecycle - ## of the IO. The application is also responsible for maintaining HTTP - ## semantics. Of specific note, in almost all cases in the current SPEC, - ## applications will have wanted to specify the header Connection:close in - ## HTTP/1.1, and not Connection:keep-alive, as there is no protocol for - ## returning hijacked sockets to the web server. For that purpose, use the - ## body streaming API instead (progressively yielding strings via each). - ## - ## Servers must ignore the body part of the response tuple when - ## the rack.hijack response API is in use. - - if env[RACK_IS_HIJACK] && headers[RACK_HIJACK] - assert('rack.hijack header must respond to #call') { - headers[RACK_HIJACK].respond_to? :call - } - original_hijack = headers[RACK_HIJACK] - proc do |io| - original_hijack.call HijackWrapper.new(io) - end - else - ## - ## The special response header rack.hijack must only be set - ## if the request env has rack.hijack? true. - assert('rack.hijack header must not be present if server does not support hijacking') { - headers[RACK_HIJACK].nil? - } - - nil - end - end - ## ==== Conventions - ## * Middleware should not use hijack unless it is handling the whole - ## response. - ## * Middleware may wrap the IO object for the response pattern. - ## * Middleware should not wrap the IO object for the request pattern. The - ## request pattern is intended to provide the hijacker with "raw tcp". - - ## == The Response - - ## === The Status - def check_status(status) - ## This is an HTTP status. When parsed as integer (+to_i+), it must be - ## greater than or equal to 100. - assert("Status must be >=100 seen as integer") { status.to_i >= 100 } - end - - ## === The Headers - def check_headers(header) - ## The header must respond to +each+, and yield values of key and value. - assert("headers object should respond to #each, but doesn't (got #{header.class} as headers)") { - header.respond_to? :each - } - - header.each { |key, value| - ## The header keys must be Strings. - assert("header key must be a string, was #{key.class}") { - key.kind_of? String - } - - ## Special headers starting "rack." are for communicating with the - ## server, and must not be sent back to the client. - next if key =~ /^rack\..+$/ - - ## The header must not contain a +Status+ key. - assert("header must not contain Status") { key.downcase != "status" } - ## The header must conform to RFC7230 token specification, i.e. cannot - ## contain non-printable ASCII, DQUOTE or "(),/:;<=>?@[\]{}". - assert("invalid header name: #{key}") { key !~ /[\(\),\/:;<=>\?@\[\\\]{}[:cntrl:]]/ } - - ## The values of the header must be Strings, - assert("a header value must be a String, but the value of " + - "'#{key}' is a #{value.class}") { value.kind_of? String } - ## consisting of lines (for multiple header values, e.g. multiple - ## Set-Cookie values) separated by "\\n". - value.split("\n").each { |item| - ## The lines must not contain characters below 037. - assert("invalid header value #{key}: #{item.inspect}") { - item !~ /[\000-\037]/ - } - } - } - end - - ## === The Content-Type - def check_content_type(status, headers) - headers.each { |key, value| - ## There must not be a Content-Type, when the +Status+ is 1xx, - ## 204 or 304. - if key.downcase == "content-type" - assert("Content-Type header found in #{status} response, not allowed") { - not Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.key? status.to_i - } - return - end - } - end - - ## === The Content-Length - def check_content_length(status, headers) - headers.each { |key, value| - if key.downcase == 'content-length' - ## There must not be a Content-Length header when the - ## +Status+ is 1xx, 204 or 304. - assert("Content-Length header found in #{status} response, not allowed") { - not Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.key? status.to_i - } - @content_length = value - end - } - end - - def verify_content_length(bytes) - if @head_request - assert("Response body was given for HEAD request, but should be empty") { - bytes == 0 - } - elsif @content_length - assert("Content-Length header was #{@content_length}, but should be #{bytes}") { - @content_length == bytes.to_s - } - end - end - - ## === The Body - def each - @closed = false - bytes = 0 - - ## The Body must respond to +each+ - assert("Response body must respond to each") do - @body.respond_to?(:each) - end - - @body.each { |part| - ## and must only yield String values. - assert("Body yielded non-string value #{part.inspect}") { - part.kind_of? String - } - bytes += part.bytesize - yield part - } - verify_content_length(bytes) - - ## - ## The Body itself should not be an instance of String, as this will - ## break in Ruby 1.9. - ## - ## If the Body responds to +close+, it will be called after iteration. If - ## the body is replaced by a middleware after action, the original body - ## must be closed first, if it responds to close. - # XXX howto: assert("Body has not been closed") { @closed } - - - ## - ## If the Body responds to +to_path+, it must return a String - ## identifying the location of a file whose contents are identical - ## to that produced by calling +each+; this may be used by the - ## server as an alternative, possibly more efficient way to - ## transport the response. - - if @body.respond_to?(:to_path) - assert("The file identified by body.to_path does not exist") { - ::File.exist? @body.to_path - } - end - - ## - ## The Body commonly is an Array of Strings, the application - ## instance itself, or a File-like object. - end - - def close - @closed = true - @body.close if @body.respond_to?(:close) - end - - # :startdoc: - - end -end - -## == Thanks -## Some parts of this specification are adopted from PEP333: Python -## Web Server Gateway Interface -## v1.0 (http://www.python.org/dev/peps/pep-0333/). I'd like to thank -## everyone involved in that effort. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/lobster.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/lobster.rb deleted file mode 100644 index b86a625de0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/lobster.rb +++ /dev/null @@ -1,70 +0,0 @@ -# frozen_string_literal: true - -require 'zlib' - -module Rack - # Paste has a Pony, Rack has a Lobster! - class Lobster - LobsterString = Zlib::Inflate.inflate("eJx9kEEOwyAMBO99xd7MAcytUhPlJyj2 - P6jy9i4k9EQyGAnBarEXeCBqSkntNXsi/ZCvC48zGQoZKikGrFMZvgS5ZHd+aGWVuWwhVF0 - t1drVmiR42HcWNz5w3QanT+2gIvTVCiE1lm1Y0eU4JGmIIbaKwextKn8rvW+p5PIwFl8ZWJ - I8jyiTlhTcYXkekJAzTyYN6E08A+dk8voBkAVTJQ==".delete("\n ").unpack("m*")[0]) - - LambdaLobster = lambda { |env| - if env[QUERY_STRING].include?("flip") - lobster = LobsterString.split("\n"). - map { |line| line.ljust(42).reverse }. - join("\n") - href = "?" - else - lobster = LobsterString - href = "?flip" - end - - content = ["Lobstericious!", - "
", lobster, "
", - "flip!"] - length = content.inject(0) { |a, e| a + e.size }.to_s - [200, { CONTENT_TYPE => "text/html", CONTENT_LENGTH => length }, content] - } - - def call(env) - req = Request.new(env) - if req.GET["flip"] == "left" - lobster = LobsterString.split("\n").map do |line| - line.ljust(42).reverse. - gsub('\\', 'TEMP'). - gsub('/', '\\'). - gsub('TEMP', '/'). - gsub('{', '}'). - gsub('(', ')') - end.join("\n") - href = "?flip=right" - elsif req.GET["flip"] == "crash" - raise "Lobster crashed" - else - lobster = LobsterString - href = "?flip=left" - end - - res = Response.new - res.write "Lobstericious!" - res.write "
"
-      res.write lobster
-      res.write "
" - res.write "

flip!

" - res.write "

crash!

" - res.finish - end - - end -end - -if $0 == __FILE__ - # :nocov: - require_relative '../rack' - Rack::Server.start( - app: Rack::ShowExceptions.new(Rack::Lint.new(Rack::Lobster.new)), Port: 9292 - ) - # :nocov: -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart.rb deleted file mode 100644 index 10f8e5fa3c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -require_relative 'multipart/parser' - -module Rack - # A multipart form data parser, adapted from IOWA. - # - # Usually, Rack::Request#POST takes care of calling this. - module Multipart - autoload :UploadedFile, 'rack/multipart/uploaded_file' - autoload :Generator, 'rack/multipart/generator' - - EOL = "\r\n" - MULTIPART_BOUNDARY = "AaB03x" - MULTIPART = %r|\Amultipart/.*boundary=\"?([^\";,]+)\"?|ni - TOKEN = /[^\s()<>,;:\\"\/\[\]?=]+/ - CONDISP = /Content-Disposition:\s*#{TOKEN}\s*/i - VALUE = /"(?:\\"|[^"])*"|#{TOKEN}/ - BROKEN = /^#{CONDISP}.*;\s*filename=(#{VALUE})/i - MULTIPART_CONTENT_TYPE = /Content-Type: (.*)#{EOL}/ni - MULTIPART_CONTENT_DISPOSITION = /Content-Disposition:.*;\s*name=(#{VALUE})/ni - MULTIPART_CONTENT_ID = /Content-ID:\s*([^#{EOL}]*)/ni - # Updated definitions from RFC 2231 - ATTRIBUTE_CHAR = %r{[^ \t\v\n\r)(><@,;:\\"/\[\]?='*%]} - ATTRIBUTE = /#{ATTRIBUTE_CHAR}+/ - SECTION = /\*[0-9]+/ - REGULAR_PARAMETER_NAME = /#{ATTRIBUTE}#{SECTION}?/ - REGULAR_PARAMETER = /(#{REGULAR_PARAMETER_NAME})=(#{VALUE})/ - EXTENDED_OTHER_NAME = /#{ATTRIBUTE}\*[1-9][0-9]*\*/ - EXTENDED_OTHER_VALUE = /%[0-9a-fA-F]{2}|#{ATTRIBUTE_CHAR}/ - EXTENDED_OTHER_PARAMETER = /(#{EXTENDED_OTHER_NAME})=(#{EXTENDED_OTHER_VALUE}*)/ - EXTENDED_INITIAL_NAME = /#{ATTRIBUTE}(?:\*0)?\*/ - EXTENDED_INITIAL_VALUE = /[a-zA-Z0-9\-]*'[a-zA-Z0-9\-]*'#{EXTENDED_OTHER_VALUE}*/ - EXTENDED_INITIAL_PARAMETER = /(#{EXTENDED_INITIAL_NAME})=(#{EXTENDED_INITIAL_VALUE})/ - EXTENDED_PARAMETER = /#{EXTENDED_INITIAL_PARAMETER}|#{EXTENDED_OTHER_PARAMETER}/ - DISPPARM = /;\s*(?:#{REGULAR_PARAMETER}|#{EXTENDED_PARAMETER})\s*/ - RFC2183 = /^#{CONDISP}(#{DISPPARM})+$/i - - class << self - def parse_multipart(env, params = Rack::Utils.default_query_parser) - extract_multipart Rack::Request.new(env), params - end - - def extract_multipart(req, params = Rack::Utils.default_query_parser) - io = req.get_header(RACK_INPUT) - io.rewind - content_length = req.content_length - content_length = content_length.to_i if content_length - - tempfile = req.get_header(RACK_MULTIPART_TEMPFILE_FACTORY) || Parser::TEMPFILE_FACTORY - bufsize = req.get_header(RACK_MULTIPART_BUFFER_SIZE) || Parser::BUFSIZE - - info = Parser.parse io, content_length, req.get_header('CONTENT_TYPE'), tempfile, bufsize, params - req.set_header(RACK_TEMPFILES, info.tmp_files) - info.params - end - - def build_multipart(params, first = true) - Generator.new(params, first).dump - end - end - - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/server.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/server.rb deleted file mode 100644 index c1f2f5caa3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/server.rb +++ /dev/null @@ -1,466 +0,0 @@ -# frozen_string_literal: true - -require 'optparse' -require 'fileutils' - -module Rack - - class Server - (require_relative 'core_ext/regexp'; using ::Rack::RegexpExtensions) if RUBY_VERSION < '2.4' - - class Options - def parse!(args) - options = {} - opt_parser = OptionParser.new("", 24, ' ') do |opts| - opts.banner = "Usage: rackup [ruby options] [rack options] [rackup config]" - - opts.separator "" - opts.separator "Ruby options:" - - lineno = 1 - opts.on("-e", "--eval LINE", "evaluate a LINE of code") { |line| - eval line, TOPLEVEL_BINDING, "-e", lineno - lineno += 1 - } - - opts.on("-d", "--debug", "set debugging flags (set $DEBUG to true)") { - options[:debug] = true - } - opts.on("-w", "--warn", "turn warnings on for your script") { - options[:warn] = true - } - opts.on("-q", "--quiet", "turn off logging") { - options[:quiet] = true - } - - opts.on("-I", "--include PATH", - "specify $LOAD_PATH (may be used more than once)") { |path| - (options[:include] ||= []).concat(path.split(":")) - } - - opts.on("-r", "--require LIBRARY", - "require the library, before executing your script") { |library| - (options[:require] ||= []) << library - } - - opts.separator "" - opts.separator "Rack options:" - opts.on("-b", "--builder BUILDER_LINE", "evaluate a BUILDER_LINE of code as a builder script") { |line| - options[:builder] = line - } - - opts.on("-s", "--server SERVER", "serve using SERVER (thin/puma/webrick)") { |s| - options[:server] = s - } - - opts.on("-o", "--host HOST", "listen on HOST (default: localhost)") { |host| - options[:Host] = host - } - - opts.on("-p", "--port PORT", "use PORT (default: 9292)") { |port| - options[:Port] = port - } - - opts.on("-O", "--option NAME[=VALUE]", "pass VALUE to the server as option NAME. If no VALUE, sets it to true. Run '#{$0} -s SERVER -h' to get a list of options for SERVER") { |name| - name, value = name.split('=', 2) - value = true if value.nil? - options[name.to_sym] = value - } - - opts.on("-E", "--env ENVIRONMENT", "use ENVIRONMENT for defaults (default: development)") { |e| - options[:environment] = e - } - - opts.on("-D", "--daemonize", "run daemonized in the background") { |d| - options[:daemonize] = d ? true : false - } - - opts.on("-P", "--pid FILE", "file to store PID") { |f| - options[:pid] = ::File.expand_path(f) - } - - opts.separator "" - opts.separator "Profiling options:" - - opts.on("--heap HEAPFILE", "Build the application, then dump the heap to HEAPFILE") do |e| - options[:heapfile] = e - end - - opts.on("--profile PROFILE", "Dump CPU or Memory profile to PROFILE (defaults to a tempfile)") do |e| - options[:profile_file] = e - end - - opts.on("--profile-mode MODE", "Profile mode (cpu|wall|object)") do |e| - { cpu: true, wall: true, object: true }.fetch(e.to_sym) do - raise OptionParser::InvalidOption, "unknown profile mode: #{e}" - end - options[:profile_mode] = e.to_sym - end - - opts.separator "" - opts.separator "Common options:" - - opts.on_tail("-h", "-?", "--help", "Show this message") do - puts opts - puts handler_opts(options) - - exit - end - - opts.on_tail("--version", "Show version") do - puts "Rack #{Rack.version} (Release: #{Rack.release})" - exit - end - end - - begin - opt_parser.parse! args - rescue OptionParser::InvalidOption => e - warn e.message - abort opt_parser.to_s - end - - options[:config] = args.last if args.last && !args.last.empty? - options - end - - def handler_opts(options) - begin - info = [] - server = Rack::Handler.get(options[:server]) || Rack::Handler.default - if server && server.respond_to?(:valid_options) - info << "" - info << "Server-specific options for #{server.name}:" - - has_options = false - server.valid_options.each do |name, description| - next if /^(Host|Port)[^a-zA-Z]/.match?(name.to_s) # ignore handler's host and port options, we do our own. - info << " -O %-21s %s" % [name, description] - has_options = true - end - return "" if !has_options - end - info.join("\n") - rescue NameError, LoadError - return "Warning: Could not find handler specified (#{options[:server] || 'default'}) to determine handler-specific options" - end - end - end - - # Start a new rack server (like running rackup). This will parse ARGV and - # provide standard ARGV rackup options, defaulting to load 'config.ru'. - # - # Providing an options hash will prevent ARGV parsing and will not include - # any default options. - # - # This method can be used to very easily launch a CGI application, for - # example: - # - # Rack::Server.start( - # :app => lambda do |e| - # [200, {'Content-Type' => 'text/html'}, ['hello world']] - # end, - # :server => 'cgi' - # ) - # - # Further options available here are documented on Rack::Server#initialize - def self.start(options = nil) - new(options).start - end - - attr_writer :options - - # Options may include: - # * :app - # a rack application to run (overrides :config and :builder) - # * :builder - # a string to evaluate a Rack::Builder from - # * :config - # a rackup configuration file path to load (.ru) - # * :environment - # this selects the middleware that will be wrapped around - # your application. Default options available are: - # - development: CommonLogger, ShowExceptions, and Lint - # - deployment: CommonLogger - # - none: no extra middleware - # note: when the server is a cgi server, CommonLogger is not included. - # * :server - # choose a specific Rack::Handler, e.g. cgi, fcgi, webrick - # * :daemonize - # if true, the server will daemonize itself (fork, detach, etc) - # * :pid - # path to write a pid file after daemonize - # * :Host - # the host address to bind to (used by supporting Rack::Handler) - # * :Port - # the port to bind to (used by supporting Rack::Handler) - # * :AccessLog - # webrick access log options (or supporting Rack::Handler) - # * :debug - # turn on debug output ($DEBUG = true) - # * :warn - # turn on warnings ($-w = true) - # * :include - # add given paths to $LOAD_PATH - # * :require - # require the given libraries - # - # Additional options for profiling app initialization include: - # * :heapfile - # location for ObjectSpace.dump_all to write the output to - # * :profile_file - # location for CPU/Memory (StackProf) profile output (defaults to a tempfile) - # * :profile_mode - # StackProf profile mode (cpu|wall|object) - def initialize(options = nil) - @ignore_options = [] - - if options - @use_default_options = false - @options = options - @app = options[:app] if options[:app] - else - argv = defined?(SPEC_ARGV) ? SPEC_ARGV : ARGV - @use_default_options = true - @options = parse_options(argv) - end - end - - def options - merged_options = @use_default_options ? default_options.merge(@options) : @options - merged_options.reject { |k, v| @ignore_options.include?(k) } - end - - def default_options - environment = ENV['RACK_ENV'] || 'development' - default_host = environment == 'development' ? 'localhost' : '0.0.0.0' - - { - environment: environment, - pid: nil, - Port: 9292, - Host: default_host, - AccessLog: [], - config: "config.ru" - } - end - - def app - @app ||= options[:builder] ? build_app_from_string : build_app_and_options_from_config - end - - class << self - def logging_middleware - lambda { |server| - /CGI/.match?(server.server.name) || server.options[:quiet] ? nil : [Rack::CommonLogger, $stderr] - } - end - - def default_middleware_by_environment - m = Hash.new {|h, k| h[k] = []} - m["deployment"] = [ - [Rack::ContentLength], - logging_middleware, - [Rack::TempfileReaper] - ] - m["development"] = [ - [Rack::ContentLength], - logging_middleware, - [Rack::ShowExceptions], - [Rack::Lint], - [Rack::TempfileReaper] - ] - - m - end - - def middleware - default_middleware_by_environment - end - end - - def middleware - self.class.middleware - end - - def start(&block) - if options[:warn] - $-w = true - end - - if includes = options[:include] - $LOAD_PATH.unshift(*includes) - end - - Array(options[:require]).each do |library| - require library - end - - if options[:debug] - $DEBUG = true - require 'pp' - p options[:server] - pp wrapped_app - pp app - end - - check_pid! if options[:pid] - - # Touch the wrapped app, so that the config.ru is loaded before - # daemonization (i.e. before chdir, etc). - handle_profiling(options[:heapfile], options[:profile_mode], options[:profile_file]) do - wrapped_app - end - - daemonize_app if options[:daemonize] - - write_pid if options[:pid] - - trap(:INT) do - if server.respond_to?(:shutdown) - server.shutdown - else - exit - end - end - - server.run(wrapped_app, **options, &block) - end - - def server - @_server ||= Rack::Handler.get(options[:server]) - - unless @_server - @_server = Rack::Handler.default - - # We already speak FastCGI - @ignore_options = [:File, :Port] if @_server.to_s == 'Rack::Handler::FastCGI' - end - - @_server - end - - private - def build_app_and_options_from_config - if !::File.exist? options[:config] - abort "configuration #{options[:config]} not found" - end - - app, options = Rack::Builder.parse_file(self.options[:config], opt_parser) - @options.merge!(options) { |key, old, new| old } - app - end - - def handle_profiling(heapfile, profile_mode, filename) - if heapfile - require "objspace" - ObjectSpace.trace_object_allocations_start - yield - GC.start - ::File.open(heapfile, "w") { |f| ObjectSpace.dump_all(output: f) } - exit - end - - if profile_mode - require "stackprof" - require "tempfile" - - make_profile_name(filename) do |filename| - ::File.open(filename, "w") do |f| - StackProf.run(mode: profile_mode, out: f) do - yield - end - puts "Profile written to: #{filename}" - end - end - exit - end - - yield - end - - def make_profile_name(filename) - if filename - yield filename - else - ::Dir::Tmpname.create("profile.dump") do |tmpname, _, _| - yield tmpname - end - end - end - - def build_app_from_string - Rack::Builder.new_from_string(self.options[:builder]) - end - - def parse_options(args) - # Don't evaluate CGI ISINDEX parameters. - # http://www.meb.uni-bonn.de/docs/cgi/cl.html - args.clear if ENV.include?(REQUEST_METHOD) - - @options = opt_parser.parse!(args) - @options[:config] = ::File.expand_path(options[:config]) - ENV["RACK_ENV"] = options[:environment] - @options - end - - def opt_parser - Options.new - end - - def build_app(app) - middleware[options[:environment]].reverse_each do |middleware| - middleware = middleware.call(self) if middleware.respond_to?(:call) - next unless middleware - klass, *args = middleware - app = klass.new(app, *args) - end - app - end - - def wrapped_app - @wrapped_app ||= build_app app - end - - def daemonize_app - # Cannot be covered as it forks - # :nocov: - Process.daemon - # :nocov: - end - - def write_pid - ::File.open(options[:pid], ::File::CREAT | ::File::EXCL | ::File::WRONLY ){ |f| f.write("#{Process.pid}") } - at_exit { ::FileUtils.rm_f(options[:pid]) } - rescue Errno::EEXIST - check_pid! - retry - end - - def check_pid! - case pidfile_process_status - when :running, :not_owned - $stderr.puts "A server is already running. Check #{options[:pid]}." - exit(1) - when :dead - ::File.delete(options[:pid]) - end - end - - def pidfile_process_status - return :exited unless ::File.exist?(options[:pid]) - - pid = ::File.read(options[:pid]).to_i - return :dead if pid == 0 - - Process.kill(0, pid) - :running - rescue Errno::ESRCH - :dead - rescue Errno::EPERM - :not_owned - end - - end - -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb deleted file mode 100644 index 638bd3b3b0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb +++ /dev/null @@ -1,523 +0,0 @@ -# frozen_string_literal: true - -# AUTHOR: blink ; blink#ruby-lang@irc.freenode.net -# bugrep: Andreas Zehnder - -require_relative '../../../rack' -require 'time' -require 'securerandom' -require 'digest/sha2' - -module Rack - - module Session - - class SessionId - ID_VERSION = 2 - - attr_reader :public_id - - def initialize(public_id) - @public_id = public_id - end - - def private_id - "#{ID_VERSION}::#{hash_sid(public_id)}" - end - - alias :cookie_value :public_id - alias :to_s :public_id - - def empty?; false; end - def inspect; public_id.inspect; end - - private - - def hash_sid(sid) - Digest::SHA256.hexdigest(sid) - end - end - - module Abstract - # SessionHash is responsible to lazily load the session from store. - - class SessionHash - include Enumerable - attr_writer :id - - Unspecified = Object.new - - def self.find(req) - req.get_header RACK_SESSION - end - - def self.set(req, session) - req.set_header RACK_SESSION, session - end - - def self.set_options(req, options) - req.set_header RACK_SESSION_OPTIONS, options.dup - end - - def initialize(store, req) - @store = store - @req = req - @loaded = false - end - - def id - return @id if @loaded or instance_variable_defined?(:@id) - @id = @store.send(:extract_session_id, @req) - end - - def options - @req.session_options - end - - def each(&block) - load_for_read! - @data.each(&block) - end - - def [](key) - load_for_read! - @data[key.to_s] - end - - def dig(key, *keys) - load_for_read! - @data.dig(key.to_s, *keys) - end - - def fetch(key, default = Unspecified, &block) - load_for_read! - if default == Unspecified - @data.fetch(key.to_s, &block) - else - @data.fetch(key.to_s, default, &block) - end - end - - def has_key?(key) - load_for_read! - @data.has_key?(key.to_s) - end - alias :key? :has_key? - alias :include? :has_key? - - def []=(key, value) - load_for_write! - @data[key.to_s] = value - end - alias :store :[]= - - def clear - load_for_write! - @data.clear - end - - def destroy - clear - @id = @store.send(:delete_session, @req, id, options) - end - - def to_hash - load_for_read! - @data.dup - end - - def update(hash) - load_for_write! - @data.update(stringify_keys(hash)) - end - alias :merge! :update - - def replace(hash) - load_for_write! - @data.replace(stringify_keys(hash)) - end - - def delete(key) - load_for_write! - @data.delete(key.to_s) - end - - def inspect - if loaded? - @data.inspect - else - "#<#{self.class}:0x#{self.object_id.to_s(16)} not yet loaded>" - end - end - - def exists? - return @exists if instance_variable_defined?(:@exists) - @data = {} - @exists = @store.send(:session_exists?, @req) - end - - def loaded? - @loaded - end - - def empty? - load_for_read! - @data.empty? - end - - def keys - load_for_read! - @data.keys - end - - def values - load_for_read! - @data.values - end - - private - - def load_for_read! - load! if !loaded? && exists? - end - - def load_for_write! - load! unless loaded? - end - - def load! - @id, session = @store.send(:load_session, @req) - @data = stringify_keys(session) - @loaded = true - end - - def stringify_keys(other) - # Use transform_keys after dropping Ruby 2.4 support - hash = {} - other.to_hash.each do |key, value| - hash[key.to_s] = value - end - hash - end - end - - # ID sets up a basic framework for implementing an id based sessioning - # service. Cookies sent to the client for maintaining sessions will only - # contain an id reference. Only #find_session, #write_session and - # #delete_session are required to be overwritten. - # - # All parameters are optional. - # * :key determines the name of the cookie, by default it is - # 'rack.session' - # * :path, :domain, :expire_after, :secure, and :httponly set the related - # cookie options as by Rack::Response#set_cookie - # * :skip will not a set a cookie in the response nor update the session state - # * :defer will not set a cookie in the response but still update the session - # state if it is used with a backend - # * :renew (implementation dependent) will prompt the generation of a new - # session id, and migration of data to be referenced at the new id. If - # :defer is set, it will be overridden and the cookie will be set. - # * :sidbits sets the number of bits in length that a generated session - # id will be. - # - # These options can be set on a per request basis, at the location of - # env['rack.session.options']. Additionally the id of the - # session can be found within the options hash at the key :id. It is - # highly not recommended to change its value. - # - # Is Rack::Utils::Context compatible. - # - # Not included by default; you must require 'rack/session/abstract/id' - # to use. - - class Persisted - DEFAULT_OPTIONS = { - key: RACK_SESSION, - path: '/', - domain: nil, - expire_after: nil, - secure: false, - httponly: true, - defer: false, - renew: false, - sidbits: 128, - cookie_only: true, - secure_random: ::SecureRandom - }.freeze - - attr_reader :key, :default_options, :sid_secure - - def initialize(app, options = {}) - @app = app - @default_options = self.class::DEFAULT_OPTIONS.merge(options) - @key = @default_options.delete(:key) - @cookie_only = @default_options.delete(:cookie_only) - @same_site = @default_options.delete(:same_site) - initialize_sid - end - - def call(env) - context(env) - end - - def context(env, app = @app) - req = make_request env - prepare_session(req) - status, headers, body = app.call(req.env) - res = Rack::Response::Raw.new status, headers - commit_session(req, res) - [status, headers, body] - end - - private - - def make_request(env) - Rack::Request.new env - end - - def initialize_sid - @sidbits = @default_options[:sidbits] - @sid_secure = @default_options[:secure_random] - @sid_length = @sidbits / 4 - end - - # Generate a new session id using Ruby #rand. The size of the - # session id is controlled by the :sidbits option. - # Monkey patch this to use custom methods for session id generation. - - def generate_sid(secure = @sid_secure) - if secure - secure.hex(@sid_length) - else - "%0#{@sid_length}x" % Kernel.rand(2**@sidbits - 1) - end - rescue NotImplementedError - generate_sid(false) - end - - # Sets the lazy session at 'rack.session' and places options and session - # metadata into 'rack.session.options'. - - def prepare_session(req) - session_was = req.get_header RACK_SESSION - session = session_class.new(self, req) - req.set_header RACK_SESSION, session - req.set_header RACK_SESSION_OPTIONS, @default_options.dup - session.merge! session_was if session_was - end - - # Extracts the session id from provided cookies and passes it and the - # environment to #find_session. - - def load_session(req) - sid = current_session_id(req) - sid, session = find_session(req, sid) - [sid, session || {}] - end - - # Extract session id from request object. - - def extract_session_id(request) - sid = request.cookies[@key] - sid ||= request.params[@key] unless @cookie_only - sid - end - - # Returns the current session id from the SessionHash. - - def current_session_id(req) - req.get_header(RACK_SESSION).id - end - - # Check if the session exists or not. - - def session_exists?(req) - value = current_session_id(req) - value && !value.empty? - end - - # Session should be committed if it was loaded, any of specific options like :renew, :drop - # or :expire_after was given and the security permissions match. Skips if skip is given. - - def commit_session?(req, session, options) - if options[:skip] - false - else - has_session = loaded_session?(session) || forced_session_update?(session, options) - has_session && security_matches?(req, options) - end - end - - def loaded_session?(session) - !session.is_a?(session_class) || session.loaded? - end - - def forced_session_update?(session, options) - force_options?(options) && session && !session.empty? - end - - def force_options?(options) - options.values_at(:max_age, :renew, :drop, :defer, :expire_after).any? - end - - def security_matches?(request, options) - return true unless options[:secure] - request.ssl? - end - - # Acquires the session from the environment and the session id from - # the session options and passes them to #write_session. If successful - # and the :defer option is not true, a cookie will be added to the - # response with the session's id. - - def commit_session(req, res) - session = req.get_header RACK_SESSION - options = session.options - - if options[:drop] || options[:renew] - session_id = delete_session(req, session.id || generate_sid, options) - return unless session_id - end - - return unless commit_session?(req, session, options) - - session.send(:load!) unless loaded_session?(session) - session_id ||= session.id - session_data = session.to_hash.delete_if { |k, v| v.nil? } - - if not data = write_session(req, session_id, session_data, options) - req.get_header(RACK_ERRORS).puts("Warning! #{self.class.name} failed to save session. Content dropped.") - elsif options[:defer] and not options[:renew] - req.get_header(RACK_ERRORS).puts("Deferring cookie for #{session_id}") if $VERBOSE - else - cookie = Hash.new - cookie[:value] = cookie_value(data) - cookie[:expires] = Time.now + options[:expire_after] if options[:expire_after] - cookie[:expires] = Time.now + options[:max_age] if options[:max_age] - - if @same_site.respond_to? :call - cookie[:same_site] = @same_site.call(req, res) - else - cookie[:same_site] = @same_site - end - set_cookie(req, res, cookie.merge!(options)) - end - end - public :commit_session - - def cookie_value(data) - data - end - - # Sets the cookie back to the client with session id. We skip the cookie - # setting if the value didn't change (sid is the same) or expires was given. - - def set_cookie(request, res, cookie) - if request.cookies[@key] != cookie[:value] || cookie[:expires] - res.set_cookie_header = - Utils.add_cookie_to_header(res.set_cookie_header, @key, cookie) - end - end - - # Allow subclasses to prepare_session for different Session classes - - def session_class - SessionHash - end - - # All thread safety and session retrieval procedures should occur here. - # Should return [session_id, session]. - # If nil is provided as the session id, generation of a new valid id - # should occur within. - - def find_session(env, sid) - raise '#find_session not implemented.' - end - - # All thread safety and session storage procedures should occur here. - # Must return the session id if the session was saved successfully, or - # false if the session could not be saved. - - def write_session(req, sid, session, options) - raise '#write_session not implemented.' - end - - # All thread safety and session destroy procedures should occur here. - # Should return a new session id or nil if options[:drop] - - def delete_session(req, sid, options) - raise '#delete_session not implemented' - end - end - - class PersistedSecure < Persisted - class SecureSessionHash < SessionHash - def [](key) - if key == "session_id" - load_for_read! - id.public_id if id - else - super - end - end - end - - def generate_sid(*) - public_id = super - - SessionId.new(public_id) - end - - def extract_session_id(*) - public_id = super - public_id && SessionId.new(public_id) - end - - private - - def session_class - SecureSessionHash - end - - def cookie_value(data) - data.cookie_value - end - end - - class ID < Persisted - def self.inherited(klass) - k = klass.ancestors.find { |kl| kl.respond_to?(:superclass) && kl.superclass == ID } - unless k.instance_variable_defined?(:"@_rack_warned") - warn "#{klass} is inheriting from #{ID}. Inheriting from #{ID} is deprecated, please inherit from #{Persisted} instead" if $VERBOSE - k.instance_variable_set(:"@_rack_warned", true) - end - super - end - - # All thread safety and session retrieval procedures should occur here. - # Should return [session_id, session]. - # If nil is provided as the session id, generation of a new valid id - # should occur within. - - def find_session(req, sid) - get_session req.env, sid - end - - # All thread safety and session storage procedures should occur here. - # Must return the session id if the session was saved successfully, or - # false if the session could not be saved. - - def write_session(req, sid, session, options) - set_session req.env, sid, session, options - end - - # All thread safety and session destroy procedures should occur here. - # Should return a new session id or nil if options[:drop] - - def delete_session(req, sid, options) - destroy_session req.env, sid, options - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/cookie.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/cookie.rb deleted file mode 100644 index bb541396f7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/cookie.rb +++ /dev/null @@ -1,203 +0,0 @@ -# frozen_string_literal: true - -require 'openssl' -require 'zlib' -require_relative 'abstract/id' -require 'json' -require 'base64' - -module Rack - - module Session - - # Rack::Session::Cookie provides simple cookie based session management. - # By default, the session is a Ruby Hash stored as base64 encoded marshalled - # data set to :key (default: rack.session). The object that encodes the - # session data is configurable and must respond to +encode+ and +decode+. - # Both methods must take a string and return a string. - # - # When the secret key is set, cookie data is checked for data integrity. - # The old secret key is also accepted and allows graceful secret rotation. - # - # Example: - # - # use Rack::Session::Cookie, :key => 'rack.session', - # :domain => 'foo.com', - # :path => '/', - # :expire_after => 2592000, - # :secret => 'change_me', - # :old_secret => 'also_change_me' - # - # All parameters are optional. - # - # Example of a cookie with no encoding: - # - # Rack::Session::Cookie.new(application, { - # :coder => Rack::Session::Cookie::Identity.new - # }) - # - # Example of a cookie with custom encoding: - # - # Rack::Session::Cookie.new(application, { - # :coder => Class.new { - # def encode(str); str.reverse; end - # def decode(str); str.reverse; end - # }.new - # }) - # - - class Cookie < Abstract::PersistedSecure - # Encode session cookies as Base64 - class Base64 - def encode(str) - ::Base64.strict_encode64(str) - end - - def decode(str) - ::Base64.decode64(str) - end - - # Encode session cookies as Marshaled Base64 data - class Marshal < Base64 - def encode(str) - super(::Marshal.dump(str)) - end - - def decode(str) - return unless str - ::Marshal.load(super(str)) rescue nil - end - end - - # N.B. Unlike other encoding methods, the contained objects must be a - # valid JSON composite type, either a Hash or an Array. - class JSON < Base64 - def encode(obj) - super(::JSON.dump(obj)) - end - - def decode(str) - return unless str - ::JSON.parse(super(str)) rescue nil - end - end - - class ZipJSON < Base64 - def encode(obj) - super(Zlib::Deflate.deflate(::JSON.dump(obj))) - end - - def decode(str) - return unless str - ::JSON.parse(Zlib::Inflate.inflate(super(str))) - rescue - nil - end - end - end - - # Use no encoding for session cookies - class Identity - def encode(str); str; end - def decode(str); str; end - end - - attr_reader :coder - - def initialize(app, options = {}) - @secrets = options.values_at(:secret, :old_secret).compact - @hmac = options.fetch(:hmac, OpenSSL::Digest::SHA1) - - warn <<-MSG unless secure?(options) - SECURITY WARNING: No secret option provided to Rack::Session::Cookie. - This poses a security threat. It is strongly recommended that you - provide a secret to prevent exploits that may be possible from crafted - cookies. This will not be supported in future versions of Rack, and - future versions will even invalidate your existing user cookies. - - Called from: #{caller[0]}. - MSG - @coder = options[:coder] ||= Base64::Marshal.new - super(app, options.merge!(cookie_only: true)) - end - - private - - def find_session(req, sid) - data = unpacked_cookie_data(req) - data = persistent_session_id!(data) - [data["session_id"], data] - end - - def extract_session_id(request) - unpacked_cookie_data(request)["session_id"] - end - - def unpacked_cookie_data(request) - request.fetch_header(RACK_SESSION_UNPACKED_COOKIE_DATA) do |k| - session_data = request.cookies[@key] - - if @secrets.size > 0 && session_data - session_data, _, digest = session_data.rpartition('--') - session_data = nil unless digest_match?(session_data, digest) - end - - request.set_header(k, coder.decode(session_data) || {}) - end - end - - def persistent_session_id!(data, sid = nil) - data ||= {} - data["session_id"] ||= sid || generate_sid - data - end - - class SessionId < DelegateClass(Session::SessionId) - attr_reader :cookie_value - - def initialize(session_id, cookie_value) - super(session_id) - @cookie_value = cookie_value - end - end - - def write_session(req, session_id, session, options) - session = session.merge("session_id" => session_id) - session_data = coder.encode(session) - - if @secrets.first - session_data << "--#{generate_hmac(session_data, @secrets.first)}" - end - - if session_data.size > (4096 - @key.size) - req.get_header(RACK_ERRORS).puts("Warning! Rack::Session::Cookie data size exceeds 4K.") - nil - else - SessionId.new(session_id, session_data) - end - end - - def delete_session(req, session_id, options) - # Nothing to do here, data is in the client - generate_sid unless options[:drop] - end - - def digest_match?(data, digest) - return unless data && digest - @secrets.any? do |secret| - Rack::Utils.secure_compare(digest, generate_hmac(data, secret)) - end - end - - def generate_hmac(data, secret) - OpenSSL::HMAC.hexdigest(@hmac.new, secret, data) - end - - def secure?(options) - @secrets.size >= 1 || - (options[:coder] && options[:let_coder_handle_secure_encoding]) - end - - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/memcache.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/memcache.rb deleted file mode 100644 index 6a60117407..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/memcache.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require 'rack/session/dalli' - -module Rack - module Session - warn "Rack::Session::Memcache is deprecated, please use Rack::Session::Dalli from 'dalli' gem instead." - Memcache = Dalli - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/pool.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/pool.rb deleted file mode 100644 index 4885605f5d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/session/pool.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: true - -# AUTHOR: blink ; blink#ruby-lang@irc.freenode.net -# THANKS: -# apeiros, for session id generation, expiry setup, and threadiness -# sergio, threadiness and bugreps - -require_relative 'abstract/id' -require 'thread' - -module Rack - module Session - # Rack::Session::Pool provides simple cookie based session management. - # Session data is stored in a hash held by @pool. - # In the context of a multithreaded environment, sessions being - # committed to the pool is done in a merging manner. - # - # The :drop option is available in rack.session.options if you wish to - # explicitly remove the session from the session cache. - # - # Example: - # myapp = MyRackApp.new - # sessioned = Rack::Session::Pool.new(myapp, - # :domain => 'foo.com', - # :expire_after => 2592000 - # ) - # Rack::Handler::WEBrick.run sessioned - - class Pool < Abstract::PersistedSecure - attr_reader :mutex, :pool - DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge drop: false - - def initialize(app, options = {}) - super - @pool = Hash.new - @mutex = Mutex.new - end - - def generate_sid - loop do - sid = super - break sid unless @pool.key? sid.private_id - end - end - - def find_session(req, sid) - with_lock(req) do - unless sid and session = get_session_with_fallback(sid) - sid, session = generate_sid, {} - @pool.store sid.private_id, session - end - [sid, session] - end - end - - def write_session(req, session_id, new_session, options) - with_lock(req) do - @pool.store session_id.private_id, new_session - session_id - end - end - - def delete_session(req, session_id, options) - with_lock(req) do - @pool.delete(session_id.public_id) - @pool.delete(session_id.private_id) - generate_sid unless options[:drop] - end - end - - def with_lock(req) - @mutex.lock if req.multithread? - yield - ensure - @mutex.unlock if @mutex.locked? - end - - private - - def get_session_with_fallback(sid) - @pool[sid.private_id] || @pool[sid.public_id] - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack.rb new file mode 100644 index 0000000000..5b87ea1bc4 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +# Copyright (C) 2007-2019 Leah Neukirchen +# +# Rack is freely distributable under the terms of an MIT-style license. +# See MIT-LICENSE or https://opensource.org/licenses/MIT. + +# The Rack main module, serving as a namespace for all core Rack +# modules and classes. +# +# All modules meant for use in your application are autoloaded here, +# so it should be enough just to require 'rack' in your code. + +require_relative 'rack/version' +require_relative 'rack/constants' + +module Rack + autoload :Builder, "rack/builder" + autoload :BodyProxy, "rack/body_proxy" + autoload :Cascade, "rack/cascade" + autoload :Chunked, "rack/chunked" + autoload :CommonLogger, "rack/common_logger" + autoload :ConditionalGet, "rack/conditional_get" + autoload :Config, "rack/config" + autoload :ContentLength, "rack/content_length" + autoload :ContentType, "rack/content_type" + autoload :ETag, "rack/etag" + autoload :Events, "rack/events" + autoload :File, "rack/file" + autoload :Files, "rack/files" + autoload :Deflater, "rack/deflater" + autoload :Directory, "rack/directory" + autoload :ForwardRequest, "rack/recursive" + autoload :Handler, "rack/handler" + autoload :Head, "rack/head" + autoload :Headers, "rack/headers" + autoload :Lint, "rack/lint" + autoload :Lock, "rack/lock" + autoload :Logger, "rack/logger" + autoload :MediaType, "rack/media_type" + autoload :MethodOverride, "rack/method_override" + autoload :Mime, "rack/mime" + autoload :NullLogger, "rack/null_logger" + autoload :Recursive, "rack/recursive" + autoload :Reloader, "rack/reloader" + autoload :RewindableInput, "rack/rewindable_input" + autoload :Runtime, "rack/runtime" + autoload :Sendfile, "rack/sendfile" + autoload :Server, "rack/server" + autoload :ShowExceptions, "rack/show_exceptions" + autoload :ShowStatus, "rack/show_status" + autoload :Static, "rack/static" + autoload :TempfileReaper, "rack/tempfile_reaper" + autoload :URLMap, "rack/urlmap" + autoload :Utils, "rack/utils" + autoload :Multipart, "rack/multipart" + + autoload :MockRequest, "rack/mock_request" + autoload :MockResponse, "rack/mock_response" + + autoload :Request, "rack/request" + autoload :Response, "rack/response" + + module Auth + autoload :Basic, "rack/auth/basic" + autoload :AbstractRequest, "rack/auth/abstract/request" + autoload :AbstractHandler, "rack/auth/abstract/handler" + autoload :Digest, "rack/auth/digest" + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/abstract/handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/abstract/handler.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/abstract/handler.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/abstract/handler.rb index 3ed87091c7..4731ee8c85 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/abstract/handler.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/abstract/handler.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative '../../constants' + module Rack module Auth # Rack::Auth::AbstractHandler implements common authentication functionality. @@ -21,7 +23,7 @@ module Rack return [ 401, { CONTENT_TYPE => 'text/plain', CONTENT_LENGTH => '0', - 'WWW-Authenticate' => www_authenticate.to_s }, + 'www-authenticate' => www_authenticate.to_s }, [] ] end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/abstract/request.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/abstract/request.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/abstract/request.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/abstract/request.rb index 34042c401b..f872331563 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/abstract/request.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/abstract/request.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative '../../request' + module Rack module Auth class AbstractRequest @@ -25,7 +27,7 @@ module Rack end def scheme - @scheme ||= parts.first && parts.first.downcase + @scheme ||= parts.first&.downcase end def params diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/basic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/basic.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/auth/basic.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/basic.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest.rb new file mode 100644 index 0000000000..d9f818b9e5 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest.rb @@ -0,0 +1,256 @@ +# frozen_string_literal: true + +require_relative 'abstract/handler' +require_relative 'abstract/request' +require 'digest/md5' +require 'base64' + +module Rack + warn "Rack::Auth::Digest is deprecated and will be removed in Rack 3.1", uplevel: 1 + + module Auth + module Digest + # Rack::Auth::Digest::Nonce is the default nonce generator for the + # Rack::Auth::Digest::MD5 authentication handler. + # + # +private_key+ needs to set to a constant string. + # + # +time_limit+ can be optionally set to an integer (number of seconds), + # to limit the validity of the generated nonces. + + class Nonce + + class << self + attr_accessor :private_key, :time_limit + end + + def self.parse(string) + new(*Base64.decode64(string).split(' ', 2)) + end + + def initialize(timestamp = Time.now, given_digest = nil) + @timestamp, @given_digest = timestamp.to_i, given_digest + end + + def to_s + Base64.encode64("#{@timestamp} #{digest}").strip + end + + def digest + ::Digest::MD5.hexdigest("#{@timestamp}:#{self.class.private_key}") + end + + def valid? + digest == @given_digest + end + + def stale? + !self.class.time_limit.nil? && (Time.now.to_i - @timestamp) > self.class.time_limit + end + + def fresh? + !stale? + end + + end + + class Params < Hash + + def self.parse(str) + Params[*split_header_value(str).map do |param| + k, v = param.split('=', 2) + [k, dequote(v)] + end.flatten] + end + + def self.dequote(str) # From WEBrick::HTTPUtils + ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup + ret.gsub!(/\\(.)/, "\\1") + ret + end + + def self.split_header_value(str) + str.scan(/\w+\=(?:"[^\"]+"|[^,]+)/n) + end + + def initialize + super() + + yield self if block_given? + end + + def [](k) + super k.to_s + end + + def []=(k, v) + super k.to_s, v.to_s + end + + UNQUOTED = ['nc', 'stale'] + + def to_s + map do |k, v| + "#{k}=#{(UNQUOTED.include?(k) ? v.to_s : quote(v))}" + end.join(', ') + end + + def quote(str) # From WEBrick::HTTPUtils + '"' + str.gsub(/[\\\"]/o, "\\\1") + '"' + end + + end + + class Request < Auth::AbstractRequest + def method + @env[RACK_METHODOVERRIDE_ORIGINAL_METHOD] || @env[REQUEST_METHOD] + end + + def digest? + "digest" == scheme + end + + def correct_uri? + request.fullpath == uri + end + + def nonce + @nonce ||= Nonce.parse(params['nonce']) + end + + def params + @params ||= Params.parse(parts.last) + end + + def respond_to?(sym, *) + super or params.has_key? sym.to_s + end + + def method_missing(sym, *args) + return super unless params.has_key?(key = sym.to_s) + return params[key] if args.size == 0 + raise ArgumentError, "wrong number of arguments (#{args.size} for 0)" + end + end + + # Rack::Auth::Digest::MD5 implements the MD5 algorithm version of + # HTTP Digest Authentication, as per RFC 2617. + # + # Initialize with the [Rack] application that you want protecting, + # and a block that looks up a plaintext password for a given username. + # + # +opaque+ needs to be set to a constant base64/hexadecimal string. + # + class MD5 < AbstractHandler + + attr_accessor :opaque + + attr_writer :passwords_hashed + + def initialize(app, realm = nil, opaque = nil, &authenticator) + @passwords_hashed = nil + if opaque.nil? and realm.respond_to? :values_at + realm, opaque, @passwords_hashed = realm.values_at :realm, :opaque, :passwords_hashed + end + super(app, realm, &authenticator) + @opaque = opaque + end + + def passwords_hashed? + !!@passwords_hashed + end + + def call(env) + auth = Request.new(env) + + unless auth.provided? + return unauthorized + end + + if !auth.digest? || !auth.correct_uri? || !valid_qop?(auth) + return bad_request + end + + if valid?(auth) + if auth.nonce.stale? + return unauthorized(challenge(stale: true)) + else + env['REMOTE_USER'] = auth.username + + return @app.call(env) + end + end + + unauthorized + end + + + private + + QOP = 'auth' + + def params(hash = {}) + Params.new do |params| + params['realm'] = realm + params['nonce'] = Nonce.new.to_s + params['opaque'] = H(opaque) + params['qop'] = QOP + + hash.each { |k, v| params[k] = v } + end + end + + def challenge(hash = {}) + "Digest #{params(hash)}" + end + + def valid?(auth) + valid_opaque?(auth) && valid_nonce?(auth) && valid_digest?(auth) + end + + def valid_qop?(auth) + QOP == auth.qop + end + + def valid_opaque?(auth) + H(opaque) == auth.opaque + end + + def valid_nonce?(auth) + auth.nonce.valid? + end + + def valid_digest?(auth) + pw = @authenticator.call(auth.username) + pw && Rack::Utils.secure_compare(digest(auth, pw), auth.response) + end + + def md5(data) + ::Digest::MD5.hexdigest(data) + end + + alias :H :md5 + + def KD(secret, data) + H "#{secret}:#{data}" + end + + def A1(auth, password) + "#{auth.username}:#{auth.realm}:#{password}" + end + + def A2(auth) + "#{auth.method}:#{auth.uri}" + end + + def digest(auth, password) + password_hash = passwords_hashed? ? password : H(A1(auth, password)) + + KD password_hash, "#{auth.nonce}:#{auth.nc}:#{auth.cnonce}:#{QOP}:#{H A2(auth)}" + end + + end + end + end +end + diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/md5.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/md5.rb new file mode 100644 index 0000000000..828eccac87 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/md5.rb @@ -0,0 +1 @@ +require_relative '../digest' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/nonce.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/nonce.rb new file mode 100644 index 0000000000..828eccac87 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/nonce.rb @@ -0,0 +1 @@ +require_relative '../digest' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/params.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/params.rb new file mode 100644 index 0000000000..828eccac87 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/params.rb @@ -0,0 +1 @@ +require_relative '../digest' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/request.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/request.rb new file mode 100644 index 0000000000..828eccac87 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/auth/digest/request.rb @@ -0,0 +1 @@ +require_relative '../digest' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/body_proxy.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/body_proxy.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/body_proxy.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/body_proxy.rb index cfc0796a61..fbb344b810 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/body_proxy.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/body_proxy.rb @@ -24,7 +24,7 @@ module Rack return if @closed @closed = true begin - @body.close if @body.respond_to? :close + @body.close if @body.respond_to?(:close) ensure @block.call end @@ -40,6 +40,8 @@ module Rack def method_missing(method_name, *args, &block) @body.__send__(method_name, *args, &block) end + # :nocov: ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true) + # :nocov: end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/builder.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/builder.rb similarity index 76% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/builder.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/builder.rb index 816ecf6208..6d40b534ac 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/builder.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/builder.rb @@ -1,8 +1,12 @@ # frozen_string_literal: true +require_relative 'urlmap' + module Rack - # Rack::Builder implements a small DSL to iteratively construct Rack - # applications. + # Rack::Builder provides a domain-specific language (DSL) to construct Rack + # applications. It is primarily used to parse +config.ru+ files which + # instantiate several middleware and a final application which are hosted + # by a Rack-compatible web server. # # Example: # @@ -29,7 +33,6 @@ module Rack # # +use+ adds middleware to the stack, +run+ dispatches to an application. # You can use +map+ to construct a Rack::URLMap in a convenient way. - class Builder # https://stackoverflow.com/questions/2223882/whats-the-difference-between-utf-8-and-utf-8-without-bom @@ -39,13 +42,11 @@ module Rack # # If the config file ends in +.ru+, it is treated as a # rackup file and the contents will be treated as if - # specified inside a Rack::Builder block, using the given - # options. + # specified inside a Rack::Builder block. # # If the config file does not end in +.ru+, it is # required and Rack will use the basename of the file # to guess which constant will be the Rack application to run. - # The options given will be ignored in this case. # # Examples: # @@ -61,23 +62,18 @@ module Rack # # requires ./my_app.rb, which should be in the # # process's current directory. After requiring, # # assumes MyApp constant contains Rack application - def self.parse_file(config, opts = Server::Options.new) - if config.end_with?('.ru') - return self.load_file(config, opts) + def self.parse_file(path) + if path.end_with?('.ru') + return self.load_file(path) else - require config - app = Object.const_get(::File.basename(config, '.rb').split('_').map(&:capitalize).join('')) - return app, {} + require path + return Object.const_get(::File.basename(path, '.rb').split('_').map(&:capitalize).join('')) end end # Load the given file as a rackup file, treating the # contents as if specified inside a Rack::Builder block. # - # Treats the first comment at the beginning of a line - # that starts with a backslash as options similar to - # options passed on a rackup command line. - # # Ignores content in the file after +__END__+, so that # use of +__END__+ will not result in a syntax error. # @@ -85,26 +81,20 @@ module Rack # # $ cat config.ru # - # #\ -p 9393 - # # use Rack::ContentLength # require './app.rb' # run App - def self.load_file(path, opts = Server::Options.new) - options = {} + def self.load_file(path) + config = ::File.read(path) + config.slice!(/\A#{UTF_8_BOM}/) if config.encoding == Encoding::UTF_8 - cfgfile = ::File.read(path) - cfgfile.slice!(/\A#{UTF_8_BOM}/) if cfgfile.encoding == Encoding::UTF_8 - - if cfgfile[/^#\\(.*)/] && opts - warn "Parsing options from the first comment line is deprecated!" - options = opts.parse! $1.split(/\s+/) + if config[/^#\\(.*)/] + fail "Parsing options from the first comment line is no longer supported: #{path}" end - cfgfile.sub!(/^__END__\n.*\Z/m, '') - app = new_from_string cfgfile, path + config.sub!(/^__END__\n.*\Z/m, '') - return app, options + return new_from_string(config, path) end # Evaluate the given +builder_script+ string in the context of @@ -114,14 +104,20 @@ module Rack # We cannot use instance_eval(String) as that would resolve constants differently. binding, builder = TOPLEVEL_BINDING.eval('Rack::Builder.new.instance_eval { [binding, self] }') eval builder_script, binding, file - builder.to_app + + return builder.to_app end # Initialize a new Rack::Builder instance. +default_app+ specifies the # default application if +run+ is not called later. If a block - # is given, it is evaluted in the context of the instance. + # is given, it is evaluated in the context of the instance. def initialize(default_app = nil, &block) - @use, @map, @run, @warmup, @freeze_app = [], nil, default_app, nil, false + @use = [] + @map = nil + @run = default_app + @warmup = nil + @freeze_app = false + instance_eval(&block) if block_given? end @@ -145,7 +141,7 @@ module Rack # end # # use Middleware - # run lambda { |env| [200, { "Content-Type" => "text/plain" }, ["OK"]] } + # run lambda { |env| [200, { "content-type" => "text/plain" }, ["OK"]] } # # All requests through to this application will first be processed by the middleware class. # The +call+ method in this example sets an additional environment key which then can be @@ -157,24 +153,46 @@ module Rack end @use << proc { |app| middleware.new(app, *args, &block) } end + # :nocov: ruby2_keywords(:use) if respond_to?(:ruby2_keywords, true) + # :nocov: - # Takes an argument that is an object that responds to #call and returns a Rack response. - # The simplest form of this is a lambda object: + # Takes a block or argument that is an object that responds to #call and + # returns a Rack response. # - # run lambda { |env| [200, { "Content-Type" => "text/plain" }, ["OK"]] } + # You can use a block: # - # However this could also be a class: + # run do |env| + # [200, { "content-type" => "text/plain" }, ["Hello World!"]] + # end + # + # You can also provide a lambda: + # + # run lambda { |env| [200, { "content-type" => "text/plain" }, ["OK"]] } + # + # You can also provide a class instance: # # class Heartbeat - # def self.call(env) - # [200, { "Content-Type" => "text/plain" }, ["OK"]] + # def call(env) + # [200, { "content-type" => "text/plain" }, ["OK"]] # end # end # - # run Heartbeat - def run(app) - @run = app + # run Heartbeat.new + # + # It could also be a module: + # + # module HelloWorld + # def call(env) + # [200, { "content-type" => "text/plain" }, ["Hello World"]] + # end + # end + # + # run HelloWorld + def run(app = nil, &block) + raise ArgumentError, "Both app and block given!" if app && block_given? + + @run = app || block end # Takes a lambda or block that is used to warm-up the application. This block is called diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/cascade.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/cascade.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/cascade.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/cascade.rb index d71274c2b7..027d7e4045 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/cascade.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/cascade.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative 'constants' + module Rack # Rack::Cascade tries a request on several apps, and returns the # first response that is not 404 or 405 (or in a list of configured diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/chunked.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/chunked.rb similarity index 78% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/chunked.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/chunked.rb index 84c6600140..47fb36ac1f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/chunked.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/chunked.rb @@ -1,22 +1,26 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'utils' + module Rack + warn "Rack::Chunked is deprecated and will be removed in Rack 3.1", uplevel: 1 # Middleware that applies chunked transfer encoding to response bodies - # when the response does not include a Content-Length header. + # when the response does not include a content-length header. # - # This supports the Trailer response header to allow the use of trailing + # This supports the trailer response header to allow the use of trailing # headers in the chunked encoding. However, using this requires you manually # specify a response body that supports a +trailers+ method. Example: # - # [200, { 'Trailer' => 'Expires'}, ["Hello", "World"]] + # [200, { 'trailer' => 'expires'}, ["Hello", "World"]] # # error raised # # body = ["Hello", "World"] # def body.trailers - # { 'Expires' => Time.now.to_s } + # { 'expires' => Time.now.to_s } # end - # [200, { 'Trailer' => 'Expires'}, body] + # [200, { 'trailer' => 'expires'}, body] # # No exception raised class Chunked include Rack::Utils @@ -92,11 +96,10 @@ module Rack end # If the rack app returns a response that should have a body, - # but does not have Content-Length or Transfer-Encoding headers, - # modify the response to use chunked Transfer-Encoding. + # but does not have content-length or transfer-encoding headers, + # modify the response to use chunked transfer-encoding. def call(env) - status, headers, body = @app.call(env) - headers = HeaderHash[headers] + status, headers, body = response = @app.call(env) if chunkable_version?(env[SERVER_PROTOCOL]) && !STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) && @@ -104,14 +107,14 @@ module Rack !headers[TRANSFER_ENCODING] headers[TRANSFER_ENCODING] = 'chunked' - if headers['Trailer'] - body = TrailerBody.new(body) + if headers['trailer'] + response[2] = TrailerBody.new(body) else - body = Body.new(body) + response[2] = Body.new(body) end end - [status, headers, body] + response end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/common_logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/common_logger.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/common_logger.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/common_logger.rb index 9c6f92147d..2feb067464 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/common_logger.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/common_logger.rb @@ -1,5 +1,10 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'utils' +require_relative 'body_proxy' +require_relative 'request' + module Rack # Rack::CommonLogger forwards every request to the given +app+, and # logs a line in the @@ -35,35 +40,35 @@ module Rack # cause the request not to be logged. def call(env) began_at = Utils.clock_time - status, headers, body = @app.call(env) - headers = Utils::HeaderHash[headers] - body = BodyProxy.new(body) { log(env, status, headers, began_at) } - [status, headers, body] + status, headers, body = response = @app.call(env) + + response[2] = BodyProxy.new(body) { log(env, status, headers, began_at) } + response end private # Log the request to the configured logger. - def log(env, status, header, began_at) - length = extract_content_length(header) + def log(env, status, response_headers, began_at) + request = Rack::Request.new(env) + length = extract_content_length(response_headers) - msg = FORMAT % [ - env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "-", - env["REMOTE_USER"] || "-", + msg = sprintf(FORMAT, + request.ip || "-", + request.get_header("REMOTE_USER") || "-", Time.now.strftime("%d/%b/%Y:%H:%M:%S %z"), - env[REQUEST_METHOD], - env[SCRIPT_NAME], - env[PATH_INFO], - env[QUERY_STRING].empty? ? "" : "?#{env[QUERY_STRING]}", - env[SERVER_PROTOCOL], + request.request_method, + request.script_name, + request.path_info, + request.query_string.empty? ? "" : "?#{request.query_string}", + request.get_header(SERVER_PROTOCOL), status.to_s[0..3], length, - Utils.clock_time - began_at ] + Utils.clock_time - began_at) - msg.gsub!(/[^[:print:]\n]/) { |c| "\\x#{c.ord}" } - - logger = @logger || env[RACK_ERRORS] + msg.gsub!(/[^[:print:]\n]/) { |c| sprintf("\\x%x", c.ord) } + logger = @logger || request.get_header(RACK_ERRORS) # Standard library logger doesn't support write but it supports << which actually # calls to write on the log device without formatting if logger.respond_to?(:write) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/conditional_get.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/conditional_get.rb similarity index 74% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/conditional_get.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/conditional_get.rb index 7b7808ac1f..c3b334a2e2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/conditional_get.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/conditional_get.rb @@ -1,10 +1,14 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'utils' +require_relative 'body_proxy' + module Rack - # Middleware that enables conditional GET using If-None-Match and - # If-Modified-Since. The application should set either or both of the - # Last-Modified or Etag response headers according to RFC 2616. When + # Middleware that enables conditional GET using if-none-match and + # if-modified-since. The application should set either or both of the + # last-modified or etag response headers according to RFC 2616. When # either of the conditions is met, the response body is set to be zero # length and the response status is set to 304 Not Modified. # @@ -24,18 +28,17 @@ module Rack def call(env) case env[REQUEST_METHOD] when "GET", "HEAD" - status, headers, body = @app.call(env) - headers = Utils::HeaderHash[headers] + status, headers, body = response = @app.call(env) + if status == 200 && fresh?(env, headers) - status = 304 + response[0] = 304 headers.delete(CONTENT_TYPE) headers.delete(CONTENT_LENGTH) - original_body = body - body = Rack::BodyProxy.new([]) do - original_body.close if original_body.respond_to?(:close) + response[2] = Rack::BodyProxy.new([]) do + body.close if body.respond_to?(:close) end end - [status, headers, body] + response else @app.call(env) end @@ -46,7 +49,7 @@ module Rack # Return whether the response has not been modified since the # last request. def fresh?(env, headers) - # If-None-Match has priority over If-Modified-Since per RFC 7232 + # if-none-match has priority over if-modified-since per RFC 7232 if none_match = env['HTTP_IF_NONE_MATCH'] etag_matches?(none_match, headers) elsif (modified_since = env['HTTP_IF_MODIFIED_SINCE']) && (modified_since = to_rfc2822(modified_since)) @@ -54,16 +57,16 @@ module Rack end end - # Whether the ETag response header matches the If-None-Match request header. + # Whether the etag response header matches the if-none-match request header. # If so, the request has not been modified. def etag_matches?(none_match, headers) - headers['ETag'] == none_match + headers[ETAG] == none_match end - # Whether the Last-Modified response header matches the If-Modified-Since + # Whether the last-modified response header matches the if-modified-since # request header. If so, the request has not been modified. def modified_since?(modified_since, headers) - last_modified = to_rfc2822(headers['Last-Modified']) and + last_modified = to_rfc2822(headers['last-modified']) and modified_since >= last_modified end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/config.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/config.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/config.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/config.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/constants.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/constants.rb new file mode 100644 index 0000000000..d99b636733 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/constants.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +module Rack + # Request env keys + HTTP_HOST = 'HTTP_HOST' + HTTP_PORT = 'HTTP_PORT' + HTTPS = 'HTTPS' + PATH_INFO = 'PATH_INFO' + REQUEST_METHOD = 'REQUEST_METHOD' + REQUEST_PATH = 'REQUEST_PATH' + SCRIPT_NAME = 'SCRIPT_NAME' + QUERY_STRING = 'QUERY_STRING' + SERVER_PROTOCOL = 'SERVER_PROTOCOL' + SERVER_NAME = 'SERVER_NAME' + SERVER_PORT = 'SERVER_PORT' + HTTP_COOKIE = 'HTTP_COOKIE' + + # Response Header Keys + CACHE_CONTROL = 'cache-control' + CONTENT_LENGTH = 'content-length' + CONTENT_TYPE = 'content-type' + ETAG = 'etag' + EXPIRES = 'expires' + SET_COOKIE = 'set-cookie' + TRANSFER_ENCODING = 'transfer-encoding' + + # HTTP method verbs + GET = 'GET' + POST = 'POST' + PUT = 'PUT' + PATCH = 'PATCH' + DELETE = 'DELETE' + HEAD = 'HEAD' + OPTIONS = 'OPTIONS' + LINK = 'LINK' + UNLINK = 'UNLINK' + TRACE = 'TRACE' + + # Rack environment variables + RACK_VERSION = 'rack.version' + RACK_TEMPFILES = 'rack.tempfiles' + RACK_ERRORS = 'rack.errors' + RACK_LOGGER = 'rack.logger' + RACK_INPUT = 'rack.input' + RACK_SESSION = 'rack.session' + RACK_SESSION_OPTIONS = 'rack.session.options' + RACK_SHOWSTATUS_DETAIL = 'rack.showstatus.detail' + RACK_URL_SCHEME = 'rack.url_scheme' + RACK_HIJACK = 'rack.hijack' + RACK_IS_HIJACK = 'rack.hijack?' + RACK_RECURSIVE_INCLUDE = 'rack.recursive.include' + RACK_MULTIPART_BUFFER_SIZE = 'rack.multipart.buffer_size' + RACK_MULTIPART_TEMPFILE_FACTORY = 'rack.multipart.tempfile_factory' + RACK_RESPONSE_FINISHED = 'rack.response_finished' + RACK_REQUEST_FORM_INPUT = 'rack.request.form_input' + RACK_REQUEST_FORM_HASH = 'rack.request.form_hash' + RACK_REQUEST_FORM_VARS = 'rack.request.form_vars' + RACK_REQUEST_COOKIE_HASH = 'rack.request.cookie_hash' + RACK_REQUEST_COOKIE_STRING = 'rack.request.cookie_string' + RACK_REQUEST_QUERY_HASH = 'rack.request.query_hash' + RACK_REQUEST_QUERY_STRING = 'rack.request.query_string' + RACK_METHODOVERRIDE_ORIGINAL_METHOD = 'rack.methodoverride.original_method' +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/content_length.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/content_length.rb new file mode 100644 index 0000000000..cbac93abcf --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/content_length.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require_relative 'constants' +require_relative 'utils' + +module Rack + + # Sets the content-length header on responses that do not specify + # a content-length or transfer-encoding header. Note that this + # does not fix responses that have an invalid content-length + # header specified. + class ContentLength + include Rack::Utils + + def initialize(app) + @app = app + end + + def call(env) + status, headers, body = response = @app.call(env) + + if !STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) && + !headers[CONTENT_LENGTH] && + !headers[TRANSFER_ENCODING] && + body.respond_to?(:to_ary) + + response[2] = body = body.to_ary + headers[CONTENT_LENGTH] = body.sum(&:bytesize).to_s + end + + response + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/content_type.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/content_type.rb similarity index 65% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/content_type.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/content_type.rb index 503f707062..19f07824f5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/content_type.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/content_type.rb @@ -1,8 +1,11 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'utils' + module Rack - # Sets the Content-Type header on responses which don't have one. + # Sets the content-type header on responses which don't have one. # # Builder Usage: # use Rack::ContentType, "text/plain" @@ -13,18 +16,18 @@ module Rack include Rack::Utils def initialize(app, content_type = "text/html") - @app, @content_type = app, content_type + @app = app + @content_type = content_type end def call(env) - status, headers, body = @app.call(env) - headers = Utils::HeaderHash[headers] + status, headers, _ = response = @app.call(env) unless STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) headers[CONTENT_TYPE] ||= @content_type end - [status, headers, body] + response end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/deflater.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/deflater.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/deflater.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/deflater.rb index e177fabb01..cc01c32a0a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/deflater.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/deflater.rb @@ -3,6 +3,11 @@ require "zlib" require "time" # for Time.httpdate +require_relative 'constants' +require_relative 'utils' +require_relative 'request' +require_relative 'body_proxy' + module Rack # This middleware enables content encoding of http responses, # usually for purposes of compression. @@ -21,8 +26,6 @@ module Rack # Note that despite the name, Deflater does not support the +deflate+ # encoding. class Deflater - (require_relative 'core_ext/regexp'; using ::Rack::RegexpExtensions) if RUBY_VERSION < '2.4' - # Creates Rack::Deflater middleware. Options: # # :if :: a lambda enabling / disabling deflation based on returned boolean value @@ -41,11 +44,10 @@ module Rack end def call(env) - status, headers, body = @app.call(env) - headers = Utils::HeaderHash[headers] + status, headers, body = response = @app.call(env) unless should_deflate?(env, status, headers, body) - return [status, headers, body] + return response end request = Request.new(env) @@ -54,21 +56,23 @@ module Rack request.accept_encoding) # Set the Vary HTTP header. - vary = headers["Vary"].to_s.split(",").map(&:strip) - unless vary.include?("*") || vary.include?("Accept-Encoding") - headers["Vary"] = vary.push("Accept-Encoding").join(",") + vary = headers["vary"].to_s.split(",").map(&:strip) + unless vary.include?("*") || vary.any?{|v| v.downcase == 'accept-encoding'} + headers["vary"] = vary.push("Accept-Encoding").join(",") end case encoding when "gzip" - headers['Content-Encoding'] = "gzip" + headers['content-encoding'] = "gzip" headers.delete(CONTENT_LENGTH) - mtime = headers["Last-Modified"] + mtime = headers["last-modified"] mtime = Time.httpdate(mtime).to_i if mtime - [status, headers, GzipStream.new(body, mtime, @sync)] + response[2] = GzipStream.new(body, mtime, @sync) + response when "identity" - [status, headers, body] - when nil + response + else # when nil + # Only possible encoding values here are 'gzip', 'identity', and nil message = "An acceptable encoding for the requested resource #{request.fullpath} could not be found." bp = Rack::BodyProxy.new([message]) { body.close if body.respond_to?(:close) } [406, { CONTENT_TYPE => "text/plain", CONTENT_LENGTH => message.length.to_s }, bp] @@ -77,6 +81,9 @@ module Rack # Body class used for gzip encoded responses. class GzipStream + + BUFFER_LENGTH = 128 * 1_024 + # Initialize the gzip stream. Arguments: # body :: Response body to compress with gzip # mtime :: The modification time of the body, used to set the @@ -93,19 +100,26 @@ module Rack @writer = block gzip = ::Zlib::GzipWriter.new(self) gzip.mtime = @mtime if @mtime - @body.each { |part| - # Skip empty strings, as they would result in no output, - # and flushing empty parts would raise Zlib::BufError. - next if part.empty? - - gzip.write(part) - gzip.flush if @sync - } + # @body.each is equivalent to @body.gets (slow) + if @body.is_a? ::File # XXX: Should probably be ::IO + while part = @body.read(BUFFER_LENGTH) + gzip.write(part) + gzip.flush if @sync + end + else + @body.each { |part| + # Skip empty strings, as they would result in no output, + # and flushing empty parts would raise Zlib::BufError. + next if part.empty? + gzip.write(part) + gzip.flush if @sync + } + end ensure - gzip.close + gzip.finish end - # Call the block passed to #each with the the gzipped data. + # Call the block passed to #each with the gzipped data. def write(data) @writer.call(data) end @@ -123,13 +137,13 @@ module Rack # Skip compressing empty entity body responses and responses with # no-transform set. if Utils::STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) || - /\bno-transform\b/.match?(headers['Cache-Control'].to_s) || - headers['Content-Encoding']&.!~(/\bidentity\b/) + /\bno-transform\b/.match?(headers[CACHE_CONTROL].to_s) || + headers['content-encoding']&.!~(/\bidentity\b/) return false end # Skip if @compressible_types are given and does not include request's content type - return false if @compressible_types && !(headers.has_key?('Content-Type') && @compressible_types.include?(headers['Content-Type'][/[^;]*/])) + return false if @compressible_types && !(headers.has_key?(CONTENT_TYPE) && @compressible_types.include?(headers[CONTENT_TYPE][/[^;]*/])) # Skip if @condition lambda is given and evaluates to false return false if @condition && !@condition.call(env, status, headers, body) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/directory.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/directory.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/directory.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/directory.rb index be72be0144..089623f91d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/directory.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/directory.rb @@ -2,6 +2,12 @@ require 'time' +require_relative 'constants' +require_relative 'utils' +require_relative 'head' +require_relative 'mime' +require_relative 'files' + module Rack # Rack::Directory serves entries below the +root+ given, according to the # path info of the Rack request. If a directory is found, the file's contents @@ -106,7 +112,7 @@ table { width:100%%; } body = "Bad Request\n" [400, { CONTENT_TYPE => "text/plain", CONTENT_LENGTH => body.bytesize.to_s, - "X-Cascade" => "pass" }, [body]] + "x-cascade" => "pass" }, [body]] end # Rack response to use for requests with paths outside the root, or nil if path is inside the root. @@ -117,7 +123,7 @@ table { width:100%%; } body = "Forbidden\n" [403, { CONTENT_TYPE => "text/plain", CONTENT_LENGTH => body.bytesize.to_s, - "X-Cascade" => "pass" }, [body]] + "x-cascade" => "pass" }, [body]] end # Rack response to use for directories under the root. @@ -176,7 +182,7 @@ table { width:100%%; } body = "Entity not found: #{path_info}\n" [404, { CONTENT_TYPE => "text/plain", CONTENT_LENGTH => body.bytesize.to_s, - "X-Cascade" => "pass" }, [body]] + "x-cascade" => "pass" }, [body]] end # Stolen from Ramaze diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/etag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/etag.rb similarity index 58% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/etag.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/etag.rb index 5039437e1c..fa78b472fd 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/etag.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/etag.rb @@ -1,17 +1,19 @@ # frozen_string_literal: true -require_relative '../rack' require 'digest/sha2' +require_relative 'constants' +require_relative 'utils' + module Rack - # Automatically sets the ETag header on all String bodies. + # Automatically sets the etag header on all String bodies. # - # The ETag header is skipped if ETag or Last-Modified headers are sent or if + # The etag header is skipped if etag or last-modified headers are sent or if # a sendfile body (body.responds_to :to_path) is given (since such cases # should be handled by apache/nginx). # - # On initialization, you can pass two parameters: a Cache-Control directive - # used when Etag is absent and a directive when it is present. The first + # On initialization, you can pass two parameters: a cache-control directive + # used when etag is absent and a directive when it is present. The first # defaults to nil, while the second defaults to "max-age=0, private, must-revalidate" class ETag ETAG_STRING = Rack::ETAG @@ -24,16 +26,11 @@ module Rack end def call(env) - status, headers, body = @app.call(env) + status, headers, body = response = @app.call(env) - headers = Utils::HeaderHash[headers] - - if etag_status?(status) && etag_body?(body) && !skip_caching?(headers) - original_body = body - digest, new_body = digest_body(body) - body = Rack::BodyProxy.new(new_body) do - original_body.close if original_body.respond_to?(:close) - end + if etag_status?(status) && body.respond_to?(:to_ary) && !skip_caching?(headers) + body = body.to_ary + digest = digest_body(body) headers[ETAG_STRING] = %(W/"#{digest}") if digest end @@ -45,7 +42,7 @@ module Rack end end - [status, headers, body] + response end private @@ -54,24 +51,18 @@ module Rack status == 200 || status == 201 end - def etag_body?(body) - !body.respond_to?(:to_path) - end - def skip_caching?(headers) - headers.key?(ETAG_STRING) || headers.key?('Last-Modified') + headers.key?(ETAG_STRING) || headers.key?('last-modified') end def digest_body(body) - parts = [] digest = nil body.each do |part| - parts << part (digest ||= Digest::SHA256.new) << part unless part.empty? end - [digest && digest.hexdigest.byteslice(0, 32), parts] + digest && digest.hexdigest.byteslice(0,32) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/events.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/events.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/events.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/events.rb index 65055fdc51..c7bb201f05 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/events.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/events.rb @@ -1,5 +1,9 @@ # frozen_string_literal: true +require_relative 'body_proxy' +require_relative 'request' +require_relative 'response' + module Rack ### This middleware provides hooks to certain places in the request / # response lifecycle. This is so that middleware that don't need to filter diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/file.rb similarity index 52% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/file.rb index fdcf9b3ec0..52c7b41667 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/file.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/file.rb @@ -3,5 +3,7 @@ require_relative 'files' module Rack + warn "Rack::File is deprecated and will be removed in Rack 3.1", uplevel: 1 + File = Files end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/files.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/files.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/files.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/files.rb index e745eb3984..5b8353f5b5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/files.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/files.rb @@ -2,6 +2,12 @@ require 'time' +require_relative 'constants' +require_relative 'head' +require_relative 'utils' +require_relative 'request' +require_relative 'mime' + module Rack # Rack::Files serves files below the +root+ directory given, according to the # path info of the Rack request. @@ -16,14 +22,6 @@ module Rack ALLOW_HEADER = ALLOWED_VERBS.join(', ') MULTIPART_BOUNDARY = 'AaB03x' - # @todo remove in 3.0 - def self.method_added(name) - if name == :response_body - raise "#{self.class}\#response_body is no longer supported." - end - super - end - attr_reader :root def initialize(root, headers = {}, default_mime = 'text/plain') @@ -41,7 +39,7 @@ module Rack def get(env) request = Rack::Request.new env unless ALLOWED_VERBS.include? request.request_method - return fail(405, "Method Not Allowed", { 'Allow' => ALLOW_HEADER }) + return fail(405, "Method Not Allowed", { 'allow' => ALLOW_HEADER }) end path_info = Utils.unescape_path request.path_info @@ -69,12 +67,12 @@ module Rack def serving(request, path) if request.options? - return [200, { 'Allow' => ALLOW_HEADER, CONTENT_LENGTH => '0' }, []] + return [200, { 'allow' => ALLOW_HEADER, CONTENT_LENGTH => '0' }, []] end last_modified = ::File.mtime(path).httpdate return [304, {}, []] if request.get_header('HTTP_IF_MODIFIED_SINCE') == last_modified - headers = { "Last-Modified" => last_modified } + headers = { "last-modified" => last_modified } mime_type = mime_type path, @default_mime headers[CONTENT_TYPE] = mime_type if mime_type @@ -91,15 +89,15 @@ module Rack elsif ranges.empty? # Unsatisfiable. Return error, and file size: response = fail(416, "Byte range unsatisfiable") - response[1]["Content-Range"] = "bytes */#{size}" + response[1]["content-range"] = "bytes */#{size}" return response - elsif ranges.size >= 1 + else # Partial content partial_content = true if ranges.size == 1 range = ranges[0] - headers["Content-Range"] = "bytes #{range.begin}-#{range.end}/#{size}" + headers["content-range"] = "bytes #{range.begin}-#{range.end}/#{size}" else headers[CONTENT_TYPE] = "multipart/byteranges; boundary=#{MULTIPART_BOUNDARY}" end @@ -164,8 +162,8 @@ module Rack <<-EOF \r --#{MULTIPART_BOUNDARY}\r -Content-Type: #{options[:mime_type]}\r -Content-Range: bytes #{range.begin}-#{range.end}/#{options[:size]}\r +content-type: #{options[:mime_type]}\r +content-range: bytes #{range.begin}-#{range.end}/#{options[:size]}\r \r EOF end @@ -197,7 +195,7 @@ EOF { CONTENT_TYPE => "text/plain", CONTENT_LENGTH => body.size.to_s, - "X-Cascade" => "pass" + "x-cascade" => "pass" }.merge!(headers), [body] ] diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/head.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/head.rb similarity index 56% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/head.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/head.rb index 8025a27d51..c1c430f653 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/head.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/head.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'body_proxy' + module Rack # Rack::Head returns an empty body for all HEAD requests. It leaves # all other requests unchanged. @@ -9,17 +12,15 @@ module Rack end def call(env) - status, headers, body = @app.call(env) + _, _, body = response = @app.call(env) if env[REQUEST_METHOD] == HEAD - [ - status, headers, Rack::BodyProxy.new([]) do - body.close if body.respond_to? :close - end - ] - else - [status, headers, body] + response[2] = Rack::BodyProxy.new([]) do + body.close if body.respond_to? :close + end end + + response end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/headers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/headers.rb new file mode 100644 index 0000000000..153c1b2233 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/headers.rb @@ -0,0 +1,154 @@ +module Rack + # Rack::Headers is a Hash subclass that downcases all keys. It's designed + # to be used by rack applications that don't implement the Rack 3 SPEC + # (by using non-lowercase response header keys), automatically handling + # the downcasing of keys. + class Headers < Hash + def self.[](*items) + if items.length % 2 != 0 + if items.length == 1 && items.first.is_a?(Hash) + new.merge!(items.first) + else + raise ArgumentError, "odd number of arguments for Rack::Headers" + end + else + hash = new + loop do + break if items.length == 0 + key = items.shift + value = items.shift + hash[key] = value + end + hash + end + end + + def [](key) + super(downcase_key(key)) + end + + def []=(key, value) + super(key.downcase.freeze, value) + end + alias store []= + + def assoc(key) + super(downcase_key(key)) + end + + def compare_by_identity + raise TypeError, "Rack::Headers cannot compare by identity, use regular Hash" + end + + def delete(key) + super(downcase_key(key)) + end + + def dig(key, *a) + super(downcase_key(key), *a) + end + + def fetch(key, *default, &block) + key = downcase_key(key) + super + end + + def fetch_values(*a) + super(*a.map!{|key| downcase_key(key)}) + end + + def has_key?(key) + super(downcase_key(key)) + end + alias include? has_key? + alias key? has_key? + alias member? has_key? + + def invert + hash = self.class.new + each{|key, value| hash[value] = key} + hash + end + + def merge(hash, &block) + dup.merge!(hash, &block) + end + + def reject(&block) + hash = dup + hash.reject!(&block) + hash + end + + def replace(hash) + clear + update(hash) + end + + def select(&block) + hash = dup + hash.select!(&block) + hash + end + + def to_proc + lambda{|x| self[x]} + end + + def transform_values(&block) + dup.transform_values!(&block) + end + + def update(hash, &block) + hash.each do |key, value| + self[key] = if block_given? && include?(key) + block.call(key, self[key], value) + else + value + end + end + self + end + alias merge! update + + def values_at(*keys) + keys.map{|key| self[key]} + end + + # :nocov: + if RUBY_VERSION >= '2.5' + # :nocov: + def slice(*a) + h = self.class.new + a.each{|k| h[k] = self[k] if has_key?(k)} + h + end + + def transform_keys(&block) + dup.transform_keys!(&block) + end + + def transform_keys! + hash = self.class.new + each do |k, v| + hash[yield k] = v + end + replace(hash) + end + end + + # :nocov: + if RUBY_VERSION >= '3.0' + # :nocov: + def except(*a) + super(*a.map!{|key| downcase_key(key)}) + end + end + + private + + def downcase_key(key) + key.is_a?(String) ? key.downcase : key + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/lint.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/lint.rb new file mode 100755 index 0000000000..42878879a8 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/lint.rb @@ -0,0 +1,901 @@ +# frozen_string_literal: true + +require 'forwardable' + +require_relative 'constants' +require_relative 'utils' + +module Rack + # Rack::Lint validates your application and the requests and + # responses according to the Rack spec. + + class Lint + def initialize(app) + @app = app + end + + # :stopdoc: + + class LintError < RuntimeError; end + # AUTHORS: n.b. The trailing whitespace between paragraphs is important and + # should not be removed. The whitespace creates paragraphs in the RDoc + # output. + # + ## This specification aims to formalize the Rack protocol. You + ## can (and should) use Rack::Lint to enforce it. + ## + ## When you develop middleware, be sure to add a Lint before and + ## after to catch all mistakes. + ## + ## = Rack applications + ## + ## A Rack application is a Ruby object (not a class) that + ## responds to +call+. + def call(env = nil) + Wrapper.new(@app, env).response + end + + class Wrapper + def initialize(app, env) + @app = app + @env = env + @response = nil + @head_request = false + + @status = nil + @headers = nil + @body = nil + @invoked = nil + @content_length = nil + @closed = false + @size = 0 + end + + def response + ## It takes exactly one argument, the *environment* + raise LintError, "No env given" unless @env + check_environment(@env) + + @env[RACK_INPUT] = InputWrapper.new(@env[RACK_INPUT]) + @env[RACK_ERRORS] = ErrorWrapper.new(@env[RACK_ERRORS]) + + ## and returns a non-frozen Array of exactly three values: + @response = @app.call(@env) + raise LintError, "response is not an Array, but #{@response.class}" unless @response.kind_of? Array + raise LintError, "response is frozen" if @response.frozen? + raise LintError, "response array has #{@response.size} elements instead of 3" unless @response.size == 3 + + @status, @headers, @body = @response + ## The *status*, + check_status(@status) + + ## the *headers*, + check_headers(@headers) + + hijack_proc = check_hijack_response(@headers, @env) + if hijack_proc + @headers[RACK_HIJACK] = hijack_proc + end + + ## and the *body*. + check_content_type(@status, @headers) + check_content_length(@status, @headers) + @head_request = @env[REQUEST_METHOD] == HEAD + + @lint = (@env['rack.lint'] ||= []) << self + + if (@env['rack.lint.body_iteration'] ||= 0) > 0 + raise LintError, "Middleware must not call #each directly" + end + + return [@status, @headers, self] + end + + ## + ## == The Environment + ## + def check_environment(env) + ## The environment must be an unfrozen instance of Hash that includes + ## CGI-like headers. The Rack application is free to modify the + ## environment. + raise LintError, "env #{env.inspect} is not a Hash, but #{env.class}" unless env.kind_of? Hash + raise LintError, "env should not be frozen, but is" if env.frozen? + + ## + ## The environment is required to include these variables + ## (adopted from {PEP 333}[https://peps.python.org/pep-0333/]), except when they'd be empty, but see + ## below. + + ## REQUEST_METHOD:: The HTTP request method, such as + ## "GET" or "POST". This cannot ever + ## be an empty string, and so is + ## always required. + + ## SCRIPT_NAME:: The initial portion of the request + ## URL's "path" that corresponds to the + ## application object, so that the + ## application knows its virtual + ## "location". This may be an empty + ## string, if the application corresponds + ## to the "root" of the server. + + ## PATH_INFO:: The remainder of the request URL's + ## "path", designating the virtual + ## "location" of the request's target + ## within the application. This may be an + ## empty string, if the request URL targets + ## the application root and does not have a + ## trailing slash. This value may be + ## percent-encoded when originating from + ## a URL. + + ## QUERY_STRING:: The portion of the request URL that + ## follows the ?, if any. May be + ## empty, but is always required! + + ## SERVER_NAME:: When combined with SCRIPT_NAME and + ## PATH_INFO, these variables can be + ## used to complete the URL. Note, however, + ## that HTTP_HOST, if present, + ## should be used in preference to + ## SERVER_NAME for reconstructing + ## the request URL. + ## SERVER_NAME can never be an empty + ## string, and so is always required. + + ## SERVER_PORT:: An optional +Integer+ which is the port the + ## server is running on. Should be specified if + ## the server is running on a non-standard port. + + ## SERVER_PROTOCOL:: A string representing the HTTP version used + ## for the request. + + ## HTTP_ Variables:: Variables corresponding to the + ## client-supplied HTTP request + ## headers (i.e., variables whose + ## names begin with HTTP_). The + ## presence or absence of these + ## variables should correspond with + ## the presence or absence of the + ## appropriate HTTP header in the + ## request. See + ## {RFC3875 section 4.1.18}[https://tools.ietf.org/html/rfc3875#section-4.1.18] + ## for specific behavior. + + ## In addition to this, the Rack environment must include these + ## Rack-specific variables: + + ## rack.url_scheme:: +http+ or +https+, depending on the + ## request URL. + + ## rack.input:: See below, the input stream. + + ## rack.errors:: See below, the error stream. + + ## rack.hijack?:: See below, if present and true, indicates + ## that the server supports partial hijacking. + + ## rack.hijack:: See below, if present, an object responding + ## to +call+ that is used to perform a full + ## hijack. + + ## Additional environment specifications have approved to + ## standardized middleware APIs. None of these are required to + ## be implemented by the server. + + ## rack.session:: A hash-like interface for storing + ## request session data. + ## The store must implement: + if session = env[RACK_SESSION] + ## store(key, value) (aliased as []=); + unless session.respond_to?(:store) && session.respond_to?(:[]=) + raise LintError, "session #{session.inspect} must respond to store and []=" + end + + ## fetch(key, default = nil) (aliased as []); + unless session.respond_to?(:fetch) && session.respond_to?(:[]) + raise LintError, "session #{session.inspect} must respond to fetch and []" + end + + ## delete(key); + unless session.respond_to?(:delete) + raise LintError, "session #{session.inspect} must respond to delete" + end + + ## clear; + unless session.respond_to?(:clear) + raise LintError, "session #{session.inspect} must respond to clear" + end + + ## to_hash (returning unfrozen Hash instance); + unless session.respond_to?(:to_hash) && session.to_hash.kind_of?(Hash) && !session.to_hash.frozen? + raise LintError, "session #{session.inspect} must respond to to_hash and return unfrozen Hash instance" + end + end + + ## rack.logger:: A common object interface for logging messages. + ## The object must implement: + if logger = env[RACK_LOGGER] + ## info(message, &block) + unless logger.respond_to?(:info) + raise LintError, "logger #{logger.inspect} must respond to info" + end + + ## debug(message, &block) + unless logger.respond_to?(:debug) + raise LintError, "logger #{logger.inspect} must respond to debug" + end + + ## warn(message, &block) + unless logger.respond_to?(:warn) + raise LintError, "logger #{logger.inspect} must respond to warn" + end + + ## error(message, &block) + unless logger.respond_to?(:error) + raise LintError, "logger #{logger.inspect} must respond to error" + end + + ## fatal(message, &block) + unless logger.respond_to?(:fatal) + raise LintError, "logger #{logger.inspect} must respond to fatal" + end + end + + ## rack.multipart.buffer_size:: An Integer hint to the multipart parser as to what chunk size to use for reads and writes. + if bufsize = env[RACK_MULTIPART_BUFFER_SIZE] + unless bufsize.is_a?(Integer) && bufsize > 0 + raise LintError, "rack.multipart.buffer_size must be an Integer > 0 if specified" + end + end + + ## rack.multipart.tempfile_factory:: An object responding to #call with two arguments, the filename and content_type given for the multipart form field, and returning an IO-like object that responds to #<< and optionally #rewind. This factory will be used to instantiate the tempfile for each multipart form file upload field, rather than the default class of Tempfile. + if tempfile_factory = env[RACK_MULTIPART_TEMPFILE_FACTORY] + raise LintError, "rack.multipart.tempfile_factory must respond to #call" unless tempfile_factory.respond_to?(:call) + env[RACK_MULTIPART_TEMPFILE_FACTORY] = lambda do |filename, content_type| + io = tempfile_factory.call(filename, content_type) + raise LintError, "rack.multipart.tempfile_factory return value must respond to #<<" unless io.respond_to?(:<<) + io + end + end + + ## The server or the application can store their own data in the + ## environment, too. The keys must contain at least one dot, + ## and should be prefixed uniquely. The prefix rack. + ## is reserved for use with the Rack core distribution and other + ## accepted specifications and must not be used otherwise. + ## + + %w[REQUEST_METHOD SERVER_NAME QUERY_STRING SERVER_PROTOCOL + rack.input rack.errors].each { |header| + raise LintError, "env missing required key #{header}" unless env.include? header + } + + ## The SERVER_PORT must be an Integer if set. + server_port = env["SERVER_PORT"] + unless server_port.nil? || (Integer(server_port) rescue false) + raise LintError, "env[SERVER_PORT] is not an Integer" + end + + ## The SERVER_NAME must be a valid authority as defined by RFC7540. + unless (URI.parse("http://#{env[SERVER_NAME]}/") rescue false) + raise LintError, "#{env[SERVER_NAME]} must be a valid authority" + end + + ## The HTTP_HOST must be a valid authority as defined by RFC7540. + unless (URI.parse("http://#{env[HTTP_HOST]}/") rescue false) + raise LintError, "#{env[HTTP_HOST]} must be a valid authority" + end + + ## The SERVER_PROTOCOL must match the regexp HTTP/\d(\.\d)?. + server_protocol = env['SERVER_PROTOCOL'] + unless %r{HTTP/\d(\.\d)?}.match?(server_protocol) + raise LintError, "env[SERVER_PROTOCOL] does not match HTTP/\\d(\\.\\d)?" + end + + ## If the HTTP_VERSION is present, it must equal the SERVER_PROTOCOL. + if env['HTTP_VERSION'] && env['HTTP_VERSION'] != server_protocol + raise LintError, "env[HTTP_VERSION] does not equal env[SERVER_PROTOCOL]" + end + + ## The environment must not contain the keys + ## HTTP_CONTENT_TYPE or HTTP_CONTENT_LENGTH + ## (use the versions without HTTP_). + %w[HTTP_CONTENT_TYPE HTTP_CONTENT_LENGTH].each { |header| + if env.include? header + raise LintError, "env contains #{header}, must use #{header[5, -1]}" + end + } + + ## The CGI keys (named without a period) must have String values. + ## If the string values for CGI keys contain non-ASCII characters, + ## they should use ASCII-8BIT encoding. + env.each { |key, value| + next if key.include? "." # Skip extensions + unless value.kind_of? String + raise LintError, "env variable #{key} has non-string value #{value.inspect}" + end + next if value.encoding == Encoding::ASCII_8BIT + unless value.b !~ /[\x80-\xff]/n + raise LintError, "env variable #{key} has value containing non-ASCII characters and has non-ASCII-8BIT encoding #{value.inspect} encoding: #{value.encoding}" + end + } + + ## There are the following restrictions: + + ## * rack.url_scheme must either be +http+ or +https+. + unless %w[http https].include?(env[RACK_URL_SCHEME]) + raise LintError, "rack.url_scheme unknown: #{env[RACK_URL_SCHEME].inspect}" + end + + ## * There must be a valid input stream in rack.input. + check_input env[RACK_INPUT] + ## * There must be a valid error stream in rack.errors. + check_error env[RACK_ERRORS] + ## * There may be a valid hijack callback in rack.hijack + check_hijack env + + ## * The REQUEST_METHOD must be a valid token. + unless env[REQUEST_METHOD] =~ /\A[0-9A-Za-z!\#$%&'*+.^_`|~-]+\z/ + raise LintError, "REQUEST_METHOD unknown: #{env[REQUEST_METHOD].dump}" + end + + ## * The SCRIPT_NAME, if non-empty, must start with / + if env.include?(SCRIPT_NAME) && env[SCRIPT_NAME] != "" && env[SCRIPT_NAME] !~ /\A\// + raise LintError, "SCRIPT_NAME must start with /" + end + ## * The PATH_INFO, if non-empty, must start with / + if env.include?(PATH_INFO) && env[PATH_INFO] != "" && env[PATH_INFO] !~ /\A\// + raise LintError, "PATH_INFO must start with /" + end + ## * The CONTENT_LENGTH, if given, must consist of digits only. + if env.include?("CONTENT_LENGTH") && env["CONTENT_LENGTH"] !~ /\A\d+\z/ + raise LintError, "Invalid CONTENT_LENGTH: #{env["CONTENT_LENGTH"]}" + end + + ## * One of SCRIPT_NAME or PATH_INFO must be + ## set. PATH_INFO should be / if + ## SCRIPT_NAME is empty. + unless env[SCRIPT_NAME] || env[PATH_INFO] + raise LintError, "One of SCRIPT_NAME or PATH_INFO must be set (make PATH_INFO '/' if SCRIPT_NAME is empty)" + end + ## SCRIPT_NAME never should be /, but instead be empty. + unless env[SCRIPT_NAME] != "/" + raise LintError, "SCRIPT_NAME cannot be '/', make it '' and PATH_INFO '/'" + end + + ## rack.response_finished:: An array of callables run by the server after the response has been + ## processed. This would typically be invoked after sending the response to the client, but it could also be + ## invoked if an error occurs while generating the response or sending the response; in that case, the error + ## argument will be a subclass of +Exception+. + ## The callables are invoked with +env, status, headers, error+ arguments and should not raise any + ## exceptions. They should be invoked in reverse order of registration. + if callables = env[RACK_RESPONSE_FINISHED] + raise LintError, "rack.response_finished must be an array of callable objects" unless callables.is_a?(Array) + + callables.each do |callable| + raise LintError, "rack.response_finished values must respond to call(env, status, headers, error)" unless callable.respond_to?(:call) + end + end + end + + ## + ## === The Input Stream + ## + ## The input stream is an IO-like object which contains the raw HTTP + ## POST data. + def check_input(input) + ## When applicable, its external encoding must be "ASCII-8BIT" and it + ## must be opened in binary mode, for Ruby 1.9 compatibility. + if input.respond_to?(:external_encoding) && input.external_encoding != Encoding::ASCII_8BIT + raise LintError, "rack.input #{input} does not have ASCII-8BIT as its external encoding" + end + if input.respond_to?(:binmode?) && !input.binmode? + raise LintError, "rack.input #{input} is not opened in binary mode" + end + + ## The input stream must respond to +gets+, +each+, and +read+. + [:gets, :each, :read].each { |method| + unless input.respond_to? method + raise LintError, "rack.input #{input} does not respond to ##{method}" + end + } + end + + class InputWrapper + def initialize(input) + @input = input + end + + ## * +gets+ must be called without arguments and return a string, + ## or +nil+ on EOF. + def gets(*args) + raise LintError, "rack.input#gets called with arguments" unless args.size == 0 + v = @input.gets + unless v.nil? or v.kind_of? String + raise LintError, "rack.input#gets didn't return a String" + end + v + end + + ## * +read+ behaves like IO#read. + ## Its signature is read([length, [buffer]]). + ## + ## If given, +length+ must be a non-negative Integer (>= 0) or +nil+, + ## and +buffer+ must be a String and may not be nil. + ## + ## If +length+ is given and not nil, then this method reads at most + ## +length+ bytes from the input stream. + ## + ## If +length+ is not given or nil, then this method reads + ## all data until EOF. + ## + ## When EOF is reached, this method returns nil if +length+ is given + ## and not nil, or "" if +length+ is not given or is nil. + ## + ## If +buffer+ is given, then the read data will be placed + ## into +buffer+ instead of a newly created String object. + def read(*args) + unless args.size <= 2 + raise LintError, "rack.input#read called with too many arguments" + end + if args.size >= 1 + unless args.first.kind_of?(Integer) || args.first.nil? + raise LintError, "rack.input#read called with non-integer and non-nil length" + end + unless args.first.nil? || args.first >= 0 + raise LintError, "rack.input#read called with a negative length" + end + end + if args.size >= 2 + unless args[1].kind_of?(String) + raise LintError, "rack.input#read called with non-String buffer" + end + end + + v = @input.read(*args) + + unless v.nil? or v.kind_of? String + raise LintError, "rack.input#read didn't return nil or a String" + end + if args[0].nil? + unless !v.nil? + raise LintError, "rack.input#read(nil) returned nil on EOF" + end + end + + v + end + + ## * +each+ must be called without arguments and only yield Strings. + def each(*args) + raise LintError, "rack.input#each called with arguments" unless args.size == 0 + @input.each { |line| + unless line.kind_of? String + raise LintError, "rack.input#each didn't yield a String" + end + yield line + } + end + + ## * +close+ can be called on the input stream to indicate that the + ## any remaining input is not needed. + def close(*args) + @input.close(*args) + end + end + + ## + ## === The Error Stream + ## + def check_error(error) + ## The error stream must respond to +puts+, +write+ and +flush+. + [:puts, :write, :flush].each { |method| + unless error.respond_to? method + raise LintError, "rack.error #{error} does not respond to ##{method}" + end + } + end + + class ErrorWrapper + def initialize(error) + @error = error + end + + ## * +puts+ must be called with a single argument that responds to +to_s+. + def puts(str) + @error.puts str + end + + ## * +write+ must be called with a single argument that is a String. + def write(str) + raise LintError, "rack.errors#write not called with a String" unless str.kind_of? String + @error.write str + end + + ## * +flush+ must be called without arguments and must be called + ## in order to make the error appear for sure. + def flush + @error.flush + end + + ## * +close+ must never be called on the error stream. + def close(*args) + raise LintError, "rack.errors#close must not be called" + end + end + + ## + ## === Hijacking + ## + ## The hijacking interfaces provides a means for an application to take + ## control of the HTTP connection. There are two distinct hijack + ## interfaces: full hijacking where the application takes over the raw + ## connection, and partial hijacking where the application takes over + ## just the response body stream. In both cases, the application is + ## responsible for closing the hijacked stream. + ## + ## Full hijacking only works with HTTP/1. Partial hijacking is functionally + ## equivalent to streaming bodies, and is still optionally supported for + ## backwards compatibility with older Rack versions. + ## + ## ==== Full Hijack + ## + ## Full hijack is used to completely take over an HTTP/1 connection. It + ## occurs before any headers are written and causes the request to + ## ignores any response generated by the application. + ## + ## It is intended to be used when applications need access to raw HTTP/1 + ## connection. + ## + def check_hijack(env) + ## If +rack.hijack+ is present in +env+, it must respond to +call+ + if original_hijack = env[RACK_HIJACK] + raise LintError, "rack.hijack must respond to call" unless original_hijack.respond_to?(:call) + + env[RACK_HIJACK] = proc do + io = original_hijack.call + + ## and return an +IO+ instance which can be used to read and write + ## to the underlying connection using HTTP/1 semantics and + ## formatting. + raise LintError, "rack.hijack must return an IO instance" unless io.is_a?(IO) + + io + end + end + end + + ## + ## ==== Partial Hijack + ## + ## Partial hijack is used for bi-directional streaming of the request and + ## response body. It occurs after the status and headers are written by + ## the server and causes the server to ignore the Body of the response. + ## + ## It is intended to be used when applications need bi-directional + ## streaming. + ## + def check_hijack_response(headers, env) + ## If +rack.hijack?+ is present in +env+ and truthy, + if env[RACK_IS_HIJACK] + ## an application may set the special response header +rack.hijack+ + if original_hijack = headers[RACK_HIJACK] + ## to an object that responds to +call+, + unless original_hijack.respond_to?(:call) + raise LintError, 'rack.hijack header must respond to #call' + end + ## accepting a +stream+ argument. + return proc do |io| + original_hijack.call StreamWrapper.new(io) + end + end + ## + ## After the response status and headers have been sent, this hijack + ## callback will be invoked with a +stream+ argument which follows the + ## same interface as outlined in "Streaming Body". Servers must + ## ignore the +body+ part of the response tuple when the + ## +rack.hijack+ response header is present. Using an empty +Array+ + ## instance is recommended. + else + ## + ## The special response header +rack.hijack+ must only be set + ## if the request +env+ has a truthy +rack.hijack?+. + if headers.key?(RACK_HIJACK) + raise LintError, 'rack.hijack header must not be present if server does not support hijacking' + end + end + + nil + end + + ## == The Response + ## + ## === The Status + ## + def check_status(status) + ## This is an HTTP status. It must be an Integer greater than or equal to + ## 100. + unless status.is_a?(Integer) && status >= 100 + raise LintError, "Status must be an Integer >=100" + end + end + + ## + ## === The Headers + ## + def check_headers(headers) + ## The headers must be a unfrozen Hash. + unless headers.kind_of?(Hash) + raise LintError, "headers object should be a hash, but isn't (got #{headers.class} as headers)" + end + + if headers.frozen? + raise LintError, "headers object should not be frozen, but is" + end + + headers.each do |key, value| + ## The header keys must be Strings. + unless key.kind_of? String + raise LintError, "header key must be a string, was #{key.class}" + end + + ## Special headers starting "rack." are for communicating with the + ## server, and must not be sent back to the client. + next if key.start_with?("rack.") + + ## The header must not contain a +Status+ key. + raise LintError, "header must not contain status" if key == "status" + ## Header keys must conform to RFC7230 token specification, i.e. cannot + ## contain non-printable ASCII, DQUOTE or "(),/:;<=>?@[\]{}". + raise LintError, "invalid header name: #{key}" if key =~ /[\(\),\/:;<=>\?@\[\\\]{}[:cntrl:]]/ + ## Header keys must not contain uppercase ASCII characters (A-Z). + raise LintError, "uppercase character in header name: #{key}" if key =~ /[A-Z]/ + + ## Header values must be either a String instance, + if value.kind_of?(String) + check_header_value(key, value) + elsif value.kind_of?(Array) + ## or an Array of String instances, + value.each{|value| check_header_value(key, value)} + else + raise LintError, "a header value must be a String or Array of Strings, but the value of '#{key}' is a #{value.class}" + end + end + end + + def check_header_value(key, value) + ## such that each String instance must not contain characters below 037. + if value =~ /[\000-\037]/ + raise LintError, "invalid header value #{key}: #{value.inspect}" + end + end + + ## + ## === The content-type + ## + def check_content_type(status, headers) + headers.each { |key, value| + ## There must not be a content-type header key when the +Status+ is 1xx, + ## 204, or 304. + if key == "content-type" + if Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.key? status.to_i + raise LintError, "content-type header found in #{status} response, not allowed" + end + return + end + } + end + + ## + ## === The content-length + ## + def check_content_length(status, headers) + headers.each { |key, value| + if key == 'content-length' + ## There must not be a content-length header key when the + ## +Status+ is 1xx, 204, or 304. + if Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.key? status.to_i + raise LintError, "content-length header found in #{status} response, not allowed" + end + @content_length = value + end + } + end + + def verify_content_length(size) + if @head_request + unless size == 0 + raise LintError, "Response body was given for HEAD request, but should be empty" + end + elsif @content_length + unless @content_length == size.to_s + raise LintError, "content-length header was #{@content_length}, but should be #{size}" + end + end + end + + ## + ## === The Body + ## + ## The Body is typically an +Array+ of +String+ instances, an enumerable + ## that yields +String+ instances, a +Proc+ instance, or a File-like + ## object. + ## + ## The Body must respond to +each+ or +call+. It may optionally respond + ## to +to_path+ or +to_ary+. A Body that responds to +each+ is considered + ## to be an Enumerable Body. A Body that responds to +call+ is considered + ## to be a Streaming Body. + ## + ## A Body that responds to both +each+ and +call+ must be treated as an + ## Enumerable Body, not a Streaming Body. If it responds to +each+, you + ## must call +each+ and not +call+. If the Body doesn't respond to + ## +each+, then you can assume it responds to +call+. + ## + ## The Body must either be consumed or returned. The Body is consumed by + ## optionally calling either +each+ or +call+. + ## Then, if the Body responds to +close+, it must be called to release + ## any resources associated with the generation of the body. + ## In other words, +close+ must always be called at least once; typically + ## after the web server has sent the response to the client, but also in + ## cases where the Rack application makes internal/virtual requests and + ## discards the response. + ## + def close + ## + ## After calling +close+, the Body is considered closed and should not + ## be consumed again. + @closed = true + + ## If the original Body is replaced by a new Body, the new Body must + ## also consume the original Body by calling +close+ if possible. + @body.close if @body.respond_to?(:close) + + index = @lint.index(self) + unless @env['rack.lint'][0..index].all? {|lint| lint.instance_variable_get(:@closed)} + raise LintError, "Body has not been closed" + end + end + + def verify_to_path + ## + ## If the Body responds to +to_path+, it must return a +String+ + ## path for the local file system whose contents are identical + ## to that produced by calling +each+; this may be used by the + ## server as an alternative, possibly more efficient way to + ## transport the response. The +to_path+ method does not consume + ## the body. + if @body.respond_to?(:to_path) + unless ::File.exist? @body.to_path + raise LintError, "The file identified by body.to_path does not exist" + end + end + end + + ## + ## ==== Enumerable Body + ## + def each + ## The Enumerable Body must respond to +each+. + raise LintError, "Enumerable Body must respond to each" unless @body.respond_to?(:each) + + ## It must only be called once. + raise LintError, "Response body must only be invoked once (#{@invoked})" unless @invoked.nil? + + ## It must not be called after being closed. + raise LintError, "Response body is already closed" if @closed + + @invoked = :each + + @body.each do |chunk| + ## and must only yield String values. + unless chunk.kind_of? String + raise LintError, "Body yielded non-string value #{chunk.inspect}" + end + + ## + ## The Body itself should not be an instance of String, as this will + ## break in Ruby 1.9. + ## + ## Middleware must not call +each+ directly on the Body. + ## Instead, middleware can return a new Body that calls +each+ on the + ## original Body, yielding at least once per iteration. + if @lint[0] == self + @env['rack.lint.body_iteration'] += 1 + else + if (@env['rack.lint.body_iteration'] -= 1) > 0 + raise LintError, "New body must yield at least once per iteration of old body" + end + end + + @size += chunk.bytesize + yield chunk + end + + verify_content_length(@size) + + verify_to_path + end + + def respond_to?(name, *) + if name == :to_ary + @body.respond_to?(name) + else + super + end + end + + ## + ## If the Body responds to +to_ary+, it must return an +Array+ whose + ## contents are identical to that produced by calling +each+. + ## Middleware may call +to_ary+ directly on the Body and return a new + ## Body in its place. In other words, middleware can only process the + ## Body directly if it responds to +to_ary+. If the Body responds to both + ## +to_ary+ and +close+, its implementation of +to_ary+ must call + ## +close+. + def to_ary + @body.to_ary.tap do |content| + unless content == @body.enum_for.to_a + raise LintError, "#to_ary not identical to contents produced by calling #each" + end + end + ensure + close + end + + ## + ## ==== Streaming Body + ## + def call(stream) + ## The Streaming Body must respond to +call+. + raise LintError, "Streaming Body must respond to call" unless @body.respond_to?(:call) + + ## It must only be called once. + raise LintError, "Response body must only be invoked once (#{@invoked})" unless @invoked.nil? + + ## It must not be called after being closed. + raise LintError, "Response body is already closed" if @closed + + @invoked = :call + + ## It takes a +stream+ argument. + ## + ## The +stream+ argument must implement: + ## read, write, <<, flush, close, close_read, close_write, closed? + ## + @body.call(StreamWrapper.new(stream)) + end + + class StreamWrapper + extend Forwardable + + ## The semantics of these IO methods must be a best effort match to + ## those of a normal Ruby IO or Socket object, using standard arguments + ## and raising standard exceptions. Servers are encouraged to simply + ## pass on real IO objects, although it is recognized that this approach + ## is not directly compatible with HTTP/2. + REQUIRED_METHODS = [ + :read, :write, :<<, :flush, :close, + :close_read, :close_write, :closed? + ] + + def_delegators :@stream, *REQUIRED_METHODS + + def initialize(stream) + @stream = stream + + REQUIRED_METHODS.each do |method_name| + raise LintError, "Stream must respond to #{method_name}" unless stream.respond_to?(method_name) + end + end + end + + # :startdoc: + end + end +end + +## +## == Thanks +## Some parts of this specification are adopted from {PEP 333 – Python Web Server Gateway Interface v1.0}[https://peps.python.org/pep-0333/] +## I'd like to thank everyone involved in that effort. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/lock.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/lock.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/lock.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/lock.rb index 4bae3a9034..342123a0f0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/lock.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/lock.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'thread' +require_relative 'body_proxy' module Rack # Rack::Lock locks every request inside a mutex, so that every request @@ -12,10 +12,8 @@ module Rack def call(env) @mutex.lock - @env = env - @old_rack_multithread = env[RACK_MULTITHREAD] begin - response = @app.call(env.merge!(RACK_MULTITHREAD => false)) + response = @app.call(env) returned = response << BodyProxy.new(response.pop) { unlock } ensure unlock unless returned @@ -26,7 +24,6 @@ module Rack def unlock @mutex.unlock - @env[RACK_MULTITHREAD] = @old_rack_multithread end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/logger.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/logger.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/logger.rb index 6c4bede0cf..bdcc069005 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/logger.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/logger.rb @@ -2,6 +2,8 @@ require 'logger' +require_relative 'constants' + module Rack # Sets up rack.logger to write to rack.errors stream class Logger diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/media_type.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/media_type.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/media_type.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/media_type.rb index 41937c9947..ff3145debf 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/media_type.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/media_type.rb @@ -15,7 +15,7 @@ module Rack # http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 def type(content_type) return nil unless content_type - content_type.split(SPLIT_PATTERN, 2).first.tap &:downcase! + content_type.split(SPLIT_PATTERN, 2).first.tap(&:downcase!) end # The media type parameters provided in CONTENT_TYPE as a Hash, or diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/method_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/method_override.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/method_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/method_override.rb index 453901fc60..cf7fcf75df 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/method_override.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/method_override.rb @@ -1,5 +1,9 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'request' +require_relative 'utils' + module Rack class MethodOverride HTTP_METHODS = %w[GET HEAD PUT POST DELETE OPTIONS PATCH LINK UNLINK] diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/mime.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mime.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/mime.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mime.rb index f6c02c1fd6..b62e3e8d6f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/mime.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mime.rb @@ -63,6 +63,7 @@ module Rack ".aif" => "audio/x-aiff", ".aiff" => "audio/x-aiff", ".ami" => "application/vnd.amiga.ami", + ".apng" => "image/apng", ".appcache" => "text/cache-manifest", ".apr" => "application/vnd.lotus-approach", ".asc" => "application/pgp-signature", @@ -77,6 +78,7 @@ module Rack ".atx" => "application/vnd.antix.game-component", ".au" => "audio/basic", ".avi" => "video/x-msvideo", + ".avif" => "image/avif", ".bat" => "application/x-msdownload", ".bcpio" => "application/x-bcpio", ".bdm" => "application/vnd.syncml.dm+wbxml", @@ -197,6 +199,7 @@ module Rack ".fe_launch" => "application/vnd.denovo.fcselayout-link", ".fg5" => "application/vnd.fujitsu.oasysgp", ".fli" => "video/x-fli", + ".flif" => "image/flif", ".flo" => "application/vnd.micrografx.flo", ".flv" => "video/x-flv", ".flw" => "application/vnd.kde.kivio", @@ -237,6 +240,10 @@ module Rack ".h264" => "video/h264", ".hbci" => "application/vnd.hbci", ".hdf" => "application/x-hdf", + ".heic" => "image/heic", + ".heics" => "image/heic-sequence", + ".heif" => "image/heif", + ".heifs" => "image/heif-sequence", ".hh" => "text/x-c", ".hlp" => "application/winhlp", ".hpgl" => "application/vnd.hp-hpgl", @@ -617,6 +624,7 @@ module Rack ".wbs" => "application/vnd.criticaltools.wbs+xml", ".wbxml" => "application/vnd.wap.wbxml", ".webm" => "video/webm", + ".webp" => "image/webp", ".wm" => "video/x-ms-wm", ".wma" => "audio/x-ms-wma", ".wmd" => "application/x-ms-wmd", diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mock.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mock.rb new file mode 100644 index 0000000000..5e5c457c72 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mock.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require_relative 'mock_request' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/mock.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mock_request.rb similarity index 61% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/mock.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mock_request.rb index 5b2512ca09..b6d7ef4fea 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/mock.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mock_request.rb @@ -2,8 +2,9 @@ require 'uri' require 'stringio' -require_relative '../rack' -require 'cgi/cookie' + +require_relative 'constants' +require_relative 'mock_response' module Rack # Rack::MockRequest helps testing your Rack application without @@ -41,12 +42,8 @@ module Rack end DEFAULT_ENV = { - RACK_VERSION => Rack::VERSION, RACK_INPUT => StringIO.new, RACK_ERRORS => StringIO.new, - RACK_MULTITHREAD => true, - RACK_MULTIPROCESS => true, - RACK_RUNONCE => false, }.freeze def initialize(app) @@ -99,6 +96,7 @@ module Rack # Options: # :fatal :: Whether to raise an exception if request outputs to rack.errors # :input :: The rack.input to set + # :http_version :: The SERVER_PROTOCOL to set # :method :: The HTTP request method to use # :params :: The params to use # :script_name :: The SCRIPT_NAME to set @@ -111,8 +109,9 @@ module Rack env[REQUEST_METHOD] = (opts[:method] ? opts[:method].to_s.upcase : GET).b env[SERVER_NAME] = (uri.host || "example.org").b env[SERVER_PORT] = (uri.port ? uri.port.to_s : "80").b + env[SERVER_PROTOCOL] = opts[:http_version] || 'HTTP/1.1' env[QUERY_STRING] = (uri.query.to_s).b - env[PATH_INFO] = ((!uri.path || uri.path.empty?) ? "/" : uri.path).b + env[PATH_INFO] = (uri.path).b env[RACK_URL_SCHEME] = (uri.scheme || "http").b env[HTTPS] = (env[RACK_URL_SCHEME] == "https" ? "on" : "off").b @@ -145,8 +144,7 @@ module Rack end end - empty_str = String.new - opts[:input] ||= empty_str + opts[:input] ||= String.new if String === opts[:input] rack_input = StringIO.new(opts[:input]) else @@ -165,109 +163,4 @@ module Rack env end end - - # Rack::MockResponse provides useful helpers for testing your apps. - # Usually, you don't create the MockResponse on your own, but use - # MockRequest. - - class MockResponse < Rack::Response - class << self - alias [] new - end - - # Headers - attr_reader :original_headers, :cookies - - # Errors - attr_accessor :errors - - def initialize(status, headers, body, errors = StringIO.new("")) - @original_headers = headers - @errors = errors.string if errors.respond_to?(:string) - @cookies = parse_cookies_from_header - - super(body, status, headers) - - buffered_body! - end - - def =~(other) - body =~ other - end - - def match(other) - body.match other - end - - def body - # FIXME: apparently users of MockResponse expect the return value of - # MockResponse#body to be a string. However, the real response object - # returns the body as a list. - # - # See spec_showstatus.rb: - # - # should "not replace existing messages" do - # ... - # res.body.should == "foo!" - # end - buffer = String.new - - super.each do |chunk| - buffer << chunk - end - - return buffer - end - - def empty? - [201, 204, 304].include? status - end - - def cookie(name) - cookies.fetch(name, nil) - end - - private - - def parse_cookies_from_header - cookies = Hash.new - if original_headers.has_key? 'Set-Cookie' - set_cookie_header = original_headers.fetch('Set-Cookie') - set_cookie_header.split("\n").each do |cookie| - cookie_name, cookie_filling = cookie.split('=', 2) - cookie_attributes = identify_cookie_attributes cookie_filling - parsed_cookie = CGI::Cookie.new( - 'name' => cookie_name.strip, - 'value' => cookie_attributes.fetch('value'), - 'path' => cookie_attributes.fetch('path', nil), - 'domain' => cookie_attributes.fetch('domain', nil), - 'expires' => cookie_attributes.fetch('expires', nil), - 'secure' => cookie_attributes.fetch('secure', false) - ) - cookies.store(cookie_name, parsed_cookie) - end - end - cookies - end - - def identify_cookie_attributes(cookie_filling) - cookie_bits = cookie_filling.split(';') - cookie_attributes = Hash.new - cookie_attributes.store('value', cookie_bits[0].strip) - cookie_bits.each do |bit| - if bit.include? '=' - cookie_attribute, attribute_value = bit.split('=') - cookie_attributes.store(cookie_attribute.strip, attribute_value.strip) - if cookie_attribute.include? 'max-age' - cookie_attributes.store('expires', Time.now + attribute_value.strip.to_i) - end - end - if bit.include? 'secure' - cookie_attributes.store('secure', true) - end - end - cookie_attributes - end - - end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mock_response.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mock_response.rb new file mode 100644 index 0000000000..3c70bb711a --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/mock_response.rb @@ -0,0 +1,126 @@ +# frozen_string_literal: true + +require 'cgi/cookie' +require 'time' + +require_relative 'response' + +module Rack + # Rack::MockResponse provides useful helpers for testing your apps. + # Usually, you don't create the MockResponse on your own, but use + # MockRequest. + + class MockResponse < Rack::Response + class << self + alias [] new + end + + # Headers + attr_reader :original_headers, :cookies + + # Errors + attr_accessor :errors + + def initialize(status, headers, body, errors = nil) + @original_headers = headers + + if errors + @errors = errors.string if errors.respond_to?(:string) + else + @errors = "" + end + + super(body, status, headers) + + @cookies = parse_cookies_from_header + buffered_body! + end + + def =~(other) + body =~ other + end + + def match(other) + body.match other + end + + def body + return @buffered_body if defined?(@buffered_body) + + # FIXME: apparently users of MockResponse expect the return value of + # MockResponse#body to be a string. However, the real response object + # returns the body as a list. + # + # See spec_showstatus.rb: + # + # should "not replace existing messages" do + # ... + # res.body.should == "foo!" + # end + buffer = @buffered_body = String.new + + @body.each do |chunk| + buffer << chunk + end + + return buffer + end + + def empty? + [201, 204, 304].include? status + end + + def cookie(name) + cookies.fetch(name, nil) + end + + private + + def parse_cookies_from_header + cookies = Hash.new + if headers.has_key? 'set-cookie' + set_cookie_header = headers.fetch('set-cookie') + Array(set_cookie_header).each do |header_value| + header_value.split("\n").each do |cookie| + cookie_name, cookie_filling = cookie.split('=', 2) + cookie_attributes = identify_cookie_attributes cookie_filling + parsed_cookie = CGI::Cookie.new( + 'name' => cookie_name.strip, + 'value' => cookie_attributes.fetch('value'), + 'path' => cookie_attributes.fetch('path', nil), + 'domain' => cookie_attributes.fetch('domain', nil), + 'expires' => cookie_attributes.fetch('expires', nil), + 'secure' => cookie_attributes.fetch('secure', false) + ) + cookies.store(cookie_name, parsed_cookie) + end + end + end + cookies + end + + def identify_cookie_attributes(cookie_filling) + cookie_bits = cookie_filling.split(';') + cookie_attributes = Hash.new + cookie_attributes.store('value', cookie_bits[0].strip) + cookie_bits.drop(1).each do |bit| + if bit.include? '=' + cookie_attribute, attribute_value = bit.split('=', 2) + cookie_attributes.store(cookie_attribute.strip.downcase, attribute_value.strip) + end + if bit.include? 'secure' + cookie_attributes.store('secure', true) + end + end + + if cookie_attributes.key? 'max-age' + cookie_attributes.store('expires', Time.now + cookie_attributes['max-age'].to_i) + elsif cookie_attributes.key? 'expires' + cookie_attributes.store('expires', Time.httpdate(cookie_attributes['expires'])) + end + + cookie_attributes + end + + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart.rb new file mode 100644 index 0000000000..3347662acc --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require_relative 'constants' +require_relative 'utils' + +require_relative 'multipart/parser' +require_relative 'multipart/generator' + +module Rack + # A multipart form data parser, adapted from IOWA. + # + # Usually, Rack::Request#POST takes care of calling this. + module Multipart + MULTIPART_BOUNDARY = "AaB03x" + + class << self + def parse_multipart(env, params = Rack::Utils.default_query_parser) + io = env[RACK_INPUT] + + if content_length = env['CONTENT_LENGTH'] + content_length = content_length.to_i + end + + content_type = env['CONTENT_TYPE'] + + tempfile = env[RACK_MULTIPART_TEMPFILE_FACTORY] || Parser::TEMPFILE_FACTORY + bufsize = env[RACK_MULTIPART_BUFFER_SIZE] || Parser::BUFSIZE + + info = Parser.parse(io, content_length, content_type, tempfile, bufsize, params) + env[RACK_TEMPFILES] = info.tmp_files + + return info.params + end + + def extract_multipart(request, params = Rack::Utils.default_query_parser) + parse_multipart(request.env) + end + + def build_multipart(params, first = true) + Generator.new(params, first).dump + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart/generator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart/generator.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart/generator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart/generator.rb index f798a98c51..30d7f51dd1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart/generator.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart/generator.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative 'uploaded_file' + module Rack module Multipart class Generator @@ -74,12 +76,12 @@ module Rack def content_for_tempfile(io, file, name) length = ::File.stat(file.path).size if file.path - filename = "; filename=\"#{Utils.escape(file.original_filename)}\"" if file.original_filename + filename = "; filename=\"#{Utils.escape_path(file.original_filename)}\"" <<-EOF --#{MULTIPART_BOUNDARY}\r -Content-Disposition: form-data; name="#{name}"#{filename}\r -Content-Type: #{file.content_type}\r -#{"Content-Length: #{length}\r\n" if length}\r +content-disposition: form-data; name="#{name}"#{filename}\r +content-type: #{file.content_type}\r +#{"content-length: #{length}\r\n" if length}\r #{io.read}\r EOF end @@ -87,7 +89,7 @@ EOF def content_for_other(file, name) <<-EOF --#{MULTIPART_BOUNDARY}\r -Content-Disposition: form-data; name="#{name}"\r +content-disposition: form-data; name="#{name}"\r \r #{file}\r EOF diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart/parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart/parser.rb similarity index 63% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart/parser.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart/parser.rb index e8ed3e976a..480badaf27 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart/parser.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart/parser.rb @@ -2,21 +2,52 @@ require 'strscan' +require_relative '../utils' + module Rack module Multipart class MultipartPartLimitError < Errno::EMFILE; end - class Parser - (require_relative '../core_ext/regexp'; using ::Rack::RegexpExtensions) if RUBY_VERSION < '2.4' + # Use specific error class when parsing multipart request + # that ends early. + class EmptyContentError < ::EOFError; end + # Base class for multipart exceptions that do not subclass from + # other exception classes for backwards compatibility. + class Error < StandardError; end + + EOL = "\r\n" + MULTIPART = %r|\Amultipart/.*boundary=\"?([^\";,]+)\"?|ni + TOKEN = /[^\s()<>,;:\\"\/\[\]?=]+/ + CONDISP = /Content-Disposition:\s*#{TOKEN}\s*/i + VALUE = /"(?:\\"|[^"])*"|#{TOKEN}/ + BROKEN = /^#{CONDISP}.*;\s*filename=(#{VALUE})/i + MULTIPART_CONTENT_TYPE = /Content-Type: (.*)#{EOL}/ni + MULTIPART_CONTENT_DISPOSITION = /Content-Disposition:.*;\s*name=(#{VALUE})/ni + MULTIPART_CONTENT_ID = /Content-ID:\s*([^#{EOL}]*)/ni + # Updated definitions from RFC 2231 + ATTRIBUTE_CHAR = %r{[^ \t\v\n\r)(><@,;:\\"/\[\]?='*%]} + ATTRIBUTE = /#{ATTRIBUTE_CHAR}+/ + SECTION = /\*[0-9]+/ + REGULAR_PARAMETER_NAME = /#{ATTRIBUTE}#{SECTION}?/ + REGULAR_PARAMETER = /(#{REGULAR_PARAMETER_NAME})=(#{VALUE})/ + EXTENDED_OTHER_NAME = /#{ATTRIBUTE}\*[1-9][0-9]*\*/ + EXTENDED_OTHER_VALUE = /%[0-9a-fA-F]{2}|#{ATTRIBUTE_CHAR}/ + EXTENDED_OTHER_PARAMETER = /(#{EXTENDED_OTHER_NAME})=(#{EXTENDED_OTHER_VALUE}*)/ + EXTENDED_INITIAL_NAME = /#{ATTRIBUTE}(?:\*0)?\*/ + EXTENDED_INITIAL_VALUE = /[a-zA-Z0-9\-]*'[a-zA-Z0-9\-]*'#{EXTENDED_OTHER_VALUE}*/ + EXTENDED_INITIAL_PARAMETER = /(#{EXTENDED_INITIAL_NAME})=(#{EXTENDED_INITIAL_VALUE})/ + EXTENDED_PARAMETER = /#{EXTENDED_INITIAL_PARAMETER}|#{EXTENDED_OTHER_PARAMETER}/ + DISPPARM = /;\s*(?:#{REGULAR_PARAMETER}|#{EXTENDED_PARAMETER})\s*/ + RFC2183 = /^#{CONDISP}(#{DISPPARM})+$/i + + class Parser BUFSIZE = 1_048_576 TEXT_PLAIN = "text/plain" TEMPFILE_FACTORY = lambda { |filename, content_type| Tempfile.new(["RackMultipart", ::File.extname(filename.gsub("\0", '%00'))]) } - BOUNDARY_REGEX = /\A([^\n]*(?:\n|\Z))/ - class BoundedIO # :nodoc: def initialize(io, content_length) @io = io @@ -38,16 +69,12 @@ module Rack if str @cursor += str.bytesize else - # Raise an error for mismatching Content-Length and actual contents + # Raise an error for mismatching content-length and actual contents raise EOFError, "bad content body" end str end - - def rewind - @io.rewind - end end MultipartInfo = Struct.new :params, :tmp_files @@ -66,18 +93,17 @@ module Rack boundary = parse_boundary content_type return EMPTY unless boundary - io = BoundedIO.new(io, content_length) if content_length - outbuf = String.new - - parser = new(boundary, tmpfile, bufsize, qp) - parser.on_read io.read(bufsize, outbuf) - - loop do - break if parser.state == :DONE - parser.on_read io.read(bufsize, outbuf) + if boundary.length > 70 + # RFC 1521 Section 7.2.1 imposes a 70 character maximum for the boundary. + # Most clients use no more than 55 characters. + raise Error, "multipart boundary size too large (#{boundary.length} characters)" end - io.rewind + io = BoundedIO.new(io, content_length) if content_length + + parser = new(boundary, tmpfile, bufsize, qp) + parser.parse(io) + parser.result end @@ -167,32 +193,46 @@ module Rack def initialize(boundary, tempfile, bufsize, query_parser) @query_parser = query_parser @params = query_parser.make_params - @boundary = "--#{boundary}" @bufsize = bufsize - @full_boundary = @boundary - @end_boundary = @boundary + '--' @state = :FAST_FORWARD @mime_index = 0 @collector = Collector.new tempfile @sbuf = StringScanner.new("".dup) - @body_regex = /(?:#{EOL})?#{Regexp.quote(@boundary)}(?:#{EOL}|--)/m - @rx_max_size = EOL.size + @boundary.bytesize + [EOL.size, '--'.size].max + @body_regex = /(?:#{EOL}|\A)--#{Regexp.quote(boundary)}(?:#{EOL}|--)/m + @rx_max_size = boundary.bytesize + 6 # (\r\n-- at start, either \r\n or -- at finish) @head_regex = /(.*?#{EOL})#{EOL}/m end - def on_read(content) - handle_empty_content!(content) - @sbuf.concat content - run_parser + def parse(io) + outbuf = String.new + read_data(io, outbuf) + + loop do + status = + case @state + when :FAST_FORWARD + handle_fast_forward + when :CONSUME_TOKEN + handle_consume_token + when :MIME_HEAD + handle_mime_head + when :MIME_BODY + handle_mime_body + else # when :DONE + return + end + + read_data(io, outbuf) if status == :want_read + end end def result @collector.each do |part| part.get_data do |data| tag_multipart_encoding(part.filename, part.content_type, part.name, data) - @query_parser.normalize_params(@params, part.name, data, @query_parser.param_depth_limit) + @query_parser.normalize_params(@params, part.name, data) end end MultipartInfo.new @params.to_params_hash, @collector.find_all(&:file?).map(&:body) @@ -200,29 +240,38 @@ module Rack private - def run_parser - loop do - case @state - when :FAST_FORWARD - break if handle_fast_forward == :want_read - when :CONSUME_TOKEN - break if handle_consume_token == :want_read - when :MIME_HEAD - break if handle_mime_head == :want_read - when :MIME_BODY - break if handle_mime_body == :want_read - when :DONE - break - end - end + def dequote(str) # From WEBrick::HTTPUtils + ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup + ret.gsub!(/\\(.)/, "\\1") + ret end + def read_data(io, outbuf) + content = io.read(@bufsize, outbuf) + handle_empty_content!(content) + @sbuf.concat(content) + end + + # This handles the initial parser state. We read until we find the starting + # boundary, then we can transition to the next state. If we find the ending + # boundary, this is an invalid multipart upload, but keep scanning for opening + # boundary in that case. If no boundary found, we need to keep reading data + # and retry. It's highly unlikely the initial read will not consume the + # boundary. The client would have to deliberately craft a response + # with the opening boundary beyond the buffer size for that to happen. def handle_fast_forward - if consume_boundary - @state = :MIME_HEAD - else - raise EOFError, "bad content body" if @sbuf.rest_size >= @bufsize - :want_read + while true + case consume_boundary + when :BOUNDARY + # found opening boundary, transition to next state + @state = :MIME_HEAD + return + when :END_BOUNDARY + # invalid multipart upload, but retry for opening boundary + else + # no boundary found, keep reading data + return :want_read + end end end @@ -241,7 +290,7 @@ module Rack head = @sbuf[1] content_type = head[MULTIPART_CONTENT_TYPE, 1] if name = head[MULTIPART_CONTENT_DISPOSITION, 1] - name = Rack::Auth::Digest::Params::dequote(name) + name = dequote(name) else name = head[MULTIPART_CONTENT_ID, 1] end @@ -278,15 +327,16 @@ module Rack end end - def full_boundary; @full_boundary; end - + # Scan until the we find the start or end of the boundary. + # If we find it, return the appropriate symbol for the start or + # end of the boundary. If we don't find the start or end of the + # boundary, clear the buffer and return nil. def consume_boundary - while read_buffer = @sbuf.scan_until(BOUNDARY_REGEX) - case read_buffer.strip - when full_boundary then return :BOUNDARY - when @end_boundary then return :END_BOUNDARY - end - return if @sbuf.eos? + if read_buffer = @sbuf.scan_until(@body_regex) + read_buffer.end_with?(EOL) ? :BOUNDARY : :END_BOUNDARY + else + @sbuf.terminate + nil end end @@ -296,10 +346,10 @@ module Rack when RFC2183 params = Hash[*head.scan(DISPPARM).flat_map(&:compact)] - if filename = params['filename'] - filename = $1 if filename =~ /^"(.*)"$/ - elsif filename = params['filename*'] + if filename = params['filename*'] encoding, _, filename = filename.split("'", 3) + elsif filename = params['filename'] + filename = $1 if filename =~ /^"(.*)"$/ end when BROKEN filename = $1 @@ -326,6 +376,7 @@ module Rack end CHARSET = "charset" + deprecate_constant :CHARSET def tag_multipart_encoding(filename, content_type, name, body) name = name.to_s @@ -346,7 +397,13 @@ module Rack k.strip! v.strip! v = v[1..-2] if v.start_with?('"') && v.end_with?('"') - encoding = Encoding.find v if k == CHARSET + if k == "charset" + encoding = begin + Encoding.find v + rescue ArgumentError + Encoding::BINARY + end + end end end end @@ -357,7 +414,7 @@ module Rack def handle_empty_content!(content) if content.nil? || content.empty? - raise EOFError + raise EmptyContentError end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart/uploaded_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart/uploaded_file.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart/uploaded_file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart/uploaded_file.rb index 9eaf691277..2782e44c73 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/multipart/uploaded_file.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/multipart/uploaded_file.rb @@ -1,8 +1,12 @@ # frozen_string_literal: true +require 'tempfile' +require 'fileutils' + module Rack module Multipart class UploadedFile + # The filename, *not* including the path, of the "uploaded" file attr_reader :original_filename diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/null_logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/null_logger.rb similarity index 80% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/null_logger.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/null_logger.rb index 3eff73d683..52fc125c3d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/null_logger.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/null_logger.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative 'constants' + module Rack class NullLogger def initialize(app) @@ -22,6 +24,11 @@ module Rack def warn? ; end def error? ; end def fatal? ; end + def debug! ; end + def error! ; end + def fatal! ; end + def info! ; end + def warn! ; end def level ; end def progname ; end def datetime_format ; end @@ -34,6 +41,8 @@ module Rack def sev_threshold=(sev_threshold); end def close ; end def add(severity, message = nil, progname = nil, &block); end + def log(severity, message = nil, progname = nil, &block); end def <<(msg); end + def reopen(logdev = nil); end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/query_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/query_parser.rb similarity index 59% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/query_parser.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/query_parser.rb index 1c3923c32f..3077fb1fdb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/query_parser.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/query_parser.rb @@ -2,9 +2,7 @@ module Rack class QueryParser - (require_relative 'core_ext/regexp'; using ::Rack::RegexpExtensions) if RUBY_VERSION < '2.4' - - DEFAULT_SEP = /[&;] */n + DEFAULT_SEP = /[&] */n COMMON_SEP = { ";" => /[;] */n, ";," => /[;,] */n, "&" => /[&] */n } # ParameterTypeError is the error that is raised when incoming structural @@ -20,29 +18,35 @@ module Rack # nested over the specified limit. class ParamsTooDeepError < RangeError; end - def self.make_default(key_space_limit, param_depth_limit) - new Params, key_space_limit, param_depth_limit + def self.make_default(_key_space_limit=(not_deprecated = true; nil), param_depth_limit) + unless not_deprecated + warn("`first argument `key_space limit` is deprecated and no longer has an effect. Please call with only one argument, which will be required in a future version of Rack", uplevel: 1) + end + + new Params, param_depth_limit end - attr_reader :key_space_limit, :param_depth_limit + attr_reader :param_depth_limit + + def initialize(params_class, _key_space_limit=(not_deprecated = true; nil), param_depth_limit) + unless not_deprecated + warn("`second argument `key_space limit` is deprecated and no longer has an effect. Please call with only two arguments, which will be required in a future version of Rack", uplevel: 1) + end - def initialize(params_class, key_space_limit, param_depth_limit) @params_class = params_class - @key_space_limit = key_space_limit @param_depth_limit = param_depth_limit end # Stolen from Mongrel, with some small modifications: - # Parses a query string by breaking it up at the '&' - # and ';' characters. You can also use this to parse - # cookies by changing the characters used in the second - # parameter (which defaults to '&;'). - def parse_query(qs, d = nil, &unescaper) + # Parses a query string by breaking it up at the '&'. You can also use this + # to parse cookies by changing the characters used in the second parameter + # (which defaults to '&'). + def parse_query(qs, separator = nil, &unescaper) unescaper ||= method(:unescape) params = make_params - (qs || '').split(d ? (COMMON_SEP[d] || /[#{d}] */n) : DEFAULT_SEP).each do |p| + (qs || '').split(separator ? (COMMON_SEP[separator] || /[#{separator}] */n) : DEFAULT_SEP).each do |p| next if p.empty? k, v = p.split('=', 2).map!(&unescaper) @@ -65,14 +69,14 @@ module Rack # query strings with parameters of conflicting types, in this case a # ParameterTypeError is raised. Users are encouraged to return a 400 in this # case. - def parse_nested_query(qs, d = nil) + def parse_nested_query(qs, separator = nil) params = make_params unless qs.nil? || qs.empty? - (qs || '').split(d ? (COMMON_SEP[d] || /[#{d}] */n) : DEFAULT_SEP).each do |p| + (qs || '').split(separator ? (COMMON_SEP[separator] || /[#{separator}] */n) : DEFAULT_SEP).each do |p| k, v = p.split('=', 2).map! { |s| unescape(s) } - normalize_params(params, k, v, param_depth_limit) + _normalize_params(params, k, v, 0) end end @@ -83,58 +87,89 @@ module Rack # normalize_params recursively expands parameters into structural types. If # the structural types represented by two different parameter names are in - # conflict, a ParameterTypeError is raised. - def normalize_params(params, name, v, depth) - raise ParamsTooDeepError if depth <= 0 + # conflict, a ParameterTypeError is raised. The depth argument is deprecated + # and should no longer be used, it is kept for backwards compatibility with + # earlier versions of rack. + def normalize_params(params, name, v, _depth=nil) + _normalize_params(params, name, v, 0) + end - name =~ %r(\A[\[\]]*([^\[\]]+)\]*) - k = $1 || '' - after = $' || '' + private def _normalize_params(params, name, v, depth) + raise ParamsTooDeepError if depth >= param_depth_limit - if k.empty? - if !v.nil? && name == "[]" - return Array(v) + if !name + # nil name, treat same as empty string (required by tests) + k = after = '' + elsif depth == 0 + # Start of parsing, don't treat [] or [ at start of string specially + if start = name.index('[', 1) + # Start of parameter nesting, use part before brackets as key + k = name[0, start] + after = name[start, name.length] else - return + # Plain parameter with no nesting + k = name + after = '' end + elsif name.start_with?('[]') + # Array nesting + k = '[]' + after = name[2, name.length] + elsif name.start_with?('[') && (start = name.index(']', 1)) + # Hash nesting, use the part inside brackets as the key + k = name[1, start-1] + after = name[start+1, name.length] + else + # Probably malformed input, nested but not starting with [ + # treat full name as key for backwards compatibility. + k = name + after = '' end + return if k.empty? + + v ||= String.new + if after == '' - params[k] = v + if k == '[]' && depth != 0 + return [v] + else + params[k] = v + end elsif after == "[" params[name] = v elsif after == "[]" params[k] ||= [] raise ParameterTypeError, "expected Array (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Array) params[k] << v - elsif after =~ %r(^\[\]\[([^\[\]]+)\]$) || after =~ %r(^\[\](.+)$) - child_key = $1 + elsif after.start_with?('[]') + # Recognize x[][y] (hash inside array) parameters + unless after[2] == '[' && after.end_with?(']') && (child_key = after[3, after.length-4]) && !child_key.empty? && !child_key.index('[') && !child_key.index(']') + # Handle other nested array parameters + child_key = after[2, after.length] + end params[k] ||= [] raise ParameterTypeError, "expected Array (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Array) if params_hash_type?(params[k].last) && !params_hash_has_key?(params[k].last, child_key) - normalize_params(params[k].last, child_key, v, depth - 1) + _normalize_params(params[k].last, child_key, v, depth + 1) else - params[k] << normalize_params(make_params, child_key, v, depth - 1) + params[k] << _normalize_params(make_params, child_key, v, depth + 1) end else params[k] ||= make_params raise ParameterTypeError, "expected Hash (got #{params[k].class.name}) for param `#{k}'" unless params_hash_type?(params[k]) - params[k] = normalize_params(params[k], after, v, depth - 1) + params[k] = _normalize_params(params[k], after, v, depth + 1) end params end def make_params - @params_class.new @key_space_limit - end - - def new_space_limit(key_space_limit) - self.class.new @params_class, key_space_limit, param_depth_limit + @params_class.new end def new_depth_limit(param_depth_limit) - self.class.new @params_class, key_space_limit, param_depth_limit + self.class.new @params_class, param_depth_limit end private @@ -160,8 +195,7 @@ module Rack end class Params - def initialize(limit) - @limit = limit + def initialize @size = 0 @params = {} end @@ -171,8 +205,6 @@ module Rack end def []=(key, value) - @size += key.size if key && !@params.key?(key) - raise ParamsTooDeepError, 'exceeded available parameter key space' if @size > @limit @params[key] = value end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/recursive.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/recursive.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/recursive.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/recursive.rb index 6971cbfd69..0945d32278 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/recursive.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/recursive.rb @@ -2,6 +2,8 @@ require 'uri' +require_relative 'constants' + module Rack # Rack::ForwardRequest gets caught by Rack::Recursive and redirects # the current request to the app at +url+. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/reloader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/reloader.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/reloader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/reloader.rb index 2f17f50b83..a15064acc4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/reloader.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/reloader.rb @@ -22,8 +22,6 @@ module Rack # It is performing a check/reload cycle at the start of every request, but # also respects a cool down time, during which nothing will be done. class Reloader - (require_relative 'core_ext/regexp'; using ::Rack::RegexpExtensions) if RUBY_VERSION < '2.4' - def initialize(app, cooldown = 10, backend = Stat) @app = app @cooldown = cooldown diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/request.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/request.rb similarity index 68% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/request.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/request.rb index 750a0dc44f..452140149d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/request.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/request.rb @@ -1,5 +1,9 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'utils' +require_relative 'media_type' + module Rack # Rack::Request provides a convenient interface to a Rack # environment. It is stateless, the environment +env+ passed to the @@ -10,22 +14,54 @@ module Rack # req.params["data"] class Request - (require_relative 'core_ext/regexp'; using ::Rack::RegexpExtensions) if RUBY_VERSION < '2.4' - class << self attr_accessor :ip_filter + + # The priority when checking forwarded headers. The default + # is [:forwarded, :x_forwarded], which means, check the + # +Forwarded+ header first, followed by the appropriate + # X-Forwarded-* header. You can revert the priority by + # reversing the priority, or remove checking of either + # or both headers by removing elements from the array. + # + # This should be set as appropriate in your environment + # based on what reverse proxies are in use. If you are not + # using reverse proxies, you should probably use an empty + # array. + attr_accessor :forwarded_priority + + # The priority when checking either the X-Forwarded-Proto + # or X-Forwarded-Scheme header for the forwarded protocol. + # The default is [:proto, :scheme], to try the + # X-Forwarded-Proto header before the + # X-Forwarded-Scheme header. Rack 2 had behavior + # similar to [:scheme, :proto]. You can remove either or + # both of the entries in array to ignore that respective header. + attr_accessor :x_forwarded_proto_priority end - self.ip_filter = lambda { |ip| /\A127\.0\.0\.1\Z|\A(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.|\A::1\Z|\Afd[0-9a-f]{2}:.+|\Alocalhost\Z|\Aunix\Z|\Aunix:/i.match?(ip) } - ALLOWED_SCHEMES = %w(https http).freeze - SCHEME_WHITELIST = ALLOWED_SCHEMES - if Object.respond_to?(:deprecate_constant) - deprecate_constant :SCHEME_WHITELIST - end + @forwarded_priority = [:forwarded, :x_forwarded] + @x_forwarded_proto_priority = [:proto, :scheme] + + valid_ipv4_octet = /\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])/ + + trusted_proxies = Regexp.union( + /\A127#{valid_ipv4_octet}{3}\z/, # localhost IPv4 range 127.x.x.x, per RFC-3330 + /\A::1\z/, # localhost IPv6 ::1 + /\Af[cd][0-9a-f]{2}(?::[0-9a-f]{0,4}){0,7}\z/i, # private IPv6 range fc00 .. fdff + /\A10#{valid_ipv4_octet}{3}\z/, # private IPv4 range 10.x.x.x + /\A172\.(1[6-9]|2[0-9]|3[01])#{valid_ipv4_octet}{2}\z/, # private IPv4 range 172.16.0.0 .. 172.31.255.255 + /\A192\.168#{valid_ipv4_octet}{2}\z/, # private IPv4 range 192.168.x.x + /\Alocalhost\z|\Aunix(\z|:)/i, # localhost hostname, and unix domain sockets + ) + + self.ip_filter = lambda { |ip| trusted_proxies.match?(ip) } + + ALLOWED_SCHEMES = %w(https http wss ws).freeze def initialize(env) + @env = env @params = nil - super(env) end def params @@ -49,6 +85,8 @@ module Rack def initialize(env) @env = env + # This module is included at least in `ActionDispatch::Request` + # The call to `super()` allows additional mixed-in initializers are called super() end @@ -135,6 +173,8 @@ module Rack # The contents of the host/:authority header sent to the proxy. HTTP_X_FORWARDED_HOST = 'HTTP_X_FORWARDED_HOST' + HTTP_FORWARDED = 'HTTP_FORWARDED' + # The value of the scheme sent to the proxy. HTTP_X_FORWARDED_SCHEME = 'HTTP_X_FORWARDED_SCHEME' @@ -144,7 +184,7 @@ module Rack # The port used to connect to the proxy. HTTP_X_FORWARDED_PORT = 'HTTP_X_FORWARDED_PORT' - # Another way for specifing https scheme was used. + # Another way for specifying https scheme was used. HTTP_X_FORWARDED_SSL = 'HTTP_X_FORWARDED_SSL' def body; get_header(RACK_INPUT) end @@ -159,7 +199,6 @@ module Rack def content_length; get_header('CONTENT_LENGTH') end def logger; get_header(RACK_LOGGER) end def user_agent; get_header('HTTP_USER_AGENT') end - def multithread?; get_header(RACK_MULTITHREAD) end # the referer of the client def referer; get_header('HTTP_REFERER') end @@ -248,9 +287,7 @@ module Rack end def server_port - if port = get_header(SERVER_PORT) - Integer(port) - end + get_header(SERVER_PORT) end def cookies @@ -307,44 +344,67 @@ module Rack def port if authority = self.authority - _, _, port = split_authority(self.authority) - - if port - return port - end + _, _, port = split_authority(authority) end - if forwarded_port = self.forwarded_port - return forwarded_port.first - end - - if scheme = self.scheme - if port = DEFAULT_PORTS[self.scheme] - return port - end - end - - self.server_port + port || forwarded_port&.last || DEFAULT_PORTS[scheme] || server_port end def forwarded_for - if value = get_header(HTTP_X_FORWARDED_FOR) - split_header(value).map do |authority| - split_authority(wrap_ipv6(authority))[1] + forwarded_priority.each do |type| + case type + when :forwarded + if forwarded_for = get_http_forwarded(:for) + return(forwarded_for.map! do |authority| + split_authority(authority)[1] + end) + end + when :x_forwarded + if value = get_header(HTTP_X_FORWARDED_FOR) + return(split_header(value).map do |authority| + split_authority(wrap_ipv6(authority))[1] + end) + end end end + + nil end def forwarded_port - if value = get_header(HTTP_X_FORWARDED_PORT) - split_header(value).map(&:to_i) + forwarded_priority.each do |type| + case type + when :forwarded + if forwarded = get_http_forwarded(:for) + return(forwarded.map do |authority| + split_authority(authority)[2] + end.compact) + end + when :x_forwarded + if value = get_header(HTTP_X_FORWARDED_PORT) + return split_header(value).map(&:to_i) + end + end end + + nil end def forwarded_authority - if value = get_header(HTTP_X_FORWARDED_HOST) - wrap_ipv6(split_header(value).first) + forwarded_priority.each do |type| + case type + when :forwarded + if forwarded = get_http_forwarded(:host) + return forwarded.last + end + when :x_forwarded + if value = get_header(HTTP_X_FORWARDED_HOST) + return wrap_ipv6(split_header(value).last) + end + end end + + nil end def ssl? @@ -356,17 +416,15 @@ module Rack external_addresses = reject_trusted_ip_addresses(remote_addresses) unless external_addresses.empty? - return external_addresses.first + return external_addresses.last end - if forwarded_for = self.forwarded_for - unless forwarded_for.empty? - # The forwarded for addresses are ordered: client, proxy1, proxy2. - # So we reject all the trusted addresses (proxy*) and return the - # last client. Or if we trust everyone, we just return the first - # address. - return reject_trusted_ip_addresses(forwarded_for).last || forwarded_for.first - end + if (forwarded_for = self.forwarded_for) && !forwarded_for.empty? + # The forwarded for addresses are ordered: client, proxy1, proxy2. + # So we reject all the trusted addresses (proxy*) and return the + # last client. Or if we trust everyone, we just return the first + # address. + return reject_trusted_ip_addresses(forwarded_for).last || forwarded_for.first end # If all the addresses are trusted, and we aren't forwarded, just return @@ -402,13 +460,13 @@ module Rack end # Determine whether the request body contains form-data by checking - # the request Content-Type for one of the media-types: + # the request content-type for one of the media-types: # "application/x-www-form-urlencoded" or "multipart/form-data". The # list of form-data media types can be modified through the # +FORM_DATA_MEDIA_TYPES+ array. # # A request body is also assumed to contain form-data when no - # Content-Type header is provided and the request_method is POST. + # content-type header is provided and the request_method is POST. def form_data? type = media_type meth = get_header(RACK_METHODOVERRIDE_ORIGINAL_METHOD) || get_header(REQUEST_METHOD) @@ -427,7 +485,7 @@ module Rack if get_header(RACK_REQUEST_QUERY_STRING) == query_string get_header(RACK_REQUEST_QUERY_HASH) else - query_hash = parse_query(query_string, '&;') + query_hash = parse_query(query_string, '&') set_header(RACK_REQUEST_QUERY_STRING, query_string) set_header(RACK_REQUEST_QUERY_HASH, query_hash) end @@ -452,13 +510,12 @@ module Rack set_header RACK_REQUEST_FORM_VARS, form_vars set_header RACK_REQUEST_FORM_HASH, parse_query(form_vars, '&') - - get_header(RACK_INPUT).rewind end set_header RACK_REQUEST_FORM_INPUT, get_header(RACK_INPUT) get_header RACK_REQUEST_FORM_HASH else - {} + set_header RACK_REQUEST_FORM_INPUT, get_header(RACK_INPUT) + set_header(RACK_REQUEST_FORM_HASH, {}) end end @@ -530,9 +587,7 @@ module Rack # shortcut for request.params[key] def [](key) - if $VERBOSE - warn("Request#[] is deprecated and will be removed in a future version of Rack. Please use request.params[] instead") - end + warn("Request#[] is deprecated and will be removed in a future version of Rack. Please use request.params[] instead", uplevel: 1) params[key.to_s] end @@ -541,9 +596,7 @@ module Rack # # Note that modifications will not be persisted in the env. Use update_param or delete_param if you want to destructively modify params. def []=(key, value) - if $VERBOSE - warn("Request#[]= is deprecated and will be removed in a future version of Rack. Please use request.params[]= instead") - end + warn("Request#[]= is deprecated and will be removed in a future version of Rack. Please use request.params[]= instead", uplevel: 1) params[key.to_s] = value end @@ -582,6 +635,11 @@ module Rack end end + # Get an array of values set in the RFC 7239 `Forwarded` request header. + def get_http_forwarded(token) + Utils.forwarded_values(get_header(HTTP_FORWARDED))&.[](token) + end + def query_parser Utils.default_query_parser end @@ -598,58 +656,94 @@ module Rack value ? value.strip.split(/[,\s]+/) : [] end - AUTHORITY = /^ - # The host: + # ipv6 extracted from resolv stdlib, simplified + # to remove numbered match group creation. + ipv6 = Regexp.union( + /(?:[0-9A-Fa-f]{1,4}:){7} + [0-9A-Fa-f]{1,4}/x, + /(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? :: + (?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?/x, + /(?:[0-9A-Fa-f]{1,4}:){6,6} + \d+\.\d+\.\d+\.\d+/x, + /(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? :: + (?:[0-9A-Fa-f]{1,4}:)* + \d+\.\d+\.\d+\.\d+/x, + /[Ff][Ee]80 + (?::[0-9A-Fa-f]{1,4}){7} + %[-0-9A-Za-z._~]+/x, + /[Ff][Ee]80: + (?: + (?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? :: + (?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? + | + :(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? + )? + :[0-9A-Fa-f]{1,4}%[-0-9A-Za-z._~]+/x) + + AUTHORITY = / + \A (? - # An IPv6 address: - (\[(?.*)\]) + # Match IPv6 as a string of hex digits and colons in square brackets + \[(?
#{ipv6})\] | - # An IPv4 address: - (?[\d\.]+) - | - # A hostname: - (?[a-zA-Z0-9\.\-]+) + # Match any other printable string (except square brackets) as a hostname + (?
[[[:graph:]&&[^\[\]]]]*?) ) - # The optional port: (:(?\d+))? - $/x + \z + /x private_constant :AUTHORITY def split_authority(authority) - if match = AUTHORITY.match(authority) - if address = match[:ip6] - return match[:host], address, match[:port]&.to_i - else - return match[:host], match[:host], match[:port]&.to_i - end - end - - # Give up! - return authority, authority, nil + return [] if authority.nil? + return [] unless match = AUTHORITY.match(authority) + return match[:host], match[:address], match[:port]&.to_i end def reject_trusted_ip_addresses(ip_addresses) ip_addresses.reject { |ip| trusted_proxy?(ip) } end + FORWARDED_SCHEME_HEADERS = { + proto: HTTP_X_FORWARDED_PROTO, + scheme: HTTP_X_FORWARDED_SCHEME + }.freeze + private_constant :FORWARDED_SCHEME_HEADERS def forwarded_scheme - allowed_scheme(get_header(HTTP_X_FORWARDED_SCHEME)) || - allowed_scheme(extract_proto_header(get_header(HTTP_X_FORWARDED_PROTO))) + forwarded_priority.each do |type| + case type + when :forwarded + if (forwarded_proto = get_http_forwarded(:proto)) && + (scheme = allowed_scheme(forwarded_proto.last)) + return scheme + end + when :x_forwarded + x_forwarded_proto_priority.each do |x_type| + if header = FORWARDED_SCHEME_HEADERS[x_type] + split_header(get_header(header)).reverse_each do |scheme| + if allowed_scheme(scheme) + return scheme + end + end + end + end + end + end + + nil end def allowed_scheme(header) header if ALLOWED_SCHEMES.include?(header) end - def extract_proto_header(header) - if header - if (comma_index = header.index(',')) - header[0, comma_index] - else - header - end - end + def forwarded_priority + Request.forwarded_priority + end + + def x_forwarded_proto_priority + Request.x_forwarded_proto_priority end end @@ -657,3 +751,7 @@ module Rack include Helpers end end + +# :nocov: +require_relative 'multipart' unless defined?(Rack::Multipart) +# :nocov: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/response.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/response.rb similarity index 60% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/response.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/response.rb index fd6d2f5d55..2b7057a2f4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/response.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/response.rb @@ -2,6 +2,11 @@ require 'time' +require_relative 'constants' +require_relative 'utils' +require_relative 'media_type' +require_relative 'headers' + module Rack # Rack::Response provides a convenient interface to create a Rack # response. @@ -26,22 +31,45 @@ module Rack attr_accessor :length, :status, :body attr_reader :headers - # @deprecated Use {#headers} instead. - alias header headers + # Deprecated, use headers instead. + def header + warn 'Rack::Response#header is deprecated and will be removed in Rack 3.1', uplevel: 1 - # Initialize the response object with the specified body, status - # and headers. + headers + end + + # Initialize the response object with the specified +body+, +status+ + # and +headers+. # - # @param body [nil, #each, #to_str] the response body. - # @param status [Integer] the integer status as defined by the - # HTTP protocol RFCs. - # @param headers [#each] a list of key-value header pairs which - # conform to the HTTP protocol RFCs. + # If the +body+ is +nil+, construct an empty response object with internal + # buffering. + # + # If the +body+ responds to +to_str+, assume it's a string-like object and + # construct a buffered response object containing using that string as the + # initial contents of the buffer. # - # Providing a body which responds to #to_str is legacy behaviour. + # Otherwise it is expected +body+ conforms to the normal requirements of a + # Rack response body, typically implementing one of +each+ (enumerable + # body) or +call+ (streaming body). + # + # The +status+ defaults to +200+ which is the "OK" HTTP status code. You + # can provide any other valid status code. + # + # The +headers+ must be a +Hash+ of key-value header pairs which conform to + # the Rack specification for response headers. The key must be a +String+ + # instance and the value can be either a +String+ or +Array+ instance. def initialize(body = nil, status = 200, headers = {}) @status = status.to_i - @headers = Utils::HeaderHash[headers] + + unless headers.is_a?(Hash) + warn "Providing non-hash headers to Rack::Response is deprecated and will be removed in Rack 3.1", uplevel: 1 + end + + @headers = Headers.new + # Convert headers input to a plain hash with lowercase keys. + headers.each do |k, v| + @headers[k] = v + end @writer = self.method(:append) @@ -58,7 +86,7 @@ module Rack @length = body.to_str.bytesize else @body = body - @buffered = false + @buffered = nil # undetermined as of yet. @length = 0 end @@ -78,7 +106,7 @@ module Rack # @return [Array] a 3-tuple suitable of `[status, headers, body]` # which is suitable to be returned from the middleware `#call(env)` method. def finish(&block) - if STATUS_WITH_NO_ENTITY_BODY[status.to_i] + if STATUS_WITH_NO_ENTITY_BODY[@status] delete_header CONTENT_TYPE delete_header CONTENT_LENGTH close @@ -105,7 +133,7 @@ module Rack end end - # Append to body and update Content-Length. + # Append to body and update content-length. # # NOTE: Do not mix #write and direct #body access! # @@ -123,10 +151,22 @@ module Rack @block == nil && @body.empty? end - def has_header?(key); headers.key? key; end - def get_header(key); headers[key]; end - def set_header(key, v); headers[key] = v; end - def delete_header(key); headers.delete key; end + def has_header?(key) + raise ArgumentError unless key.is_a?(String) + @headers.key?(key) + end + def get_header(key) + raise ArgumentError unless key.is_a?(String) + @headers[key] + end + def set_header(key, value) + raise ArgumentError unless key.is_a?(String) + @headers[key] = value + end + def delete_header(key) + raise ArgumentError unless key.is_a?(String) + @headers.delete key + end alias :[] :get_header alias :[]= :set_header @@ -150,31 +190,43 @@ module Rack def forbidden?; status == 403; end def not_found?; status == 404; end def method_not_allowed?; status == 405; end + def not_acceptable?; status == 406; end + def request_timeout?; status == 408; end def precondition_failed?; status == 412; end def unprocessable?; status == 422; end def redirect?; [301, 302, 303, 307, 308].include? status; end def include?(header) - has_header? header + has_header?(header) end # Add a header that may have multiple values. # # Example: - # response.add_header 'Vary', 'Accept-Encoding' - # response.add_header 'Vary', 'Cookie' + # response.add_header 'vary', 'accept-encoding' + # response.add_header 'vary', 'cookie' # - # assert_equal 'Accept-Encoding,Cookie', response.get_header('Vary') + # assert_equal 'accept-encoding,cookie', response.get_header('vary') # # http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 - def add_header(key, v) - if v.nil? - get_header key - elsif has_header? key - set_header key, "#{get_header key},#{v}" + def add_header(key, value) + raise ArgumentError unless key.is_a?(String) + + if value.nil? + return get_header(key) + end + + value = value.to_s + + if header = get_header(key) + if header.is_a?(Array) + header << value + else + set_header(key, [header, value]) + end else - set_header key, v + set_header(key, value) end end @@ -202,36 +254,39 @@ module Rack end def location - get_header "Location" + get_header "location" end def location=(location) - set_header "Location", location + set_header "location", location end def set_cookie(key, value) - cookie_header = get_header SET_COOKIE - set_header SET_COOKIE, ::Rack::Utils.add_cookie_to_header(cookie_header, key, value) + add_header SET_COOKIE, Utils.set_cookie_header(key, value) end def delete_cookie(key, value = {}) - set_header SET_COOKIE, ::Rack::Utils.add_remove_cookie_to_header(get_header(SET_COOKIE), key, value) + set_header(SET_COOKIE, + Utils.delete_set_cookie_header!( + get_header(SET_COOKIE), key, value + ) + ) end def set_cookie_header get_header SET_COOKIE end - def set_cookie_header=(v) - set_header SET_COOKIE, v + def set_cookie_header=(value) + set_header SET_COOKIE, value end def cache_control get_header CACHE_CONTROL end - def cache_control=(v) - set_header CACHE_CONTROL, v + def cache_control=(value) + set_header CACHE_CONTROL, value end # Specifies that the content shouldn't be cached. Overrides `cache!` if already called. @@ -254,34 +309,38 @@ module Rack get_header ETAG end - def etag=(v) - set_header ETAG, v + def etag=(value) + set_header ETAG, value end protected def buffered_body! - return if @buffered + if @buffered.nil? + if @body.is_a?(Array) + # The user supplied body was an array: + @body = @body.compact + @body.each do |part| + @length += part.to_s.bytesize + end + elsif @body.respond_to?(:each) + # Turn the user supplied body into a buffered array: + body = @body + @body = Array.new - if @body.is_a?(Array) - # The user supplied body was an array: - @body = @body.compact - @body.each do |part| - @length += part.to_s.bytesize + body.each do |part| + @writer.call(part.to_s) + end + + body.close if body.respond_to?(:close) + + @buffered = true + else + @buffered = false end - else - # Turn the user supplied body into a buffered array: - body = @body - @body = Array.new - - body.each do |part| - @writer.call(part.to_s) - end - - body.close if body.respond_to?(:close) end - @buffered = true + return @buffered end def append(chunk) @@ -309,10 +368,21 @@ module Rack @headers = headers end - def has_header?(key); headers.key? key; end - def get_header(key); headers[key]; end - def set_header(key, v); headers[key] = v; end - def delete_header(key); headers.delete key; end + def has_header?(key) + headers.key?(key) + end + + def get_header(key) + headers[key] + end + + def set_header(key, value) + headers[key] = value + end + + def delete_header(key) + headers.delete(key) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/rewindable_input.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/rewindable_input.rb similarity index 81% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/rewindable_input.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/rewindable_input.rb index 91b9d1eb36..730c6a2851 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/rewindable_input.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/rewindable_input.rb @@ -3,17 +3,29 @@ require 'tempfile' +require_relative 'constants' + module Rack # Class which can make any IO object rewindable, including non-rewindable ones. It does # this by buffering the data into a tempfile, which is rewindable. # - # rack.input is required to be rewindable, so if your input stream IO is non-rewindable - # by nature (e.g. a pipe or a socket) then you can wrap it in an object of this class - # to easily make it rewindable. - # # Don't forget to call #close when you're done. This frees up temporary resources that # RewindableInput uses, though it does *not* close the original IO object. class RewindableInput + # Makes rack.input rewindable, for compatibility with applications and middleware + # designed for earlier versions of Rack (where rack.input was required to be + # rewindable). + class Middleware + def initialize(app) + @app = app + end + + def call(env) + env[RACK_INPUT] = RewindableInput.new(env[RACK_INPUT]) + @app.call(env) + end + end + def initialize(io) @io = io @rewindable_io = nil @@ -40,6 +52,11 @@ module Rack @rewindable_io.rewind end + def size + make_rewindable unless @rewindable_io + @rewindable_io.size + end + # Closes this RewindableInput object without closing the originally # wrapped IO object. Cleans up any temporary resources that this RewindableInput # has created. @@ -66,12 +83,14 @@ module Rack # access it because we have the file handle open. @rewindable_io = Tempfile.new('RackRewindableInput') @rewindable_io.chmod(0000) - @rewindable_io.set_encoding(Encoding::BINARY) if @rewindable_io.respond_to?(:set_encoding) + @rewindable_io.set_encoding(Encoding::BINARY) @rewindable_io.binmode + # :nocov: if filesystem_has_posix_semantics? raise 'Unlink failed. IO closed.' if @rewindable_io.closed? @unlinked = true end + # :nocov: buffer = "".dup while @io.read(1024 * 4, buffer) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/runtime.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/runtime.rb similarity index 70% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/runtime.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/runtime.rb index d9b2d8ed19..a1bfa696e3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/runtime.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/runtime.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true +require_relative 'utils' + module Rack - # Sets an "X-Runtime" response header, indicating the response + # Sets an "x-runtime" response header, indicating the response # time of the request, in seconds # # You can put it right before the application to see the processing @@ -9,18 +11,17 @@ module Rack # too. class Runtime FORMAT_STRING = "%0.6f" # :nodoc: - HEADER_NAME = "X-Runtime" # :nodoc: + HEADER_NAME = "x-runtime" # :nodoc: def initialize(app, name = nil) @app = app @header_name = HEADER_NAME - @header_name += "-#{name}" if name + @header_name += "-#{name.to_s.downcase}" if name end def call(env) start_time = Utils.clock_time - status, headers, body = @app.call(env) - headers = Utils::HeaderHash[headers] + _, headers, _ = response = @app.call(env) request_time = Utils.clock_time - start_time @@ -28,7 +29,7 @@ module Rack headers[@header_name] = FORMAT_STRING % request_time end - [status, headers, body] + response end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/sendfile.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/sendfile.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/sendfile.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/sendfile.rb index 3d5e786ff7..45f0a8c36b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/sendfile.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/sendfile.rb @@ -1,32 +1,36 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'utils' +require_relative 'body_proxy' + module Rack # = Sendfile # # The Sendfile middleware intercepts responses whose body is being - # served from a file and replaces it with a server specific X-Sendfile + # served from a file and replaces it with a server specific x-sendfile # header. The web server is then responsible for writing the file contents # to the client. This can dramatically reduce the amount of work required # by the Ruby backend and takes advantage of the web server's optimized file # delivery code. # # In order to take advantage of this middleware, the response body must - # respond to +to_path+ and the request must include an X-Sendfile-Type + # respond to +to_path+ and the request must include an x-sendfile-type # header. Rack::Files and other components implement +to_path+ so there's - # rarely anything you need to do in your application. The X-Sendfile-Type + # rarely anything you need to do in your application. The x-sendfile-type # header is typically set in your web servers configuration. The following # sections attempt to document # # === Nginx # - # Nginx supports the X-Accel-Redirect header. This is similar to X-Sendfile + # Nginx supports the x-accel-redirect header. This is similar to x-sendfile # but requires parts of the filesystem to be mapped into a private URL # hierarchy. # # The following example shows the Nginx configuration required to create - # a private "/files/" area, enable X-Accel-Redirect, and pass the special - # X-Sendfile-Type and X-Accel-Mapping headers to the backend: + # a private "/files/" area, enable x-accel-redirect, and pass the special + # x-sendfile-type and x-accel-mapping headers to the backend: # # location ~ /files/(.*) { # internal; @@ -40,14 +44,14 @@ module Rack # proxy_set_header X-Real-IP $remote_addr; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # - # proxy_set_header X-Sendfile-Type X-Accel-Redirect; - # proxy_set_header X-Accel-Mapping /var/www/=/files/; + # proxy_set_header x-sendfile-type x-accel-redirect; + # proxy_set_header x-accel-mapping /var/www/=/files/; # # proxy_pass http://127.0.0.1:8080/; # } # - # Note that the X-Sendfile-Type header must be set exactly as shown above. - # The X-Accel-Mapping header should specify the location on the file system, + # Note that the x-sendfile-type header must be set exactly as shown above. + # The x-accel-mapping header should specify the location on the file system, # followed by an equals sign (=), followed name of the private URL pattern # that it maps to. The middleware performs a simple substitution on the # resulting path. @@ -56,8 +60,8 @@ module Rack # # === lighttpd # - # Lighttpd has supported some variation of the X-Sendfile header for some - # time, although only recent version support X-Sendfile in a reverse proxy + # Lighttpd has supported some variation of the x-sendfile header for some + # time, although only recent version support x-sendfile in a reverse proxy # configuration. # # $HTTP["host"] == "example.com" { @@ -71,7 +75,7 @@ module Rack # # proxy-core.allow-x-sendfile = "enable" # proxy-core.rewrite-request = ( - # "X-Sendfile-Type" => (".*" => "X-Sendfile") + # "x-sendfile-type" => (".*" => "x-sendfile") # ) # } # @@ -79,21 +83,21 @@ module Rack # # === Apache # - # X-Sendfile is supported under Apache 2.x using a separate module: + # x-sendfile is supported under Apache 2.x using a separate module: # # https://tn123.org/mod_xsendfile/ # # Once the module is compiled and installed, you can enable it using # XSendFile config directive: # - # RequestHeader Set X-Sendfile-Type X-Sendfile + # RequestHeader Set x-sendfile-type x-sendfile # ProxyPassReverse / http://localhost:8001/ # XSendFile on # # === Mapping parameter # # The third parameter allows for an overriding extension of the - # X-Accel-Mapping header. Mappings should be provided in tuples of internal to + # x-accel-mapping header. Mappings should be provided in tuples of internal to # external. The internal values may contain regular expression syntax, they # will be matched with case indifference. @@ -107,28 +111,29 @@ module Rack end def call(env) - status, headers, body = @app.call(env) + status, headers, body = response = @app.call(env) + if body.respond_to?(:to_path) case type = variation(env) - when 'X-Accel-Redirect' + when /x-accel-redirect/i path = ::File.expand_path(body.to_path) if url = map_accel_path(env, path) headers[CONTENT_LENGTH] = '0' # '?' must be percent-encoded because it is not query string but a part of path - headers[type] = ::Rack::Utils.escape_path(url).gsub('?', '%3F') + headers[type.downcase] = ::Rack::Utils.escape_path(url).gsub('?', '%3F') obody = body - body = Rack::BodyProxy.new([]) do + response[2] = Rack::BodyProxy.new([]) do obody.close if obody.respond_to?(:close) end else - env[RACK_ERRORS].puts "X-Accel-Mapping header missing" + env[RACK_ERRORS].puts "x-accel-mapping header missing" end - when 'X-Sendfile', 'X-Lighttpd-Send-File' + when /x-sendfile|x-lighttpd-send-file/i path = ::File.expand_path(body.to_path) headers[CONTENT_LENGTH] = '0' - headers[type] = path + headers[type.downcase] = path obody = body - body = Rack::BodyProxy.new([]) do + response[2] = Rack::BodyProxy.new([]) do obody.close if obody.respond_to?(:close) end when '', nil @@ -136,7 +141,7 @@ module Rack env[RACK_ERRORS].puts "Unknown x-sendfile variation: '#{type}'.\n" end end - [status, headers, body] + response end private diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/show_exceptions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/show_exceptions.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/show_exceptions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/show_exceptions.rb index 07e6038806..ca090a5048 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/show_exceptions.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/show_exceptions.rb @@ -3,6 +3,10 @@ require 'ostruct' require 'erb' +require_relative 'constants' +require_relative 'utils' +require_relative 'request' + module Rack # Rack::ShowExceptions catches all exceptions raised from the app it # wraps. It shows a useful backtrace with the sourcefile and @@ -55,7 +59,12 @@ module Rack private :accepts_html? def dump_exception(exception) - string = "#{exception.class}: #{exception.message}\n".dup + if exception.respond_to?(:detailed_message) + message = exception.detailed_message(highlight: false) + else + message = exception.message + end + string = "#{exception.class}: #{message}\n".dup string << exception.backtrace.map { |l| "\t#{l}" }.join("\n") string end @@ -159,7 +168,7 @@ module Rack div.commands { margin-left: 40px; } div.commands a { color:black; text-decoration:none; } #summary { background: #ffc; } - #summary h2 { font-weight: normal; color: #666; } + #summary h2 { font-family: monospace; font-weight: normal; color: #666; white-space: pre-wrap; } #summary ul#quicklinks { list-style-type: none; margin-bottom: 2em; } #summary ul#quicklinks li { float: left; padding: 0 1em; } #summary ul#quicklinks>li+li { border-left: 1px #666 solid; } @@ -227,7 +236,11 @@ module Rack

<%=h exception.class %> at <%=h path %>

+ <% if exception.respond_to?(:detailed_message) %> +

<%=h exception.detailed_message(highlight: false) %>

+ <% else %>

<%=h exception.message %>

+ <% end %>
Ruby diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/show_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/show_status.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/show_status.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/show_status.rb index a99bdaf33a..b6f75a016e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/show_status.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/show_status.rb @@ -2,6 +2,11 @@ require 'erb' +require_relative 'constants' +require_relative 'utils' +require_relative 'request' +require_relative 'body_proxy' + module Rack # Rack::ShowStatus catches all empty responses and replaces them # with a site explaining the error. @@ -17,8 +22,7 @@ module Rack end def call(env) - status, headers, body = @app.call(env) - headers = Utils::HeaderHash[headers] + status, headers, body = response = @app.call(env) empty = headers[CONTENT_LENGTH].to_i <= 0 # client or server error, or explicit message @@ -33,12 +37,18 @@ module Rack # Yes, it is dumb, but I don't like Ruby yelling at me. detail = detail = env[RACK_SHOWSTATUS_DETAIL] || message - body = @template.result(binding) - size = body.bytesize - [status, headers.merge(CONTENT_TYPE => "text/html", CONTENT_LENGTH => size.to_s), [body]] - else - [status, headers, body] + html = @template.result(binding) + size = html.bytesize + + response[2] = Rack::BodyProxy.new([html]) do + body.close if body.respond_to?(:close) + end + + headers[CONTENT_TYPE] = "text/html" + headers[CONTENT_LENGTH] = size.to_s end + + response end def h(obj) # :nodoc: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/static.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/static.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/static.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/static.rb index 8cb58b2fd7..5c9b6760ff 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/static.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/static.rb @@ -1,5 +1,9 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'files' +require_relative 'mime' + module Rack # The Rack::Static middleware intercepts requests for static files @@ -78,16 +82,14 @@ module Rack # :header_rules => [ # # Cache all static files in public caches (e.g. Rack::Cache) # # as well as in the browser - # [:all, {'Cache-Control' => 'public, max-age=31536000'}], + # [:all, {'cache-control' => 'public, max-age=31536000'}], # # # Provide web fonts with cross-origin access-control-headers # # Firefox requires this when serving assets using a Content Delivery Network - # [:fonts, {'Access-Control-Allow-Origin' => '*'}] + # [:fonts, {'access-control-allow-origin' => '*'}] # ] # class Static - (require_relative 'core_ext/regexp'; using ::Rack::RegexpExtensions) if RUBY_VERSION < '2.4' - def initialize(app, options = {}) @app = app @urls = options[:urls] || ["/favicon.ico"] @@ -137,10 +139,8 @@ module Rack elsif response[0] == 304 # Do nothing, leave headers as is else - if mime_type = Mime.mime_type(::File.extname(path), 'text/plain') - response[1][CONTENT_TYPE] = mime_type - end - response[1]['Content-Encoding'] = 'gzip' + response[1][CONTENT_TYPE] = Mime.mime_type(::File.extname(path), 'text/plain') + response[1]['content-encoding'] = 'gzip' end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/tempfile_reaper.rb similarity index 59% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/tempfile_reaper.rb index 9b04fefc24..0b94cc73a1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/tempfile_reaper.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +require_relative 'constants' +require_relative 'body_proxy' + module Rack # Middleware tracks and cleans Tempfiles created throughout a request (i.e. Rack::Multipart) @@ -12,11 +15,19 @@ module Rack def call(env) env[RACK_TEMPFILES] ||= [] - status, headers, body = @app.call(env) - body_proxy = BodyProxy.new(body) do - env[RACK_TEMPFILES].each(&:close!) unless env[RACK_TEMPFILES].nil? + + begin + _, _, body = response = @app.call(env) + rescue Exception + env[RACK_TEMPFILES]&.each(&:close!) + raise end - [status, headers, body_proxy] + + response[2] = BodyProxy.new(body) do + env[RACK_TEMPFILES]&.each(&:close!) + end + + response end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/urlmap.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/urlmap.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/urlmap.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/urlmap.rb index 31a642c418..afb97eea44 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/urlmap.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/urlmap.rb @@ -2,6 +2,8 @@ require 'set' +require_relative 'constants' + module Rack # Rack::URLMap takes a hash mapping urls or paths to apps, and # dispatches accordingly. Support for HTTP/1.1 host names exists if @@ -74,7 +76,7 @@ module Rack return app.call(env) end - [404, { CONTENT_TYPE => "text/plain", "X-Cascade" => "pass" }, ["Not Found: #{path}"]] + [404, { CONTENT_TYPE => "text/plain", "x-cascade" => "pass" }, ["Not Found: #{path}"]] ensure env[PATH_INFO] = path diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/utils.rb similarity index 62% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/utils.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/utils.rb index 34849ded1c..648b70590d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/utils.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/utils.rb @@ -8,29 +8,29 @@ require 'tempfile' require 'time' require_relative 'query_parser' +require_relative 'mime' +require_relative 'headers' +require_relative 'constants' module Rack # Rack::Utils contains a grab-bag of useful methods for writing web # applications adopted from all kinds of Ruby libraries. module Utils - (require_relative 'core_ext/regexp'; using ::Rack::RegexpExtensions) if RUBY_VERSION < '2.4' - ParameterTypeError = QueryParser::ParameterTypeError InvalidParameterError = QueryParser::InvalidParameterError + ParamsTooDeepError = QueryParser::ParamsTooDeepError DEFAULT_SEP = QueryParser::DEFAULT_SEP COMMON_SEP = QueryParser::COMMON_SEP KeySpaceConstrainedParams = QueryParser::Params - RFC2822_DAY_NAME = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ] - RFC2822_MONTH_NAME = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ] - class << self attr_accessor :default_query_parser end - # The default number of bytes to allow parameter keys to take up. - # This helps prevent a rogue client from flooding a Request. - self.default_query_parser = QueryParser.make_default(65536, 100) + # The default amount of nesting to allowed by hash parameters. + # This helps prevent a rogue client from triggering a possible stack overflow + # when parsing parameters. + self.default_query_parser = QueryParser.make_default(32) module_function @@ -75,11 +75,12 @@ module Rack end def self.key_space_limit - default_query_parser.key_space_limit + warn("`Rack::Utils.key_space_limit` is deprecated as this value no longer has an effect. It will be removed in Rack 3.1", uplevel: 1) + 65536 end def self.key_space_limit=(v) - self.default_query_parser = self.default_query_parser.new_space_limit(v) + warn("`Rack::Utils.key_space_limit=` is deprecated and no longer has an effect. It will be removed in Rack 3.1", uplevel: 1) end if defined?(Process::CLOCK_MONOTONIC) @@ -141,6 +142,19 @@ module Rack end end + def forwarded_values(forwarded_header) + return nil unless forwarded_header + forwarded_header = forwarded_header.to_s.gsub("\n", ";") + + forwarded_header.split(/\s*;\s*/).each_with_object({}) do |field, values| + field.split(/\s*,\s*/).each do |pair| + return nil unless pair =~ /\A\s*(by|for|host|proto)\s*=\s*"?([^"]+)"?\s*\Z/i + (values[$1.downcase.to_sym] ||= []) << $2 + end + end + end + module_function :forwarded_values + # Return best accept value to use, based on the algorithm # in RFC 2616 Section 14. If there are multiple best # matches (same specificity and quality), the value returned @@ -155,7 +169,7 @@ module Rack end.compact.sort_by do |match, quality| (match.split('/', 2).count('*') * -10) + quality end.last - matches && matches.first + matches&.first end ESCAPE_HTML = { @@ -206,17 +220,20 @@ module Rack (encoding_candidates & available_encodings)[0] end - def parse_cookies(env) - parse_cookies_header env[HTTP_COOKIE] - end + # :call-seq: + # parse_cookies_header(value) -> hash + # + # Parse cookies from the provided header +value+ according to RFC6265. The + # syntax for cookie headers only supports semicolons. Returns a map of + # cookie +key+ to cookie +value+. + # + # parse_cookies_header('myname=myvalue; max-age=0') + # # => {"myname"=>"myvalue", "max-age"=>"0"} + # + def parse_cookies_header(value) + return {} unless value - def parse_cookies_header(header) - # According to RFC 6265: - # The syntax for cookie headers only supports semicolons - # User Agent -> Server == - # Cookie: SID=31d4d96e407aad42; lang=en-US - return {} unless header - header.split(/[;] */n).each_with_object({}) do |cookie, cookies| + value.split(/; */n).each_with_object({}) do |cookie, cookies| next if cookie.empty? key, value = cookie.split('=', 2) cookies[key] = (unescape(value) rescue value) unless cookies.key?(key) @@ -224,14 +241,66 @@ module Rack end def add_cookie_to_header(header, key, value) + warn("add_cookie_to_header is deprecated and will be removed in Rack 3.1", uplevel: 1) + + case header + when nil, '' + return set_cookie_header(key, value) + when String + [header, set_cookie_header(key, value)] + when Array + header + [set_cookie_header(key, value)] + else + raise ArgumentError, "Unrecognized cookie header value. Expected String, Array, or nil, got #{header.inspect}" + end + end + + # :call-seq: + # parse_cookies(env) -> hash + # + # Parse cookies from the provided request environment using + # parse_cookies_header. Returns a map of cookie +key+ to cookie +value+. + # + # parse_cookies({'HTTP_COOKIE' => 'myname=myvalue'}) + # # => {'myname' => 'myvalue'} + # + def parse_cookies(env) + parse_cookies_header env[HTTP_COOKIE] + end + + # :call-seq: + # set_cookie_header(key, value) -> encoded string + # + # Generate an encoded string using the provided +key+ and +value+ suitable + # for the +set-cookie+ header according to RFC6265. The +value+ may be an + # instance of either +String+ or +Hash+. + # + # If the cookie +value+ is an instance of +Hash+, it considers the following + # cookie attribute keys: +domain+, +max_age+, +expires+ (must be instance + # of +Time+), +secure+, +http_only+, +same_site+ and +value+. For more + # details about the interpretation of these fields, consult + # [RFC6265 Section 5.2](https://datatracker.ietf.org/doc/html/rfc6265#section-5.2). + # + # An extra cookie attribute +escape_key+ can be provided to control whether + # or not the cookie key is URL encoded. If explicitly set to +false+, the + # cookie key name will not be url encoded (escaped). The default is +true+. + # + # set_cookie_header("myname", "myvalue") + # # => "myname=myvalue" + # + # set_cookie_header("myname", {value: "myvalue", max_age: 10}) + # # => "myname=myvalue; max-age=10" + # + def set_cookie_header(key, value) case value when Hash + key = escape(key) unless value[:escape_key] == false domain = "; domain=#{value[:domain]}" if value[:domain] path = "; path=#{value[:path]}" if value[:path] max_age = "; max-age=#{value[:max_age]}" if value[:max_age] expires = "; expires=#{value[:expires].httpdate}" if value[:expires] secure = "; secure" if value[:secure] - httponly = "; HttpOnly" if (value.key?(:httponly) ? value[:httponly] : value[:http_only]) + httponly = "; httponly" if (value.key?(:httponly) ? value[:httponly] : value[:http_only]) same_site = case value[:same_site] when false, nil @@ -246,100 +315,109 @@ module Rack raise ArgumentError, "Invalid SameSite value: #{value[:same_site].inspect}" end value = value[:value] + else + key = escape(key) end + value = [value] unless Array === value - cookie = "#{escape(key)}=#{value.map { |v| escape v }.join('&')}#{domain}" \ + return "#{key}=#{value.map { |v| escape v }.join('&')}#{domain}" \ "#{path}#{max_age}#{expires}#{secure}#{httponly}#{same_site}" + end - case header - when nil, '' - cookie - when String - [header, cookie].join("\n") - when Array - (header + [cookie]).join("\n") + # :call-seq: + # set_cookie_header!(headers, key, value) -> header value + # + # Append a cookie in the specified headers with the given cookie +key+ and + # +value+ using set_cookie_header. + # + # If the headers already contains a +set-cookie+ key, it will be converted + # to an +Array+ if not already, and appended to. + def set_cookie_header!(headers, key, value) + if header = headers[SET_COOKIE] + if header.is_a?(Array) + header << set_cookie_header(key, value) + else + headers[SET_COOKIE] = [header, set_cookie_header(key, value)] + end else - raise ArgumentError, "Unrecognized cookie header value. Expected String, Array, or nil, got #{header.inspect}" + headers[SET_COOKIE] = set_cookie_header(key, value) end end - def set_cookie_header!(header, key, value) - header[SET_COOKIE] = add_cookie_to_header(header[SET_COOKIE], key, value) - nil + # :call-seq: + # delete_set_cookie_header(key, value = {}) -> encoded string + # + # Generate an encoded string based on the given +key+ and +value+ using + # set_cookie_header for the purpose of causing the specified cookie to be + # deleted. The +value+ may be an instance of +Hash+ and can include + # attributes as outlined by set_cookie_header. The encoded cookie will have + # a +max_age+ of 0 seconds, an +expires+ date in the past and an empty + # +value+. When used with the +set-cookie+ header, it will cause the client + # to *remove* any matching cookie. + # + # delete_set_cookie_header("myname") + # # => "myname=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT" + # + def delete_set_cookie_header(key, value = {}) + set_cookie_header(key, value.merge(max_age: '0', expires: Time.at(0), value: '')) end def make_delete_cookie_header(header, key, value) - case header - when nil, '' - cookies = [] - when String - cookies = header.split("\n") - when Array - cookies = header + warn("make_delete_cookie_header is deprecated and will be removed in Rack 3.1, use delete_set_cookie_header! instead", uplevel: 1) + + delete_set_cookie_header!(header, key, value) + end + + def delete_cookie_header!(headers, key, value = {}) + headers[SET_COOKIE] = delete_set_cookie_header!(headers[SET_COOKIE], key, value) + + return nil + end + + def add_remove_cookie_to_header(header, key, value = {}) + warn("add_remove_cookie_to_header is deprecated and will be removed in Rack 3.1, use delete_set_cookie_header! instead", uplevel: 1) + + delete_set_cookie_header!(header, key, value) + end + + # :call-seq: + # delete_set_cookie_header!(header, key, value = {}) -> header value + # + # Set an expired cookie in the specified headers with the given cookie + # +key+ and +value+ using delete_set_cookie_header. This causes + # the client to immediately delete the specified cookie. + # + # delete_set_cookie_header!(nil, "mycookie") + # # => "mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT" + # + # If the header is non-nil, it will be modified in place. + # + # header = [] + # delete_set_cookie_header!(header, "mycookie") + # # => ["mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT"] + # header + # # => ["mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT"] + # + def delete_set_cookie_header!(header, key, value = {}) + if header + header = Array(header) + header << delete_set_cookie_header(key, value) + else + header = delete_set_cookie_header(key, value) end - key = escape(key) - domain = value[:domain] - path = value[:path] - regexp = if domain - if path - /\A#{key}=.*(?:domain=#{domain}(?:;|$).*path=#{path}(?:;|$)|path=#{path}(?:;|$).*domain=#{domain}(?:;|$))/ - else - /\A#{key}=.*domain=#{domain}(?:;|$)/ - end - elsif path - /\A#{key}=.*path=#{path}(?:;|$)/ - else - /\A#{key}=/ - end - - cookies.reject! { |cookie| regexp.match? cookie } - - cookies.join("\n") - end - - def delete_cookie_header!(header, key, value = {}) - header[SET_COOKIE] = add_remove_cookie_to_header(header[SET_COOKIE], key, value) - nil - end - - # Adds a cookie that will *remove* a cookie from the client. Hence the - # strange method name. - def add_remove_cookie_to_header(header, key, value = {}) - new_header = make_delete_cookie_header(header, key, value) - - add_cookie_to_header(new_header, key, - { value: '', path: nil, domain: nil, - max_age: '0', - expires: Time.at(0) }.merge(value)) - + return header end def rfc2822(time) time.rfc2822 end - # Modified version of stdlib time.rb Time#rfc2822 to use '%d-%b-%Y' instead - # of '% %b %Y'. - # It assumes that the time is in GMT to comply to the RFC 2109. - # - # NOTE: I'm not sure the RFC says it requires GMT, but is ambiguous enough - # that I'm certain someone implemented only that option. - # Do not use %a and %b from Time.strptime, it would use localized names for - # weekday and month. - # - def rfc2109(time) - wday = RFC2822_DAY_NAME[time.wday] - mon = RFC2822_MONTH_NAME[time.mon - 1] - time.strftime("#{wday}, %d-#{mon}-%Y %H:%M:%S GMT") - end - # Parses the "Range:" header, if present, into an array of Range objects. # Returns nil if the header is missing or syntactically invalid. # Returns an empty array if none of the ranges are satisfiable. def byte_ranges(env, size) - warn "`byte_ranges` is deprecated, please use `get_byte_ranges`" if $VERBOSE get_byte_ranges env['HTTP_RANGE'], size end @@ -371,20 +449,30 @@ module Rack ranges end - # Constant time string comparison. - # - # NOTE: the values compared should be of fixed length, such as strings - # that have already been processed by HMAC. This should not be used - # on variable length plaintext strings because it could leak length info - # via timing attacks. - def secure_compare(a, b) - return false unless a.bytesize == b.bytesize + # :nocov: + if defined?(OpenSSL.fixed_length_secure_compare) + # Constant time string comparison. + # + # NOTE: the values compared should be of fixed length, such as strings + # that have already been processed by HMAC. This should not be used + # on variable length plaintext strings because it could leak length info + # via timing attacks. + def secure_compare(a, b) + return false unless a.bytesize == b.bytesize - l = a.unpack("C*") + OpenSSL.fixed_length_secure_compare(a, b) + end + # :nocov: + else + def secure_compare(a, b) + return false unless a.bytesize == b.bytesize - r, i = 0, -1 - b.each_byte { |v| r |= v ^ l[i += 1] } - r == 0 + l = a.unpack("C*") + + r, i = 0, -1 + b.each_byte { |v| r |= v ^ l[i += 1] } + r == 0 + end end # Context allows the use of a compatible middleware at different points @@ -413,94 +501,32 @@ module Rack end end - # A case-insensitive Hash that preserves the original case of a + # A wrapper around Headers # header when set. # # @api private class HeaderHash < Hash # :nodoc: def self.[](headers) - if headers.is_a?(HeaderHash) && !headers.frozen? + warn "Rack::Utils::HeaderHash is deprecated and will be removed in Rack 3.1, switch to Rack::Headers", uplevel: 1 + if headers.is_a?(Headers) && !headers.frozen? return headers - else - return self.new(headers) end + + new_headers = Headers.new + headers.each{|k,v| new_headers[k] = v} + new_headers end - def initialize(hash = {}) - super() - @names = {} - hash.each { |k, v| self[k] = v } + def self.new(hash = {}) + warn "Rack::Utils::HeaderHash is deprecated and will be removed in Rack 3.1, switch to Rack::Headers", uplevel: 1 + headers = Headers.new + hash.each{|k,v| headers[k] = v} + headers end - # on dup/clone, we need to duplicate @names hash - def initialize_copy(other) - super - @names = other.names.dup + def self.allocate + raise TypeError, "cannot allocate HeaderHash" end - - # on clear, we need to clear @names hash - def clear - super - @names.clear - end - - def each - super do |k, v| - yield(k, v.respond_to?(:to_ary) ? v.to_ary.join("\n") : v) - end - end - - def to_hash - hash = {} - each { |k, v| hash[k] = v } - hash - end - - def [](k) - super(k) || super(@names[k.downcase]) - end - - def []=(k, v) - canonical = k.downcase.freeze - delete k if @names[canonical] && @names[canonical] != k # .delete is expensive, don't invoke it unless necessary - @names[canonical] = k - super k, v - end - - def delete(k) - canonical = k.downcase - result = super @names.delete(canonical) - result - end - - def include?(k) - super || @names.include?(k.downcase) - end - - alias_method :has_key?, :include? - alias_method :member?, :include? - alias_method :key?, :include? - - def merge!(other) - other.each { |k, v| self[k] = v } - self - end - - def merge(other) - hash = dup - hash.merge! other - end - - def replace(other) - clear - other.each { |k, v| self[k] = v } - self - end - - protected - def names - @names - end end # Every standard HTTP code mapped to the appropriate message. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/version.rb similarity index 69% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/version.rb index f05a2c602c..782eb98114 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-2.2.4/lib/rack/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.0/lib/rack/version.rb @@ -13,14 +13,19 @@ module Rack # The Rack protocol version number implemented. - VERSION = [1, 3] + VERSION = [1, 3].freeze + deprecate_constant :VERSION - # Return the Rack protocol version as a dotted string. + VERSION_STRING = "1.3".freeze + deprecate_constant :VERSION_STRING + + # The Rack protocol version number implemented. def self.version - VERSION.join(".") + warn "Rack.version is deprecated and will be removed in Rack 3.1!", uplevel: 1 + VERSION end - RELEASE = "2.2.4" + RELEASE = "3.0.0" # Return the Rack release as a dotted string. def self.release diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/config/default.yml similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/config/default.yml index 0b5f4c5a5d..ee6aaad3d8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/config/default.yml @@ -1,5 +1,9 @@ # This is the default configuration file. +Performance: + Enabled: true + DocumentationBaseURL: https://docs.rubocop.org/rubocop-performance + Performance/AncestorsInclude: Description: 'Use `A <= B` instead of `A.ancestors.include?(B)`.' Reference: 'https://github.com/JuanitoFatas/fast-ruby#ancestorsinclude-vs--code' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/config/obsoletion.yml similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/config/obsoletion.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/config/obsoletion.yml diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop-performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop-performance.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop-performance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop-performance.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/mixin/regexp_metacharacter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/mixin/sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/mixin/sort_block.rb similarity index 80% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/mixin/sort_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/mixin/sort_block.rb index 8a287b9c4d..cc62dc1683 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/mixin/sort_block.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/mixin/sort_block.rb @@ -14,6 +14,13 @@ module RuboCop $send) PATTERN + def_node_matcher :sort_with_numblock?, <<~PATTERN + (numblock + $(send _ :sort) + $_arg_count + $send) + PATTERN + def_node_matcher :replaceable_body?, <<~PATTERN (send (lvar %1) :<=> (lvar %2)) PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/ancestors_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/ancestors_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/ancestors_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/ancestors_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb index d41d38c397..1909b6568e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb @@ -41,11 +41,7 @@ module RuboCop end elsif (numeric_to_d = to_d?(node)) add_offense(numeric_to_d.source_range) do |corrector| - big_decimal_args = node - .arguments - .map(&:source) - .unshift("'#{numeric_to_d.source}'") - .join(', ') + big_decimal_args = node.arguments.map(&:source).unshift("'#{numeric_to_d.source}'").join(', ') corrector.replace(node, "BigDecimal(#{big_decimal_args})") end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/bind_call.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/bind_call.rb index 0e97597ba2..0937a252af 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/bind_call.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/bind_call.rb @@ -26,8 +26,7 @@ module RuboCop minimum_target_ruby_version 2.7 - MSG = 'Use `bind_call(%s%s%s)` ' \ - 'instead of `bind(%s).call(%s)`.' + MSG = 'Use `bind_call(%s%s%s)` instead of `bind(%s).call(%s)`.' RESTRICT_ON_SEND = %i[call].freeze def_node_matcher :bind_with_call_method?, <<~PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/block_given_with_explicit_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/block_given_with_explicit_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/block_given_with_explicit_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/block_given_with_explicit_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/caller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/caller.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/caller.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/caller.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/case_when_splat.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/case_when_splat.rb index 20ca76efbc..08ee889a8e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/case_when_splat.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/case_when_splat.rb @@ -99,8 +99,7 @@ module RuboCop def inline_fix_branch(corrector, when_node) conditions = when_node.conditions - range = range_between(conditions[0].loc.expression.begin_pos, - conditions[-1].loc.expression.end_pos) + range = range_between(conditions[0].loc.expression.begin_pos, conditions[-1].loc.expression.end_pos) corrector.replace(range, replacement(conditions)) end @@ -111,8 +110,7 @@ module RuboCop return if when_branches.one? corrector.remove(when_branch_range(when_node)) - corrector.insert_after(when_branches.last.source_range, - reordering_correction(when_node)) + corrector.insert_after(when_branches.last.source_range, reordering_correction(when_node)) end def reordering_correction(when_node) @@ -126,11 +124,9 @@ module RuboCop end def when_branch_range(when_node) - next_branch = - when_node.parent.when_branches[when_node.branch_index + 1] + next_branch = when_node.parent.when_branches[when_node.branch_index + 1] - range_between(when_node.source_range.begin_pos, - next_branch.source_range.begin_pos) + range_between(when_node.source_range.begin_pos, next_branch.source_range.begin_pos) end def new_condition_with_then(node, new_condition) @@ -162,13 +158,11 @@ module RuboCop def non_splat?(condition) variable, = *condition - (condition.splat_type? && variable.array_type?) || - !condition.splat_type? + (condition.splat_type? && variable.array_type?) || !condition.splat_type? end def needs_reorder?(when_node) - following_branches = - when_node.parent.when_branches[(when_node.branch_index + 1)..] + following_branches = when_node.parent.when_branches[(when_node.branch_index + 1)..] following_branches.any? do |when_branch| when_branch.conditions.any? do |condition| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/casecmp.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/casecmp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/casecmp.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/chain_array_allocation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/chain_array_allocation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/chain_array_allocation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb index 50b0bbc20f..937c5e9ea9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/collection_literal_in_loop.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb @@ -104,9 +104,7 @@ module RuboCop end def loop?(ancestor, node) - keyword_loop?(ancestor.type) || - kernel_loop?(ancestor) || - node_within_enumerable_loop?(node, ancestor) + keyword_loop?(ancestor.type) || kernel_loop?(ancestor) || node_within_enumerable_loop?(node, ancestor) end def keyword_loop?(type) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/compare_with_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/compare_with_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/compare_with_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/concurrent_monotonic_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/concurrent_monotonic_time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/concurrent_monotonic_time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/concurrent_monotonic_time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/constant_regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/constant_regexp.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/constant_regexp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/constant_regexp.rb index af70c73966..00be251b0e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/constant_regexp.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/constant_regexp.rb @@ -39,9 +39,7 @@ module RuboCop MSG = 'Extract this regexp into a constant, memoize it, or append an `/o` option to its options.' def on_regexp(node) - return if within_allowed_assignment?(node) || - !include_interpolated_const?(node) || - node.single_interpolation? + return if within_allowed_assignment?(node) || !include_interpolated_const?(node) || node.single_interpolation? add_offense(node) do |corrector| corrector.insert_after(node, 'o') diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/count.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/count.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/count.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_prefix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/delete_prefix.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_prefix.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/delete_prefix.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_suffix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/delete_suffix.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/delete_suffix.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/delete_suffix.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/detect.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/detect.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/detect.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/double_start_end_with.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/double_start_end_with.rb index 3f922ba502..df1dea94f6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/double_start_end_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/double_start_end_with.rb @@ -41,8 +41,7 @@ module RuboCop class DoubleStartEndWith < Base extend AutoCorrector - MSG = 'Use `%s.%s(%s)` ' \ - 'instead of `%s`.' + MSG = 'Use `%s.%s(%s)` instead of `%s`.' def on_or(node) receiver, method, first_call_args, second_call_args = process_source(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/end_with.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/end_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/end_with.rb index 460367be6c..2430f84931 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/end_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/end_with.rb @@ -50,8 +50,7 @@ module RuboCop include RegexpMetacharacter extend AutoCorrector - MSG = 'Use `String#end_with?` instead of a regex match anchored to ' \ - 'the end of the string.' + MSG = 'Use `String#end_with?` instead of a regex match anchored to the end of the string.' RESTRICT_ON_SEND = %i[match =~ match?].freeze def_node_matcher :redundant_regex?, <<~PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/fixed_size.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/fixed_size.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/fixed_size.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/flat_map.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/flat_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/flat_map.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/inefficient_hash_search.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/inefficient_hash_search.rb index dd38a94b20..3af118e250 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/inefficient_hash_search.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/inefficient_hash_search.rb @@ -83,9 +83,7 @@ module RuboCop def use_long_method preferred_config = config.for_all_cops['Style/PreferredHashMethods'] - preferred_config && - preferred_config['EnforcedStyle'] == 'long' && - preferred_config['Enabled'] + preferred_config && preferred_config['EnforcedStyle'] == 'long' && preferred_config['Enabled'] end def autocorrect_argument(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/io_readlines.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/io_readlines.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/io_readlines.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/map_compact.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/map_compact.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/map_compact.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/method_object_as_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/method_object_as_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/method_object_as_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/method_object_as_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/open_struct.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/open_struct.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/open_struct.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/open_struct.rb index 9e4351eb70..f5ef6942f8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/open_struct.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/open_struct.rb @@ -32,8 +32,7 @@ module RuboCop # end # class OpenStruct < Base - MSG = 'Consider using `Struct` over `OpenStruct` ' \ - 'to optimize the performance.' + MSG = 'Consider using `Struct` over `OpenStruct` to optimize the performance.' RESTRICT_ON_SEND = %i[new].freeze def_node_matcher :open_struct, <<~PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/range_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/range_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/range_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/range_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_block_call.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_block_call.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_block_call.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_match.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_match.rb index c2fa42c0c4..23539c529b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_match.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_match.rb @@ -20,8 +20,7 @@ module RuboCop class RedundantMatch < Base extend AutoCorrector - MSG = 'Use `=~` in places where the `MatchData` returned by ' \ - '`#match` will not be used.' + MSG = 'Use `=~` in places where the `MatchData` returned by `#match` will not be used.' RESTRICT_ON_SEND = %i[match].freeze # 'match' is a fairly generic name, so we don't flag it unless we see @@ -41,21 +40,23 @@ module RuboCop !(node.parent && node.parent.block_type?) add_offense(node) do |corrector| - autocorrect(corrector, node) + autocorrect(corrector, node) if autocorrectable?(node) end end private def autocorrect(corrector, node) - # Regexp#match can take a second argument, but this cop doesn't - # register an offense in that case - return unless node.first_argument.regexp_type? - new_source = "#{node.receiver.source} =~ #{node.first_argument.source}" corrector.replace(node.source_range, new_source) end + + def autocorrectable?(node) + # Regexp#match can take a second argument, but this cop doesn't + # register an offense in that case + node.receiver.regexp_type? || node.first_argument.regexp_type? + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_merge.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_merge.rb index 7dfb53a267..a0ce62ad04 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_merge.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_merge.rb @@ -99,8 +99,7 @@ module RuboCop end def non_redundant_value_used?(receiver, node) - node.value_used? && - !EachWithObjectInspector.new(node, receiver).value_used? + node.value_used? && !EachWithObjectInspector.new(node, receiver).value_used? end def correct_multiple_elements(corrector, node, parent, new_source) @@ -125,9 +124,7 @@ module RuboCop key = key.sym_type? && pair.colon? ? ":#{key.source}" : key.source - format(AREF_ASGN, receiver: receiver.source, - key: key, - value: value.source) + format(AREF_ASGN, receiver: receiver.source, key: key, value: value.source) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_sort_block.rb similarity index 54% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_sort_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_sort_block.rb index 55c3af49cb..ca5481039d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_sort_block.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_sort_block.rb @@ -16,25 +16,33 @@ module RuboCop include SortBlock extend AutoCorrector - MSG = 'Use `sort` instead of `%s`.' + MSG = 'Use `sort` without block.' def on_block(node) return unless (send, var_a, var_b, body = sort_with_block?(node)) replaceable_body?(body, var_a, var_b) do - range = sort_range(send, node) + register_offense(send, node) + end + end - add_offense(range, message: message(var_a, var_b)) do |corrector| - corrector.replace(range, 'sort') - end + def on_numblock(node) + return unless (send, arg_count, body = sort_with_numblock?(node)) + return unless arg_count == 2 + + replaceable_body?(body, :_1, :_2) do + register_offense(send, node) end end private - def message(var_a, var_b) - bad_method = "sort { |#{var_a}, #{var_b}| #{var_a} <=> #{var_b} }" - format(MSG, bad_method: bad_method) + def register_offense(send, node) + range = sort_range(send, node) + + add_offense(range) do |corrector| + corrector.replace(range, 'sort') + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_string_chars.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/redundant_string_chars.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/redundant_string_chars.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/regexp_match.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/regexp_match.rb index 2b7eecc7e8..5a5c5ee62c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/regexp_match.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/regexp_match.rb @@ -217,8 +217,7 @@ module RuboCop def find_last_match(body, range, scope_root) last_matches(body).find do |ref| ref_pos = ref.loc.expression.begin_pos - range.cover?(ref_pos) && - scope_root(ref) == scope_root + range.cover?(ref_pos) && scope_root(ref) == scope_root end end @@ -241,14 +240,7 @@ module RuboCop end def match_gvar?(sym) - %i[ - $~ - $MATCH - $PREMATCH - $POSTMATCH - $LAST_PAREN_MATCH - $LAST_MATCH_INFO - ].include?(sym) + %i[$~ $MATCH $PREMATCH $POSTMATCH $LAST_PAREN_MATCH $LAST_MATCH_INFO].include?(sym) end def correct_operator(corrector, recv, arg, oper = nil) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/reverse_each.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/reverse_each.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/reverse_first.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/reverse_first.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/reverse_first.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/select_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/select_map.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/select_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/select_map.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/size.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/size.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/size.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/sort_reverse.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/sort_reverse.rb similarity index 53% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/sort_reverse.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/sort_reverse.rb index 301906804e..524e03b23d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/sort_reverse.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/sort_reverse.rb @@ -17,27 +17,36 @@ module RuboCop include SortBlock extend AutoCorrector - MSG = 'Use `sort.reverse` instead of `%s`.' + MSG = 'Use `sort.reverse` instead.' def on_block(node) sort_with_block?(node) do |send, var_a, var_b, body| replaceable_body?(body, var_b, var_a) do - range = sort_range(send, node) + register_offense(send, node) + end + end + end - add_offense(range, message: message(var_a, var_b)) do |corrector| - replacement = 'sort.reverse' + def on_numblock(node) + sort_with_numblock?(node) do |send, arg_count, body| + next unless arg_count == 2 - corrector.replace(range, replacement) - end + replaceable_body?(body, :_2, :_1) do + register_offense(send, node) end end end private - def message(var_a, var_b) - bad_method = "sort { |#{var_a}, #{var_b}| #{var_b} <=> #{var_a} }" - format(MSG, bad_method: bad_method) + def register_offense(send, node) + range = sort_range(send, node) + + add_offense(range) do |corrector| + replacement = 'sort.reverse' + + corrector.replace(range, replacement) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/squeeze.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/squeeze.rb index 3b7c0bfb58..7691b170f8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/squeeze.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/squeeze.rb @@ -24,10 +24,7 @@ module RuboCop MSG = 'Use `%s` instead of `%s`.' RESTRICT_ON_SEND = %i[gsub gsub!].freeze - PREFERRED_METHODS = { - gsub: :squeeze, - gsub!: :squeeze! - }.freeze + PREFERRED_METHODS = { gsub: :squeeze, gsub!: :squeeze! }.freeze def_node_matcher :squeeze_candidate?, <<~PATTERN (send diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/start_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/start_with.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/start_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/start_with.rb index bf35a10af2..c1d2853d86 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/start_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/start_with.rb @@ -50,8 +50,7 @@ module RuboCop include RegexpMetacharacter extend AutoCorrector - MSG = 'Use `String#start_with?` instead of a regex match anchored to ' \ - 'the beginning of the string.' + MSG = 'Use `String#start_with?` instead of a regex match anchored to the beginning of the string.' RESTRICT_ON_SEND = %i[match =~ match?].freeze def_node_matcher :redundant_regex?, <<~PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_identifier_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/string_identifier_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_identifier_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/string_identifier_argument.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/string_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/string_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/string_replacement.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/string_replacement.rb index cc9358a528..e4cd35d0c6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/string_replacement.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/string_replacement.rb @@ -86,8 +86,7 @@ module RuboCop unless first_param.str_type? return true if options - return true unless first_source.is_a?(String) && - first_source =~ DETERMINISTIC_REGEX + return true unless first_source.is_a?(String) && first_source =~ DETERMINISTIC_REGEX # This must be done after checking DETERMINISTIC_REGEX # Otherwise things like \s will trip us up @@ -141,8 +140,7 @@ module RuboCop end def message(node, first_source, second_source) - replacement_method = - replacement_method(node, first_source, second_source) + replacement_method = replacement_method(node, first_source, second_source) format(MSG, prefer: replacement_method, current: node.method_name) end @@ -152,8 +150,7 @@ module RuboCop end def remove_second_param(corrector, node, first_param) - end_range = range_between(first_param.source_range.end_pos, - node.source_range.end_pos) + end_range = range_between(first_param.source_range.end_pos, node.source_range.end_pos) corrector.replace(end_range, method_suffix(node)) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/sum.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/sum.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/sum.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/times_map.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/times_map.rb index 977b2c54a8..18584e2c52 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/times_map.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/times_map.rb @@ -32,8 +32,7 @@ module RuboCop class TimesMap < Base extend AutoCorrector - MESSAGE = 'Use `Array.new(%s)` with a block ' \ - 'instead of `.times.%s`' + MESSAGE = 'Use `Array.new(%s)` with a block instead of `.times.%s`' MESSAGE_ONLY_IF = 'only if `%s` is always 0 or more' RESTRICT_ON_SEND = %i[map collect].freeze @@ -44,14 +43,14 @@ module RuboCop def on_block(node) check(node) end + alias on_numblock on_block private def check(node) times_map_call(node) do |map_or_collect, count| add_offense(node, message: message(map_or_collect, count)) do |corrector| - replacement = "Array.new(#{count.source}" \ - "#{map_or_collect.arguments.map { |arg| ", #{arg.source}" }.join})" + replacement = "Array.new(#{count.source}#{map_or_collect.arguments.map { |arg| ", #{arg.source}" }.join})" corrector.replace(map_or_collect.loc.expression, replacement) end @@ -68,7 +67,7 @@ module RuboCop end def_node_matcher :times_map_call, <<~PATTERN - {(block $(send (send $!nil? :times) {:map :collect}) ...) + {({block numblock} $(send (send $!nil? :times) {:map :collect}) ...) $(send (send $!nil? :times) {:map :collect} (block_pass ...))} PATTERN end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/unfreeze_string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/unfreeze_string.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/unfreeze_string.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/unfreeze_string.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/uri_default_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/uri_default_parser.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/uri_default_parser.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/uri_default_parser.rb index 0f8de7d86a..636c9b055a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance/uri_default_parser.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance/uri_default_parser.rb @@ -15,8 +15,7 @@ module RuboCop class UriDefaultParser < Base extend AutoCorrector - MSG = 'Use `%sURI::DEFAULT_PARSER` instead of ' \ - '`%sURI::Parser.new`.' + MSG = 'Use `%sURI::DEFAULT_PARSER` instead of `%sURI::Parser.new`.' RESTRICT_ON_SEND = %i[new].freeze def_node_matcher :uri_parser_new?, <<~PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance_cops.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/cop/performance_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/cop/performance_cops.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/performance.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/performance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/performance.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/performance/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/performance/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/performance/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/performance/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/performance/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/performance/version.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/performance/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/performance/version.rb index 1d9846349b..d9e54520b7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.14.3/lib/rubocop/performance/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.15.0/lib/rubocop/performance/version.rb @@ -4,7 +4,7 @@ module RuboCop module Performance # This module holds the RuboCop Performance version information. module Version - STRING = '1.14.3' + STRING = '1.15.0' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/obsoletion.yml deleted file mode 100644 index 9cfb451ff7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/obsoletion.yml +++ /dev/null @@ -1,7 +0,0 @@ -# -# Configuration for obsoletion. -# -# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions -# -extracted: - Rails/*: ~ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/default.yml similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/default.yml index 27446c2fed..bb8a6376a3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/default.yml @@ -10,6 +10,9 @@ AllCops: # Exclude db/schema.rb and db/[CONFIGURATION_NAMESPACE]_schema.rb by default. # See: https://guides.rubyonrails.org/active_record_multiple_databases.html#setting-up-your-application - db/*schema.rb + # Enable checking Active Support extensions. + # See: https://docs.rubocop.org/rubocop/configuration.html#enable-checking-active-support-extensions + ActiveSupportExtensionsEnabled: true # What version of Rails is the inspected code using? If a value is specified # for TargetRailsVersion then it is used. Acceptable values are specified # as a float (i.e. 5.1); the patch version of Rails should not be included. @@ -23,6 +26,24 @@ Lint/NumberConversion: # Add Rails' duration methods to the ignore list for `Lint/NumberConversion` # so that calling `to_i` on one of these does not register an offense. # See: https://github.com/rubocop/rubocop/issues/8950 + AllowedMethods: + - ago + - from_now + - second + - seconds + - minute + - minutes + - hour + - hours + - day + - days + - week + - weeks + - fortnight + - fortnights + - in_milliseconds + AllowedPatterns: [] + # Deprecated. IgnoredMethods: - ago - from_now @@ -40,6 +61,18 @@ Lint/NumberConversion: - fortnights - in_milliseconds +Rails: + Enabled: true + DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails + +Rails/ActionControllerFlashBeforeRender: + Description: 'Use `flash.now` instead of `flash` before `render`.' + StyleGuide: 'https://rails.rubystyle.guide/#flash-before-render' + Reference: 'https://api.rubyonrails.org/classes/ActionController/FlashBeforeRender.html' + Enabled: 'pending' + SafeAutocorrect: false + VersionAdded: '2.16' + Rails/ActionControllerTestCase: Description: 'Use `ActionDispatch::IntegrationTest` instead of `ActionController::TestCase`.' StyleGuide: 'https://rails.rubystyle.guide/#integration-testing' @@ -96,6 +129,15 @@ Rails/ActiveSupportAliases: Enabled: true VersionAdded: '0.48' +Rails/ActiveSupportOnLoad: + Description: 'Use `ActiveSupport.on_load(...)` to patch Rails framework classes.' + Enabled: 'pending' + Reference: + - 'https://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html' + - 'https://guides.rubyonrails.org/engines.html#available-load-hooks' + SafeAutoCorrect: false + VersionAdded: '2.16' + Rails/AddColumnIndex: Description: >- Rails migrations don't make use of a given `index` key, but also @@ -407,6 +449,14 @@ Rails/FindEach: VersionChanged: '2.9' Include: - app/models/**/*.rb + AllowedMethods: + # Methods that don't work well with `find_each`. + - order + - limit + - select + - lock + AllowedPatterns: [] + # Deprecated. IgnoredMethods: # Methods that don't work well with `find_each`. - order @@ -414,6 +464,13 @@ Rails/FindEach: - select - lock +Rails/FreezeTime: + Description: 'Prefer `freeze_time` over `travel_to` with an argument of the current time.' + StyleGuide: 'https://rails.rubystyle.guide/#freeze-time' + Enabled: pending + VersionAdded: '2.16' + SafeAutoCorrect: false + Rails/HasAndBelongsToMany: Description: 'Prefer has_many :through to has_and_belongs_to_many.' StyleGuide: 'https://rails.rubystyle.guide#has-many-through' @@ -785,6 +842,11 @@ Rails/RootJoinChain: Enabled: pending VersionAdded: '2.13' +Rails/RootPathnameMethods: + Description: 'Use `Rails.root` IO methods instead of passing it to `File`.' + Enabled: pending + VersionAdded: '2.16' + Rails/RootPublicPath: Description: "Favor `Rails.public_path` over `Rails.root` with `'public'`." Enabled: pending @@ -937,6 +999,18 @@ Rails/ToFormattedS: - to_formatted_s VersionAdded: '2.15' +Rails/ToSWithArgument: + Description: 'Identifies passing any argument to `#to_s`.' + Enabled: pending + Safe: false + VersionAdded: '2.16' + +Rails/TopLevelHashWithIndifferentAccess: + Description: 'Identifies top-level `HashWithIndifferentAccess`.' + Reference: 'https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#top-level-hashwithindifferentaccess-is-soft-deprecated' + Enabled: pending + VersionAdded: '2.16' + Rails/TransactionExitStatement: Description: 'Avoid the usage of `return`, `break` and `throw` in transaction blocks.' Enabled: pending @@ -1003,6 +1077,12 @@ Rails/WhereExists: VersionAdded: '2.7' VersionChanged: '2.10' +Rails/WhereMissing: + Description: 'Use `where.missing(...)` to find missing relationship records.' + StyleGuide: 'https://rails.rubystyle.guide/#finding-missing-relationship-records' + Enabled: pending + VersionAdded: '2.16' + Rails/WhereNot: Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.' StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/obsoletion.yml new file mode 100644 index 0000000000..b304073aa6 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/obsoletion.yml @@ -0,0 +1,17 @@ +# +# Configuration for obsoletion. +# +# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions +# +extracted: + Rails/*: ~ + +# Cop parameters that have been changed +# Can be treated as a warning instead of a failure with `severity: warning` +changed_parameters: + - cops: Rails/FindEach + parameters: IgnoredMethods + alternatives: + - AllowedMethods + - AllowedPatterns + severity: warning diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop-rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop-rails.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop-rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop-rails.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_helper.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_helper.rb index 3a9b1ea4b3..4e776f90bd 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_helper.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_helper.rb @@ -48,10 +48,7 @@ module RuboCop class_nodes = class_node.defined_module.each_node namespaces = class_node.each_ancestor(:class, :module).map(&:identifier) - [*class_nodes, *namespaces] - .reverse - .map { |node| node.children[1] }.join('_') - .tableize + [*class_nodes, *namespaces].reverse.map { |node| node.children[1] }.join('_').tableize end # Resolve relation into column name. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_migrations_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb index 0934d2693f..0364f2b99d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_migrations_helper.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb @@ -10,9 +10,7 @@ module RuboCop bigint binary boolean date datetime decimal float integer json string text time timestamp virtual ].freeze - RAILS_ABSTRACT_SCHEMA_DEFINITIONS_HELPERS = %i[ - column references belongs_to primary_key numeric - ].freeze + RAILS_ABSTRACT_SCHEMA_DEFINITIONS_HELPERS = %i[column references belongs_to primary_key numeric].freeze POSTGRES_SCHEMA_DEFINITIONS = %i[ bigserial bit bit_varying cidr citext daterange hstore inet interval int4range int8range jsonb ltree macaddr money numrange oid point line diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/class_send_node_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/class_send_node_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/class_send_node_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/class_send_node_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/enforce_superclass.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/enforce_superclass.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/enforce_superclass.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/enforce_superclass.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/index_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/index_method.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/index_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/index_method.rb index 952ffcf862..5cc2009486 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/index_method.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/index_method.rb @@ -6,7 +6,7 @@ module RuboCop module IndexMethod # rubocop:disable Metrics/ModuleLength RESTRICT_ON_SEND = %i[each_with_object to_h map collect []].freeze - def on_block(node) + def on_block(node) # rubocop:todo InternalAffairs/NumblockHandler on_bad_each_with_object(node) do |*match| handle_possible_offense(node, match, 'each_with_object') end @@ -98,10 +98,7 @@ module RuboCop captures = extract_captures(correction.match) correction.set_new_arg_name(captures.transformed_argname, corrector) - correction.set_new_body_expression( - captures.transforming_body_expr, - corrector - ) + correction.set_new_body_expression(captures.transforming_body_expr, corrector) end # Internal helper class to hold match data @@ -110,8 +107,7 @@ module RuboCop :transforming_body_expr ) do def noop_transformation? - transforming_body_expr.lvar_type? && - transforming_body_expr.children == [transformed_argname] + transforming_body_expr.lvar_type? && transforming_body_expr.children == [transformed_argname] end end @@ -157,17 +153,11 @@ module RuboCop end def set_new_arg_name(transformed_argname, corrector) - corrector.replace( - block_node.arguments.loc.expression, - "|#{transformed_argname}|" - ) + corrector.replace(block_node.arguments.loc.expression, "|#{transformed_argname}|") end def set_new_body_expression(transforming_body_expr, corrector) - corrector.replace( - block_node.body.loc.expression, - transforming_body_expr.loc.expression.source - ) + corrector.replace(block_node.body.loc.expression, transforming_body_expr.loc.expression.source) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/migrations_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/migrations_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/migrations_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/target_rails_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/target_rails_version.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/target_rails_version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/target_rails_version.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb new file mode 100644 index 0000000000..92a7af6296 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Using `flash` assignment before `render` in Rails controllers will persist the message for too long. + # Check https://guides.rubyonrails.org/action_controller_overview.html#flash-now + # + # @safety + # This cop's autocorrection is unsafe because it replaces `flash` by `flash.now`. + # Even though it is usually a mistake, it might be used intentionally. + # + # @example + # + # # bad + # class HomeController < ApplicationController + # def create + # flash[:alert] = "msg" + # render :index + # end + # end + # + # # good + # class HomeController < ApplicationController + # def create + # flash.now[:alert] = "msg" + # render :index + # end + # end + # + class ActionControllerFlashBeforeRender < Base + extend AutoCorrector + + MSG = 'Use `flash.now` before `render`.' + + def_node_search :flash_assignment?, <<~PATTERN + ^(send (send nil? :flash) :[]= ...) + PATTERN + + def_node_search :render?, <<~PATTERN + (send nil? :render ...) + PATTERN + + def_node_search :action_controller?, <<~PATTERN + { + (const nil? :ApplicationController) + (const (const nil? :ActionController) :Base) + } + PATTERN + + RESTRICT_ON_SEND = [:flash].freeze + + def on_send(flash_node) + return unless flash_assignment?(flash_node) + + return unless followed_by_render?(flash_node) + + return unless instance_method_or_block?(flash_node) + + return unless inherit_action_controller_base?(flash_node) + + add_offense(flash_node) do |corrector| + corrector.replace(flash_node, 'flash.now') + end + end + + private + + def followed_by_render?(flash_node) + flash_assigment_node = find_ancestor(flash_node, type: :send) + context = flash_assigment_node.parent + + context.each_child_node.any? do |node| + render?(node) + end + end + + def inherit_action_controller_base?(node) + class_node = find_ancestor(node, type: :class) + return unless class_node + + action_controller?(class_node) + end + + def instance_method_or_block?(node) + def_node = find_ancestor(node, type: :def) + block_node = find_ancestor(node, type: :block) + + def_node || block_node + end + + def find_ancestor(node, type:) + node.each_ancestor(type).first + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_controller_test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_test_case.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_controller_test_case.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_test_case.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_filter.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_filter.rb index 83db0ade84..e144568e8a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_filter.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_filter.rb @@ -69,7 +69,7 @@ module RuboCop RESTRICT_ON_SEND = FILTER_METHODS + ACTION_METHODS - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler check_method_node(node.send_node) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_aliases.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_aliases.rb index d48e184723..6f81e3b6d7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_aliases.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_aliases.rb @@ -21,10 +21,7 @@ module RuboCop MSG = 'Use `%s` instead of `%s`.' - ALIASES = { - update_attributes: :update, - update_attributes!: :update! - }.freeze + ALIASES = { update_attributes: :update, update_attributes!: :update! }.freeze RESTRICT_ON_SEND = ALIASES.keys.freeze diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_callbacks_order.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_callbacks_order.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_callbacks_order.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_callbacks_order.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_override.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_override.rb index 16fe42e82d..695643fb57 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_override.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_override.rb @@ -25,12 +25,9 @@ module RuboCop # end # class ActiveRecordOverride < Base - MSG = - 'Use %s callbacks instead of overriding the Active Record ' \ - 'method `%s`.' + MSG = 'Use %s callbacks instead of overriding the Active Record method `%s`.' BAD_METHODS = %i[create destroy save update].freeze - ACTIVE_RECORD_CLASSES = %w[ApplicationRecord ActiveModel::Base - ActiveRecord::Base].freeze + ACTIVE_RECORD_CLASSES = %w[ApplicationRecord ActiveModel::Base ActiveRecord::Base].freeze def on_def(node) return unless BAD_METHODS.include?(node.method_name) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_support_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_support_aliases.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_support_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_support_aliases.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_support_on_load.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_support_on_load.rb new file mode 100644 index 0000000000..1bb9f50d2b --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_support_on_load.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Checks for Rails framework classes that are patched directly instead of using Active Support load hooks. Direct + # patching forcibly loads the framework referenced, using hooks defers loading until it's actually needed. + # + # @safety + # While using lazy load hooks is recommended, it changes the order in which is code is loaded and may reveal + # load order dependency bugs. + # + # @example + # + # # bad + # ActiveRecord::Base.include(MyClass) + # + # # good + # ActiveSupport.on_load(:active_record) { include MyClass } + class ActiveSupportOnLoad < Base + extend AutoCorrector + + MSG = 'Use `%s` instead of `%s`.' + RESTRICT_ON_SEND = %i[prepend include extend].freeze + LOAD_HOOKS = { + 'ActionCable' => 'action_cable', + 'ActionCable::Channel::Base' => 'action_cable_channel', + 'ActionCable::Connection::Base' => 'action_cable_connection', + 'ActionCable::Connection::TestCase' => 'action_cable_connection_test_case', + 'ActionController::API' => 'action_controller', + 'ActionController::Base' => 'action_controller', + 'ActionController::TestCase' => 'action_controller_test_case', + 'ActionDispatch::IntegrationTest' => 'action_dispatch_integration_test', + 'ActionDispatch::Request' => 'action_dispatch_request', + 'ActionDispatch::Response' => 'action_dispatch_response', + 'ActionDispatch::SystemTestCase' => 'action_dispatch_system_test_case', + 'ActionMailbox::Base' => 'action_mailbox', + 'ActionMailbox::InboundEmail' => 'action_mailbox_inbound_email', + 'ActionMailbox::Record' => 'action_mailbox_record', + 'ActionMailbox::TestCase' => 'action_mailbox_test_case', + 'ActionMailer::Base' => 'action_mailer', + 'ActionMailer::TestCase' => 'action_mailer_test_case', + 'ActionText::Content' => 'action_text_content', + 'ActionText::Record' => 'action_text_record', + 'ActionText::RichText' => 'action_text_rich_text', + 'ActionView::Base' => 'action_view', + 'ActionView::TestCase' => 'action_view_test_case', + 'ActiveJob::Base' => 'active_job', + 'ActiveJob::TestCase' => 'active_job_test_case', + 'ActiveRecord::Base' => 'active_record', + 'ActiveStorage::Attachment' => 'active_storage_attachment', + 'ActiveStorage::Blob' => 'active_storage_blob', + 'ActiveStorage::Record' => 'active_storage_record', + 'ActiveStorage::VariantRecord' => 'active_storage_variant_record', + 'ActiveSupport::TestCase' => 'active_support_test_case' + }.freeze + + def on_send(node) + receiver, method, arguments = *node # rubocop:disable InternalAffairs/NodeDestructuring + return unless receiver && (hook = LOAD_HOOKS[receiver.const_name]) + + preferred = "ActiveSupport.on_load(:#{hook}) { #{method} #{arguments.source} }" + add_offense(node, message: format(MSG, prefer: preferred, current: node.source)) do |corrector| + corrector.replace(node, preferred) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/add_column_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/add_column_index.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/add_column_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/add_column_index.rb index 9bc6bb7cd4..96cf6174d1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/add_column_index.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/add_column_index.rb @@ -53,10 +53,7 @@ module RuboCop private def index_range(pair_node) - range_with_surrounding_comma( - range_with_surrounding_space(range: pair_node.loc.expression, side: :left), - :left - ) + range_with_surrounding_comma(range_with_surrounding_space(pair_node.loc.expression, side: :left), :left) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/after_commit_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/after_commit_override.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/after_commit_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/after_commit_override.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_controller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_controller.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_controller.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_controller.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_job.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_job.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_job.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_job.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_mailer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_mailer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_mailer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_mailer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_record.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_record.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_record.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_record.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/arel_star.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/arel_star.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/arel_star.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/arel_star.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/assert_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/assert_not.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/assert_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/assert_not.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/attribute_default_block_value.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/attribute_default_block_value.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/attribute_default_block_value.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/attribute_default_block_value.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/belongs_to.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/belongs_to.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/belongs_to.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/blank.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/blank.rb index d5a0a8fa2c..1c0825a790 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/blank.rb @@ -63,8 +63,7 @@ module RuboCop MSG_NIL_OR_EMPTY = 'Use `%s` instead of `%s`.' MSG_NOT_PRESENT = 'Use `%s` instead of `%s`.' - MSG_UNLESS_PRESENT = 'Use `if %s` instead of ' \ - '`%s`.' + MSG_UNLESS_PRESENT = 'Use `if %s` instead of `%s`.' RESTRICT_ON_SEND = %i[!].freeze # `(send nil $_)` is not actually a valid match for an offense. Nodes diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/bulk_change_table.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/bulk_change_table.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/bulk_change_table.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/bulk_change_table.rb index a9bfb2c9e5..a97f0485a3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/bulk_change_table.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/bulk_change_table.rb @@ -111,25 +111,13 @@ module RuboCop remove_timestamps ].freeze - MYSQL_COMBINABLE_TRANSFORMATIONS = %i[ - rename - index - remove_index - ].freeze + MYSQL_COMBINABLE_TRANSFORMATIONS = %i[rename index remove_index].freeze - MYSQL_COMBINABLE_ALTER_METHODS = %i[ - rename_column - add_index - remove_index - ].freeze + MYSQL_COMBINABLE_ALTER_METHODS = %i[rename_column add_index remove_index].freeze - POSTGRESQL_COMBINABLE_TRANSFORMATIONS = %i[ - change_default - ].freeze + POSTGRESQL_COMBINABLE_TRANSFORMATIONS = %i[change_default].freeze - POSTGRESQL_COMBINABLE_ALTER_METHODS = %i[ - change_column_default - ].freeze + POSTGRESQL_COMBINABLE_ALTER_METHODS = %i[change_column_default].freeze def on_def(node) return unless support_bulk_alter? @@ -186,8 +174,7 @@ module RuboCop options = node.arguments[1] return false unless options - options.hash_type? && - options.keys.any? { |key| key.sym_type? && key.value == :bulk } + options.hash_type? && options.keys.any? { |key| key.sym_type? && key.value == :bulk } end def database @@ -237,8 +224,7 @@ module RuboCop end def call_to_combinable_alter_method?(child_node) - child_node.send_type? && - combinable_alter_methods.include?(child_node.method_name) + child_node.send_type? && combinable_alter_methods.include?(child_node.method_name) end def combinable_alter_methods diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/compact_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/compact_blank.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/compact_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/compact_blank.rb index 8efcf30f1d..fe5e88448f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/compact_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/compact_blank.rb @@ -93,7 +93,11 @@ module RuboCop end def offense_range(node) - end_pos = node.parent&.block_type? ? node.parent.loc.expression.end_pos : node.loc.expression.end_pos + end_pos = if node.parent&.block_type? && node.parent&.send_node == node + node.parent.loc.expression.end_pos + else + node.loc.expression.end_pos + end range_between(node.loc.selector.begin_pos, end_pos) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/content_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/content_tag.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/content_tag.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/content_tag.rb index 2c36621d1c..9cc8dc9d45 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/content_tag.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/content_tag.rb @@ -37,9 +37,7 @@ module RuboCop return if node.arguments.count >= 3 first_argument = node.first_argument - return if !first_argument || - allowed_argument?(first_argument) || - corrected_ancestor?(node) + return if !first_argument || allowed_argument?(first_argument) || corrected_ancestor?(node) preferred_method = node.first_argument.value.to_s.underscore message = format(MSG, preferred_method: preferred_method, current_argument: first_argument.source) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/create_table_with_timestamps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/create_table_with_timestamps.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/date.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/date.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/date.rb index 1515387925..e9de8d44e0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/date.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/date.rb @@ -53,22 +53,17 @@ module RuboCop class Date < Base include ConfigurableEnforcedStyle - MSG = 'Do not use `Date.%s` without zone. Use ' \ - '`Time.zone.%s` instead.' + MSG = 'Do not use `Date.%s` without zone. Use `Time.zone.%s` instead.' - MSG_SEND = 'Do not use `%s` on Date objects, because they ' \ - 'know nothing about the time zone in use.' + MSG_SEND = 'Do not use `%s` on Date objects, because they know nothing about the time zone in use.' RESTRICT_ON_SEND = %i[to_time to_time_in_current_zone].freeze BAD_DAYS = %i[today current yesterday tomorrow].freeze - DEPRECATED_METHODS = [ - { deprecated: 'to_time_in_current_zone', relevant: 'in_time_zone' } - ].freeze + DEPRECATED_METHODS = [{ deprecated: 'to_time_in_current_zone', relevant: 'in_time_zone' }].freeze - DEPRECATED_MSG = '`%s` is deprecated. ' \ - 'Use `%s` instead.' + DEPRECATED_MSG = '`%s` is deprecated. Use `%s` instead.' def on_const(node) mod, klass = *node.children diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/default_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/default_scope.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/default_scope.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/default_scope.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/delegate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/delegate.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/delegate.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/delegate.rb index 7bc8f27c08..2f1c80662b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/delegate.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/delegate.rb @@ -93,15 +93,12 @@ module RuboCop return false if arg_array.size != argument_array.size arg_array.zip(argument_array).all? do |arg, argument| - arg.arg_type? && - argument.lvar_type? && - arg.children == argument.children + arg.arg_type? && argument.lvar_type? && arg.children == argument.children end end def method_name_matches?(method_name, body) - method_name == body.method_name || - (include_prefix_case? && method_name == prefixed_method_name(body)) + method_name == body.method_name || (include_prefix_case? && method_name == prefixed_method_name(body)) end def include_prefix_case? diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/delegate_allow_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/delegate_allow_blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/delegate_allow_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/delegate_allow_blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb similarity index 81% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb index e2c9d79e93..f07dc156f1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb @@ -37,7 +37,8 @@ module RuboCop extend AutoCorrector MSG = 'Avoid manipulating ActiveModel errors as hash directly.' - AUTOCORECTABLE_METHODS = %i[<< clear keys].freeze + AUTOCORRECTABLE_METHODS = %i[<< clear keys].freeze + INCOMPATIBLE_METHODS = %i[keys values to_h to_xml].freeze MANIPULATIVE_METHODS = Set[ *%i[ @@ -55,7 +56,7 @@ module RuboCop { #root_manipulation? #root_assignment? - #errors_keys? + #errors_deprecated? #messages_details_manipulation? #messages_details_assignment? } @@ -77,10 +78,10 @@ module RuboCop ...) PATTERN - def_node_matcher :errors_keys?, <<~PATTERN + def_node_matcher :errors_deprecated?, <<~PATTERN (send (send #receiver_matcher :errors) - :keys) + {:keys :values :to_h :to_xml}) PATTERN def_node_matcher :messages_details_manipulation?, <<~PATTERN @@ -106,10 +107,10 @@ module RuboCop def on_send(node) any_manipulation?(node) do - next if node.method?(:keys) && target_rails_version <= 6.0 + next if target_rails_version <= 6.0 && INCOMPATIBLE_METHODS.include?(node.method_name) add_offense(node) do |corrector| - next unless AUTOCORECTABLE_METHODS.include?(node.method_name) + next if skip_autocorrect?(node) autocorrect(corrector, node) end @@ -118,14 +119,16 @@ module RuboCop private + def skip_autocorrect?(node) + return true unless AUTOCORRECTABLE_METHODS.include?(node.method_name) + return false unless (receiver = node.receiver.receiver) + + receiver.send_type? && receiver.method?(:details) && node.method?(:<<) + end + def autocorrect(corrector, node) receiver = node.receiver - if receiver.receiver.send_type? && receiver.receiver.method?(:messages) - corrector.remove(receiver.receiver.loc.dot) - corrector.remove(receiver.receiver.loc.selector) - end - range = offense_range(node, receiver) replacement = replacement(node, receiver) @@ -133,11 +136,12 @@ module RuboCop end def offense_range(node, receiver) - range_between(receiver.receiver.source_range.end_pos, node.source_range.end_pos) + receiver = receiver.receiver while receiver.send_type? && !receiver.method?(:errors) && receiver.receiver + range_between(receiver.source_range.end_pos, node.source_range.end_pos) end def replacement(node, receiver) - return '.errors.attribute_names' if node.method?(:keys) + return '.attribute_names' if node.method?(:keys) key = receiver.first_argument.source diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dot_separated_keys.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dot_separated_keys.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dot_separated_keys.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dot_separated_keys.rb index 29d9ece7b9..73d8da171c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dot_separated_keys.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dot_separated_keys.rb @@ -37,7 +37,7 @@ module RuboCop add_offense(scope_node) do |corrector| # Eat the comma on the left. - range = range_with_surrounding_space(range: scope_node.source_range, side: :left) + range = range_with_surrounding_space(scope_node.source_range, side: :left) range = range_with_surrounding_comma(range, :left) corrector.remove(range) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duplicate_association.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duplicate_association.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duplicate_association.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duplicate_association.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duplicate_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duplicate_scope.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duplicate_scope.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duplicate_scope.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duration_arithmetic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duration_arithmetic.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duration_arithmetic.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duration_arithmetic.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dynamic_find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dynamic_find_by.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dynamic_find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dynamic_find_by.rb index b3a8750353..654586e947 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dynamic_find_by.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dynamic_find_by.rb @@ -70,8 +70,7 @@ module RuboCop end def allowed_invocation?(node) - allowed_method?(node) || allowed_receiver?(node) || - whitelisted?(node) + allowed_method?(node) || allowed_receiver?(node) || whitelisted?(node) end def allowed_method?(node) @@ -95,8 +94,7 @@ module RuboCop end def autocorrect_method_name(corrector, node) - corrector.replace(node.loc.selector, - static_method_name(node.method_name.to_s)) + corrector.replace(node.loc.selector, static_method_name(node.method_name.to_s)) end def autocorrect_argument_keywords(corrector, node, keywords) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/eager_evaluation_log_message.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/eager_evaluation_log_message.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_uniqueness.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_uniqueness.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_uniqueness.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_uniqueness.rb index e01ff831f8..dfb49502d1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_uniqueness.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_uniqueness.rb @@ -20,8 +20,7 @@ module RuboCop class EnumUniqueness < Base include Duplication - MSG = 'Duplicate value `%s` found in `%s` ' \ - 'enum declaration.' + MSG = 'Duplicate value `%s` found in `%s` enum declaration.' RESTRICT_ON_SEND = %i[enum].freeze def_node_matcher :enum?, <<~PATTERN @@ -41,9 +40,7 @@ module RuboCop next unless duplicates?(items) consecutive_duplicates(items).each do |item| - add_offense(item, message: format( - MSG, value: item.source, enum: enum_name(key) - )) + add_offense(item, message: format(MSG, value: item.source, enum: enum_name(key))) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/environment_comparison.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/environment_comparison.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/environment_comparison.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/environment_comparison.rb index c5a25465bf..1e1c5261aa 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/environment_comparison.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/environment_comparison.rb @@ -96,8 +96,7 @@ module RuboCop end def rails_env_on_lhs?(node) - comparing_str_env_with_rails_env_on_lhs?(node) || - comparing_sym_env_with_rails_env_on_lhs?(node) + comparing_str_env_with_rails_env_on_lhs?(node) || comparing_sym_env_with_rails_env_on_lhs?(node) end def build_predicate_method_for_rails_env_on_lhs(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/environment_variable_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/environment_variable_access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/environment_variable_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/environment_variable_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/exit.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/exit.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/exit.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/exit.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/expanded_date_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/expanded_date_range.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/expanded_date_range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/expanded_date_range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/file_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/file_path.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/file_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/file_path.rb index bde2094342..80b9e49a6c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/file_path.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/file_path.rb @@ -50,8 +50,7 @@ module RuboCop return unless node.children.last.str_type? last_child_source = node.children.last.source - return unless last_child_source.start_with?('.') || - last_child_source.include?(File::SEPARATOR) + return unless last_child_source.start_with?('.') || last_child_source.include?(File::SEPARATOR) return if last_child_source.start_with?(':') register_offense(node) @@ -97,8 +96,7 @@ module RuboCop def register_offense(node) line_range = node.loc.column...node.loc.last_column - source_range = source_range(processed_source.buffer, node.first_line, - line_range) + source_range = source_range(processed_source.buffer, node.first_line, line_range) add_offense(source_range) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_by.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_by_id.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_by_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_each.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_each.rb index 73eb23fc45..4857c13891 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_each.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_each.rb @@ -13,11 +13,17 @@ module RuboCop # # good # User.all.find_each # - # @example IgnoredMethods: ['order'] + # @example AllowedMethods: ['order'] + # # good + # User.order(:foo).each + # + # @example AllowedPattern: [/order/] # # good # User.order(:foo).each class FindEach < Base include ActiveRecordHelper + include AllowedMethods + include AllowedPattern extend AutoCorrector MSG = 'Use `find_each` instead of `each`.' @@ -47,7 +53,7 @@ module RuboCop method_chain = node.each_node(:send).map(&:method_name) - (cop_config['IgnoredMethods'].map(&:to_sym) & method_chain).any? + method_chain.any? { |method_name| allowed_method?(method_name) || matches_allowed_pattern?(method_name) } end def active_model_error_where?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/freeze_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/freeze_time.rb new file mode 100644 index 0000000000..21d2748544 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/freeze_time.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Identifies usages of `travel_to` with an argument of the current time and + # change them to use `freeze_time` instead. + # + # @safety + # This cop’s autocorrection is unsafe because `freeze_time` just delegates to + # `travel_to` with a default `Time.now`, it is not strictly equivalent to `Time.now` + # if the argument of `travel_to` is the current time considering time zone. + # + # @example + # # bad + # travel_to(Time.now) + # travel_to(Time.new) + # travel_to(DateTime.now) + # travel_to(Time.current) + # travel_to(Time.zone.now) + # travel_to(Time.now.in_time_zone) + # travel_to(Time.current.to_time) + # + # # good + # freeze_time + # + class FreezeTime < Base + extend AutoCorrector + + MSG = 'Use `freeze_time` instead of `travel_to`.' + NOW_METHODS = %i[now new current].freeze + CONV_METHODS = %i[to_time in_time_zone].freeze + RESTRICT_ON_SEND = %i[travel_to].freeze + + # @!method time_now?(node) + def_node_matcher :time_now?, <<~PATTERN + (const nil? {:Time :DateTime}) + PATTERN + + # @!method zoned_time_now?(node) + def_node_matcher :zoned_time_now?, <<~PATTERN + (send (const nil? :Time) :zone) + PATTERN + + def on_send(node) + child_node, method_name = *node.first_argument.children + return unless current_time?(child_node, method_name) || current_time_with_convert?(child_node, method_name) + + add_offense(node) { |corrector| corrector.replace(node, 'freeze_time') } + end + + private + + def current_time?(node, method_name) + return false unless NOW_METHODS.include?(method_name) + + node.send_type? ? zoned_time_now?(node) : time_now?(node) + end + + def current_time_with_convert?(node, method_name) + return false unless CONV_METHODS.include?(method_name) + + child_node, child_method_name = *node.children + current_time?(child_node, child_method_name) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/has_and_belongs_to_many.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/has_and_belongs_to_many.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/has_and_belongs_to_many.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/has_and_belongs_to_many.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb index e8f4e69cc3..df752f52b1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb @@ -105,9 +105,7 @@ module RuboCop return false unless node.parent - return true if contain_valid_options_in_with_options_block?( - node.parent.parent - ) + return true if contain_valid_options_in_with_options_block?(node.parent.parent) end false diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/helper_instance_variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/helper_instance_variable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/helper_instance_variable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/helper_instance_variable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_positional_arguments.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_positional_arguments.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_positional_arguments.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_positional_arguments.rb index bb0f214eae..361e5e5b2c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_positional_arguments.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_positional_arguments.rb @@ -22,11 +22,8 @@ module RuboCop extend AutoCorrector extend TargetRailsVersion - MSG = 'Use keyword arguments instead of ' \ - 'positional arguments for http call: `%s`.' - KEYWORD_ARGS = %i[ - method params session body flash xhr as headers env to - ].freeze + MSG = 'Use keyword arguments instead of positional arguments for http call: `%s`.' + KEYWORD_ARGS = %i[method params session body flash xhr as headers env to].freeze ROUTING_METHODS = %i[draw routes].freeze RESTRICT_ON_SEND = %i[get post put patch delete head].freeze @@ -75,8 +72,7 @@ module RuboCop return false if kwsplat_hash?(data) data.each_pair.none? do |pair| - special_keyword_arg?(pair.key) || - (format_arg?(pair.key) && data.pairs.one?) + special_keyword_arg?(pair.key) || (format_arg?(pair.key) && data.pairs.one?) end end @@ -98,8 +94,7 @@ module RuboCop return '' if data.hash_type? && data.empty? hash_data = if data.hash_type? - format('{ %s }', - data: data.pairs.map(&:source).join(', ')) + format('{ %s }', data: data.pairs.map(&:source).join(', ')) else # user supplies an object, # no need to surround with braces diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_status.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_status.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_status.rb index adc4047a8c..b80498c27e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_status.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_status.rb @@ -84,10 +84,8 @@ module RuboCop # :nodoc: class SymbolicStyleChecker - MSG = 'Prefer `%s` over `%s` ' \ - 'to define HTTP status code.' - DEFAULT_MSG = 'Prefer `symbolic` over `numeric` ' \ - 'to define HTTP status code.' + MSG = 'Prefer `%s` over `%s` to define HTTP status code.' + DEFAULT_MSG = 'Prefer `symbolic` over `numeric` to define HTTP status code.' attr_reader :node @@ -118,17 +116,14 @@ module RuboCop end def custom_http_status_code? - node.int_type? && - !::Rack::Utils::SYMBOL_TO_STATUS_CODE.value?(number) + node.int_type? && !::Rack::Utils::SYMBOL_TO_STATUS_CODE.value?(number) end end # :nodoc: class NumericStyleChecker - MSG = 'Prefer `%s` over `%s` ' \ - 'to define HTTP status code.' - DEFAULT_MSG = 'Prefer `numeric` over `symbolic` ' \ - 'to define HTTP status code.' + MSG = 'Prefer `%s` over `%s` to define HTTP status code.' + DEFAULT_MSG = 'Prefer `numeric` over `symbolic` to define HTTP status code.' PERMITTED_STATUS = %i[error success missing redirect].freeze attr_reader :node diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/i18n_lazy_lookup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/i18n_lazy_lookup.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/i18n_lazy_lookup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/i18n_lazy_lookup.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/i18n_locale_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/i18n_locale_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/i18n_locale_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/i18n_locale_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/i18n_locale_texts.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/i18n_locale_texts.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/i18n_locale_texts.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/i18n_locale_texts.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb index 57a2ca9847..de824f54f1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb @@ -42,12 +42,7 @@ module RuboCop `%s` option will be ignored when `%s` and `%s` are used together. MSG - RESTRICT_ON_SEND = %i[ - skip_after_action - skip_around_action - skip_before_action - skip_action_callback - ].freeze + RESTRICT_ON_SEND = %i[skip_after_action skip_around_action skip_before_action skip_action_callback].freeze FILTERS = RESTRICT_ON_SEND.map { |method_name| ":#{method_name}" } @@ -67,11 +62,9 @@ module RuboCop options = options_hash(options) if if_and_only?(options) - add_offense(options[:if], - message: format(MSG, prefer: :only, ignore: :if)) + add_offense(options[:if], message: format(MSG, prefer: :only, ignore: :if)) elsif if_and_except?(options) - add_offense(options[:except], - message: format(MSG, prefer: :if, ignore: :except)) + add_offense(options[:except], message: format(MSG, prefer: :if, ignore: :except)) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/index_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/index_by.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/index_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/index_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/index_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/index_with.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/index_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/index_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inverse_of.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inverse_of.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inverse_of.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inverse_of.rb index e80351a7de..b2db3d0f1c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inverse_of.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inverse_of.rb @@ -192,8 +192,7 @@ module RuboCop end return if options_ignoring_inverse_of?(options) - return unless scope?(arguments) || - options_requiring_inverse_of?(options) + return unless scope?(arguments) || options_requiring_inverse_of?(options) return if options_contain_inverse_of?(options) @@ -206,8 +205,7 @@ module RuboCop def options_requiring_inverse_of?(options) required = options.any? do |opt| - conditions_option?(opt) || - foreign_key_option?(opt) + conditions_option?(opt) || foreign_key_option?(opt) end return required if target_rails_version >= 5.2 @@ -227,8 +225,7 @@ module RuboCop def with_options_arguments(recv, node) blocks = node.each_ancestor(:block).select do |block| - block.send_node.command?(:with_options) && - same_context_in_with_options?(block.arguments.first, recv) + block.send_node.command?(:with_options) && same_context_in_with_options?(block.arguments.first, recv) end blocks.flat_map { |n| n.send_node.arguments } end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb index 3b96591f88..25cb6e2ffa 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb @@ -184,13 +184,9 @@ module RuboCop # @return [String] def message(methods, parent) if methods.size == 1 - format(MSG, - action: "`#{methods[0]}` is", - type: parent.type) + format(MSG, action: "`#{methods[0]}` is", type: parent.type) else - format(MSG, - action: "`#{methods.join('`, `')}` are", - type: parent.type) + format(MSG, action: "`#{methods.join('`, `')}` are", type: parent.type) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/link_to_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/link_to_blank.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/link_to_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/link_to_blank.rb index a0c2899f99..32811e7952 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/link_to_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/link_to_blank.rb @@ -68,10 +68,7 @@ module RuboCop def append_to_rel(rel_node, corrector) existing_rel = rel_node.children.last.value - str_range = rel_node.children.last.loc.expression.adjust( - begin_pos: 1, - end_pos: -1 - ) + str_range = rel_node.children.last.loc.expression.adjust(begin_pos: 1, end_pos: -1) corrector.replace(str_range, "#{existing_rel} noopener") end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/mailer_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/mailer_name.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/mailer_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/mailer_name.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/match_route.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/match_route.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/match_route.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/match_route.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/migration_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/migration_class_name.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/migration_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/migration_class_name.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/negate_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/negate_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/negate_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/negate_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/not_null_column.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/not_null_column.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/not_null_column.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/not_null_column.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/order_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/order_by_id.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/order_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/order_by_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output.rb index 655cef658e..9f87c9a7a8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output.rb @@ -21,11 +21,8 @@ module RuboCop include RangeHelp extend AutoCorrector - MSG = 'Do not write to stdout. ' \ - "Use Rails's logger if you want to log." - RESTRICT_ON_SEND = %i[ - ap p pp pretty_print print puts binwrite syswrite write write_nonblock - ].freeze + MSG = "Do not write to stdout. Use Rails's logger if you want to log." + RESTRICT_ON_SEND = %i[ap p pp pretty_print print puts binwrite syswrite write write_nonblock].freeze def_node_matcher :output?, <<~PATTERN (send nil? {:ap :p :pp :pretty_print :print :puts} ...) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output_safety.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output_safety.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output_safety.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pick.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pick.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pick.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pick.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck_id.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck_in_where.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck_in_where.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck_in_where.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck_in_where.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluralization_grammar.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluralization_grammar.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluralization_grammar.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluralization_grammar.rb index 24f6f1e660..ef62d15c8c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluralization_grammar.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluralization_grammar.rb @@ -94,8 +94,7 @@ module RuboCop end def duration_method?(method_name) - SINGULAR_DURATION_METHODS.key?(method_name) || - PLURAL_DURATION_METHODS.key?(method_name) + SINGULAR_DURATION_METHODS.key?(method_name) || PLURAL_DURATION_METHODS.key?(method_name) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/presence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/presence.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/presence.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/presence.rb index 2fbba874c1..f9313ef75a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/presence.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/presence.rb @@ -106,9 +106,7 @@ module RuboCop end def message(node, receiver, other) - format(MSG, - prefer: replacement(receiver, other), - current: node.source) + format(MSG, prefer: replacement(receiver, other), current: node.source) end def replacement(receiver, other) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/present.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/present.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/present.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/present.rb index 55b5bd923e..0eccfca32f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/present.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/present.rb @@ -47,10 +47,8 @@ module RuboCop extend AutoCorrector MSG_NOT_BLANK = 'Use `%s` instead of `%s`.' - MSG_EXISTS_AND_NOT_EMPTY = 'Use `%s` instead of ' \ - '`%s`.' - MSG_UNLESS_BLANK = 'Use `if %s` instead of ' \ - '`%s`.' + MSG_EXISTS_AND_NOT_EMPTY = 'Use `%s` instead of `%s`.' + MSG_UNLESS_BLANK = 'Use `if %s` instead of `%s`.' RESTRICT_ON_SEND = %i[!].freeze def_node_matcher :exists_and_not_empty?, <<~PATTERN @@ -118,8 +116,7 @@ module RuboCop unless_blank?(node) do |method_call, receiver| range = unless_condition(node, method_call) - msg = format(MSG_UNLESS_BLANK, prefer: replacement(receiver), - current: range.source) + msg = format(MSG_UNLESS_BLANK, prefer: replacement(receiver), current: range.source) add_offense(range, message: msg) do |corrector| autocorrect(corrector, node) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/rake_environment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/rake_environment.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/rake_environment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/rake_environment.rb index fdb6f76924..8772b2682c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/rake_environment.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/rake_environment.rb @@ -39,7 +39,7 @@ module RuboCop (block $(send nil? :task ...) ...) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler task_definition?(node) do |task_method| return if task_name(task_method) == :default return if with_dependencies?(task_method) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/read_write_attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/read_write_attribute.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/read_write_attribute.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/read_write_attribute.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_allow_nil.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_allow_nil.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_allow_nil.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_allow_nil.rb index 9fb17bdf73..b1dccd1335 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_allow_nil.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_allow_nil.rb @@ -30,11 +30,9 @@ module RuboCop include RangeHelp extend AutoCorrector - MSG_SAME = - '`allow_nil` is redundant when `allow_blank` has the same value.' + MSG_SAME = '`allow_nil` is redundant when `allow_blank` has the same value.' - MSG_ALLOW_NIL_FALSE = - '`allow_nil: false` is redundant when `allow_blank` is true.' + MSG_ALLOW_NIL_FALSE = '`allow_nil: false` is redundant when `allow_blank` is true.' RESTRICT_ON_SEND = %i[validates].freeze diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_foreign_key.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_foreign_key.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_foreign_key.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_foreign_key.rb index e32d207aa1..21ccc18f4d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_foreign_key.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_foreign_key.rb @@ -41,7 +41,7 @@ module RuboCop association_with_foreign_key(node) do |type, name, options, foreign_key_pair, foreign_key| if redundant?(node, type, name, options, foreign_key) add_offense(foreign_key_pair.loc.expression) do |corrector| - range = range_with_surrounding_space(range: foreign_key_pair.source_range, side: :left) + range = range_with_surrounding_space(foreign_key_pair.source_range, side: :left) range = range_with_surrounding_comma(range, :left) corrector.remove(range) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb index d9a877abc9..ac48407a6e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb @@ -217,7 +217,7 @@ module RuboCop keys.each do |key| key_node = node.arguments.find { |arg| arg.value == key } key_range = range_with_surrounding_space( - range: range_with_surrounding_comma(key_node.source_range, :right), + range_with_surrounding_comma(key_node.source_range, :right), side: :right ) corrector.remove(key_range) @@ -226,7 +226,7 @@ module RuboCop def remove_presence_option(corrector, presence) range = range_with_surrounding_comma( - range_with_surrounding_space(range: presence.source_range, side: :left), + range_with_surrounding_space(presence.source_range, side: :left), :left ) corrector.remove(range) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb index f289e76217..6a6b1e4827 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb @@ -60,15 +60,6 @@ module RuboCop MSG = 'Redundant receiver in `with_options`.' - def_node_matcher :with_options?, <<~PATTERN - (block - (send nil? :with_options - (...)) - (args - $_arg) - $_body) - PATTERN - def_node_search :all_block_nodes_in, <<~PATTERN (block ...) PATTERN @@ -78,29 +69,40 @@ module RuboCop PATTERN def on_block(node) - with_options?(node) do |arg, body| - return if body.nil? - return unless all_block_nodes_in(body).count.zero? + return unless node.method?(:with_options) + return unless (body = node.body) + return unless all_block_nodes_in(body).count.zero? - send_nodes = all_send_nodes_in(body) + send_nodes = all_send_nodes_in(body) + return unless redundant_receiver?(send_nodes, node) - if send_nodes.all? { |n| same_value?(arg, n.receiver) } - send_nodes.each do |send_node| - receiver = send_node.receiver - add_offense(receiver.source_range) do |corrector| - autocorrect(corrector, send_node) - end - end + send_nodes.each do |send_node| + receiver = send_node.receiver + add_offense(receiver.source_range) do |corrector| + autocorrect(corrector, send_node, node) end end end + alias on_numblock on_block + private - def autocorrect(corrector, node) - corrector.remove(node.receiver.source_range) - corrector.remove(node.loc.dot) - corrector.remove(block_argument_range(node)) + def autocorrect(corrector, send_node, node) + corrector.remove(send_node.receiver.source_range) + corrector.remove(send_node.loc.dot) + corrector.remove(block_argument_range(send_node)) unless node.numblock_type? + end + + def redundant_receiver?(send_nodes, node) + proc = if node.numblock_type? + ->(n) { n.receiver.lvar_type? && n.receiver.source == '_1' } + else + arg = node.arguments.first + ->(n) { same_value?(arg, n.receiver) } + end + + send_nodes.all?(&proc) end def block_argument_range(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_travel_back.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_travel_back.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_travel_back.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_travel_back.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reflection_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reflection_class_name.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reflection_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reflection_class_name.rb index 2de89b84ac..ff2f3eb283 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reflection_class_name.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reflection_class_name.rb @@ -34,12 +34,29 @@ module RuboCop def on_send(node) association_with_reflection(node) do |reflection_class_name| + return if reflection_class_name.value.send_type? && reflection_class_name.value.receiver.nil? + return if reflection_class_name.value.lvar_type? && str_assigned?(reflection_class_name) + add_offense(reflection_class_name.loc.expression) end end private + def str_assigned?(reflection_class_name) + lvar = reflection_class_name.value.source + + reflection_class_name.ancestors.each do |nodes| + return true if nodes.each_child_node(:lvasgn).detect do |node| + lhs, rhs = *node + + lhs.to_s == lvar && ALLOWED_REFLECTION_CLASS_TYPES.include?(rhs.type) + end + end + + false + end + def reflection_class_value?(class_value) if class_value.send_type? !class_value.method?(:to_s) || class_value.receiver&.const_type? diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/refute_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/refute_methods.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/refute_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/refute_methods.rb index eb86dee436..e141b24ea6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/refute_methods.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/refute_methods.rb @@ -81,11 +81,7 @@ module RuboCop end def offense_message(method_name) - format( - MSG, - bad_method: method_name, - good_method: convert_good_method(method_name) - ) + format(MSG, bad_method: method_name, good_method: convert_good_method(method_name)) end def convert_good_method(bad_method) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/relative_date_constant.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/relative_date_constant.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/relative_date_constant.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/relative_date_constant.rb index ac57ef0350..92fd50d0b6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/relative_date_constant.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/relative_date_constant.rb @@ -34,8 +34,7 @@ module RuboCop include RangeHelp extend AutoCorrector - MSG = 'Do not assign `%s` to constants as it ' \ - 'will be evaluated only once.' + MSG = 'Do not assign `%s` to constants as it will be evaluated only once.' RELATIVE_DATE_METHODS = %i[since from_now after ago until before yesterday tomorrow].to_set.freeze def on_casgn(node) @@ -77,9 +76,7 @@ module RuboCop return unless scope.nil? indent = ' ' * node.loc.column - new_code = ["def self.#{const_name.downcase}", - "#{indent}#{value.source}", - 'end'].join("\n#{indent}") + new_code = ["def self.#{const_name.downcase}", "#{indent}#{value.source}", 'end'].join("\n#{indent}") corrector.replace(node.source_range, new_code) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/render_inline.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/render_inline.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/render_inline.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/render_inline.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/render_plain_text.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/render_plain_text.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/render_plain_text.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/render_plain_text.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/request_referer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/request_referer.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/request_referer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/request_referer.rb index 4ad0f3a237..38a68d8099 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/request_referer.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/request_referer.rb @@ -23,8 +23,7 @@ module RuboCop include ConfigurableEnforcedStyle extend AutoCorrector - MSG = 'Use `request.%s` instead of ' \ - '`request.%s`.' + MSG = 'Use `request.%s` instead of `request.%s`.' RESTRICT_ON_SEND = %i[referer referrer].freeze def_node_matcher :referer?, <<~PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/require_dependency.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/require_dependency.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/require_dependency.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/require_dependency.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration.rb index ceb9940379..5af544b000 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration.rb @@ -229,6 +229,8 @@ module RuboCop check_change_table_node(node.send_node, node.body) end + alias on_numblock on_block + private def check_irreversible_schema_statement_node(node) @@ -240,10 +242,7 @@ module RuboCop def check_drop_table_node(node) drop_table_call(node) do unless node.parent.block_type? || node.last_argument.block_pass_type? - add_offense( - node, - message: format(MSG, action: 'drop_table(without block)') - ) + add_offense(node, message: format(MSG, action: 'drop_table(without block)')) end end end @@ -251,22 +250,12 @@ module RuboCop def check_reversible_hash_node(node) return if reversible_change_table_call?(node) - add_offense( - node, - message: format( - MSG, action: "#{node.method_name}(without :from and :to)" - ) - ) + add_offense(node, message: format(MSG, action: "#{node.method_name}(without :from and :to)")) end def check_remove_column_node(node) remove_column_call(node) do |args| - if args.to_a.size < 3 - add_offense( - node, - message: format(MSG, action: 'remove_column(without type)') - ) - end + add_offense(node, message: format(MSG, action: 'remove_column(without type)')) if args.to_a.size < 3 end end @@ -295,10 +284,7 @@ module RuboCop unless all_hash_key?(args, :type) && target_rails_version >= 6.1 action = target_rails_version >= 6.1 ? 'remove_columns(without type)' : 'remove_columns' - add_offense( - node, - message: format(MSG, action: action) - ) + add_offense(node, message: format(MSG, action: action)) end end end @@ -306,18 +292,14 @@ module RuboCop def check_remove_index_node(node) remove_index_call(node) do |args| if args.hash_type? && !all_hash_key?(args, :column) - add_offense( - node, - message: format(MSG, action: 'remove_index(without column)') - ) + add_offense(node, message: format(MSG, action: 'remove_index(without column)')) end end end def check_change_table_offense(receiver, node) method_name = node.method_name - return if receiver != node.receiver && - reversible_change_table_call?(node) + return if receiver != node.receiver && reversible_change_table_call?(node) action = if method_name == :remove target_rails_version >= 6.1 ? 't.remove (without type)' : 't.remove' @@ -325,10 +307,7 @@ module RuboCop "change_table(with #{method_name})" end - add_offense( - node, - message: format(MSG, action: action) - ) + add_offense(node, message: format(MSG, action: action)) end def reversible_change_table_call?(node) @@ -353,9 +332,7 @@ module RuboCop def within_reversible_or_up_only_block?(node) node.each_ancestor(:block).any? do |ancestor| - (ancestor.block_type? && - ancestor.send_node.method?(:reversible)) || - ancestor.send_node.method?(:up_only) + (ancestor.block_type? && ancestor.send_node.method?(:reversible)) || ancestor.send_node.method?(:up_only) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration_method_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration_method_definition.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb index acc506cadf..fbf2b1d87d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration_method_definition.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb @@ -45,8 +45,7 @@ module RuboCop class ReversibleMigrationMethodDefinition < Base include MigrationsHelper - MSG = 'Migrations must contain either a `change` method, or ' \ - 'both an `up` and a `down` method.' + MSG = 'Migrations must contain either a `change` method, or both an `up` and a `down` method.' def_node_matcher :change_method?, <<~PATTERN `(def :change (args) _) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/root_join_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_join_chain.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/root_join_chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_join_chain.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_pathname_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_pathname_methods.rb new file mode 100644 index 0000000000..5509d5eefd --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_pathname_methods.rb @@ -0,0 +1,175 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Use `Rails.root` IO methods instead of passing it to `File`. + # + # `Rails.root` is an instance of `Pathname` + # so we can apply many IO methods directly. + # + # This cop works best when used together with + # `Style/FileRead`, `Style/FileWrite` and `Rails/RootJoinChain`. + # + # @example + # # bad + # File.open(Rails.root.join('db', 'schema.rb')) + # File.open(Rails.root.join('db', 'schema.rb'), 'w') + # File.read(Rails.root.join('db', 'schema.rb')) + # File.binread(Rails.root.join('db', 'schema.rb')) + # File.write(Rails.root.join('db', 'schema.rb'), content) + # File.binwrite(Rails.root.join('db', 'schema.rb'), content) + # + # # good + # Rails.root.join('db', 'schema.rb').open + # Rails.root.join('db', 'schema.rb').open('w') + # Rails.root.join('db', 'schema.rb').read + # Rails.root.join('db', 'schema.rb').binread + # Rails.root.join('db', 'schema.rb').write(content) + # Rails.root.join('db', 'schema.rb').binwrite(content) + # + class RootPathnameMethods < Base + extend AutoCorrector + + MSG = '`%s` is a `Pathname` so you can just append `#%s`.' + + DIR_METHODS = %i[children delete each_child empty? entries exist? glob mkdir open rmdir unlink].to_set.freeze + + FILE_METHODS = %i[ + atime + basename + binread + binwrite + birthtime + blockdev? + chardev? + chmod + chown + ctime + delete + directory? + dirname + empty? + executable? + executable_real? + exist? + expand_path + extname + file? + fnmatch + fnmatch? + ftype + grpowned? + join + lchmod + lchown + lstat + mtime + open + owned? + pipe? + read + readable? + readable_real? + readlines + readlink + realdirpath + realpath + rename + setgid? + setuid? + size + size? + socket? + split + stat + sticky? + symlink? + sysopen + truncate + unlink + utime + world_readable? + world_writable? + writable? + writable_real? + write + zero? + ].to_set.freeze + + FILE_TEST_METHODS = %i[ + blockdev? + chardev? + directory? + empty? + executable? + executable_real? + exist? + file? + grpowned? + owned? + pipe? + readable? + readable_real? + setgid? + setuid? + size + size? + socket? + sticky? + symlink? + world_readable? + world_writable? + writable? + writable_real? + zero? + ].to_set.freeze + + FILE_UTILS_METHODS = %i[chmod chown mkdir mkpath rmdir rmtree].to_set.freeze + + RESTRICT_ON_SEND = (DIR_METHODS + FILE_METHODS + FILE_TEST_METHODS + FILE_UTILS_METHODS).to_set.freeze + + def_node_matcher :pathname_method, <<~PATTERN + { + (send (const {nil? cbase} :Dir) $DIR_METHODS $_ $...) + (send (const {nil? cbase} {:IO :File}) $FILE_METHODS $_ $...) + (send (const {nil? cbase} :FileTest) $FILE_TEST_METHODS $_ $...) + (send (const {nil? cbase} :FileUtils) $FILE_UTILS_METHODS $_ $...) + } + PATTERN + + def_node_matcher :rails_root_pathname?, <<~PATTERN + { + $#rails_root? + (send $#rails_root? :join ...) + } + PATTERN + + # @!method rails_root?(node) + def_node_matcher :rails_root?, <<~PATTERN + (send (const {nil? cbase} :Rails) {:root :public_path}) + PATTERN + + def on_send(node) + evidence(node) do |method, path, args, rails_root| + add_offense(node, message: format(MSG, method: method, rails_root: rails_root.source)) do |corrector| + replacement = "#{path.source}.#{method}" + replacement += "(#{args.map(&:source).join(', ')})" unless args.empty? + + corrector.replace(node, replacement) + end + end + end + + private + + def evidence(node) + return if node.method?(:open) && node.parent&.send_type? + return unless (method, path, args = pathname_method(node)) && (rails_root = rails_root_pathname?(path)) + + yield(method, path, args, rails_root) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/root_public_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_public_path.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/root_public_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_public_path.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation_with_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation_with_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb index 37cb73474e..c19cd8180e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation_with_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb @@ -31,9 +31,7 @@ module RuboCop class SafeNavigationWithBlank < Base extend AutoCorrector - MSG = - 'Avoid calling `blank?` with the safe navigation operator ' \ - 'in conditionals.' + MSG = 'Avoid calling `blank?` with the safe navigation operator in conditionals.' def_node_matcher :safe_navigation_blank_in_conditional?, <<~PATTERN (if $(csend ... :blank?) ...) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/save_bang.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/save_bang.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/save_bang.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/save_bang.rb index da2b0cc7bd..cd0f6288e7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/save_bang.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/save_bang.rb @@ -121,18 +121,12 @@ module RuboCop include NegativeConditional extend AutoCorrector - MSG = 'Use `%s` instead of `%s` if the return ' \ - 'value is not checked.' - CREATE_MSG = (MSG + - ' Or check `persisted?` on model returned from ' \ - '`%s`.').freeze - CREATE_CONDITIONAL_MSG = '`%s` returns a model which is ' \ - 'always truthy.' + MSG = 'Use `%s` instead of `%s` if the return value is not checked.' + CREATE_MSG = "#{MSG} Or check `persisted?` on model returned from `%s`." + CREATE_CONDITIONAL_MSG = '`%s` returns a model which is always truthy.' - CREATE_PERSIST_METHODS = %i[create create_or_find_by - first_or_create find_or_create_by].freeze - MODIFY_PERSIST_METHODS = %i[save - update update_attributes destroy].freeze + CREATE_PERSIST_METHODS = %i[create create_or_find_by first_or_create find_or_create_by].freeze + MODIFY_PERSIST_METHODS = %i[save update update_attributes destroy].freeze RESTRICT_ON_SEND = (CREATE_PERSIST_METHODS + MODIFY_PERSIST_METHODS).freeze def self.joining_forces @@ -244,8 +238,7 @@ module RuboCop parent = node.parent return false unless parent - operator_or_single_negative?(parent) || - (conditional?(parent) && node == parent.condition) + operator_or_single_negative?(parent) || (conditional?(parent) && node == parent.condition) end def operator_or_single_negative?(node) @@ -294,9 +287,7 @@ module RuboCop # NameSpace::Const != ::Const # Const != NameSpace::Const def const_matches?(const, allowed_const) - parts = allowed_const.split('::').reverse.zip( - const.split('::').reverse - ) + parts = allowed_const.split('::').reverse.zip(const.split('::').reverse) parts.all? do |(allowed_part, const_part)| allowed_part == const_part.to_s end @@ -335,9 +326,7 @@ module RuboCop end def persist_method?(node, methods = RESTRICT_ON_SEND) - methods.include?(node.method_name) && - expected_signature?(node) && - !allowed_receiver?(node) + methods.include?(node.method_name) && expected_signature?(node) && !allowed_receiver?(node) end # Check argument signature as no arguments or one hash @@ -345,8 +334,7 @@ module RuboCop !node.arguments? || (node.arguments.one? && node.method_name != :destroy && - (node.first_argument.hash_type? || - !node.first_argument.literal?)) + (node.first_argument.hash_type? || !node.first_argument.literal?)) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/schema_comment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/schema_comment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/schema_comment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/schema_comment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/scope_args.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/scope_args.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/scope_args.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/scope_args.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/short_i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/short_i18n.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/short_i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/short_i18n.rb index 82152a1580..35e02faf2d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/short_i18n.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/short_i18n.rb @@ -44,10 +44,7 @@ module RuboCop MSG = 'Use `%s` instead of `%s`.' - PREFERRED_METHODS = { - translate: :t, - localize: :l - }.freeze + PREFERRED_METHODS = { translate: :t, localize: :l }.freeze RESTRICT_ON_SEND = PREFERRED_METHODS.keys.freeze diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/skips_model_validations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/skips_model_validations.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/skips_model_validations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/skips_model_validations.rb index 16266c2d86..cbc977eb95 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/skips_model_validations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/skips_model_validations.rb @@ -93,8 +93,7 @@ module RuboCop end def allowed_method?(node) - METHODS_WITH_ARGUMENTS.include?(node.method_name.to_s) && - !node.arguments? + METHODS_WITH_ARGUMENTS.include?(node.method_name.to_s) && !node.arguments? end def forbidden_methods diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/squished_sql_heredocs.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/squished_sql_heredocs.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb index ec36e3be85..55f5654baf 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/squished_sql_heredocs.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb @@ -72,11 +72,7 @@ module RuboCop end def message(node) - format( - MSG, - expect: "#{node.source}#{SQUISH}", - current: node.source - ) + format(MSG, expect: "#{node.source}#{SQUISH}", current: node.source) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/strip_heredoc.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/strip_heredoc.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/strip_heredoc.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/strip_heredoc.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/table_name_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/table_name_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/table_name_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/table_name_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/time_zone.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/time_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/time_zone.rb index 5cf55ec422..5955fba982 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/time_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/time_zone.rb @@ -43,21 +43,17 @@ module RuboCop include ConfigurableEnforcedStyle extend AutoCorrector - MSG = 'Do not use `%s` without zone. Use `%s` ' \ - 'instead.' + MSG = 'Do not use `%s` without zone. Use `%s` instead.' - MSG_ACCEPTABLE = 'Do not use `%s` without zone. ' \ - 'Use one of %s instead.' + MSG_ACCEPTABLE = 'Do not use `%s` without zone. Use one of %s instead.' - MSG_LOCALTIME = 'Do not use `Time.localtime` without ' \ - 'offset or zone.' + MSG_LOCALTIME = 'Do not use `Time.localtime` without offset or zone.' GOOD_METHODS = %i[zone zone_default find_zone find_zone!].freeze DANGEROUS_METHODS = %i[now local new parse at].freeze - ACCEPTED_METHODS = %i[in_time_zone utc getlocal xmlschema iso8601 - jisx0301 rfc3339 httpdate to_i to_f].freeze + ACCEPTED_METHODS = %i[in_time_zone utc getlocal xmlschema iso8601 jisx0301 rfc3339 httpdate to_i to_f].freeze TIMEZONE_SPECIFIER = /[A-z]/.freeze @@ -100,13 +96,11 @@ module RuboCop # remove redundant `.in_time_zone` from `Time.zone.now.in_time_zone` def remove_redundant_in_time_zone(corrector, node) time_methods_called = extract_method_chain(node) - return unless time_methods_called.include?(:in_time_zone) || - time_methods_called.include?(:zone) + return unless time_methods_called.include?(:in_time_zone) || time_methods_called.include?(:zone) while node&.send_type? if node.children.last == :in_time_zone - in_time_zone_with_dot = - node.loc.selector.adjust(begin_pos: -1) + in_time_zone_with_dot = node.loc.selector.adjust(begin_pos: -1) corrector.remove(in_time_zone_with_dot) end node = node.parent @@ -144,9 +138,7 @@ module RuboCop ) else safe_method_name = safe_method(method_name, node) - format(MSG, - current: "#{klass}.#{method_name}", - prefer: "Time.zone.#{safe_method_name}") + format(MSG, current: "#{klass}.#{method_name}", prefer: "Time.zone.#{safe_method_name}") end end @@ -227,10 +219,7 @@ module RuboCop end def acceptable_methods(klass, method_name, node) - acceptable = [ - "`Time.zone.#{safe_method(method_name, node)}`", - "`#{klass}.current`" - ] + acceptable = ["`Time.zone.#{safe_method(method_name, node)}`", "`#{klass}.current`"] ACCEPTED_METHODS.each do |am| acceptable << "`#{klass}.#{method_name}.#{am}`" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/time_zone_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/time_zone_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/time_zone_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/time_zone_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/to_formatted_s.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/to_formatted_s.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/to_formatted_s.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/to_formatted_s.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/to_s_with_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/to_s_with_argument.rb new file mode 100644 index 0000000000..cf04752b6f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/to_s_with_argument.rb @@ -0,0 +1,41 @@ +# 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb new file mode 100644 index 0000000000..2d5ca04db6 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Identifies top-level `HashWithIndifferentAccess`. + # This has been soft-deprecated since Rails 5.1. + # + # @example + # # bad + # HashWithIndifferentAccess.new(foo: 'bar') + # + # # good + # ActiveSupport::HashWithIndifferentAccess.new(foo: 'bar') + # + class TopLevelHashWithIndifferentAccess < Base + extend AutoCorrector + extend TargetRailsVersion + + minimum_target_rails_version 5.1 + + MSG = 'Avoid top-level `HashWithIndifferentAccess`.' + + # @!method top_level_hash_with_indifferent_access?(node) + # @param [RuboCop::AST::ConstNode] node + # @return [Boolean] + def_node_matcher :top_level_hash_with_indifferent_access?, <<~PATTERN + (const {nil? cbase} :HashWithIndifferentAccess) + PATTERN + + # @param [RuboCop::AST::ConstNode] node + def on_const(node) + return unless top_level_hash_with_indifferent_access?(node) + + add_offense(node) do |corrector| + autocorrect(corrector, node) + end + end + + private + + def autocorrect(corrector, node) + corrector.insert_before(node.location.name, 'ActiveSupport::') + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/transaction_exit_statement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/transaction_exit_statement.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/transaction_exit_statement.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/transaction_exit_statement.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/uniq_before_pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/uniq_before_pluck.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/uniq_before_pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/uniq_before_pluck.rb index bcbe1477e9..91caf5506d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/uniq_before_pluck.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/uniq_before_pluck.rb @@ -54,11 +54,9 @@ module RuboCop NEWLINE = "\n" PATTERN = '[!^block (send (send %s :pluck ...) :uniq ...)]' - def_node_matcher :conservative_node_match, - format(PATTERN, type: 'const') + def_node_matcher :conservative_node_match, format(PATTERN, type: 'const') - def_node_matcher :aggressive_node_match, - format(PATTERN, type: '_') + def_node_matcher :aggressive_node_match, format(PATTERN, type: '_') def on_send(node) uniq = if style == :conservative @@ -80,8 +78,7 @@ module RuboCop private def dot_method_with_whitespace(method, node) - range_between(dot_method_begin_pos(method, node), - node.loc.selector.end_pos) + range_between(dot_method_begin_pos(method, node), node.loc.selector.end_pos) end def dot_method_begin_pos(method, node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unique_validation_without_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unique_validation_without_index.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unique_validation_without_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unique_validation_without_index.rb index f2aa63db34..6c7cc3d222 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unique_validation_without_index.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unique_validation_without_index.rb @@ -59,9 +59,7 @@ module RuboCop add_indices = schema.add_indices_by(table_name: table_name(klass)) (table.indices + add_indices).any? do |index| - index.unique && - (index.columns.to_set == names || - include_column_names_in_expression_index?(index, names)) + index.unique && (index.columns.to_set == names || include_column_names_in_expression_index?(index, names)) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unknown_env.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unknown_env.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unknown_env.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unknown_env.rb index 42020b4155..c3d8d467eb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unknown_env.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unknown_env.rb @@ -19,8 +19,7 @@ module RuboCop # Rails.env == 'production' class UnknownEnv < Base MSG = 'Unknown environment `%s`.' - MSG_SIMILAR = 'Unknown environment `%s`. ' \ - 'Did you mean `%s`?' + MSG_SIMILAR = 'Unknown environment `%s`. Did you mean `%s`?' def_node_matcher :rails_env?, <<~PATTERN (send @@ -79,8 +78,7 @@ module RuboCop def unknown_env_predicate?(name) name = name.to_s - name.end_with?('?') && - !environments.include?(name[0..-2]) + name.end_with?('?') && !environments.include?(name[0..-2]) end def unknown_env_name?(name) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unused_ignored_columns.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unused_ignored_columns.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unused_ignored_columns.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unused_ignored_columns.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/validation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/validation.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/validation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/validation.rb index 29f5f33629..2958e14552 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/validation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/validation.rb @@ -35,8 +35,7 @@ module RuboCop class Validation < Base extend AutoCorrector - MSG = 'Prefer the new style validations `%s` over ' \ - '`%s`.' + MSG = 'Prefer the new style validations `%s` over `%s`.' TYPES = %w[ acceptance @@ -62,8 +61,7 @@ module RuboCop add_offense(range, message: message(node)) do |corrector| last_argument = node.arguments.last - return if !last_argument.literal? && !last_argument.splat_type? && - !frozen_array_argument?(last_argument) + return if !last_argument.literal? && !last_argument.splat_type? && !frozen_array_argument?(last_argument) corrector.replace(range, 'validates') correct_validate_type(corrector, node) @@ -104,10 +102,7 @@ module RuboCop end def correct_validate_type_for_hash(corrector, node, arguments) - corrector.replace( - arguments.loc.expression, - "#{validate_type(node)}: #{braced_options(arguments)}" - ) + corrector.replace(arguments.loc.expression, "#{validate_type(node)}: #{braced_options(arguments)}") end def correct_validate_type_for_array(corrector, node, arguments, loc) @@ -121,10 +116,7 @@ module RuboCop end end - corrector.replace( - loc.expression, - "#{attributes.join(', ')}, #{validate_type(node)}: true" - ) + corrector.replace(loc.expression, "#{attributes.join(', ')}, #{validate_type(node)}: true") end def validate_type(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_equals.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_equals.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_equals.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_equals.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_exists.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_exists.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_exists.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_exists.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_missing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_missing.rb new file mode 100644 index 0000000000..04009fef00 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_missing.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Use `where.missing(...)` to find missing relationship records. + # + # This cop is enabled in Rails 6.1 or higher. + # + # @example + # # bad + # Post.left_joins(:author).where(authors: { id: nil }) + # + # # good + # Post.where.missing(:author) + # + class WhereMissing < Base + include RangeHelp + extend AutoCorrector + extend TargetRailsVersion + + MSG = 'Use `where.missing(:%s)` instead of ' \ + '`%s(:%s).where(%s: { id: nil })`.' + RESTRICT_ON_SEND = %i[left_joins left_outer_joins].freeze + + minimum_target_rails_version 6.1 + + # @!method where_node_and_argument(node) + def_node_search :where_node_and_argument, <<~PATTERN + $(send ... :where (hash <(pair $(sym _) (hash (pair (sym :id) (nil))))...> )) + PATTERN + + # @!method missing_relationship(node) + def_node_search :missing_relationship, <<~PATTERN + (pair (sym _) (hash (pair (sym :id) (nil)))) + PATTERN + + def on_send(node) + return unless node.first_argument.sym_type? + + where_node_and_argument(root_receiver(node)) do |where_node, where_argument| + next unless same_relationship?(where_argument, node.first_argument) + + range = range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + register_offense(node, where_node, where_argument, range) + break + end + end + + private + + def root_receiver(node) + node&.parent&.send_type? ? root_receiver(node.parent) : node + end + + def same_relationship?(where, left_joins) + where.value.to_s.match?(/^#{left_joins.value}s?$/) + end + + def register_offense(node, where_node, where_argument, range) + add_offense(range, message: message(node, where_argument)) do |corrector| + corrector.replace(node.loc.selector, 'where.missing') + if multi_condition?(where_node.first_argument) + replace_where_method(corrector, where_node) + else + remove_where_method(corrector, node, where_node) + end + end + end + + def replace_where_method(corrector, where_node) + missing_relationship(where_node) do |where_clause| + corrector.remove(replace_range(where_clause)) + end + end + + def replace_range(child) + if (right_sibling = child.right_sibling) + range_between(child.loc.expression.begin_pos, right_sibling.loc.expression.begin_pos) + else + range_between(child.left_sibling.loc.expression.end_pos, child.loc.expression.end_pos) + end + end + + def remove_where_method(corrector, node, where_node) + range = range_between(where_node.loc.selector.begin_pos, where_node.loc.end.end_pos) + if node.multiline? && !same_line?(node, where_node) + range = range_by_whole_lines(range, include_final_newline: true) + else + corrector.remove(where_node.loc.dot) + end + + corrector.remove(range) + end + + def same_line?(left_joins_node, where_node) + left_joins_node.loc.selector.line == where_node.loc.selector.line + end + + def multi_condition?(where_arg) + where_arg.children.count > 1 + end + + def message(node, where_argument) + format(MSG, left_joins_association: node.first_argument.value, left_joins_method: node.method_name, + where_association: where_argument.value) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_not.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_not.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails_cops.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails_cops.rb index cf7c6c5769..8e0e555cc4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails_cops.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails_cops.rb @@ -8,12 +8,14 @@ require_relative 'mixin/index_method' require_relative 'mixin/migrations_helper' require_relative 'mixin/target_rails_version' +require_relative 'rails/action_controller_flash_before_render' require_relative 'rails/action_controller_test_case' require_relative 'rails/action_filter' require_relative 'rails/active_record_aliases' require_relative 'rails/active_record_callbacks_order' require_relative 'rails/active_record_override' require_relative 'rails/active_support_aliases' +require_relative 'rails/active_support_on_load' require_relative 'rails/add_column_index' require_relative 'rails/after_commit_override' require_relative 'rails/application_controller' @@ -50,6 +52,7 @@ require_relative 'rails/file_path' require_relative 'rails/find_by' require_relative 'rails/find_by_id' require_relative 'rails/find_each' +require_relative 'rails/freeze_time' require_relative 'rails/has_and_belongs_to_many' require_relative 'rails/has_many_or_has_one_dependent' require_relative 'rails/helper_instance_variable' @@ -97,6 +100,7 @@ require_relative 'rails/require_dependency' require_relative 'rails/reversible_migration' require_relative 'rails/reversible_migration_method_definition' require_relative 'rails/root_join_chain' +require_relative 'rails/root_pathname_methods' require_relative 'rails/root_public_path' require_relative 'rails/safe_navigation' require_relative 'rails/safe_navigation_with_blank' @@ -111,6 +115,8 @@ require_relative 'rails/table_name_assignment' require_relative 'rails/time_zone' require_relative 'rails/time_zone_assignment' require_relative 'rails/to_formatted_s' +require_relative 'rails/to_s_with_argument' +require_relative 'rails/top_level_hash_with_indifferent_access' require_relative 'rails/transaction_exit_statement' require_relative 'rails/uniq_before_pluck' require_relative 'rails/unique_validation_without_index' @@ -119,4 +125,5 @@ require_relative 'rails/unused_ignored_columns' require_relative 'rails/validation' require_relative 'rails/where_equals' require_relative 'rails/where_exists' +require_relative 'rails/where_missing' require_relative 'rails/where_not' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/schema_loader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/schema_loader.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/schema_loader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/schema_loader.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/schema_loader/schema.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/schema_loader/schema.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/schema_loader/schema.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/schema_loader/schema.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/version.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/version.rb index 0b65ad0ee2..829beda4f4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/version.rb @@ -4,7 +4,7 @@ module RuboCop module Rails # This module holds the RuboCop Rails version information. module Version - STRING = '2.15.2' + STRING = '2.16.0' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/specific_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/specific_matcher.rb deleted file mode 100644 index 2df783c905..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/specific_matcher.rb +++ /dev/null @@ -1,77 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module Capybara - # Checks for there is a more specific matcher offered by Capybara. - # - # @example - # - # # bad - # expect(page).to have_selector('button') - # expect(page).to have_no_selector('button.cls') - # expect(page).to have_css('button') - # expect(page).to have_no_css('a.cls', exact_text: 'foo') - # expect(page).to have_css('table.cls') - # expect(page).to have_css('select') - # - # # good - # expect(page).to have_button - # expect(page).to have_no_button(class: 'cls') - # expect(page).to have_button - # expect(page).to have_no_link('foo', class: 'cls') - # expect(page).to have_table(class: 'cls') - # expect(page).to have_select - # - class SpecificMatcher < Base - MSG = 'Prefer `%s` over `%s`.' - RESTRICT_ON_SEND = %i[have_selector have_no_selector have_css - have_no_css].freeze - SPECIFIC_MATCHER = { - 'button' => 'button', - 'a' => 'link', - 'table' => 'table', - 'select' => 'select' - }.freeze - - # @!method first_argument(node) - def_node_matcher :first_argument, <<-PATTERN - (send nil? _ (str $_) ... ) - PATTERN - - def on_send(node) - return unless (arg = first_argument(node)) - return unless (matcher = specific_matcher(arg)) - return if acceptable_pattern?(arg) - - add_offense(node, message: message(node, matcher)) - end - - private - - def specific_matcher(arg) - splitted_arg = arg[/^\w+/, 0] - SPECIFIC_MATCHER[splitted_arg] - end - - def acceptable_pattern?(arg) - arg.match?(/\[.+=\w+\]/) || arg.match?(/[ >,+]/) - end - - def message(node, matcher) - format(MSG, - good_matcher: good_matcher(node, matcher), - bad_matcher: node.method_name) - end - - def good_matcher(node, matcher) - node.method_name - .to_s - .gsub(/selector|css/, matcher.to_s) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/context_wording.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/context_wording.rb deleted file mode 100644 index 623468c95f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/context_wording.rb +++ /dev/null @@ -1,77 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that `context` docstring starts with an allowed prefix. - # - # The default list of prefixes is minimal. Users are encouraged to tailor - # the configuration to meet project needs. Other acceptable prefixes may - # include `if`, `unless`, `for`, `before`, `after`, or `during`. - # They may consist of multiple words if desired. - # - # @see https://rspec.rubystyle.guide/#context-descriptions - # @see http://www.betterspecs.org/#contexts - # - # @example `Prefixes` configuration - # - # # .rubocop.yml - # # RSpec/ContextWording: - # # Prefixes: - # # - when - # # - with - # # - without - # # - if - # # - unless - # # - for - # - # @example - # # bad - # context 'the display name not present' do - # # ... - # end - # - # # good - # context 'when the display name is not present' do - # # ... - # end - class ContextWording < Base - MSG = 'Start context description with %s.' - - # @!method context_wording(node) - def_node_matcher :context_wording, <<-PATTERN - (block (send #rspec? { :context :shared_context } $(str #bad_prefix?) ...) ...) - PATTERN - - def on_block(node) - context_wording(node) do |context| - add_offense(context, - message: format(MSG, prefixes: joined_prefixes)) - end - end - - private - - def bad_prefix?(description) - !prefix_regex.match?(description) - end - - def joined_prefixes - quoted = prefixes.map { |prefix| "'#{prefix}'" } - return quoted.first if quoted.size == 1 - - quoted << "or #{quoted.pop}" - quoted.join(', ') - end - - def prefixes - cop_config['Prefixes'] || [] - end - - def prefix_regex - /^#{Regexp.union(prefixes)}\b/ - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/config/default.yml similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/config/default.yml index b584a7c591..585923bf45 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/config/default.yml @@ -2,6 +2,7 @@ RSpec: Enabled: true StyleGuideBaseURL: https://rspec.rubystyle.guide + DocumentationBaseURL: https://docs.rubocop.org/rubocop-rspec Include: &1 - "**/*_spec.rb" - "**/spec/**/*" @@ -61,9 +62,14 @@ RSpec: Pending: - pending Expectations: + - are_expected - expect - - is_expected - expect_any_instance_of + - is_expected + - should + - should_not + - should_not_receive + - should_receive Helpers: - let - let! @@ -187,8 +193,21 @@ RSpec/BeforeAfterAll: RSpec/ChangeByZero: Description: Prefer negated matchers over `to change.by(0)`. Enabled: pending - VersionAdded: 2.11.0 + VersionAdded: '2.11' + VersionChanged: '2.13' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero + NegatedMatcher: ~ + +RSpec/ClassCheck: + Description: Enforces consistent use of `be_a` or `be_kind_of`. + StyleGuide: "#is-a-vs-kind-of" + Enabled: pending + VersionAdded: '2.13' + EnforcedStyle: be_a + SupportedStyles: + - be_a + - be_kind_of + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ClassCheck RSpec/ContextMethod: Description: "`context` should not be used for specifying methods." @@ -204,8 +223,9 @@ RSpec/ContextWording: - when - with - without + AllowedPatterns: [] VersionAdded: '1.20' - VersionChanged: 1.20.1 + VersionChanged: '2.13' StyleGuide: https://rspec.rubystyle.guide/#context-descriptions Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording @@ -279,8 +299,9 @@ RSpec/Dialect: RSpec/EmptyExampleGroup: Description: Checks if an example group does not include any tests. Enabled: true + SafeAutoCorrect: false VersionAdded: '1.7' - VersionChanged: '2.0' + VersionChanged: '2.13' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup RSpec/EmptyHook: @@ -315,8 +336,10 @@ RSpec/EmptyLineAfterHook: Description: Checks if there is an empty line after hook blocks. Enabled: true VersionAdded: '1.27' + VersionChanged: '2.13' StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook + AllowConsecutiveOneLiners: true RSpec/EmptyLineAfterSubject: Description: Checks if there is an empty line after subject block. @@ -607,10 +630,18 @@ RSpec/NestedGroups: Description: Checks for nested example groups. Enabled: true Max: 3 + AllowedGroups: [] VersionAdded: '1.7' - VersionChanged: '1.10' + VersionChanged: '2.13' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups +RSpec/NoExpectationExample: + Description: Checks if an example contains any expectation. + Enabled: pending + Safe: false + VersionAdded: '2.13' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NoExpectationExample + RSpec/NotToNot: Description: Checks for consistent method usage for negating expectations. Enabled: true @@ -775,9 +806,10 @@ RSpec/VariableName: SupportedStyles: - snake_case - camelCase + AllowedPatterns: [] IgnoredPatterns: [] VersionAdded: '1.40' - VersionChanged: '1.43' + VersionChanged: '2.13' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName RSpec/VerifiedDoubleReference: @@ -834,6 +866,12 @@ RSpec/Capybara/FeatureMethods: VersionChanged: '2.0' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods +RSpec/Capybara/SpecificFinders: + Description: Checks if there is a more specific finder offered by Capybara. + Enabled: pending + VersionAdded: '2.13' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificFinders + RSpec/Capybara/SpecificMatcher: Description: Checks for there is a more specific matcher offered by Capybara. Enabled: pending diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/config/obsoletion.yml new file mode 100644 index 0000000000..38f27529a5 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/config/obsoletion.yml @@ -0,0 +1,14 @@ +# +# Configuration of obsolete/deprecated cops used by `ConfigObsoletion`. +# +# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions +# + +# Cop parameters that have been changed +# Can be treated as a warning instead of a failure with `severity: warning` +changed_parameters: + - cops: + - RSpec/VariableName + parameters: IgnoredPatterns + alternative: AllowedPatterns + severity: warning diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop-rspec.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop-rspec.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop-rspec.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop-rspec.rb index cac7dc77d7..b1ae4329c7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop-rspec.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop-rspec.rb @@ -5,6 +5,7 @@ require 'yaml' require 'rubocop' +require_relative 'rubocop/rspec' require_relative 'rubocop/rspec/version' require_relative 'rubocop/rspec/inject' require_relative 'rubocop/rspec/node' @@ -20,6 +21,8 @@ require_relative 'rubocop/cop/rspec/mixin/final_end_location' require_relative 'rubocop/cop/rspec/mixin/comments_help' require_relative 'rubocop/cop/rspec/mixin/empty_line_separation' require_relative 'rubocop/cop/rspec/mixin/inside_example_group' +require_relative 'rubocop/cop/rspec/mixin/namespace' +require_relative 'rubocop/cop/rspec/mixin/css_selector' require_relative 'rubocop/rspec/concept' require_relative 'rubocop/rspec/example_group' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/align_left_let_brace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/align_left_let_brace.rb similarity index 79% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/align_left_let_brace.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/align_left_let_brace.rb index 1d943c23e1..990222a686 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/align_left_let_brace.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/align_left_let_brace.rb @@ -6,16 +6,15 @@ module RuboCop # Checks that left braces for adjacent single line lets are aligned. # # @example + # # bad + # let(:foobar) { blahblah } + # let(:baz) { bar } + # let(:a) { b } # - # # bad - # let(:foobar) { blahblah } - # let(:baz) { bar } - # let(:a) { b } - # - # # good - # let(:foobar) { blahblah } - # let(:baz) { bar } - # let(:a) { b } + # # good + # let(:foobar) { blahblah } + # let(:baz) { bar } + # let(:a) { b } # class AlignLeftLetBrace < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/align_right_let_brace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/align_right_let_brace.rb similarity index 77% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/align_right_let_brace.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/align_right_let_brace.rb index 93e7fc464a..cd33e6d8ef 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/align_right_let_brace.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/align_right_let_brace.rb @@ -6,16 +6,15 @@ module RuboCop # Checks that right braces for adjacent single line lets are aligned. # # @example + # # bad + # let(:foobar) { blahblah } + # let(:baz) { bar } + # let(:a) { b } # - # # bad - # let(:foobar) { blahblah } - # let(:baz) { bar } - # let(:a) { b } - # - # # good - # let(:foobar) { blahblah } - # let(:baz) { bar } - # let(:a) { b } + # # good + # let(:foobar) { blahblah } + # let(:baz) { bar } + # let(:a) { b } # class AlignRightLetBrace < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/any_instance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/any_instance.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/any_instance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/any_instance.rb index 282b0b7111..6c0e5bb8e1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/any_instance.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/any_instance.rb @@ -22,6 +22,7 @@ module RuboCop # allow(my_instance).to receive(:foo) # end # end + # class AnyInstance < Base MSG = 'Avoid stubbing using `%s`.' RESTRICT_ON_SEND = %i[ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/around_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/around_block.rb similarity index 70% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/around_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/around_block.rb index f2c1e29d56..4bf38ebd25 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/around_block.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/around_block.rb @@ -25,23 +25,29 @@ module RuboCop # some_method # test.run # end + # class AroundBlock < Base MSG_NO_ARG = 'Test object should be passed to around block.' MSG_UNUSED_ARG = 'You should call `%s.call` ' \ 'or `%s.run`.' - # @!method hook(node) - def_node_matcher :hook, <<-PATTERN + # @!method hook_block(node) + def_node_matcher :hook_block, <<-PATTERN (block (send nil? :around sym ?) (args $...) ...) PATTERN + # @!method hook_numblock(node) + def_node_matcher :hook_numblock, <<-PATTERN + (numblock (send nil? :around sym ?) ...) + PATTERN + # @!method find_arg_usage(node) def_node_search :find_arg_usage, <<-PATTERN {(send $... {:call :run}) (send _ _ $...) (yield $...) (block-pass $...)} PATTERN def on_block(node) - hook(node) do |(example_proxy)| + hook_block(node) do |(example_proxy)| if example_proxy.nil? add_no_arg_offense(node) else @@ -50,6 +56,12 @@ module RuboCop end end + def on_numblock(node) + hook_numblock(node) do + check_for_numblock(node) + end + end + private def add_no_arg_offense(node) @@ -68,6 +80,17 @@ module RuboCop message: format(MSG_UNUSED_ARG, arg: name) ) end + + def check_for_numblock(block) + find_arg_usage(block) do |usage| + return if usage.include?(s(:lvar, :_1)) + end + + add_offense( + block.children.last, + message: format(MSG_UNUSED_ARG, arg: :_1) + ) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/base.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/base.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/base.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be.rb index 30ae14fb45..e0b5f03a12 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be.rb @@ -10,7 +10,6 @@ module RuboCop # cases it's better to specify what exactly is the expected value. # # @example - # # # bad # expect(foo).to be # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be_eq.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be_eq.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be_eq.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be_eq.rb index 04cb5e40e6..d36c80a943 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be_eq.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be_eq.rb @@ -10,7 +10,6 @@ module RuboCop # the `be` matcher is preferable as it is a more strict test. # # @example - # # # bad # expect(foo).to eq(true) # expect(foo).to eq(false) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be_eql.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be_eql.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be_eql.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be_eql.rb index fdf7cc0401..8273e01254 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be_eql.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be_eql.rb @@ -11,7 +11,6 @@ module RuboCop # preferable as it is a more strict test. # # @example - # # # bad # expect(foo).to eql(1) # expect(foo).to eql(1.0) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be_nil.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be_nil.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/be_nil.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/be_nil.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/before_after_all.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/before_after_all.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/before_after_all.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/before_after_all.rb index eb18e7fbb4..7c3298c8fb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/before_after_all.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/before_after_all.rb @@ -23,6 +23,7 @@ module RuboCop # before(:each) { Widget.create } # after(:each) { Widget.delete_all } # end + # class BeforeAfterAll < Base MSG = 'Beware of using `%s` as it may cause state to leak ' \ 'between tests. If you are using `rspec-rails`, and ' \ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb index 0606570ed5..a6568a0cb9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb @@ -14,14 +14,20 @@ module RuboCop # which ensures that preceding actions (like `click_link`) have # completed. # + # This cop does not support autocorrection in some cases. + # # @example # # bad # expect(current_path).to eq('/callback') - # expect(page.current_path).to match(/widgets/) # # # good - # expect(page).to have_current_path("/callback") - # expect(page).to have_current_path(/widgets/) + # expect(page).to have_current_path('/callback') + # + # # bad (does not support autocorrection) + # expect(page.current_path).to match(variable) + # + # # good + # expect(page).to have_current_path('/callback') # class CurrentPathExpectation < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/feature_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/feature_methods.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/feature_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/feature_methods.rb index 413b5068b6..5fe49758ed 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/feature_methods.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/feature_methods.rb @@ -40,6 +40,7 @@ module RuboCop # # ... # end # end + # class FeatureMethods < Base extend AutoCorrector include InsideExampleGroup @@ -68,7 +69,7 @@ module RuboCop ...) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless inside_example_group?(node) feature_method(node) do |send_node, match| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/specific_finders.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/specific_finders.rb new file mode 100644 index 0000000000..398915f087 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/specific_finders.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + module Capybara + # Checks if there is a more specific finder offered by Capybara. + # + # @example + # # bad + # find('#some-id') + # find('[visible][id=some-id]') + # + # # good + # find_by_id('some-id') + # find_by_id('some-id', visible: true) + # + class SpecificFinders < Base + extend AutoCorrector + + include RangeHelp + + MSG = 'Prefer `find_by` over `find`.' + RESTRICT_ON_SEND = %i[find].freeze + + # @!method find_argument(node) + def_node_matcher :find_argument, <<~PATTERN + (send _ :find (str $_) ...) + PATTERN + + def on_send(node) + find_argument(node) do |arg| + next if CssSelector.multiple_selectors?(arg) + + on_attr(node, arg) if attribute?(arg) + on_id(node, arg) if CssSelector.id?(arg) + end + end + + private + + def on_attr(node, arg) + return unless (id = CssSelector.attributes(arg)['id']) + + register_offense(node, replaced_arguments(arg, id)) + end + + def on_id(node, arg) + register_offense(node, "'#{arg.to_s.delete('#')}'") + end + + def attribute?(arg) + CssSelector.attribute?(arg) && + CssSelector.common_attributes?(arg) + end + + def register_offense(node, arg_replacement) + add_offense(offense_range(node)) do |corrector| + corrector.replace(node.loc.selector, 'find_by_id') + corrector.replace(node.first_argument.loc.expression, + arg_replacement) + end + end + + def replaced_arguments(arg, id) + options = to_options(CssSelector.attributes(arg)) + options.empty? ? id : "#{id}, #{options}" + end + + def to_options(attrs) + attrs.each.map do |key, value| + next if key == 'id' + + "#{key}: #{value}" + end.compact.join(', ') + end + + def offense_range(node) + range_between(node.loc.selector.begin_pos, + node.loc.end.end_pos) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/specific_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/specific_matcher.rb new file mode 100644 index 0000000000..68ca7f6933 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/specific_matcher.rb @@ -0,0 +1,158 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + module Capybara + # Checks for there is a more specific matcher offered by Capybara. + # + # @example + # + # # bad + # expect(page).to have_selector('button') + # expect(page).to have_no_selector('button.cls') + # expect(page).to have_css('button') + # expect(page).to have_no_css('a.cls', href: 'http://example.com') + # expect(page).to have_css('table.cls') + # expect(page).to have_css('select') + # expect(page).to have_css('input', exact_text: 'foo') + # + # # good + # expect(page).to have_button + # expect(page).to have_no_button(class: 'cls') + # expect(page).to have_button + # expect(page).to have_no_link('foo', class: 'cls', href: 'http://example.com') + # expect(page).to have_table(class: 'cls') + # expect(page).to have_select + # expect(page).to have_field('foo') + # + class SpecificMatcher < Base # rubocop:disable Metrics/ClassLength + MSG = 'Prefer `%s` over `%s`.' + RESTRICT_ON_SEND = %i[have_selector have_no_selector have_css + have_no_css].freeze + SPECIFIC_MATCHER = { + 'button' => 'button', + 'a' => 'link', + 'table' => 'table', + 'select' => 'select', + 'input' => 'field' + }.freeze + SPECIFIC_MATCHER_OPTIONS = { + 'button' => ( + CssSelector::COMMON_OPTIONS + %w[disabled name value title type] + ).freeze, + 'link' => ( + CssSelector::COMMON_OPTIONS + %w[href alt title download] + ).freeze, + 'table' => ( + CssSelector::COMMON_OPTIONS + %w[ + caption with_cols cols with_rows rows + ] + ).freeze, + 'select' => ( + CssSelector::COMMON_OPTIONS + %w[ + disabled name placeholder options enabled_options + disabled_options selected with_selected multiple with_options + ] + ).freeze, + 'field' => ( + CssSelector::COMMON_OPTIONS + %w[ + checked unchecked disabled valid name placeholder + validation_message readonly with type multiple + ] + ).freeze + }.freeze + SPECIFIC_MATCHER_PSEUDO_CLASSES = %w[ + not() disabled enabled checked unchecked + ].freeze + + # @!method first_argument(node) + def_node_matcher :first_argument, <<-PATTERN + (send nil? _ (str $_) ... ) + PATTERN + + # @!method option?(node) + def_node_search :option?, <<-PATTERN + (pair (sym %) _) + PATTERN + + def on_send(node) + first_argument(node) do |arg| + next unless (matcher = specific_matcher(arg)) + next if CssSelector.multiple_selectors?(arg) + next unless specific_matcher_option?(node, arg, matcher) + next unless specific_matcher_pseudo_classes?(arg) + + add_offense(node, message: message(node, matcher)) + end + end + + private + + def specific_matcher(arg) + splitted_arg = arg[/^\w+/, 0] + SPECIFIC_MATCHER[splitted_arg] + end + + def specific_matcher_option?(node, arg, matcher) + attrs = CssSelector.attributes(arg).keys + return true if attrs.empty? + return false unless replaceable_matcher?(node, matcher, attrs) + + attrs.all? do |attr| + SPECIFIC_MATCHER_OPTIONS.fetch(matcher, []).include?(attr) + end + end + + def specific_matcher_pseudo_classes?(arg) + CssSelector.pseudo_classes(arg).all? do |pseudo_class| + replaceable_pseudo_class?(pseudo_class, arg) + end + end + + def replaceable_pseudo_class?(pseudo_class, arg) + unless SPECIFIC_MATCHER_PSEUDO_CLASSES.include?(pseudo_class) + return false + end + + case pseudo_class + when 'not()' then replaceable_pseudo_class_not?(arg) + else true + end + end + + def replaceable_pseudo_class_not?(arg) + arg.scan(/not\(.*?\)/).all? do |not_arg| + CssSelector.attributes(not_arg).values.all? do |v| + v.is_a?(TrueClass) || v.is_a?(FalseClass) + end + end + end + + def replaceable_matcher?(node, matcher, attrs) + case matcher + when 'link' then replaceable_to_have_link?(node, attrs) + else true + end + end + + def replaceable_to_have_link?(node, attrs) + option?(node, :href) || attrs.include?('href') + end + + def message(node, matcher) + format(MSG, + good_matcher: good_matcher(node, matcher), + bad_matcher: node.method_name) + end + + def good_matcher(node, matcher) + node.method_name + .to_s + .gsub(/selector|css/, matcher.to_s) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb index 163066e890..57098b8d4d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb @@ -16,7 +16,6 @@ module RuboCop # https://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FFinders:all[the documentation]. # # @example - # # # bad # expect(page).to have_selector('.foo', visible: false) # expect(page).to have_css('.foo', visible: true) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/change_by_zero.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/change_by_zero.rb similarity index 53% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/change_by_zero.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/change_by_zero.rb index 1174161497..70f8c722d4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/change_by_zero.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/change_by_zero.rb @@ -5,12 +5,20 @@ module RuboCop module RSpec # Prefer negated matchers over `to change.by(0)`. # - # @example + # In the case of composite expectations, cop suggest using the + # negation matchers of `RSpec::Matchers#change`. + # + # By default the cop does not support autocorrect of + # compound expectations, but if you set the + # negated matcher for `change`, e.g. `not_change` with + # the `NegatedMatcher` option, the cop will perform the autocorrection. + # + # @example NegatedMatcher: ~ (default) # # bad # expect { run }.to change(Foo, :bar).by(0) # expect { run }.to change { Foo.bar }.by(0) # - # # bad - compound expectations + # # bad - compound expectations (does not support autocorrection) # expect { run } # .to change(Foo, :bar).by(0) # .and change(Foo, :baz).by(0) @@ -31,10 +39,28 @@ module RuboCop # .to not_change { Foo.bar } # .and not_change { Foo.baz } # + # @example NegatedMatcher: not_change + # # bad (support autocorrection to good case) + # expect { run } + # .to change(Foo, :bar).by(0) + # .and change(Foo, :baz).by(0) + # expect { run } + # .to change { Foo.bar }.by(0) + # .and change { Foo.baz }.by(0) + # + # # good + # define_negated_matcher :not_change, :change + # expect { run } + # .to not_change(Foo, :bar) + # .and not_change(Foo, :baz) + # expect { run } + # .to not_change { Foo.bar } + # .and not_change { Foo.baz } + # class ChangeByZero < Base extend AutoCorrector MSG = 'Prefer `not_to change` over `to change.by(0)`.' - MSG_COMPOUND = 'Prefer negated matchers with compound expectations ' \ + MSG_COMPOUND = 'Prefer %s with compound expectations ' \ 'over `change.by(0)`.' RESTRICT_ON_SEND = %i[change].freeze @@ -55,6 +81,11 @@ module RuboCop (int 0)) PATTERN + # @!method change_nodes(node) + def_node_search :change_nodes, <<-PATTERN + $(send nil? :change ...) + PATTERN + def on_send(node) expect_change_with_arguments(node.parent) do check_offense(node.parent) @@ -70,7 +101,9 @@ module RuboCop def check_offense(node) expression = node.loc.expression if compound_expectations?(node) - add_offense(expression, message: MSG_COMPOUND) + add_offense(expression, message: message_compound) do |corrector| + autocorrect_compound(corrector, node) + end else add_offense(expression) do |corrector| autocorrect(corrector, node) @@ -79,7 +112,7 @@ module RuboCop end def compound_expectations?(node) - %i[and or].include?(node.parent.method_name) + %i[and or & |].include?(node.parent.method_name) end def autocorrect(corrector, node) @@ -87,6 +120,28 @@ module RuboCop range = node.loc.dot.with(end_pos: node.loc.expression.end_pos) corrector.remove(range) end + + def autocorrect_compound(corrector, node) + return unless negated_matcher + + change_nodes(node) do |change_node| + corrector.replace(change_node.loc.selector, negated_matcher) + range = node.loc.dot.with(end_pos: node.loc.expression.end_pos) + corrector.remove(range) + end + end + + def negated_matcher + cop_config['NegatedMatcher'] + end + + def message_compound + format(MSG_COMPOUND, preferred: preferred_method) + end + + def preferred_method + negated_matcher ? "`#{negated_matcher}`" : 'negated matchers' + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/class_check.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/class_check.rb new file mode 100644 index 0000000000..5e426d5d23 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/class_check.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # Enforces consistent use of `be_a` or `be_kind_of`. + # + # @example EnforcedStyle: be_a (default) + # # bad + # expect(object).to be_kind_of(String) + # expect(object).to be_a_kind_of(String) + # + # # good + # expect(object).to be_a(String) + # expect(object).to be_an(String) + # + # @example EnforcedStyle: be_kind_of + # # bad + # expect(object).to be_a(String) + # expect(object).to be_an(String) + # + # # good + # expect(object).to be_kind_of(String) + # expect(object).to be_a_kind_of(String) + # + class ClassCheck < Base + extend AutoCorrector + include ConfigurableEnforcedStyle + + MSG = 'Prefer `%s` over `%s`.' + + METHOD_NAMES_FOR_BE_A = ::Set[ + :be_a, + :be_an + ].freeze + + METHOD_NAMES_FOR_KIND_OF = ::Set[ + :be_a_kind_of, + :be_kind_of + ].freeze + + PREFERRED_METHOD_NAME_BY_STYLE = { + be_a: :be_a, + be_kind_of: :be_kind_of + }.freeze + + RESTRICT_ON_SEND = %i[ + be_a + be_a_kind_of + be_an + be_kind_of + ].freeze + + def on_send(node) + return unless offending?(node) + + add_offense( + node.loc.selector, + message: format_message(node) + ) do |corrector| + autocorrect(corrector, node) + end + end + + private + + def autocorrect(corrector, node) + corrector.replace(node.loc.selector, preferred_method_name) + end + + def format_message(node) + format( + MSG, + current: node.method_name, + preferred: preferred_method_name + ) + end + + def offending?(node) + !node.receiver && !preferred_method_name?(node.method_name) + end + + def preferred_method_name?(method_name) + preferred_method_names.include?(method_name) + end + + def preferred_method_name + PREFERRED_METHOD_NAME_BY_STYLE[style] + end + + def preferred_method_names + if style == :be_a + METHOD_NAMES_FOR_BE_A + else + METHOD_NAMES_FOR_KIND_OF + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/context_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/context_method.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/context_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/context_method.rb index c0f52b5683..d639e18321 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/context_method.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/context_method.rb @@ -23,6 +23,7 @@ module RuboCop # describe '.foo_bar' do # # ... # end + # class ContextMethod < Base extend AutoCorrector @@ -33,7 +34,7 @@ module RuboCop (block (send #rspec? :context $(str #method_name?) ...) ...) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler context_method(node) do |context| add_offense(context) do |corrector| corrector.replace(node.send_node.loc.selector, 'describe') diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/context_wording.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/context_wording.rb new file mode 100644 index 0000000000..cb786a196c --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/context_wording.rb @@ -0,0 +1,108 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # Checks that `context` docstring starts with an allowed prefix. + # + # The default list of prefixes is minimal. Users are encouraged to tailor + # the configuration to meet project needs. Other acceptable prefixes may + # include `if`, `unless`, `for`, `before`, `after`, or `during`. + # They may consist of multiple words if desired. + # + # @see https://rspec.rubystyle.guide/#context-descriptions + # @see http://www.betterspecs.org/#contexts + # + # @example `Prefixes` configuration + # # .rubocop.yml + # # RSpec/ContextWording: + # # Prefixes: + # # - when + # # - with + # # - without + # # - if + # # - unless + # # - for + # + # @example + # # bad + # context 'the display name not present' do + # # ... + # end + # + # # good + # context 'when the display name is not present' do + # # ... + # end + # + # This cop can be customized allowed context description pattern + # with `AllowedPatterns`. By default, there are no checking by pattern. + # + # @example `AllowedPatterns` configuration + # + # # .rubocop.yml + # # RSpec/ContextWording: + # # AllowedPatterns: + # # - /とき$/ + # + # @example + # # bad + # context '条件を満たす' do + # # ... + # end + # + # # good + # context '条件を満たすとき' do + # # ... + # end + # + class ContextWording < Base + include AllowedPattern + + MSG = 'Context description should match %s.' + + # @!method context_wording(node) + def_node_matcher :context_wording, <<-PATTERN + (block (send #rspec? { :context :shared_context } $(str $_) ...) ...) + PATTERN + + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler + context_wording(node) do |context, description| + if bad_pattern?(description) + message = format(MSG, patterns: expect_patterns) + add_offense(context, message: message) + end + end + end + + private + + def allowed_patterns + super + prefix_regexes + end + + def prefix_regexes + @prefix_regexes ||= prefixes.map { |pre| /^#{Regexp.escape(pre)}\b/ } + end + + def bad_pattern?(description) + return false if allowed_patterns.empty? + + !matches_allowed_pattern?(description) + end + + def expect_patterns + inspected = allowed_patterns.map(&:inspect) + return inspected.first if inspected.size == 1 + + inspected << "or #{inspected.pop}" + inspected.join(', ') + end + + def prefixes + Array(cop_config.fetch('Prefixes', [])) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/describe_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/describe_class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/describe_class.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/describe_class.rb index 9443220ee1..ab358678a2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/describe_class.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/describe_class.rb @@ -10,7 +10,6 @@ module RuboCop # Ignores Rails and Aruba `type` metadata by default. # # @example `IgnoredMetadata` configuration - # # # .rubocop.yml # # RSpec/DescribeClass: # # IgnoredMetadata: @@ -34,6 +33,7 @@ module RuboCop # # describe "A feature example", type: :feature do # end + # class DescribeClass < Base include TopLevelGroup diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/describe_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/describe_method.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/describe_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/describe_method.rb index 8a8c114133..f5e266635b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/describe_method.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/describe_method.rb @@ -16,6 +16,7 @@ module RuboCop # # describe MyClass, '.my_class_method' do # end + # class DescribeMethod < Base include TopLevelGroup diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/describe_symbol.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/describe_symbol.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/describe_symbol.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/describe_symbol.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/described_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/described_class.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/described_class.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/described_class.rb index f1b4ed7300..06a3376916 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/described_class.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/described_class.rb @@ -57,6 +57,7 @@ module RuboCop class DescribedClass < Base extend AutoCorrector include ConfigurableEnforcedStyle + include Namespace DESCRIBED_CLASS = 'described_class' MSG = 'Use `%s` instead of `%s`.' @@ -81,7 +82,7 @@ module RuboCop def_node_search :contains_described_class?, '(send nil? :described_class)' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler # In case the explicit style is used, we need to remember what's # being described. @described_class, body = described_constant(node) @@ -160,7 +161,8 @@ module RuboCop end def full_const_name(node) - collapse_namespace(namespace(node), const_name(node)) + symbolized_namespace = namespace(node).map(&:to_sym) + collapse_namespace(symbolized_namespace, const_name(node)) end # @param namespace [Array] @@ -200,18 +202,6 @@ module RuboCop [nil, name] end end - - # @param node [RuboCop::AST::Node] - # @return [Array] - # @example - # namespace(node) # => [:A, :B, :C] - def namespace(node) - node - .each_ancestor(:class, :module) - .reverse_each - .flat_map { |ancestor| ancestor.defined_module_name.split('::') } - .map(&:to_sym) - end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/described_class_module_wrapping.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/described_class_module_wrapping.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/described_class_module_wrapping.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/described_class_module_wrapping.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/dialect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/dialect.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/dialect.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/dialect.rb index 1fca3d0fdc..5c1770325c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/dialect.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/dialect.rb @@ -41,6 +41,7 @@ module RuboCop # describe 'display name presence' do # # ... # end + # class Dialect < Base extend AutoCorrector include MethodPreference diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_example_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_example_group.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_example_group.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_example_group.rb index e0162627c5..7fd30d3f8c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_example_group.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_example_group.rb @@ -6,7 +6,6 @@ module RuboCop # Checks if an example group does not include any tests. # # @example usage - # # # bad # describe Bacon do # let(:bacon) { Bacon.new(chunkiness) } @@ -35,7 +34,12 @@ module RuboCop # describe Bacon do # pending 'will add tests later' # end + # class EmptyExampleGroup < Base + extend AutoCorrector + + include RangeHelp + MSG = 'Empty example group detected.' # @!method example_group_body(node) @@ -119,7 +123,7 @@ module RuboCop # describe { it { i_run_as_well } } # # @example source that does not match - # before { it { whatever here wont run anyway } } + # before { it { whatever here won't run anyway } } # # @param node [RuboCop::AST::Node] # @return [Array] matching nodes @@ -130,12 +134,16 @@ module RuboCop } PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return if node.each_ancestor(:def, :defs).any? return if node.each_ancestor(:block).any? { |block| example?(block) } example_group_body(node) do |body| - add_offense(node.send_node) if offensive?(body) + next unless offensive?(body) + + add_offense(node.send_node) do |corrector| + corrector.remove(removed_range(node)) + end end end @@ -163,6 +171,13 @@ module RuboCop def examples_in_branches?(condition_node) condition_node.branches.any? { |branch| examples?(branch) } end + + def removed_range(node) + range_by_whole_lines( + node.location.expression, + include_final_newline: true + ) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_hook.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_hook.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_hook.rb index 820c1c5328..6c088121ee 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_hook.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_hook.rb @@ -22,6 +22,7 @@ module RuboCop # create_feed # end # after(:all) { cleanup_feed } + # class EmptyHook < Base extend AutoCorrector include RuboCop::Cop::RangeHelp @@ -33,7 +34,7 @@ module RuboCop (block $#{send_pattern('#Hooks.all')} _ nil?) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler empty_hook?(node) do |hook| add_offense(hook) do |corrector| corrector.remove( diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_example.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_example.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_example.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_example.rb index 9122251883..bfab9ffc19 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_example.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_example.rb @@ -30,7 +30,6 @@ module RuboCop # end # # @example with AllowConsecutiveOneLiners configuration - # # # rubocop.yml # # RSpec/EmptyLineAfterExample: # # AllowConsecutiveOneLiners: false @@ -47,7 +46,7 @@ module RuboCop MSG = 'Add an empty line after `%s`.' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example?(node) return if allowed_one_liner?(node) @@ -65,19 +64,15 @@ module RuboCop end def consecutive_one_liner?(node) - node.line_count == 1 && next_one_line_example?(node) + node.single_line? && next_one_line_example?(node) end def next_one_line_example?(node) - next_sibling = next_sibling(node) + next_sibling = node.right_sibling return unless next_sibling return unless example?(next_sibling) - next_sibling.line_count == 1 - end - - def next_sibling(node) - node.parent.children[node.sibling_index + 1] + next_sibling.single_line? end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_example_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_example_group.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_example_group.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_example_group.rb index e0f89f8854..d43573d478 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_example_group.rb @@ -29,7 +29,7 @@ module RuboCop MSG = 'Add an empty line after `%s`.' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group?(node) missing_separating_line_offense(node) do |method| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_final_let.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_final_let.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_final_let.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_final_let.rb index 1f91190edf..72f0fc1856 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_final_let.rb @@ -16,13 +16,14 @@ module RuboCop # let(:something) { other } # # it { does_something } + # class EmptyLineAfterFinalLet < Base extend AutoCorrector include EmptyLineSeparation MSG = 'Add an empty line after the last `%s`.' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group_with_body?(node) final_let = node.body.child_nodes.reverse.find { |child| let?(child) } diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb similarity index 51% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb index bf2ae16f68..cfcd8d30af 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_hook.rb @@ -5,6 +5,9 @@ module RuboCop module RSpec # Checks if there is an empty line after hook blocks. # + # `AllowConsecutiveOneLiners` configures whether adjacent + # one-line definitions are considered an offense. + # # @example # # bad # before { do_something } @@ -19,11 +22,23 @@ module RuboCop # it { does_something } # # # good - # before { do_something } + # after { do_something } # # it { does_something } # - # # good + # # fair - it's ok to have non-separated one-liners hooks + # around { |test| test.run } + # after { do_something } + # + # it { does_something } + # + # @example with AllowConsecutiveOneLiners configuration + # # rubocop.yml + # # RSpec/EmptyLineAfterHook: + # # AllowConsecutiveOneLiners: false + # + # # bad + # around { |test| test.run } # after { do_something } # # it { does_something } @@ -31,21 +46,36 @@ module RuboCop # # good # around { |test| test.run } # + # after { do_something } + # # it { does_something } # class EmptyLineAfterHook < Base extend AutoCorrector + include ConfigurableEnforcedStyle include EmptyLineSeparation MSG = 'Add an empty line after `%s`.' def on_block(node) return unless hook?(node) + return if cop_config['AllowConsecutiveOneLiners'] && + chained_single_line_hooks?(node) missing_separating_line_offense(node) do |method| format(MSG, hook: method) end end + + alias on_numblock on_block + + private + + def chained_single_line_hooks?(node) + next_node = node.right_sibling + + hook?(next_node) && node.single_line? && next_node.single_line? + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_subject.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_subject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_subject.rb index 47d515d842..f232e3fa56 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/empty_line_after_subject.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/empty_line_after_subject.rb @@ -14,6 +14,7 @@ module RuboCop # subject(:obj) { described_class } # # let(:foo) { bar } + # class EmptyLineAfterSubject < Base extend AutoCorrector include EmptyLineSeparation @@ -21,7 +22,7 @@ module RuboCop MSG = 'Add an empty line after `%s`.' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless subject?(node) return unless inside_example_group?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/example_length.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/example_length.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/example_length.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/example_length.rb index 9f5625046c..2796ef0420 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/example_length.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/example_length.rb @@ -47,12 +47,13 @@ module RuboCop # content. # HEREDOC # end # 5 points + # class ExampleLength < Base include CodeLength LABEL = 'Example' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example?(node) check_code_length(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/example_without_description.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/example_without_description.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/example_without_description.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/example_without_description.rb index 3ada55b5bf..8d52098491 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/example_without_description.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/example_without_description.rb @@ -47,6 +47,7 @@ module RuboCop # result = service.call # expect(result).to be(true) # end + # class ExampleWithoutDescription < Base include ConfigurableEnforcedStyle @@ -57,7 +58,7 @@ module RuboCop # @!method example_description(node) def_node_matcher :example_description, '(send nil? _ $(str $_))' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example?(node) check_example_without_description(node.send_node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/example_wording.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/example_wording.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/example_wording.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/example_wording.rb index 19d460164d..90850b4894 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/example_wording.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/example_wording.rb @@ -29,6 +29,7 @@ module RuboCop # # good # it 'does things' do # end + # class ExampleWording < Base extend AutoCorrector @@ -46,7 +47,7 @@ module RuboCop } ...) ...) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler it_description(node) do |description_node, message| if message.match?(SHOULD_PREFIX) add_wording_offense(description_node, MSG_SHOULD) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb index bc9800505e..0b3d3d0000 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb @@ -22,6 +22,7 @@ module RuboCop # # good # context 'when a condition is met' do # end + # class ExcessiveDocstringSpacing < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_actual.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_actual.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_actual.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_actual.rb index 9f5867f960..3a50fc931b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_actual.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_actual.rb @@ -18,6 +18,9 @@ module RuboCop # expect(pattern).to eq(/foo/) # expect(name).to eq("John") # + # # bad (not supported autocorrection) + # expect(false).to eq(true) + # class ExpectActual < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_change.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_change.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_change.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_change.rb index 8864ca3489..e723e033a8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_change.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_change.rb @@ -69,7 +69,7 @@ module RuboCop end end - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless style == :method_call expect_change_with_block(node) do |receiver, message| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_in_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_in_hook.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_in_hook.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_in_hook.rb index c111f150b9..166ecc9ff8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_in_hook.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_in_hook.rb @@ -20,13 +20,14 @@ module RuboCop # it do # expect(something).to eq 'foo' # end + # class ExpectInHook < Base MSG = 'Do not use `%s` in `%s` hook' # @!method expectation(node) def_node_search :expectation, send_pattern('#Expectations.all') - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless hook?(node) return if node.body.nil? @@ -36,6 +37,8 @@ module RuboCop end end + alias on_numblock on_block + private def message(expect, hook) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_output.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_output.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_output.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_output.rb index 70e8a771cc..bc57dcdded 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/expect_output.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/expect_output.rb @@ -14,6 +14,7 @@ module RuboCop # # # good # expect { my_app.print_report }.to output('Hello World').to_stdout + # class ExpectOutput < Base MSG = 'Use `expect { ... }.to output(...).to_%s` ' \ 'instead of mutating $%s.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb index a4b6dbe17c..41b2b13145 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb @@ -24,6 +24,7 @@ module RuboCop # # # good # count { 1 } + # class AttributeDefinedStatically < Base extend AutoCorrector @@ -39,7 +40,7 @@ module RuboCop (block (send _ #attribute_defining_method? ...) _ { (begin $...) $(send ...) } ) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler attributes = factory_attributes(node) || [] attributes = [attributes] unless attributes.is_a?(Array) # rubocop:disable Style/ArrayCoercion, Lint/RedundantCopDisableDirective diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/create_list.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/create_list.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/create_list.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/create_list.rb index 12db0979ea..986a3e708b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/create_list.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/create_list.rb @@ -30,6 +30,7 @@ module RuboCop # # # good # 3.times { create :user } + # class CreateList < Base extend AutoCorrector include ConfigurableEnforcedStyle @@ -39,20 +40,23 @@ module RuboCop MSG_N_TIMES = 'Prefer %s.times.' RESTRICT_ON_SEND = %i[create_list].freeze - # @!method n_times_block?(node) - def_node_matcher :n_times_block?, <<-PATTERN + # @!method array_new_or_n_times_block?(node) + def_node_matcher :array_new_or_n_times_block?, <<-PATTERN (block - (send (int _) :times) + { + (send (const {nil? | cbase} :Array) :new (int _)) | + (send (int _) :times) + } ... ) PATTERN - # @!method n_times_block_with_arg_and_used?(node) - def_node_matcher :n_times_block_with_arg_and_used?, <<-PATTERN + # @!method block_with_arg_and_used?(node) + def_node_matcher :block_with_arg_and_used?, <<-PATTERN (block - (send (int _) :times) + _ (args (arg _value)) - `_value + `_value ) PATTERN @@ -71,11 +75,11 @@ module RuboCop (send {nil? #factory_bot?} :create_list (sym _) (int $_) ...) PATTERN - def on_block(node) + def on_block(node) # rubocop:todo InternalAffairs/NumblockHandler return unless style == :create_list - return unless n_times_block?(node) - return if n_times_block_with_arg_and_used?(node) + return unless array_new_or_n_times_block?(node) + return if block_with_arg_and_used?(node) return unless node.body return if arguments_include_method_call?(node.body) return unless contains_only_factory?(node.body) @@ -183,7 +187,7 @@ module RuboCop def call_with_block_replacement(node) block = node.body - arguments = build_arguments(block, node.receiver.source) + arguments = build_arguments(block, count_from(node)) replacement = format_receiver(block.receiver) replacement += format_method_call(block, 'create_list', arguments) replacement += format_block(block) @@ -203,7 +207,7 @@ module RuboCop block = node.body factory, *options = *block.arguments - arguments = "#{factory.source}, #{node.receiver.source}" + arguments = "#{factory.source}, #{count_from(node)}" options = build_options_string(options) arguments += ", #{options}" unless options.empty? @@ -212,6 +216,16 @@ module RuboCop replacement end + def count_from(node) + count_node = + if node.receiver.int_type? + node.receiver + else + node.send_node.first_argument + end + count_node.source + end + def format_block(node) if node.body.begin_type? format_multiline_block(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb index 2deb3584ff..a69a4cd7f9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb @@ -19,6 +19,7 @@ module RuboCop # # good # factory :foo, class: 'Foo' do # end + # class FactoryClassName < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/file_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/file_path.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/file_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/file_path.rb index 00ff71508b..2ef8a71590 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/file_path.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/file_path.rb @@ -58,6 +58,7 @@ module RuboCop # class FilePath < Base include TopLevelGroup + include Namespace MSG = 'Spec path should end with `%s`.' @@ -101,7 +102,7 @@ module RuboCop def pattern_for(example_group, method_name) if spec_suffix_only? || !example_group.const_type? - return pattern_for_spec_suffix_only? + return pattern_for_spec_suffix_only end [ @@ -111,7 +112,7 @@ module RuboCop ].join end - def pattern_for_spec_suffix_only? + def pattern_for_spec_suffix_only '.*_spec\.rb' end @@ -123,8 +124,10 @@ module RuboCop end def expected_path(constant) + constants = namespace(constant) + constant.const_name.split('::') + File.join( - constant.const_name.split('::').map do |name| + constants.map do |name| custom_transform.fetch(name) { camel_to_snake_case(name) } end ) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/focus.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/focus.rb similarity index 85% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/focus.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/focus.rb index 2ecaeba076..3e5da5a542 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/focus.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/focus.rb @@ -5,6 +5,8 @@ module RuboCop module RSpec # Checks if examples are focused. # + # This cop does not support autocorrection in some cases. + # # @example # # bad # describe MyClass, focus: true do @@ -19,6 +21,22 @@ module RuboCop # # good # describe MyClass do # end + # + # # bad + # fdescribe 'test' do; end + # + # # good + # describe 'test' do; end + # + # # bad + # fdescribe 'test' do; end + # + # # good + # describe 'test' do; end + # + # # bad (does not support autocorrection) + # focus 'test' do; end + # class Focus < Base extend AutoCorrector include RangeHelp diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/hook_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/hook_argument.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/hook_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/hook_argument.rb index 5fa9c8f41c..2d1cb4f7c7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/hook_argument.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/hook_argument.rb @@ -57,6 +57,7 @@ module RuboCop # before(:example) do # # ... # end + # class HookArgument < Base extend AutoCorrector include ConfigurableEnforcedStyle @@ -66,11 +67,13 @@ module RuboCop # @!method scoped_hook(node) def_node_matcher :scoped_hook, <<-PATTERN - (block $(send _ #Hooks.all (sym ${:each :example})) ...) + ({block numblock} $(send _ #Hooks.all (sym ${:each :example})) ...) PATTERN # @!method unscoped_hook(node) - def_node_matcher :unscoped_hook, '(block $(send _ #Hooks.all) ...)' + def_node_matcher :unscoped_hook, <<-PATTERN + ({block numblock} $(send _ #Hooks.all) ...) + PATTERN def on_block(node) hook(node) do |method_send, scope_name| @@ -86,6 +89,8 @@ module RuboCop end end + alias on_numblock on_block + private def check_implicit(method_send) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/hooks_before_examples.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/hooks_before_examples.rb similarity index 79% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/hooks_before_examples.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/hooks_before_examples.rb index 412314a2c8..bff319d2f6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/hooks_before_examples.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/hooks_before_examples.rb @@ -6,8 +6,7 @@ module RuboCop # Checks for before/around/after hooks that come after an example. # # @example - # # Bad - # + # # bad # it 'checks what foo does' do # expect(foo).to be # end @@ -15,7 +14,7 @@ module RuboCop # before { prepare } # after { clean_up } # - # # Good + # # good # before { prepare } # after { clean_up } # @@ -32,6 +31,7 @@ module RuboCop def_node_matcher :example_or_group?, <<-PATTERN { #{block_pattern('{#ExampleGroups.all #Examples.all}')} + #{numblock_pattern('{#ExampleGroups.all #Examples.all}')} #{send_pattern('#Includes.examples')} } PATTERN @@ -42,6 +42,8 @@ module RuboCop check_hooks(node.body) if multiline_block?(node.body) end + alias on_numblock on_block + private def multiline_block?(block) @@ -52,13 +54,12 @@ module RuboCop first_example = find_first_example(node) return unless first_example - node.each_child_node do |child| - next if child.sibling_index < first_example.sibling_index - next unless hook?(child) + first_example.right_siblings.each do |sibling| + next unless hook?(sibling) - msg = format(MSG, hook: child.method_name) - add_offense(child, message: msg) do |corrector| - autocorrect(corrector, child, first_example) + msg = format(MSG, hook: sibling.method_name) + add_offense(sibling, message: msg) do |corrector| + autocorrect(corrector, sibling, first_example) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/identical_equality_assertion.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/identical_equality_assertion.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/identical_equality_assertion.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/identical_equality_assertion.rb index 89f911b999..7298415c93 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/identical_equality_assertion.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/identical_equality_assertion.rb @@ -6,7 +6,6 @@ module RuboCop # Checks for equality assertions with identical expressions on both sides. # # @example - # # # bad # expect(foo.bar).to eq(foo.bar) # expect(foo.bar).to eql(foo.bar) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/implicit_block_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/implicit_block_expectation.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/implicit_block_expectation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/implicit_block_expectation.rb index 9ad8a360d7..a9f8993965 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/implicit_block_expectation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/implicit_block_expectation.rb @@ -16,6 +16,7 @@ module RuboCop # it 'changes something to a new value' do # expect { do_something }.to change(something).to(new_value) # end + # class ImplicitBlockExpectation < Base MSG = 'Avoid implicit block expectations.' RESTRICT_ON_SEND = %i[is_expected should should_not].freeze diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/implicit_expect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/implicit_expect.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/implicit_expect.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/implicit_expect.rb index e69f669785..c2f8650bda 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/implicit_expect.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/implicit_expect.rb @@ -9,7 +9,6 @@ module RuboCop # and supports the `--auto-gen-config` flag. # # @example `EnforcedStyle: is_expected` (default) - # # # bad # it { should be_truthy } # @@ -17,7 +16,6 @@ module RuboCop # it { is_expected.to be_truthy } # # @example `EnforcedStyle: should` - # # # bad # it { is_expected.to be_truthy } # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/implicit_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/implicit_subject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/implicit_subject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/implicit_subject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/instance_spy.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/instance_spy.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/instance_spy.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/instance_spy.rb index 5b186ecff8..bcb37c4600 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/instance_spy.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/instance_spy.rb @@ -42,7 +42,7 @@ module RuboCop ...) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example?(node) null_double(node) do |var, receiver| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/instance_variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/instance_variable.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/instance_variable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/instance_variable.rb index ea1aab4dfe..0ce0298ba2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/instance_variable.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/instance_variable.rb @@ -24,7 +24,6 @@ module RuboCop # end # # @example with AssignmentOnly configuration - # # # rubocop.yml # # RSpec/InstanceVariable: # # AssignmentOnly: false diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/it_behaves_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/it_behaves_like.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/it_behaves_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/it_behaves_like.rb index 8ed681ff21..a8f76cbac3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/it_behaves_like.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/it_behaves_like.rb @@ -18,6 +18,7 @@ module RuboCop # # # good # it_should_behave_like 'a foo' + # class ItBehavesLike < Base extend AutoCorrector include ConfigurableEnforcedStyle diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/iterated_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/iterated_expectation.rb similarity index 77% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/iterated_expectation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/iterated_expectation.rb index 58bef7acd6..7d65851a46 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/iterated_expectation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/iterated_expectation.rb @@ -15,6 +15,7 @@ module RuboCop # it 'validates users' do # expect([user1, user2, user3]).to all(be_valid) # end + # class IteratedExpectation < Base MSG = 'Prefer using the `all` matcher instead ' \ 'of iterating over an array.' @@ -28,6 +29,13 @@ module RuboCop ) PATTERN + # @!method each_numblock?(node) + def_node_matcher :each_numblock?, <<-PATTERN + (numblock + (send ... :each) _ $(...) + ) + PATTERN + # @!method expectation?(node) def_node_matcher :expectation?, <<-PATTERN (send (send nil? :expect (lvar %)) :to ...) @@ -41,6 +49,14 @@ module RuboCop end end + def on_numblock(node) + each_numblock?(node) do |body| + if single_expectation?(body, :_1) || only_expectations?(body, :_1) + add_offense(node.send_node) + end + end + end + private def single_expectation?(body, arg) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/leading_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/leading_subject.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/leading_subject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/leading_subject.rb index c1ceb28770..c5ec22fd74 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/leading_subject.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/leading_subject.rb @@ -7,29 +7,29 @@ module RuboCop # # @example # # bad - # let(:params) { blah } - # subject { described_class.new(params) } + # let(:params) { blah } + # subject { described_class.new(params) } # - # before { do_something } - # subject { described_class.new(params) } + # before { do_something } + # subject { described_class.new(params) } # - # it { expect_something } - # subject { described_class.new(params) } - # it { expect_something_else } + # it { expect_something } + # subject { described_class.new(params) } + # it { expect_something_else } # # # # good - # subject { described_class.new(params) } - # let(:params) { blah } + # subject { described_class.new(params) } + # let(:params) { blah } # # # good - # subject { described_class.new(params) } - # before { do_something } + # subject { described_class.new(params) } + # before { do_something } # # # good - # subject { described_class.new(params) } - # it { expect_something } - # it { expect_something_else } + # subject { described_class.new(params) } + # it { expect_something } + # it { expect_something_else } # class LeadingSubject < Base extend AutoCorrector @@ -37,7 +37,7 @@ module RuboCop MSG = 'Declare `subject` above any other `%s` declarations.' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless subject?(node) return unless inside_example_group?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/leaky_constant_declaration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/leaky_constant_declaration.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/leaky_constant_declaration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/leaky_constant_declaration.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/let_before_examples.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/let_before_examples.rb similarity index 85% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/let_before_examples.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/let_before_examples.rb index 3df02cc57c..5059b568b1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/let_before_examples.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/let_before_examples.rb @@ -6,7 +6,7 @@ module RuboCop # Checks for `let` definitions that come after an example. # # @example - # # Bad + # # bad # let(:foo) { bar } # # it 'checks what foo does' do @@ -19,7 +19,7 @@ module RuboCop # expect(some).to be # end # - # # Good + # # good # let(:foo) { bar } # let(:some) { other } # @@ -43,7 +43,7 @@ module RuboCop } PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group_with_body?(node) check_let_declarations(node.body) if multiline_block?(node.body) @@ -59,12 +59,11 @@ module RuboCop first_example = find_first_example(node) return unless first_example - node.each_child_node do |child| - next if child.sibling_index < first_example.sibling_index - next unless let?(child) + first_example.right_siblings.each do |sibling| + next unless let?(sibling) - add_offense(child) do |corrector| - autocorrect(corrector, child, first_example) + add_offense(sibling) do |corrector| + autocorrect(corrector, sibling, first_example) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/let_setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/let_setup.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/let_setup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/let_setup.rb index 482e4de589..6767b8fbd1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/let_setup.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/let_setup.rb @@ -6,20 +6,20 @@ module RuboCop # Checks unreferenced `let!` calls being used for test setup. # # @example - # # Bad + # # bad # let!(:my_widget) { create(:widget) } # # it 'counts widgets' do # expect(Widget.count).to eq(1) # end # - # # Good + # # good # it 'counts widgets' do # create(:widget) # expect(Widget.count).to eq(1) # end # - # # Good + # # good # before { create(:widget) } # # it 'counts widgets' do @@ -49,7 +49,7 @@ module RuboCop # @!method method_called?(node) def_node_search :method_called?, '(send nil? %)' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_or_shared_group_or_including?(node) unused_let_bang(node) do |let| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/message_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/message_chain.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/message_chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/message_chain.rb index fc3593cad2..14a09bb3a7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/message_chain.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/message_chain.rb @@ -9,7 +9,7 @@ module RuboCop # # bad # allow(foo).to receive_message_chain(:bar, :baz).and_return(42) # - # # better + # # good # thing = Thing.new(baz: 42) # allow(foo).to receive(:bar).and_return(thing) # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/message_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/message_expectation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/message_expectation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/message_expectation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/message_spies.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/message_spies.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/message_spies.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/message_spies.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb index a29df6f591..4522fde211 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb @@ -19,10 +19,11 @@ module RuboCop # # describe "A feature example" do # end + # class MissingExampleGroupArgument < Base MSG = 'The first argument to `%s` should not be empty.' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group?(node) return if node.send_node.arguments? diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/comments_help.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/comments_help.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/comments_help.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/comments_help.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/css_selector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/css_selector.rb new file mode 100644 index 0000000000..baeb28f4d5 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/css_selector.rb @@ -0,0 +1,99 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # Helps parsing css selector. + module CssSelector + COMMON_OPTIONS = %w[ + above below left_of right_of near count minimum maximum between text + id class style visible obscured exact exact_text normalize_ws match + wait filter_set focused + ].freeze + + module_function + + # @param selector [String] + # @return [Boolean] + # @example + # id?('#some-id') # => true + # id?('.some-class') # => false + def id?(selector) + selector.start_with?('#') + end + + # @param selector [String] + # @return [Boolean] + # @example + # attribute?('[attribute]') # => true + # attribute?('attribute') # => false + def attribute?(selector) + selector.start_with?('[') + end + + # @param selector [String] + # @return [Array] + # @example + # attributes('a[foo-bar_baz]') # => {"foo-bar_baz=>true} + # attributes('button[foo][bar]') # => {"foo"=>true, "bar"=>true} + # attributes('table[foo=bar]') # => {"foo"=>"'bar'"} + def attributes(selector) + selector.scan(/\[(.*?)\]/).flatten.to_h do |attr| + key, value = attr.split('=') + [key, normalize_value(value)] + end + end + + # @param selector [String] + # @return [Boolean] + # @example + # common_attributes?('a[focused]') # => true + # common_attributes?('button[focused][visible]') # => true + # common_attributes?('table[id=some-id]') # => true + # common_attributes?('h1[invalid]') # => false + def common_attributes?(selector) + attributes(selector).keys.difference(COMMON_OPTIONS).none? + end + + # @param selector [String] + # @return [Array] + # @example + # pseudo_classes('button:not([disabled])') # => ['not()'] + # pseudo_classes('a:enabled:not([valid])') # => ['enabled', 'not()'] + def pseudo_classes(selector) + # Attributes must be excluded or else the colon in the `href`s URL + # will also be picked up as pseudo classes. + # "a:not([href='http://example.com']):enabled" => "a:not():enabled" + ignored_attribute = selector.gsub(/\[.*?\]/, '') + # "a:not():enabled" => ["not()", "enabled"] + ignored_attribute.scan(/:([^:]*)/).flatten + end + + # @param selector [String] + # @return [Boolean] + # @example + # multiple_selectors?('a.cls b#id') # => true + # multiple_selectors?('a.cls') # => false + def multiple_selectors?(selector) + selector.match?(/[ >,+]/) + end + + # @param value [String] + # @return [Boolean, String] + # @example + # normalize_value('true') # => true + # normalize_value('false') # => false + # normalize_value(nil) # => false + # normalize_value("foo") # => "'foo'" + def normalize_value(value) + case value + when 'true' then true + when 'false' then false + when nil then true + else "'#{value}'" + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/inside_example_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/inside_example_group.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/inside_example_group.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/inside_example_group.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/namespace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/namespace.rb new file mode 100644 index 0000000000..f39555ad5e --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/namespace.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # Helps to find namespace of the node. + module Namespace + private + + # @param node [RuboCop::AST::Node] + # @return [Array] + # @example + # namespace(node) # => ['A', 'B', 'C'] + def namespace(node) + node + .each_ancestor(:class, :module) + .reverse_each + .flat_map { |ancestor| ancestor.defined_module_name.split('::') } + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/top_level_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/top_level_group.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/top_level_group.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/top_level_group.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/variable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/variable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/variable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_describes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_describes.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_describes.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_describes.rb index 20662eeba7..4c231dedc4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_describes.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_describes.rb @@ -22,6 +22,7 @@ module RuboCop # describe '.do_something_else' do # end # end + # class MultipleDescribes < Base include TopLevelGroup diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_expectations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_expectations.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_expectations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_expectations.rb index 33df173fd6..3d3289ef47 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_expectations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_expectations.rb @@ -11,7 +11,6 @@ module RuboCop # and works with `--auto-gen-config`. # # @example - # # # bad # describe UserCreator do # it 'builds a user' do @@ -32,7 +31,6 @@ module RuboCop # end # # @example `aggregate_failures: true` (default) - # # # good - the cop ignores when RSpec aggregates failures # describe UserCreator do # it 'builds a user', :aggregate_failures do @@ -42,7 +40,6 @@ module RuboCop # end # # @example `aggregate_failures: false` - # # # Detected as an offense # describe UserCreator do # it 'builds a user', aggregate_failures: false do @@ -52,7 +49,6 @@ module RuboCop # end # # @example configuration - # # # .rubocop.yml # # RSpec/MultipleExpectations: # # Max: 2 @@ -88,7 +84,7 @@ module RuboCop (block (send nil? :aggregate_failures ...) ...) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example?(node) return if example_with_aggregate_failures?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb index 674b383b93..0e68102bfb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb @@ -56,7 +56,6 @@ module RuboCop # end # # @example when disabling AllowSubject configuration - # # # rubocop.yml # # RSpec/MultipleMemoizedHelpers: # # AllowSubject: false @@ -72,7 +71,6 @@ module RuboCop # end # # @example with Max configuration - # # # rubocop.yml # # RSpec/MultipleMemoizedHelpers: # # Max: 1 @@ -89,7 +87,7 @@ module RuboCop MSG = 'Example group has too many memoized helpers [%d/%d]' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless spec_group?(node) count = all_helpers(node).uniq.count diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_subjects.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_subjects.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_subjects.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_subjects.rb index 1667748a85..43017ee07a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/multiple_subjects.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/multiple_subjects.rb @@ -6,7 +6,6 @@ module RuboCop # Checks if an example group defines `subject` multiple times. # # @example - # # # bad # describe Foo do # subject(:user) { User.new } @@ -19,6 +18,21 @@ module RuboCop # subject(:post) { Post.new } # end # + # # bad (does not support autocorrection) + # describe Foo do + # subject!(:user) { User.new } + # subject!(:post) { Post.new } + # end + # + # # good + # describe Foo do + # before do + # User.new + # Post.new + # end + # end + # + # This cop does not support autocorrection in some cases. # The autocorrect behavior for this cop depends on the type of # duplication: # @@ -33,13 +47,14 @@ module RuboCop # - If subjects are defined with `subject!` then we don't autocorrect. # This is enough of an edge case that people can just move this to # a `before` hook on their own + # class MultipleSubjects < Base extend AutoCorrector include RangeHelp MSG = 'Do not set more than one subject per example group' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group?(node) subjects = RuboCop::RSpec::ExampleGroup.new(node).subjects diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/named_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/named_subject.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/named_subject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/named_subject.rb index 1f18855237..394a71baae 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/named_subject.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/named_subject.rb @@ -41,6 +41,7 @@ module RuboCop # # it { is_expected.to be_valid } # end + # class NamedSubject < Base MSG = 'Name your test subject if you need to reference it explicitly.' @@ -55,7 +56,7 @@ module RuboCop # @!method subject_usage(node) def_node_search :subject_usage, '$(send nil? :subject)' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler if !example_or_hook_block?(node) || ignored_shared_example?(node) return end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/nested_groups.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/nested_groups.rb similarity index 67% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/nested_groups.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/nested_groups.rb index 53c60ffe64..834324d89b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/nested_groups.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/nested_groups.rb @@ -36,7 +36,7 @@ module RuboCop # end # end # - # # better + # # good # context 'using some feature as an admin' do # let(:some) { :various } # let(:feature) { :setup } @@ -53,34 +53,40 @@ module RuboCop # it 'yada yada' # end # - # @example configuration - # - # # .rubocop.yml - # # RSpec/NestedGroups: - # # Max: 2 - # - # context 'when using some feature' do - # let(:some) { :various } - # let(:feature) { :setup } - # - # context 'when user is signed in' do - # let(:user) do - # UserCreate.call(user_attributes) + # @example `Max: 3` (default) + # # bad + # describe Foo do + # context 'foo' do + # context 'bar' do + # context 'baz' do # flagged by rubocop + # end # end + # end + # end # - # let(:user_attributes) do - # { - # name: 'John', - # age: 22, - # role: role - # } + # @example `Max: 2` + # # bad + # describe Foo do + # context 'foo' do + # context 'bar' do # flagged by rubocop + # context 'baz' do # flagged by rubocop + # end # end + # end + # end # - # context 'when user is an admin' do # flagged by rubocop - # let(:role) { 'admin' } + # @example `AllowedGroups: [] (default)` + # describe Foo do # <-- nested groups 1 + # context 'foo' do # <-- nested groups 2 + # context 'bar' do # <-- nested groups 3 + # end + # end + # end # - # it 'blah blah' - # it 'yada yada' + # @example `AllowedGroups: [path]` + # describe Foo do # <-- nested groups 1 + # path '/foo' do # <-- nested groups 1 (not counted) + # context 'bar' do # <-- nested groups 2 # end # end # end @@ -113,13 +119,23 @@ module RuboCop example_group = example_group?(node) yield node, nesting if example_group && nesting > max_nesting - next_nesting = example_group ? nesting + 1 : nesting + next_nesting = if count_up_nesting?(node, example_group) + nesting + 1 + else + nesting + end node.each_child_node(:block, :begin) do |child| find_nested_example_groups(child, nesting: next_nesting, &block) end end + def count_up_nesting?(node, example_group) + example_group && + (node.block_type? && + !allowed_groups.include?(node.method_name)) + end + def message(nesting) format(MSG, total: nesting, max: max_nesting) end @@ -136,6 +152,10 @@ module RuboCop cop_config.fetch('Max', 3) end end + + def allowed_groups + @allowed_groups ||= cop_config.fetch('AllowedGroups', []) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/no_expectation_example.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/no_expectation_example.rb new file mode 100644 index 0000000000..f4689698d5 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/no_expectation_example.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module RSpec + # Checks if an example contains any expectation. + # + # All RSpec's example and expectation methods are covered by default. + # If you are using your own custom methods, + # add the following configuration: + # + # RSpec: + # Language: + # Examples: + # Regular: + # - custom_it + # Expectations: + # - custom_expect + # + # @example + # # bad + # it do + # a? + # end + # + # # good + # it do + # expect(a?).to be(true) + # end + # + class NoExpectationExample < Base + MSG = 'No expectation found in this example.' + + # @!method regular_or_focused_example?(node) + # @param [RuboCop::AST::Node] node + # @return [Boolean] + def_node_matcher :regular_or_focused_example?, <<~PATTERN + { + #{block_pattern('{#Examples.regular | #Examples.focused}')} + #{numblock_pattern('{#Examples.regular | #Examples.focused}')} + } + PATTERN + + # @!method including_any_expectation?(node) + # @param [RuboCop::AST::Node] node + # @return [Boolean] + def_node_search( + :including_any_expectation?, + send_pattern('#Expectations.all') + ) + + # @param [RuboCop::AST::BlockNode] node + def on_block(node) + return unless regular_or_focused_example?(node) + return if including_any_expectation?(node) + + add_offense(node) + end + + alias on_numblock on_block + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/not_to_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/not_to_not.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/not_to_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/not_to_not.rb index d79b4bd2bf..8f09684846 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/not_to_not.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/not_to_not.rb @@ -6,7 +6,6 @@ module RuboCop # Checks for consistent method usage for negating expectations. # # @example `EnforcedStyle: not_to` (default) - # # # bad # it '...' do # expect(false).to_not be_true @@ -18,7 +17,6 @@ module RuboCop # end # # @example `EnforcedStyle: to_not` - # # # bad # it '...' do # expect(false).not_to be_true @@ -28,6 +26,7 @@ module RuboCop # it '...' do # expect(false).to_not be_true # end + # class NotToNot < Base extend AutoCorrector include ConfigurableEnforcedStyle diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/overwriting_setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/overwriting_setup.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/overwriting_setup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/overwriting_setup.rb index 1339755000..c6abc544a3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/overwriting_setup.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/overwriting_setup.rb @@ -21,6 +21,7 @@ module RuboCop # let(:foo) { bar } # let(:baz) { baz } # let!(:other) { other } + # class OverwritingSetup < Base MSG = '`%s` is already defined.' @@ -30,7 +31,7 @@ module RuboCop # @!method first_argument_name(node) def_node_matcher :first_argument_name, '(send _ _ ({str sym} $_))' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group_with_body?(node) find_duplicates(node.body) do |duplicate, name| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/pending.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/pending.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/pending.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/pending.rb index 5a2515560f..c4bbc1da57 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/pending.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/pending.rb @@ -31,6 +31,7 @@ module RuboCop # # good # describe MyClass do # end + # class Pending < Base MSG = 'Pending spec found.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/predicate_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/predicate_matcher.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/predicate_matcher.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/predicate_matcher.rb index f29ce2d3f5..c0818372b7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/predicate_matcher.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/predicate_matcher.rb @@ -276,6 +276,7 @@ module RuboCop # # # good - the above code is rewritten to it by this cop # expect(foo.something?).to be_truthy + # class PredicateMatcher < Base extend AutoCorrector include ConfigurableEnforcedStyle @@ -291,7 +292,7 @@ module RuboCop end end - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler check_explicit(node) if style == :explicit end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb index 00c1abe88b..49176c69aa 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb @@ -7,7 +7,6 @@ module RuboCop # Checks that tests use RSpec `before` hook over Rails `setup` method. # # @example - # # # bad # setup do # allow(foo).to receive(:bar) @@ -30,7 +29,7 @@ module RuboCop (args) _) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler setup_call(node) do |setup| add_offense(node) do |corrector| corrector.replace setup, 'before' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/rails/have_http_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/rails/have_http_status.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/rails/have_http_status.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/rails/have_http_status.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/rails/http_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/rails/http_status.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/rails/http_status.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/rails/http_status.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/receive_counts.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/receive_counts.rb similarity index 73% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/receive_counts.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/receive_counts.rb index 5ad9e590ca..c0d56fa6bf 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/receive_counts.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/receive_counts.rb @@ -6,22 +6,21 @@ module RuboCop # Check for `once` and `twice` receive counts matchers usage. # # @example + # # bad + # expect(foo).to receive(:bar).exactly(1).times + # expect(foo).to receive(:bar).exactly(2).times + # expect(foo).to receive(:bar).at_least(1).times + # expect(foo).to receive(:bar).at_least(2).times + # expect(foo).to receive(:bar).at_most(1).times + # expect(foo).to receive(:bar).at_most(2).times # - # # bad - # expect(foo).to receive(:bar).exactly(1).times - # expect(foo).to receive(:bar).exactly(2).times - # expect(foo).to receive(:bar).at_least(1).times - # expect(foo).to receive(:bar).at_least(2).times - # expect(foo).to receive(:bar).at_most(1).times - # expect(foo).to receive(:bar).at_most(2).times - # - # # good - # expect(foo).to receive(:bar).once - # expect(foo).to receive(:bar).twice - # expect(foo).to receive(:bar).at_least(:once) - # expect(foo).to receive(:bar).at_least(:twice) - # expect(foo).to receive(:bar).at_most(:once) - # expect(foo).to receive(:bar).at_most(:twice).times + # # good + # expect(foo).to receive(:bar).once + # expect(foo).to receive(:bar).twice + # expect(foo).to receive(:bar).at_least(:once) + # expect(foo).to receive(:bar).at_least(:twice) + # expect(foo).to receive(:bar).at_most(:once) + # expect(foo).to receive(:bar).at_most(:twice).times # class ReceiveCounts < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/receive_never.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/receive_never.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/receive_never.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/receive_never.rb index c5538ee583..aeb9f87ad1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/receive_never.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/receive_never.rb @@ -6,12 +6,11 @@ module RuboCop # Prefer `not_to receive(...)` over `receive(...).never`. # # @example + # # bad + # expect(foo).to receive(:bar).never # - # # bad - # expect(foo).to receive(:bar).never - # - # # good - # expect(foo).not_to receive(:bar) + # # good + # expect(foo).not_to receive(:bar) # class ReceiveNever < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_description.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_description.rb similarity index 62% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_description.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_description.rb index f499bb1023..8fcab32f5a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_description.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_description.rb @@ -6,44 +6,43 @@ module RuboCop # Check for repeated description strings in example groups. # # @example - # - # # bad - # RSpec.describe User do - # it 'is valid' do - # # ... - # end - # - # it 'is valid' do - # # ... - # end + # # bad + # RSpec.describe User do + # it 'is valid' do + # # ... # end # - # # good - # RSpec.describe User do - # it 'is valid when first and last name are present' do - # # ... - # end + # it 'is valid' do + # # ... + # end + # end # - # it 'is valid when last name only is present' do - # # ... - # end + # # good + # RSpec.describe User do + # it 'is valid when first and last name are present' do + # # ... # end # - # # good - # RSpec.describe User do - # it 'is valid' do - # # ... - # end - # - # it 'is valid', :flag do - # # ... - # end + # it 'is valid when last name only is present' do + # # ... # end + # end + # + # # good + # RSpec.describe User do + # it 'is valid' do + # # ... + # end + # + # it 'is valid', :flag do + # # ... + # end + # end # class RepeatedDescription < Base MSG = "Don't repeat descriptions within an example group." - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group?(node) repeated_descriptions(node).each do |repeated_description| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_example.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_example.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_example.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_example.rb index 7a7274aade..ce14ba64c2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_example.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_example.rb @@ -18,7 +18,7 @@ module RuboCop class RepeatedExample < Base MSG = "Don't repeat examples within an example group." - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group?(node) repeated_examples(node).each do |repeated_example| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_example_group_body.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_example_group_body.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_example_group_body.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_example_group_body.rb index 596d6d61c8..3339546891 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_example_group_body.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_example_group_body.rb @@ -6,42 +6,41 @@ module RuboCop # Check for repeated describe and context block body. # # @example + # # bad + # describe 'cool feature x' do + # it { cool_predicate } + # end # - # # bad - # describe 'cool feature x' do - # it { cool_predicate } - # end + # describe 'cool feature y' do + # it { cool_predicate } + # end # - # describe 'cool feature y' do - # it { cool_predicate } - # end + # # good + # describe 'cool feature' do + # it { cool_predicate } + # end # - # # good - # describe 'cool feature' do - # it { cool_predicate } - # end + # describe 'another cool feature' do + # it { another_predicate } + # end # - # describe 'another cool feature' do - # it { another_predicate } - # end + # # good + # context 'when case x', :tag do + # it { cool_predicate } + # end # - # # good - # context 'when case x', :tag do - # it { cool_predicate } - # end + # context 'when case y' do + # it { cool_predicate } + # end # - # context 'when case y' do - # it { cool_predicate } - # end + # # good + # context Array do + # it { is_expected.to respond_to :each } + # end # - # # good - # context Array do - # it { is_expected.to respond_to :each } - # end - # - # context Hash do - # it { is_expected.to respond_to :each } - # end + # context Hash do + # it { is_expected.to respond_to :each } + # end # class RepeatedExampleGroupBody < Base MSG = 'Repeated %s block body on line(s) %s' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_example_group_description.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_example_group_description.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_example_group_description.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_example_group_description.rb index b36b18dff3..55777318bb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_example_group_description.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_example_group_description.rb @@ -6,42 +6,41 @@ module RuboCop # Check for repeated example group descriptions. # # @example + # # bad + # describe 'cool feature' do + # # example group + # end # - # # bad - # describe 'cool feature' do - # # example group - # end + # describe 'cool feature' do + # # example group + # end # - # describe 'cool feature' do - # # example group - # end + # # bad + # context 'when case x' do + # # example group + # end # - # # bad - # context 'when case x' do - # # example group - # end + # describe 'when case x' do + # # example group + # end # - # describe 'when case x' do - # # example group - # end + # # good + # describe 'cool feature' do + # # example group + # end # - # # good - # describe 'cool feature' do - # # example group - # end + # describe 'another cool feature' do + # # example group + # end # - # describe 'another cool feature' do - # # example group - # end + # # good + # context 'when case x' do + # # example group + # end # - # # good - # context 'when case x' do - # # example group - # end - # - # context 'when another case' do - # # example group - # end + # context 'when another case' do + # # example group + # end # class RepeatedExampleGroupDescription < Base MSG = 'Repeated %s block description on line(s) %s' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_include_example.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_include_example.rb similarity index 67% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_include_example.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_include_example.rb index 90baf2b5e8..4e2e03a838 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/repeated_include_example.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/repeated_include_example.rb @@ -6,45 +6,44 @@ module RuboCop # Check for repeated include of shared examples. # # @example + # # bad + # describe 'foo' do + # include_examples 'cool stuff' + # include_examples 'cool stuff' + # end # - # # bad - # describe 'foo' do - # include_examples 'cool stuff' - # include_examples 'cool stuff' - # end + # # bad + # describe 'foo' do + # it_behaves_like 'a cool', 'thing' + # it_behaves_like 'a cool', 'thing' + # end # - # # bad - # describe 'foo' do - # it_behaves_like 'a cool', 'thing' - # it_behaves_like 'a cool', 'thing' - # end + # # bad + # context 'foo' do + # it_should_behave_like 'a duck' + # it_should_behave_like 'a duck' + # end # - # # bad - # context 'foo' do - # it_should_behave_like 'a duck' - # it_should_behave_like 'a duck' - # end + # # good + # describe 'foo' do + # include_examples 'cool stuff' + # end # - # # good - # describe 'foo' do - # include_examples 'cool stuff' - # end + # describe 'bar' do + # include_examples 'cool stuff' + # end # - # describe 'bar' do - # include_examples 'cool stuff' - # end + # # good + # describe 'foo' do + # it_behaves_like 'a cool', 'thing' + # it_behaves_like 'a cool', 'person' + # end # - # # good - # describe 'foo' do - # it_behaves_like 'a cool', 'thing' - # it_behaves_like 'a cool', 'person' - # end - # - # # good - # context 'foo' do - # it_should_behave_like 'a duck' - # it_should_behave_like 'a goose' - # end + # # good + # context 'foo' do + # it_should_behave_like 'a duck' + # it_should_behave_like 'a goose' + # end # class RepeatedIncludeExample < Base MSG = 'Repeated include of shared_examples %s ' \ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/return_from_stub.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/return_from_stub.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/return_from_stub.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/return_from_stub.rb index 759a0d32fc..3c05ef05c8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/return_from_stub.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/return_from_stub.rb @@ -59,7 +59,7 @@ module RuboCop check_and_return_call(node) end - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless style == :and_return return unless stub_with_block?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/scattered_let.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/scattered_let.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/scattered_let.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/scattered_let.rb index 8644b81e09..9b89c6b182 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/scattered_let.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/scattered_let.rb @@ -31,7 +31,7 @@ module RuboCop MSG = 'Group all let/let! blocks in the example group together.' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group_with_body?(node) check_let_declarations(node.body) @@ -53,10 +53,6 @@ module RuboCop end end end - - def find_first_let(node) - node.children.find { |child| let?(child) } - end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/scattered_setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/scattered_setup.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/scattered_setup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/scattered_setup.rb index 58312857b8..aaf117165e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/scattered_setup.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/scattered_setup.rb @@ -26,7 +26,7 @@ module RuboCop MSG = 'Do not define multiple `%s` hooks in the same ' \ 'example group (also defined on %s).' - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler return unless example_group?(node) repeated_hooks(node).each do |occurrences| diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/shared_context.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/shared_context.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/shared_context.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/shared_context.rb index 0f93f8d157..d30e83eae6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/shared_context.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/shared_context.rb @@ -79,7 +79,7 @@ module RuboCop def_node_matcher :shared_example, block_pattern('#SharedGroups.examples') - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler context_with_only_examples(node) do add_offense(node.send_node, message: MSG_EXAMPLES) do |corrector| corrector.replace(node.send_node.loc.selector, 'shared_examples') diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/shared_examples.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/shared_examples.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/shared_examples.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/shared_examples.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/single_argument_message_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/single_argument_message_chain.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/single_argument_message_chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/single_argument_message_chain.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/stubbed_mock.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/stubbed_mock.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/stubbed_mock.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/stubbed_mock.rb index 43646dda66..9d00083d17 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/stubbed_mock.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/stubbed_mock.rb @@ -6,7 +6,6 @@ module RuboCop # Checks that message expectations do not have a configured response. # # @example - # # # bad # expect(foo).to receive(:bar).with(42).and_return("hello world") # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/subject_declaration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/subject_declaration.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/subject_declaration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/subject_declaration.rb index ce4d948a64..47e8b74159 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/subject_declaration.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/subject_declaration.rb @@ -6,7 +6,6 @@ module RuboCop # Ensure that subject is defined using subject helper. # # @example - # # # bad # let(:subject) { foo } # let!(:subject) { foo } diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/subject_stub.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/subject_stub.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/subject_stub.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/subject_stub.rb index 588f184893..3edb2592a7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/subject_stub.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/subject_stub.rb @@ -11,7 +11,7 @@ module RuboCop # when subject is also defined in parent example groups. # # @see https://robots.thoughtbot.com/don-t-stub-the-system-under-test - # @see https://samphippen.com/introducing-rspec-smells-and-where-to-find-them#smell-1-stubject + # @see https://penelope.zone/2015/12/27/introducing-rspec-smells-and-where-to-find-them.html#smell-1-stubjec # @see https://github.com/rubocop-hq/rspec-style-guide#dont-stub-subject # # @example @@ -72,7 +72,7 @@ module RuboCop def_node_matcher :subject?, <<-PATTERN (block (send nil? - {:subject (sym $_) | $:subject} + { #Subjects.all (sym $_) | $#Subjects.all } ) args ...) PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/unspecified_exception.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/unspecified_exception.rb similarity index 70% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/unspecified_exception.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/unspecified_exception.rb index 257aafc281..d169f02c15 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/unspecified_exception.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/unspecified_exception.rb @@ -10,26 +10,26 @@ module RuboCop # to `raise_error` # # @example + # # bad + # expect { + # raise StandardError.new('error') + # }.to raise_error # - # # bad - # expect { - # raise StandardError.new('error') - # }.to raise_error + # # good + # expect { + # raise StandardError.new('error') + # }.to raise_error(StandardError) # - # # good - # expect { - # raise StandardError.new('error') - # }.to raise_error(StandardError) + # expect { + # raise StandardError.new('error') + # }.to raise_error('error') # - # expect { - # raise StandardError.new('error') - # }.to raise_error('error') + # expect { + # raise StandardError.new('error') + # }.to raise_error(/err/) # - # expect { - # raise StandardError.new('error') - # }.to raise_error(/err/) + # expect { do_something }.not_to raise_error # - # expect { do_something }.not_to raise_error class UnspecifiedException < Base MSG = 'Specify the exception being captured' RESTRICT_ON_SEND = %i[to].freeze diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/variable_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/variable_definition.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/variable_definition.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/variable_definition.rb index 3df2fc6d38..089c87ddc6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/variable_definition.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/variable_definition.rb @@ -22,6 +22,7 @@ module RuboCop # # good # subject('user') { create_user } # let('user_name') { 'Adam' } + # class VariableDefinition < Base extend AutoCorrector include ConfigurableEnforcedStyle diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/variable_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/variable_name.rb similarity index 81% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/variable_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/variable_name.rb index ed93a6e284..ae5563c1d6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/variable_name.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/variable_name.rb @@ -5,7 +5,7 @@ module RuboCop module RSpec # Checks that memoized helper names use the configured style. # - # Variables can be excluded from checking using the `IgnoredPatterns` + # Variables can be excluded from checking using the `AllowedPatterns` # option. # # @example EnforcedStyle: snake_case (default) @@ -26,22 +26,21 @@ module RuboCop # subject(:userName1) { 'Adam' } # let(:userName2) { 'Adam' } # - # @example IgnoredPatterns configuration - # + # @example AllowedPatterns configuration # # rubocop.yml # # RSpec/VariableName: # # EnforcedStyle: snake_case - # # IgnoredPatterns: + # # AllowedPatterns: # # - ^userFood # # @example - # # okay because it matches the `^userFood` regex in `IgnoredPatterns` + # # okay because it matches the `^userFood` regex in `AllowedPatterns` # subject(:userFood_1) { 'spaghetti' } # let(:userFood_2) { 'fettuccine' } # class VariableName < Base include ConfigurableNaming - include IgnoredPattern + include AllowedPattern include Variable MSG = 'Use %