diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 20f8839f1c..3e115fa9b2 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,6 +1,6 @@ name: New issue for Reproducible Bug description: "If you're sure it's reproducible and not just your machine: submit an issue so we can investigate." -labels: [bug] +type: "Bug" body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml index b96a27f18b..fa8cbb4b38 100644 --- a/.github/ISSUE_TEMPLATE/feature.yml +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -1,6 +1,6 @@ name: New issue for Feature Suggestion description: Request our thoughts on your suggestion for a new feature for Homebrew. -labels: features +type: "Feature" body: - type: markdown attributes: diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 417a3aaeac..f08563b11c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -14,6 +14,7 @@ updates: artifacts: patterns: - actions/*-artifact + open-pull-requests-limit: 10 - package-ecosystem: bundler directory: /Library/Homebrew @@ -25,6 +26,7 @@ updates: sorbet: patterns: - "sorbet*" + open-pull-requests-limit: 10 - package-ecosystem: npm directory: / @@ -32,6 +34,7 @@ updates: interval: daily allow: - dependency-type: all + open-pull-requests-limit: 10 - package-ecosystem: docker directory: / @@ -39,6 +42,7 @@ updates: interval: daily allow: - dependency-type: all + open-pull-requests-limit: 10 - package-ecosystem: devcontainers directory: / @@ -46,6 +50,7 @@ updates: interval: daily allow: - dependency-type: all + open-pull-requests-limit: 10 - package-ecosystem: pip directory: / @@ -53,6 +58,7 @@ updates: interval: daily allow: - dependency-type: all + open-pull-requests-limit: 10 - package-ecosystem: pip directory: /Library/Homebrew/formula-analytics/ @@ -60,3 +66,4 @@ updates: interval: daily allow: - dependency-type: all + open-pull-requests-limit: 10 diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 0475c337e4..310fe401fa 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -57,7 +57,7 @@ jobs: zizmor --format sarif . > results.sarif || true - name: Upload SARIF file - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 with: name: results.sarif path: results.sarif @@ -72,13 +72,13 @@ jobs: security-events: write steps: - name: Download SARIF file - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 with: name: results.sarif path: results.sarif - name: Upload SARIF file - uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 + uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 with: sarif_file: results.sarif category: zizmor diff --git a/.github/workflows/autogenerated-files.yml b/.github/workflows/autogenerated-files.yml index bd0bf5cd45..752408d08a 100644 --- a/.github/workflows/autogenerated-files.yml +++ b/.github/workflows/autogenerated-files.yml @@ -34,7 +34,7 @@ jobs: test-bot: true - name: Cache Bundler RubyGems - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 10e0bc4e8e..b279cfe0c3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -28,7 +28,7 @@ jobs: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 + uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 with: languages: ruby config: | @@ -36,4 +36,4 @@ jobs: - Library/Homebrew/vendor - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 + uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d86215f7ca..9b0ddf1f3b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -37,7 +37,7 @@ jobs: run: git fetch origin master - name: Set up Docker Buildx - uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3.9.0 + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 with: cache-binary: false @@ -112,7 +112,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build Docker image - uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0 + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 with: context: . load: true @@ -141,7 +141,7 @@ jobs: - name: Deploy the tagged Docker image if: steps.attributes.outputs.push == 'true' - uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0 + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 with: context: . push: true diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f0269acf64..a44e31398e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -53,7 +53,7 @@ jobs: run: vale docs/ - name: Install Ruby - uses: ruby/setup-ruby@d781c1b4ed31764801bfae177617bb0446f5ef8d # v1.218.0 + uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # v1.221.0 with: bundler-cache: true working-directory: docs diff --git a/.github/workflows/pkg-installer.yml b/.github/workflows/pkg-installer.yml index f98f0d7e92..8f371bfdba 100644 --- a/.github/workflows/pkg-installer.yml +++ b/.github/workflows/pkg-installer.yml @@ -133,12 +133,12 @@ jobs: fi - name: Generate build provenance - uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0 + uses: actions/attest-build-provenance@bd77c077858b8d561b7a36cbe48ef4cc642ca39d # v2.2.2 with: subject-path: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg - name: Upload installer to GitHub Actions - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 with: name: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg path: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg @@ -160,7 +160,7 @@ jobs: name: macos-15-arm64 steps: - name: Download installer from GitHub Actions - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 with: name: "${{ needs.build.outputs.installer_path }}" @@ -213,7 +213,7 @@ jobs: contents: write steps: - name: Download installer from GitHub Actions - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 with: name: "${{ needs.build.outputs.installer_path }}" diff --git a/.github/workflows/rubydoc.yml b/.github/workflows/rubydoc.yml index 9580c363b1..bbf4fdbf5a 100644 --- a/.github/workflows/rubydoc.yml +++ b/.github/workflows/rubydoc.yml @@ -43,7 +43,7 @@ jobs: persist-credentials: false - name: Install Ruby - uses: ruby/setup-ruby@d781c1b4ed31764801bfae177617bb0446f5ef8d # v1.218.0 + uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # v1.221.0 with: bundler-cache: true working-directory: rubydoc diff --git a/.github/workflows/sponsors-maintainers-man-completions.yml b/.github/workflows/sponsors-maintainers-man-completions.yml index 110cf3cb86..c1a59d02fb 100644 --- a/.github/workflows/sponsors-maintainers-man-completions.yml +++ b/.github/workflows/sponsors-maintainers-man-completions.yml @@ -50,7 +50,7 @@ jobs: signing_key: ${{ secrets.BREWTESTBOT_SSH_SIGNING_KEY }} - name: Cache Bundler RubyGems - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 631d86d86a..5123481f58 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,7 +40,7 @@ jobs: test-bot: false - name: Cache Bundler RubyGems - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} key: ${{ runner.os }}-rubygems-syntax-${{ steps.set-up-homebrew.outputs.gems-hash }} @@ -53,7 +53,7 @@ jobs: run: brew install shellcheck shfmt - name: Cache style cache - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: ~/.cache/Homebrew/style key: syntax-style-cache-${{ github.sha }} @@ -92,7 +92,7 @@ jobs: test-bot: true - name: Cache Bundler RubyGems - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} key: ${{ runner.os }}-rubygems-tap-syntax-${{ steps.set-up-homebrew.outputs.gems-hash }} @@ -102,7 +102,7 @@ jobs: run: brew install-bundler-gems --groups=style - name: Cache style cache - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: ~/.cache/Homebrew/style key: tap-syntax-style-cache-${{ github.sha }} @@ -242,6 +242,7 @@ jobs: name: ${{ matrix.name }} needs: syntax runs-on: ${{ matrix.runs-on }} + container: ${{ matrix.container }} strategy: matrix: include: @@ -259,7 +260,8 @@ jobs: runs-on: ubuntu-22.04 - name: tests (Ubuntu 20.04) test-flags: --coverage - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + container: ghcr.io/homebrew/ubuntu20.04:latest - name: tests (macOS 13 x86_64) test-flags: --coverage runs-on: macos-13 @@ -279,7 +281,7 @@ jobs: test-bot: false - name: Cache Bundler RubyGems - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} key: ${{ matrix.runs-on }}-tests-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} @@ -294,7 +296,7 @@ jobs: run: mkdir tests - name: Cache parallel tests log - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: tests key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec-${{ github.sha }} @@ -341,14 +343,14 @@ jobs: filenames=$(find Library/Homebrew/test/junit -name 'rspec*.xml' -print | tr '\n' ',') echo "filenames=${filenames%,}" >> "$GITHUB_OUTPUT" - - uses: codecov/test-results-action@44ecb3a270cd942bdf0fa8f2ce14cb32493e810a # v1.0.3 + - uses: codecov/test-results-action@5c441a7bcc06f8706cde90192857d337c5dab8a6 # v1.0.4 with: working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} files: ${{ steps.junit_xml.outputs.filenames }} disable_search: true token: ${{ secrets.CODECOV_TOKEN }} - - uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 + - uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0 with: working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} files: Library/Homebrew/test/coverage/coverage.xml @@ -364,12 +366,15 @@ jobs: strategy: matrix: include: + - name: test default formula (Ubuntu 24.04) + runs-on: ubuntu-latest + container: ghcr.io/homebrew/ubuntu24.04:latest - name: test default formula (Ubuntu 22.04) runs-on: ubuntu-latest container: ghcr.io/homebrew/ubuntu22.04:master - name: test default formula (Ubuntu 20.04) runs-on: ubuntu-latest - container: ghcr.io/homebrew/ubuntu20.04 + container: ghcr.io/homebrew/ubuntu20.04:latest - name: test default formula (macOS 13 x86_64) runs-on: macos-13 - name: test default formula (macOS 15 arm64) @@ -415,7 +420,7 @@ jobs: - name: Cache Homebrew Bundler RubyGems id: cache - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} diff --git a/.github/workflows/vendor-gems.yml b/.github/workflows/vendor-gems.yml index e69cf92f41..feb0dcafd9 100644 --- a/.github/workflows/vendor-gems.yml +++ b/.github/workflows/vendor-gems.yml @@ -92,7 +92,7 @@ jobs: fi - name: Generate push token - uses: actions/create-github-app-token@67e27a7eb7db372a1c61a7f9bdab8699e9ee57f7 # v1.11.3 + uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6 id: app-token if: github.event_name == 'workflow_dispatch' with: diff --git a/.gitignore b/.gitignore index 8823009012..0c7a0e9c0f 100644 --- a/.gitignore +++ b/.gitignore @@ -90,6 +90,7 @@ **/vendor/bundle/ruby/*/gems/json_schemer-*/ **/vendor/bundle/ruby/*/gems/kramdown-*/ **/vendor/bundle/ruby/*/gems/language_server-protocol-*/ +**/vendor/bundle/ruby/*/gems/lint_roller-*/ **/vendor/bundle/ruby/*/gems/logger-*/ **/vendor/bundle/ruby/*/gems/method_source-*/ **/vendor/bundle/ruby/*/gems/mini_portile2-*/ diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index c45838da8c..7259c42a9b 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -1,9 +1,14 @@ --- +plugins: + - rubocop-md: + plugin_class_name: RuboCop::Markdown::Plugin + - rubocop-performance: + plugin_class_name: RuboCop::Performance::Plugin + - rubocop-rspec: + plugin_class_name: RuboCop::RSpec::Plugin + require: - ./Homebrew/rubocops.rb - - rubocop-md - - rubocop-performance - - rubocop-rspec - rubocop-sorbet inherit_mode: @@ -255,6 +260,11 @@ RSpec/Focus: RSpec/MessageSpies: EnforcedStyle: receive +# These are legacy violations that we should try to fix. +Sorbet/AllowIncompatibleOverride: + Exclude: + - "Homebrew/livecheck/strategy/*.rb" + # Try getting rid of these. Sorbet/ConstantsFromStrings: Enabled: false diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 8028d7eda5..ae914193d9 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -10,13 +10,13 @@ GEM bindata (2.5.0) coderay (1.1.3) concurrent-ruby (1.3.5) - diff-lcs (1.5.1) + diff-lcs (1.6.0) docile (1.4.1) elftools (1.3.1) bindata (~> 2) erubi (1.13.1) hana (1.3.7) - json (2.9.1) + json (2.10.1) json_schemer (2.4.0) bigdecimal hana (~> 1.3) @@ -25,12 +25,13 @@ GEM kramdown (2.5.1) rexml (>= 3.3.9) language_server-protocol (3.17.0.4) - logger (1.6.5) + lint_roller (1.1.0) + logger (1.6.6) method_source (1.1.0) minitest (5.25.4) netrc (0.11.0) parallel (1.26.3) - parallel_tests (4.9.0) + parallel_tests (5.0.1) parallel parser (3.3.7.1) ast (~> 2.4.1) @@ -51,9 +52,9 @@ GEM sorbet-runtime (>= 0.5.9204) rbs (3.8.1) logger - redcarpet (3.6.0) + redcarpet (3.6.1) regexp_parser (2.10.0) - rexml (3.4.0) + rexml (3.4.1) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -75,9 +76,10 @@ GEM rspec-support (3.13.2) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.71.2) + rubocop (1.73.2) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) @@ -85,18 +87,21 @@ GEM rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.38.0) + rubocop-ast (1.38.1) parser (>= 3.3.1.0) - rubocop-md (1.2.4) - rubocop (>= 1.45) - rubocop-performance (1.23.1) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (3.4.0) - rubocop (~> 1.61) - rubocop-sorbet (0.8.7) + rubocop-md (2.0.0) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) + rubocop-performance (1.24.0) + lint_roller (~> 1.1) + rubocop (>= 1.72.1, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-rspec (3.5.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-sorbet (0.8.9) rubocop (>= 1) - ruby-lsp (0.23.9) + ruby-lsp (0.23.11) language_server-protocol (~> 3.17.0) prism (>= 1.2, < 2.0) rbs (>= 3, < 4) @@ -114,23 +119,23 @@ GEM simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) simpleidn (0.2.3) - sorbet (0.5.11812) - sorbet-static (= 0.5.11812) - sorbet-runtime (0.5.11812) - sorbet-static (0.5.11812-aarch64-linux) - sorbet-static (0.5.11812-universal-darwin) - sorbet-static (0.5.11812-x86_64-linux) - sorbet-static-and-runtime (0.5.11812) - sorbet (= 0.5.11812) - sorbet-runtime (= 0.5.11812) - spoom (1.5.3) + sorbet (0.5.11888) + sorbet-static (= 0.5.11888) + sorbet-runtime (0.5.11888) + sorbet-static (0.5.11888-aarch64-linux) + sorbet-static (0.5.11888-universal-darwin) + sorbet-static (0.5.11888-x86_64-linux) + sorbet-static-and-runtime (0.5.11888) + sorbet (= 0.5.11888) + sorbet-runtime (= 0.5.11888) + spoom (1.5.4) erubi (>= 1.10.0) prism (>= 0.28.0) rbi (>= 0.2.3) sorbet-static-and-runtime (>= 0.5.10187) thor (>= 0.19.2) stackprof (0.2.27) - tapioca (0.16.9) + tapioca (0.16.11) benchmark bundler (>= 2.2.25) netrc (>= 0.11.0) @@ -153,7 +158,6 @@ GEM PLATFORMS aarch64-linux - arm-linux arm64-darwin x86_64-darwin x86_64-linux diff --git a/Library/Homebrew/attrable.rb b/Library/Homebrew/attrable.rb deleted file mode 100644 index 8dd176ef24..0000000000 --- a/Library/Homebrew/attrable.rb +++ /dev/null @@ -1,30 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -# This module provides methods to define specialized attributes. -# Method stubs are generated by the {Tapioca::Compilers::Attrables} compiler. -# @note The compiler is fragile, and must be updated if the filename changes, if methods are added or removed, -# or if a method's arity changes. -module Attrable - extend T::Helpers - - requires_ancestor { Module } - - sig { params(attrs: Symbol).void } - def attr_predicate(*attrs) - attrs.each do |attr| - define_method attr do - instance_variable_get("@#{attr.to_s.sub(/\?$/, "")}") == true - end - end - end - - sig { params(attrs: Symbol).void } - def attr_rw(*attrs) - attrs.each do |attr| - define_method attr do |val = nil| - val.nil? ? instance_variable_get(:"@#{attr}") : instance_variable_set(:"@#{attr}", val) - end - end - end -end diff --git a/Library/Homebrew/bottle_specification.rb b/Library/Homebrew/bottle_specification.rb index 556659a8ee..1984a3c64e 100644 --- a/Library/Homebrew/bottle_specification.rb +++ b/Library/Homebrew/bottle_specification.rb @@ -2,10 +2,8 @@ # frozen_string_literal: true class BottleSpecification - extend Attrable RELOCATABLE_CELLARS = [:any, :any_skip_relocation].freeze - attr_rw :rebuild attr_accessor :tap attr_reader :collector, :root_url_specs, :repository @@ -17,6 +15,11 @@ class BottleSpecification @root_url_specs = {} end + sig { params(val: Integer).returns(T.nilable(Integer)) } + def rebuild(val = T.unsafe(nil)) + val.nil? ? @rebuild : @rebuild = val + end + def root_url(var = nil, specs = {}) if var.nil? @root_url ||= if (github_packages_url = GitHubPackages.root_url_if_match(Homebrew::EnvConfig.bottle_domain)) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index ee48f55738..d74fc2578b 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -969,13 +969,6 @@ then export HOMEBREW_DEVELOPER_COMMAND="1" fi -# Provide a (temporary, undocumented) way to disable Sorbet globally if needed -# to avoid reverting the above. -if [[ -n "${HOMEBREW_NO_SORBET_RUNTIME}" ]] -then - unset HOMEBREW_SORBET_RUNTIME -fi - if [[ -n "${HOMEBREW_DEVELOPER_COMMAND}" && -z "${HOMEBREW_DEVELOPER}" ]] then if [[ -z "${HOMEBREW_DEV_CMD_RUN}" ]] @@ -999,6 +992,13 @@ then export HOMEBREW_SORBET_RUNTIME="1" fi +# Provide a (temporary, undocumented) way to disable Sorbet globally if needed +# to avoid reverting the above. +if [[ -n "${HOMEBREW_NO_SORBET_RUNTIME}" ]] +then + unset HOMEBREW_SORBET_RUNTIME +fi + if [[ -f "${HOMEBREW_LIBRARY}/Homebrew/cmd/${HOMEBREW_COMMAND}.sh" ]] then HOMEBREW_BASH_COMMAND="${HOMEBREW_LIBRARY}/Homebrew/cmd/${HOMEBREW_COMMAND}.sh" diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index ae869d5e08..7827a93609 100644 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -148,12 +148,15 @@ class Build # https://github.com/Homebrew/homebrew-core/pull/87470 TZ: "UTC0", ) do - formula.patch - if args.git? + formula.selective_patch(is_data: false) system "git", "init" system "git", "add", "-A" + formula.selective_patch(is_data: true) + else + formula.patch end + if args.interactive? ohai "Entering interactive mode..." puts <<~EOS @@ -185,6 +188,8 @@ class Build # Find and link metafiles formula.prefix.install_metafiles formula.buildpath formula.prefix.install_metafiles formula.libexec if formula.libexec.exist? + + normalize_pod2man_outputs!(formula) end end end @@ -214,6 +219,11 @@ class Build rescue raise "#{formula.opt_prefix} not present or broken\nPlease reinstall #{formula.full_name}. Sorry :(" end + + def normalize_pod2man_outputs!(formula) + keg = Keg.new(formula.prefix) + keg.normalize_pod2man_outputs! + end end begin diff --git a/Library/Homebrew/cask/artifact.rb b/Library/Homebrew/cask/artifact.rb index eab26b9f43..02b1298b55 100644 --- a/Library/Homebrew/cask/artifact.rb +++ b/Library/Homebrew/cask/artifact.rb @@ -22,6 +22,9 @@ require "cask/artifact/prefpane" require "cask/artifact/qlplugin" require "cask/artifact/mdimporter" require "cask/artifact/screen_saver" +require "cask/artifact/bashcompletion" +require "cask/artifact/fishcompletion" +require "cask/artifact/zshcompletion" require "cask/artifact/service" require "cask/artifact/stage_only" require "cask/artifact/suite" diff --git a/Library/Homebrew/cask/artifact/abstract_artifact.rb b/Library/Homebrew/cask/artifact/abstract_artifact.rb index 7a509970f9..09ed1fabe8 100644 --- a/Library/Homebrew/cask/artifact/abstract_artifact.rb +++ b/Library/Homebrew/cask/artifact/abstract_artifact.rb @@ -1,7 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" require "extend/object/deep_dup" module Cask diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index 2242b7961a..0c9edb929d 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -411,7 +411,7 @@ module Cask next end - if MacOS.undeletable?(resolved_path) + if undeletable?(resolved_path) opoo "Skipping #{Formatter.identifier(action)} for undeletable path '#{path}'." next end @@ -538,6 +538,10 @@ module Cask recursive_rmdir(*resolved_paths, **kwargs) end end + + def undeletable?(target); end end end end + +require "extend/os/cask/artifact/abstract_uninstall" diff --git a/Library/Homebrew/cask/artifact/bashcompletion.rb b/Library/Homebrew/cask/artifact/bashcompletion.rb new file mode 100644 index 0000000000..3ffe7c6833 --- /dev/null +++ b/Library/Homebrew/cask/artifact/bashcompletion.rb @@ -0,0 +1,25 @@ +# typed: strict +# frozen_string_literal: true + +require "cask/artifact/shellcompletion" + +module Cask + module Artifact + # Artifact corresponding to the `bash_completion` stanza. + class BashCompletion < ShellCompletion + sig { params(target: T.any(String, Pathname)).returns(Pathname) } + def resolve_target(target) + name = if File.extname(target).nil? + target + else + new_name = File.basename(target, File.extname(target)) + odebug "Renaming completion #{target} to #{new_name}" + + new_name + end + + config.bash_completion/name + end + end + end +end diff --git a/Library/Homebrew/cask/artifact/fishcompletion.rb b/Library/Homebrew/cask/artifact/fishcompletion.rb new file mode 100644 index 0000000000..ef4e13c8cd --- /dev/null +++ b/Library/Homebrew/cask/artifact/fishcompletion.rb @@ -0,0 +1,25 @@ +# typed: strict +# frozen_string_literal: true + +require "cask/artifact/shellcompletion" + +module Cask + module Artifact + # Artifact corresponding to the `fish_completion` stanza. + class FishCompletion < ShellCompletion + sig { params(target: T.any(String, Pathname)).returns(Pathname) } + def resolve_target(target) + name = if target.to_s.end_with? ".fish" + target + else + new_name = "#{File.basename(target, File.extname(target))}.fish" + odebug "Renaming completion #{target} to #{new_name}" + + new_name + end + + config.fish_completion/name + end + end + end +end diff --git a/Library/Homebrew/cask/artifact/relocated.rb b/Library/Homebrew/cask/artifact/relocated.rb index c1b327a79d..dc01d74545 100644 --- a/Library/Homebrew/cask/artifact/relocated.rb +++ b/Library/Homebrew/cask/artifact/relocated.rb @@ -72,6 +72,7 @@ module Cask private ALT_NAME_ATTRIBUTE = "com.apple.metadata:kMDItemAlternateNames" + private_constant :ALT_NAME_ATTRIBUTE # Try to make the asset searchable under the target name. Spotlight # respects this attribute for many filetypes, but ignores it for App diff --git a/Library/Homebrew/cask/artifact/shellcompletion.rb b/Library/Homebrew/cask/artifact/shellcompletion.rb new file mode 100644 index 0000000000..d39d1f6913 --- /dev/null +++ b/Library/Homebrew/cask/artifact/shellcompletion.rb @@ -0,0 +1,20 @@ +# typed: strict +# frozen_string_literal: true + +require "cask/artifact/symlinked" + +module Cask + module Artifact + class ShellCompletion < Symlinked + sig { params(cask: Cask, source: T.any(String, Pathname)).returns(ShellCompletion) } + def self.from_args(cask, source) + new(cask, source) + end + + sig { params(_: T.any(String, Pathname)).returns(Pathname) } + def resolve_target(_) + raise CaskInvalidError, "Shell completion without shell info" + end + end + end +end diff --git a/Library/Homebrew/cask/artifact/symlinked.rb b/Library/Homebrew/cask/artifact/symlinked.rb index 170ecc5367..3ed0f956b6 100644 --- a/Library/Homebrew/cask/artifact/symlinked.rb +++ b/Library/Homebrew/cask/artifact/symlinked.rb @@ -62,7 +62,7 @@ module Cask end ohai "Linking #{self.class.english_name} '#{source.basename}' to '#{target}'" - create_filesystem_link(command:) + create_filesystem_link(command) end def unlink(command: nil, **) @@ -72,14 +72,10 @@ module Cask Utils.gain_permissions_remove(target, command:) end - def create_filesystem_link(command: nil) - Utils.gain_permissions_mkpath(target.dirname, command:) - - command.run! "/bin/ln", args: ["-h", "-f", "-s", "--", source, target], - sudo: !target.dirname.writable? - - add_altname_metadata(source, target.basename, command:) - end + sig { params(command: T.class_of(SystemCommand)).void } + def create_filesystem_link(command); end end end end + +require "extend/os/cask/artifact/symlinked" diff --git a/Library/Homebrew/cask/artifact/zshcompletion.rb b/Library/Homebrew/cask/artifact/zshcompletion.rb new file mode 100644 index 0000000000..971de91857 --- /dev/null +++ b/Library/Homebrew/cask/artifact/zshcompletion.rb @@ -0,0 +1,25 @@ +# typed: strict +# frozen_string_literal: true + +require "cask/artifact/shellcompletion" + +module Cask + module Artifact + # Artifact corresponding to the `zsh_completion` stanza. + class ZshCompletion < ShellCompletion + sig { params(target: T.any(String, Pathname)).returns(Pathname) } + def resolve_target(target) + name = if target.to_s.start_with? "_" + target + else + new_name = "_#{File.basename(target, File.extname(target))}" + odebug "Renaming completion #{target} to #{new_name}" + + new_name + end + + config.zsh_completion/name + end + end + end +end diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index cd243526d8..0a64100adc 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -1,7 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" require "cask/denylist" require "cask/download" require "digest" @@ -19,7 +18,6 @@ module Cask class Audit include SystemCommand::Mixin include ::Utils::Curl - extend Attrable sig { returns(Cask) } attr_reader :cask @@ -27,11 +25,16 @@ module Cask sig { returns(T.nilable(Download)) } attr_reader :download - attr_predicate :new_cask?, :strict?, :signing?, :online?, :token_conflicts? - + sig { + params( + cask: ::Cask::Cask, download: T::Boolean, quarantine: T::Boolean, token_conflicts: T.nilable(T::Boolean), + online: T.nilable(T::Boolean), strict: T.nilable(T::Boolean), signing: T.nilable(T::Boolean), + new_cask: T.nilable(T::Boolean), only: T::Array[String], except: T::Array[String] + ).void + } def initialize( cask, - download: nil, quarantine: nil, + download: false, quarantine: false, token_conflicts: nil, online: nil, strict: nil, signing: nil, new_cask: nil, only: [], except: [] ) @@ -42,7 +45,7 @@ module Cask token_conflicts = new_cask if token_conflicts.nil? # `online` and `signing` imply `download` - download = online || signing if download.nil? + download ||= online || signing @cask = cask @download = Download.new(cask, quarantine:) if download @@ -51,18 +54,34 @@ module Cask @signing = signing @new_cask = new_cask @token_conflicts = token_conflicts - @only = only || [] - @except = except || [] + @only = only + @except = except end + sig { returns(T::Boolean) } + def new_cask? = !!@new_cask + + sig { returns(T::Boolean) } + def online? =!!@online + + sig { returns(T::Boolean) } + def signing? = !!@signing + + sig { returns(T::Boolean) } + def strict? = !!@strict + + sig { returns(T::Boolean) } + def token_conflicts? = !!@token_conflicts + + sig { returns(::Cask::Audit) } def run! only_audits = @only except_audits = @except private_methods.map(&:to_s).grep(/^audit_/).each do |audit_method_name| name = audit_method_name.delete_prefix("audit_") - next if !only_audits.empty? && only_audits&.exclude?(name) - next if except_audits&.include?(name) + next if !only_audits.empty? && only_audits.exclude?(name) + next if except_audits.include?(name) send(audit_method_name) end @@ -292,6 +311,7 @@ module Cask end LIVECHECK_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#stanza-livecheck" + private_constant :LIVECHECK_REFERENCE_URL sig { params(livecheck_result: T.any(NilClass, T::Boolean, Symbol)).void } def audit_hosting_with_livecheck(livecheck_result: audit_livecheck_version) @@ -317,6 +337,7 @@ module Cask end SOURCEFORGE_OSDN_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#sourceforgeosdn-urls" + private_constant :SOURCEFORGE_OSDN_REFERENCE_URL sig { void } def audit_download_url_format @@ -339,6 +360,7 @@ module Cask end VERIFIED_URL_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#when-url-and-homepage-domains-differ-add-verified" + private_constant :VERIFIED_URL_REFERENCE_URL sig { void } def audit_unnecessary_verified diff --git a/Library/Homebrew/cask/auditor.rb b/Library/Homebrew/cask/auditor.rb index f79de72185..0af5f20860 100644 --- a/Library/Homebrew/cask/auditor.rb +++ b/Library/Homebrew/cask/auditor.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "cask/audit" @@ -6,22 +6,50 @@ require "cask/audit" module Cask # Helper class for auditing all available languages of a cask. class Auditor - def self.audit(cask, **options) - new(cask, **options).audit + # TODO: use argument forwarding (...) when Sorbet supports it in strict mode + sig { + params( + cask: ::Cask::Cask, audit_download: T::Boolean, audit_online: T.nilable(T::Boolean), + audit_strict: T.nilable(T::Boolean), audit_signing: T.nilable(T::Boolean), + audit_token_conflicts: T.nilable(T::Boolean), audit_new_cask: T.nilable(T::Boolean), quarantine: T::Boolean, + any_named_args: T::Boolean, language: T.nilable(String), only: T::Array[String], except: T::Array[String] + ).returns(T::Set[String]) + } + def self.audit( + cask, audit_download: false, audit_online: nil, audit_strict: nil, audit_signing: nil, + audit_token_conflicts: nil, audit_new_cask: nil, quarantine: false, any_named_args: false, language: nil, + only: [], except: [] + ) + new( + cask, audit_download:, audit_online:, audit_strict:, audit_signing:, audit_token_conflicts:, + audit_new_cask:, quarantine:, any_named_args:, language:, only:, except: + ).audit end - attr_reader :cask, :language + sig { returns(::Cask::Cask) } + attr_reader :cask + sig { returns(T.nilable(String)) } + attr_reader :language + + sig { + params( + cask: ::Cask::Cask, audit_download: T::Boolean, audit_online: T.nilable(T::Boolean), + audit_strict: T.nilable(T::Boolean), audit_signing: T.nilable(T::Boolean), + audit_token_conflicts: T.nilable(T::Boolean), audit_new_cask: T.nilable(T::Boolean), quarantine: T::Boolean, + any_named_args: T::Boolean, language: T.nilable(String), only: T::Array[String], except: T::Array[String] + ).void + } def initialize( cask, - audit_download: nil, + audit_download: false, audit_online: nil, audit_strict: nil, audit_signing: nil, audit_token_conflicts: nil, audit_new_cask: nil, - quarantine: nil, - any_named_args: nil, + quarantine: false, + any_named_args: false, language: nil, only: [], except: [] @@ -42,17 +70,18 @@ module Cask LANGUAGE_BLOCK_LIMIT = 10 + sig { returns(T::Set[String]) } def audit errors = Set.new - if !language && language_blocks - sample_languages = if language_blocks.length > LANGUAGE_BLOCK_LIMIT && !@audit_new_cask - sample_keys = language_blocks.keys.sample(LANGUAGE_BLOCK_LIMIT) + if !language && (blocks = language_blocks) + sample_languages = if blocks.length > LANGUAGE_BLOCK_LIMIT && !@audit_new_cask + sample_keys = T.must(blocks.keys.sample(LANGUAGE_BLOCK_LIMIT)) ohai "Auditing a sample of available languages for #{cask}: " \ "#{sample_keys.map { |lang| lang[0].to_s }.to_sentence}" - language_blocks.select { |k| sample_keys.include?(k) } + blocks.select { |k| sample_keys.include?(k) } else - language_blocks + blocks end sample_languages.each_key do |l| @@ -74,14 +103,16 @@ module Cask private + sig { params(audit: T.nilable(Audit)).returns(T::Boolean) } def output_summary?(audit = nil) - return true if @any_named_args.present? - return true if @audit_strict.present? - return false if audit.blank? + return true if @any_named_args + return true if @audit_strict + return false if audit.nil? audit.errors? end + sig { params(languages: T::Array[String]).returns(::Cask::Audit) } def audit_languages(languages) original_config = cask.config localized_config = original_config.merge(Config.new(explicit: { languages: })) @@ -92,6 +123,7 @@ module Cask cask.config = original_config end + sig { params(cask: ::Cask::Cask).returns(::Cask::Audit) } def audit_cask_instance(cask) audit = Audit.new( cask, @@ -108,6 +140,7 @@ module Cask audit.run! end + sig { returns(T.nilable(T::Hash[T::Array[String], T.proc.returns(T.untyped)])) } def language_blocks cask.instance_variable_get(:@dsl).instance_variable_get(:@language_blocks) end diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index ee1f6dcae6..2a787593c4 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -1,7 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" require "bundle_version" require "cask/cask_loader" require "cask/config" @@ -15,7 +14,6 @@ module Cask # An instance of a cask. class Cask extend Forwardable - extend Attrable extend APIHashable include Metadata @@ -32,8 +30,6 @@ module Cask attr_reader :sourcefile_path, :source, :default_config, :loader attr_accessor :download, :allow_reassignment - attr_predicate :loaded_from_api? - def self.all(eval_all: false) if !eval_all && !Homebrew::EnvConfig.eval_all? raise ArgumentError, "Cask::Cask#all cannot be used without `--eval-all` or HOMEBREW_EVAL_ALL" @@ -92,6 +88,9 @@ module Cask end end + sig { returns(T::Boolean) } + def loaded_from_api? = @loaded_from_api + # An old name for the cask. sig { returns(T::Array[String]) } def old_tokens @@ -114,12 +113,11 @@ module Cask return unless @block @dsl.instance_eval(&@block) + @dsl.add_implicit_macos_dependency @dsl.language_eval end - ::Cask::DSL::DSL_METHODS.each do |method_name| - define_method(method_name) { |*args, &block| @dsl.send(method_name, *args, &block) } - end + def_delegators :@dsl, *::Cask::DSL::DSL_METHODS sig { params(caskroom_path: Pathname).returns(T::Array[[String, String]]) } def timestamped_versions(caskroom_path: self.caskroom_path) diff --git a/Library/Homebrew/cask/cask.rbi b/Library/Homebrew/cask/cask.rbi deleted file mode 100644 index 1f789206e3..0000000000 --- a/Library/Homebrew/cask/cask.rbi +++ /dev/null @@ -1,67 +0,0 @@ -# typed: strict - -module Cask - class Cask - def appdir; end - - def artifacts; end - - def auto_updates; end - - def caveats; end - - def conflicts_with; end - - def container; end - - def depends_on; end - - def desc; end - - def discontinued?; end - - def deprecated?; end - - def deprecation_date; end - - def deprecation_reason; end - - def deprecation_replacement; end - - def disabled?; end - - def disable_date; end - - def disable_reason; end - - def disable_replacement; end - - def homepage; end - - def language; end - - def languages; end - - def livecheck; end - - def livecheck_defined?; end - - def livecheckable?; end - - def name; end - - def on_system_blocks_exist?; end - - sig { returns(T.nilable(MacOSVersion)) } - def on_system_block_min_os; end - - def sha256; end - - def staged_path; end - - sig { returns(T.nilable(::Cask::URL)) } - def url; end - - def version; end - end -end diff --git a/Library/Homebrew/cask/config.rb b/Library/Homebrew/cask/config.rb index aa0d76dfb3..68b0f91e95 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -176,6 +176,21 @@ module Cask @manpagedir ||= T.let(HOMEBREW_PREFIX/"share/man", T.nilable(Pathname)) end + sig { returns(Pathname) } + def bash_completion + @bash_completion ||= T.let(HOMEBREW_PREFIX/"etc/bash_completion.d", T.nilable(Pathname)) + end + + sig { returns(Pathname) } + def zsh_completion + @zsh_completion ||= T.let(HOMEBREW_PREFIX/"share/zsh/site-functions", T.nilable(Pathname)) + end + + sig { returns(Pathname) } + def fish_completion + @fish_completion ||= T.let(HOMEBREW_PREFIX/"share/fish/vendor_completions.d", T.nilable(Pathname)) + end + sig { returns(T::Array[String]) } def languages [ diff --git a/Library/Homebrew/cask/dsl.rb b/Library/Homebrew/cask/dsl.rb index 434159b57a..6dc120b395 100644 --- a/Library/Homebrew/cask/dsl.rb +++ b/Library/Homebrew/cask/dsl.rb @@ -1,7 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" require "locale" require "lazy_object" require "livecheck" @@ -54,6 +53,9 @@ module Cask Artifact::Suite, Artifact::VstPlugin, Artifact::Vst3Plugin, + Artifact::ZshCompletion, + Artifact::FishCompletion, + Artifact::BashCompletion, Artifact::Uninstall, Artifact::Zap, ].freeze @@ -105,19 +107,36 @@ module Cask *ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] }, ]).freeze - extend Attrable - include OnSystem::MacOSOnly + include OnSystem::MacOSAndLinux attr_reader :cask, :token, :deprecation_date, :deprecation_reason, :deprecation_replacement, :disable_date, :disable_reason, :disable_replacement, :on_system_block_min_os - attr_predicate :deprecated?, :disabled?, :livecheck_defined?, :on_system_blocks_exist?, :depends_on_set_in_block? - def initialize(cask) @cask = cask + @depends_on_set_in_block = T.let(false, T::Boolean) + @deprecated = T.let(false, T::Boolean) + @disabled = T.let(false, T::Boolean) + @livecheck_defined = T.let(false, T::Boolean) + @on_system_blocks_exist = T.let(false, T::Boolean) @token = cask.token end + sig { returns(T::Boolean) } + def depends_on_set_in_block? = @depends_on_set_in_block + + sig { returns(T::Boolean) } + def deprecated? = @deprecated + + sig { returns(T::Boolean) } + def disabled? = @disabled + + sig { returns(T::Boolean) } + def livecheck_defined? = @livecheck_defined + + sig { returns(T::Boolean) } + def on_system_blocks_exist? = @on_system_blocks_exist + # Specifies the cask's name. # # NOTE: Multiple names can be specified. @@ -287,6 +306,7 @@ module Cask # # @see DSL::Version # @api public + sig { params(arg: T.nilable(T.any(String, Symbol))).returns(T.nilable(DSL::Version)) } def version(arg = nil) set_unique_stanza(:version, arg.nil?) do if !arg.is_a?(String) && arg != :latest @@ -310,18 +330,36 @@ module Cask # For architecture-dependent downloads: # # ```ruby - # sha256 arm: "7bdb497080ffafdfd8cc94d8c62b004af1be9599e865e5555e456e2681e150ca", - # intel: "b3c1c2442480a0219b9e05cf91d03385858c20f04b764ec08a3fa83d1b27e7b2" + # sha256 arm: "7bdb497080ffafdfd8cc94d8c62b004af1be9599e865e5555e456e2681e150ca", + # x86_64: "b3c1c2442480a0219b9e05cf91d03385858c20f04b764ec08a3fa83d1b27e7b2" + # x86_64_linux: "1a2aee7f1ddc999993d4d7d42a150c5e602bc17281678050b8ed79a0500cc90f" + # arm64_linux: "bd766af7e692afceb727a6f88e24e6e68d9882aeb3e8348412f6c03d96537c75" # ``` # # @api public - def sha256(arg = nil, arm: nil, intel: nil) - should_return = arg.nil? && arm.nil? && intel.nil? + sig { + params( + arg: T.nilable(T.any(String, Symbol)), + arm: T.nilable(String), + intel: T.nilable(String), + x86_64: T.nilable(String), + x86_64_linux: T.nilable(String), + arm64_linux: T.nilable(String), + ).returns(T.nilable(T.any(Symbol, Checksum))) + } + def sha256(arg = nil, arm: nil, intel: nil, x86_64: nil, x86_64_linux: nil, arm64_linux: nil) + should_return = arg.nil? && arm.nil? && (intel.nil? || x86_64.nil?) && x86_64_linux.nil? && arm64_linux.nil? + x86_64 ||= intel if intel.present? && x86_64.nil? set_unique_stanza(:sha256, should_return) do - @on_system_blocks_exist = true if arm.present? || intel.present? + if arm.present? || x86_64.present? || x86_64_linux.present? || arm64_linux.present? + @on_system_blocks_exist = true + end - val = arg || on_arch_conditional(arm:, intel:) + val = arg || on_system_conditional( + macos: on_arch_conditional(arm:, intel: x86_64), + linux: on_arch_conditional(arm: arm64_linux, intel: x86_64_linux), + ) case val when :no_check val @@ -352,6 +390,31 @@ module Cask end end + # Sets the cask's os strings. + # + # ### Example + # + # ```ruby + # os macos: "darwin", linux: "tux" + # ``` + # + # @api public + sig { + params( + macos: T.nilable(String), + linux: T.nilable(String), + ).returns(T.nilable(String)) + } + def os(macos: nil, linux: nil) + should_return = macos.nil? && linux.nil? + + set_unique_stanza(:os, should_return) do + @on_system_blocks_exist = true + + on_system_conditional(macos:, linux:) + end + end + # Declare dependencies and requirements for a cask. # # NOTE: Multiple dependencies can be specified. @@ -370,6 +433,13 @@ module Cask @depends_on end + # @api private + def add_implicit_macos_dependency + return if @depends_on.present? && @depends_on.macos.present? + + depends_on macos: ">= :#{MacOSVersion::SYMBOLS.key MacOSVersion::SYMBOLS.values.min}" + end + # Declare conflicts that keep a cask from installing or working correctly. # # @api public @@ -382,6 +452,7 @@ module Cask @artifacts ||= ArtifactSet.new end + sig { returns(Pathname) } def caskroom_path cask.caskroom_path end @@ -389,6 +460,7 @@ module Cask # The staged location for this cask, including version number. # # @api public + sig { returns(Pathname) } def staged_path return @staged_path if @staged_path @@ -520,9 +592,15 @@ module Cask true end + sig { returns(T.nilable(MacOSVersion)) } + def os_version + nil + end + # The directory `app`s are installed into. # # @api public + sig { returns(T.any(Pathname, String)) } def appdir return HOMEBREW_CASK_APPDIR_PLACEHOLDER if Cask.generating_hash? diff --git a/Library/Homebrew/cask/dsl/caveats.rb b/Library/Homebrew/cask/dsl/caveats.rb index cd27bf0776..9d5d38490a 100644 --- a/Library/Homebrew/cask/dsl/caveats.rb +++ b/Library/Homebrew/cask/dsl/caveats.rb @@ -1,8 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" - module Cask class DSL # Class corresponding to the `caveats` stanza. @@ -15,10 +13,6 @@ module Cask # to the output by the caller, but that feature is only for the # convenience of cask authors. class Caveats < Base - extend Attrable - - attr_predicate :discontinued? - def initialize(*args) super @built_in_caveats = {} @@ -37,6 +31,9 @@ module Cask private_class_method :caveat + sig { returns(T::Boolean) } + def discontinued? = @discontinued + sig { returns(String) } def to_s (@custom_caveats + @built_in_caveats.values).join("\n") diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index e9bbdc497d..188013086f 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -1,7 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" require "formula_installer" require "unpack_strategy" require "utils/topological_hash" @@ -17,8 +16,15 @@ require "cgi" module Cask # Installer for a {Cask}. class Installer - extend Attrable - + sig { + params( + cask: ::Cask::Cask, command: T::Class[SystemCommand], force: T::Boolean, adopt: T::Boolean, + skip_cask_deps: T::Boolean, binaries: T::Boolean, verbose: T::Boolean, zap: T::Boolean, + require_sha: T::Boolean, upgrade: T::Boolean, reinstall: T::Boolean, installed_as_dependency: T::Boolean, + installed_on_request: T::Boolean, quarantine: T::Boolean, verify_download_integrity: T::Boolean, + quiet: T::Boolean + ).void + } def initialize(cask, command: SystemCommand, force: false, adopt: false, skip_cask_deps: false, binaries: true, verbose: false, zap: false, require_sha: false, upgrade: false, reinstall: false, @@ -42,9 +48,44 @@ module Cask @quiet = quiet end - attr_predicate :binaries?, :force?, :adopt?, :skip_cask_deps?, :require_sha?, - :reinstall?, :upgrade?, :verbose?, :zap?, :installed_as_dependency?, :installed_on_request?, - :quarantine?, :quiet? + sig { returns(T::Boolean) } + def adopt? = @adopt + + sig { returns(T::Boolean) } + def binaries? = @binaries + + sig { returns(T::Boolean) } + def force? = @force + + sig { returns(T::Boolean) } + def installed_as_dependency? = @installed_as_dependency + + sig { returns(T::Boolean) } + def installed_on_request? = @installed_on_request + + sig { returns(T::Boolean) } + def quarantine? = @quarantine + + sig { returns(T::Boolean) } + def quiet? = @quiet + + sig { returns(T::Boolean) } + def reinstall? = @reinstall + + sig { returns(T::Boolean) } + def require_sha? = @require_sha + + sig { returns(T::Boolean) } + def skip_cask_deps? = @skip_cask_deps + + sig { returns(T::Boolean) } + def upgrade? = @upgrade + + sig { returns(T::Boolean) } + def verbose? = @verbose + + sig { returns(T::Boolean) } + def zap? = @zap def self.caveats(cask) odebug "Printing caveats" diff --git a/Library/Homebrew/cask/macos.rb b/Library/Homebrew/cask/macos.rb index ac1a2349b9..5b402d4089 100644 --- a/Library/Homebrew/cask/macos.rb +++ b/Library/Homebrew/cask/macos.rb @@ -1,11 +1,9 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module OS module Mac - module_function - - SYSTEM_DIRS = [ + SYSTEM_DIRS = T.let([ "/", "/Applications", "/Applications/Utilities", @@ -234,14 +232,13 @@ module OS "/var/spool/mail", "/var/tmp", ] - .map(&method(:Pathname)) - .to_set - .freeze + .to_set { Pathname(_1) } + .freeze, T::Set[Pathname]) private_constant :SYSTEM_DIRS # TODO: There should be a way to specify a containing # directory under which nothing can be deleted. - UNDELETABLE_PATHS = [ + UNDELETABLE_PATHS = T.let([ "~/", "~/Applications", "~/Applications/.localized", @@ -378,14 +375,16 @@ module OS ] .to_set { |path| Pathname(path.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path } .union(SYSTEM_DIRS) - .freeze + .freeze, T::Set[Pathname]) private_constant :UNDELETABLE_PATHS - def system_dir?(dir) + sig { params(dir: T.any(Pathname, String)).returns(T::Boolean) } + def self.system_dir?(dir) SYSTEM_DIRS.include?(Pathname.new(dir).expand_path) end - def undeletable?(path) + sig { params(path: T.any(Pathname, String)).returns(T::Boolean) } + def self.undeletable?(path) UNDELETABLE_PATHS.include?(Pathname.new(path).expand_path) end end diff --git a/Library/Homebrew/cask/reinstall.rb b/Library/Homebrew/cask/reinstall.rb index bad643b380..cdd0124606 100644 --- a/Library/Homebrew/cask/reinstall.rb +++ b/Library/Homebrew/cask/reinstall.rb @@ -1,32 +1,32 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module Cask class Reinstall + sig { + params( + casks: ::Cask::Cask, verbose: T::Boolean, force: T::Boolean, skip_cask_deps: T::Boolean, binaries: T::Boolean, + require_sha: T::Boolean, quarantine: T::Boolean, zap: T::Boolean + ).void + } def self.reinstall_casks( *casks, - verbose: nil, - force: nil, - skip_cask_deps: nil, - binaries: nil, - require_sha: nil, - quarantine: nil, - zap: nil + verbose: false, + force: false, + skip_cask_deps: false, + binaries: false, + require_sha: false, + quarantine: false, + zap: false ) require "cask/installer" quarantine = true if quarantine.nil? casks.each do |cask| - Installer.new(cask, - binaries:, - verbose:, - force:, - skip_cask_deps:, - require_sha:, - reinstall: true, - quarantine:, - zap:).install + Installer + .new(cask, binaries:, verbose:, force:, skip_cask_deps:, require_sha:, reinstall: true, quarantine:, zap:) + .install end end end diff --git a/Library/Homebrew/cask/staged.rb b/Library/Homebrew/cask/staged.rb index 43d0e8c37c..dbaa50a8f8 100644 --- a/Library/Homebrew/cask/staged.rb +++ b/Library/Homebrew/cask/staged.rb @@ -8,7 +8,7 @@ module Cask module Staged extend T::Helpers - requires_ancestor { Kernel } + requires_ancestor { ::Cask::DSL::Base } Paths = T.type_alias { T.any(String, Pathname, T::Array[T.any(String, Pathname)]) } sig { params(paths: Paths, permissions_str: String).void } diff --git a/Library/Homebrew/cask/uninstall.rb b/Library/Homebrew/cask/uninstall.rb index ebfc74ee27..38f2587e13 100644 --- a/Library/Homebrew/cask/uninstall.rb +++ b/Library/Homebrew/cask/uninstall.rb @@ -1,9 +1,10 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module Cask class Uninstall - def self.uninstall_casks(*casks, binaries: nil, force: false, verbose: false) + sig { params(casks: ::Cask::Cask, binaries: T::Boolean, force: T::Boolean, verbose: T::Boolean).void } + def self.uninstall_casks(*casks, binaries: false, force: false, verbose: false) require "cask/installer" casks.each do |cask| diff --git a/Library/Homebrew/cask/upgrade.rb b/Library/Homebrew/cask/upgrade.rb index 6e60b2415a..b6a077de52 100644 --- a/Library/Homebrew/cask/upgrade.rb +++ b/Library/Homebrew/cask/upgrade.rb @@ -42,9 +42,16 @@ module Cask greedy = true if Homebrew::EnvConfig.upgrade_greedy? + greedy_casks = if (upgrade_greedy_casks = Homebrew::EnvConfig.upgrade_greedy_casks.presence) + upgrade_greedy_casks.split + else + [] + end + outdated_casks = if casks.empty? Caskroom.casks(config: Config.from_args(args)).select do |cask| - cask.outdated?(greedy:, greedy_latest:, + cask_greedy = greedy || greedy_casks.include?(cask.token) + cask.outdated?(greedy: cask_greedy, greedy_latest:, greedy_auto_updates:) end else @@ -78,7 +85,7 @@ module Cask return false if outdated_casks.empty? - if casks.empty? && !greedy + if casks.empty? && !greedy && greedy_casks.empty? if !greedy_auto_updates && !greedy_latest ohai "Casks with 'auto_updates true' or 'version :latest' " \ "will not be upgraded; pass `--greedy` to upgrade them." diff --git a/Library/Homebrew/cask/url.rb b/Library/Homebrew/cask/url.rb index bec7cf6f90..b347208aa8 100644 --- a/Library/Homebrew/cask/url.rb +++ b/Library/Homebrew/cask/url.rb @@ -267,6 +267,7 @@ module Cask return false unless interpolated_url + interpolated_url = interpolated_url.gsub(/\#{\s*arch\s*}/, "") interpolated_url = interpolated_url.gsub(/\#{\s*version\s*\.major\s*}/, "") if ignore_major_version interpolated_url.exclude?('#{') diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index 4a233a0acd..b843926058 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -19,8 +19,8 @@ class Caveats sig { returns(String) } def caveats caveats = [] + build = formula.build begin - build = formula.build formula.build = Tab.for_formula(formula) string = formula.caveats.to_s caveats << "#{string.chomp}\n" unless string.empty? @@ -29,7 +29,7 @@ class Caveats end caveats << keg_only_text - valid_shells = [:bash, :zsh, :fish].freeze + valid_shells = [:bash, :zsh, :fish, :pwsh].freeze current_shell = Utils::Shell.preferred || Utils::Shell.parent shells = if current_shell.present? && (shell_sym = current_shell.to_sym) && @@ -143,6 +143,11 @@ class Caveats zsh #{installed.join(" and ")} have been installed to: #{root_dir}/share/zsh/site-functions EOS + when :pwsh + <<~EOS + PowerShell completion has been installed to: + #{root_dir}/share/pwsh/completions + EOS end end diff --git a/Library/Homebrew/cleaner.rb b/Library/Homebrew/cleaner.rb index 5df0e39b15..625c152c4c 100644 --- a/Library/Homebrew/cleaner.rb +++ b/Library/Homebrew/cleaner.rb @@ -114,6 +114,7 @@ class Cleaner # Arch & MacPorts amongst other packagers as well. The files are # created as part of installing any Perl module. PERL_BASENAMES = T.let(Set.new(%w[perllocal.pod .packlist]).freeze, T::Set[String]) + private_constant :PERL_BASENAMES # Clean a top-level (`bin`, `sbin`, `lib`) directory, recursively, by fixing file # permissions and removing .la files, unless the files (or parent diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index 68b22eb204..9c20506a87 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -3,7 +3,6 @@ require "utils/bottles" -require "attrable" require "formula" require "cask/cask_loader" @@ -209,11 +208,8 @@ module Homebrew end end - extend Attrable - PERIODIC_CLEAN_FILE = (HOMEBREW_CACHE/".cleaned").freeze - attr_predicate :dry_run?, :scrub?, :prune? attr_reader :args, :days, :cache, :disk_cleanup_size def initialize(*args, dry_run: false, scrub: false, days: nil, cache: HOMEBREW_CACHE) @@ -227,6 +223,15 @@ module Homebrew @cleaned_up_paths = Set.new end + sig { returns(T::Boolean) } + def dry_run? = @dry_run + + sig { returns(T::Boolean) } + def prune? = @prune + + sig { returns(T::Boolean) } + def scrub? = @scrub + def self.install_formula_clean!(formula, dry_run: false) return if Homebrew::EnvConfig.no_install_cleanup? return unless formula.latest_version_installed? diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 583e7621f1..5aeb277dbc 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -221,8 +221,8 @@ module Homebrew deps = dependency.runtime_dependencies if @use_runtime_dependencies if recursive - deps ||= recursive_includes(Dependency, dependency, includes, ignores) - reqs = recursive_includes(Requirement, dependency, includes, ignores) + deps ||= recursive_dep_includes(dependency, includes, ignores) + reqs = recursive_req_includes(dependency, includes, ignores) else deps ||= select_includes(dependency.deps, ignores, includes) reqs = select_includes(dependency.requirements, ignores, includes) diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 495b85aa6e..5b9fda067d 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -209,16 +209,18 @@ module Homebrew formulae.map(&:to_hash) end when :v2 - formulae, casks = if all - [ - Formula.all(eval_all: args.eval_all?).sort, - Cask::Cask.all(eval_all: args.eval_all?).sort_by(&:full_name), - ] - elsif args.installed? - [Formula.installed.sort, Cask::Caskroom.casks.sort_by(&:full_name)] - else - args.named.to_formulae_to_casks - end + formulae, casks = T.let( + if all + [ + Formula.all(eval_all: args.eval_all?).sort, + Cask::Cask.all(eval_all: args.eval_all?).sort_by(&:full_name), + ] + elsif args.installed? + [Formula.installed.sort, Cask::Caskroom.casks.sort_by(&:full_name)] + else + T.cast(args.named.to_formulae_to_casks, [T::Array[Formula], T::Array[Cask::Cask]]) + end, [T::Array[Formula], T::Array[Cask::Cask]] + ) if args.variations? { diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index 538baed2c1..4bfdc6e912 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -123,7 +123,8 @@ module Homebrew raise UsageError, "Cannot use #{flags.join(", ")} with formula arguments." unless args.no_named? formulae = if args.t? - Formula.installed.sort_by { |formula| test("M", formula.rack) }.reverse! + # See https://ruby-doc.org/3.2/Kernel.html#method-i-test + Formula.installed.sort_by { |formula| T.cast(test("M", formula.rack.to_s), Time) }.reverse! elsif args.full_name? Formula.installed.sort { |a, b| tap_and_name_comparison.call(a.full_name, b.full_name) } else diff --git a/Library/Homebrew/cmd/missing.rb b/Library/Homebrew/cmd/missing.rb index 41cce0329d..b30184cbf8 100644 --- a/Library/Homebrew/cmd/missing.rb +++ b/Library/Homebrew/cmd/missing.rb @@ -33,7 +33,7 @@ module Homebrew end ff.each do |f| - missing = f.missing_dependencies(hide: args.hide) + missing = f.missing_dependencies(hide: args.hide || []) next if missing.empty? Homebrew.failed = true diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index 85aef45a01..17fbfb5639 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -59,14 +59,14 @@ module Homebrew elsif args.no_named? puts Tap.installed.sort_by(&:name) else - tap = Tap.fetch(args.named.fetch(0)) begin + tap = Tap.fetch(args.named.fetch(0)) tap.install clone_target: args.named.second, custom_remote: args.custom_remote?, quiet: args.quiet?, verify: args.eval_all? || Homebrew::EnvConfig.eval_all?, force: args.force? - rescue TapRemoteMismatchError, TapNoCustomRemoteError => e + rescue Tap::InvalidNameError, TapRemoteMismatchError, TapNoCustomRemoteError => e odie e rescue TapAlreadyTappedError nil diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 8bc403d671..91395f4e98 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -161,7 +161,7 @@ module Homebrew end next unless formula.any_version_installed? - keg = formula.installed_kegs.last + keg = formula.installed_kegs.fetch(-1) tab = keg.tab # force a `brew upgrade` from the linuxbrew-core version to the homebrew-core version (even if lower) tab.source["versions"]["version_scheme"] = -1 @@ -277,7 +277,7 @@ module Homebrew puts new_major_version, new_minor_version, new_patch_version = new_tag.split(".").map(&:to_i) - old_major_version, old_minor_version = (old_tag.split(".")[0, 2]).map(&:to_i) if old_tag.present? + old_major_version, old_minor_version = old_tag.split(".")[0, 2].map(&:to_i) if old_tag.present? if old_tag.blank? || new_major_version > old_major_version || new_minor_version > old_minor_version puts <<~EOS The #{new_major_version}.#{new_minor_version}.0 release notes are available on the Homebrew Blog: diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 10d5328d45..a515751a3d 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -94,7 +94,7 @@ module Homebrew sig { params(use_runtime_dependents: T::Boolean, used_formulae: T::Array[T.any(Formula, UnavailableFormula)]) - .returns(T::Array[Formula]) + .returns(T::Array[T.any(Formula, CaskDependent)]) } def intersection_of_dependents(use_runtime_dependents, used_formulae) recursive = args.recursive? @@ -106,9 +106,9 @@ module Homebrew # We can only get here if `used_formulae_missing` is false, thus there are no UnavailableFormula. used_formulae = T.cast(used_formulae, T::Array[Formula]) if show_formulae_and_casks || args.formula? - deps += used_formulae.map(&:runtime_installed_formula_dependents) - .reduce(&:&) - .select(&:any_version_installed?) + deps += T.must(used_formulae.map(&:runtime_installed_formula_dependents) + .reduce(&:&)) + .select(&:any_version_installed?) end if show_formulae_and_casks || args.cask? deps += select_used_dependents( @@ -150,26 +150,30 @@ module Homebrew sig { params( - dependents: T::Array[Formula], used_formulae: T::Array[T.any(Formula, UnavailableFormula)], - recursive: T::Boolean, includes: T::Array[Symbol], ignores: T::Array[Symbol] - ).returns( - T::Array[Formula], - ) + dependents: T::Array[T.any(Formula, CaskDependent)], + used_formulae: T::Array[T.any(Formula, UnavailableFormula)], + recursive: T::Boolean, + includes: T::Array[Symbol], + ignores: T::Array[Symbol], + ).returns(T::Array[T.any(Formula, CaskDependent)]) } def select_used_dependents(dependents, used_formulae, recursive, includes, ignores) dependents.select do |d| deps = if recursive - recursive_includes(Dependency, d, includes, ignores) + recursive_dep_includes(d, includes, ignores) else select_includes(d.deps, ignores, includes) end used_formulae.all? do |ff| deps.any? do |dep| - match = begin + match = case dep + when Dependency dep.to_formula.full_name == ff.full_name if dep.name.include?("/") - rescue + when Requirement nil + else + T.absurd(dep) end next match unless match.nil? diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index 7097260fe4..fb3dd3e4e6 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -92,6 +92,7 @@ class CompilerFailure create(:clang), ], }.freeze + private_constant :COLLECTIONS end # Class for selecting a compiler for a formula. diff --git a/Library/Homebrew/debrew.rb b/Library/Homebrew/debrew.rb index 5679d2ccfb..46956f696b 100644 --- a/Library/Homebrew/debrew.rb +++ b/Library/Homebrew/debrew.rb @@ -1,7 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" require "mutex_m" require "ignorable" @@ -73,9 +72,10 @@ module Debrew @debugged_exceptions = Set.new class << self - extend Attrable - attr_predicate :active? attr_reader :debugged_exceptions + + sig { returns(T::Boolean) } + def active? = @active end def self.debrew diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb index 354b12745e..3e8bd125e8 100644 --- a/Library/Homebrew/dependencies.rb +++ b/Library/Homebrew/dependencies.rb @@ -39,11 +39,6 @@ class Dependencies < SimpleDelegator def inspect "#<#{self.class.name}: #{__getobj__}>" end - - sig { returns(T::Array[Dependency]) } - def to_a - __getobj__.to_a - end end # A collection of requirements. diff --git a/Library/Homebrew/dependencies.rbi b/Library/Homebrew/dependencies.rbi index ea20b01d7e..29a8508c06 100644 --- a/Library/Homebrew/dependencies.rbi +++ b/Library/Homebrew/dependencies.rbi @@ -1,13 +1,32 @@ # typed: strict class Dependencies < SimpleDelegator + include Enumerable include Kernel + # This is a workaround to enable `alias eql? ==` # @see https://github.com/sorbet/sorbet/issues/2378#issuecomment-569474238 sig { params(other: BasicObject).returns(T::Boolean) } def ==(other); end + + sig { params(blk: T.proc.params(arg0: Dependency).void).returns(T.self_type) } + sig { returns(T::Enumerator[Dependency]) } + def each(&blk); end + + sig { params(blk: T.proc.params(arg0: Dependency).returns(T::Boolean)).returns(T::Array[Dependency]) } + sig { returns(T::Enumerator[Dependency]) } + def select(&blk); end end class Requirements < SimpleDelegator + include Enumerable include Kernel + + sig { params(blk: T.proc.params(arg0: Requirement).void).returns(T.self_type) } + sig { returns(T::Enumerator[Requirement]) } + def each(&blk); end + + sig { params(blk: T.proc.params(arg0: Requirement).returns(T::Boolean)).returns(T::Array[Requirement]) } + sig { returns(T::Enumerator[Requirement]) } + def select(&blk); end end diff --git a/Library/Homebrew/dependencies_helpers.rb b/Library/Homebrew/dependencies_helpers.rb index 0c4276f707..ba23cc46a8 100644 --- a/Library/Homebrew/dependencies_helpers.rb +++ b/Library/Homebrew/dependencies_helpers.rb @@ -1,14 +1,10 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "cask_dependent" # Helper functions for dependencies. module DependenciesHelpers - extend T::Helpers - - requires_ancestor { Kernel } - def args_includes_ignores(args) includes = [:required?, :recommended?] # included by default includes << :implicit? if args.include_implicit? @@ -23,9 +19,35 @@ module DependenciesHelpers [includes, ignores] end - def recursive_includes(klass, root_dependent, includes, ignores) - raise ArgumentError, "Invalid class argument: #{klass}" if klass != Dependency && klass != Requirement + sig { + params(root_dependent: T.any(Formula, CaskDependent), includes: T::Array[Symbol], ignores: T::Array[Symbol]) + .returns(T::Array[Dependency]) + } + def recursive_dep_includes(root_dependent, includes, ignores) + # The use of T.unsafe is recommended by the Sorbet docs: + # https://sorbet.org/docs/overloads#multiple-methods-but-sharing-a-common-implementation + T.unsafe(recursive_includes(Dependency, root_dependent, includes, ignores)) + end + sig { + params(root_dependent: T.any(Formula, CaskDependent), includes: T::Array[Symbol], ignores: T::Array[Symbol]) + .returns(Requirements) + } + def recursive_req_includes(root_dependent, includes, ignores) + # The use of T.unsafe is recommended by the Sorbet docs: + # https://sorbet.org/docs/overloads#multiple-methods-but-sharing-a-common-implementation + T.unsafe(recursive_includes(Requirement, root_dependent, includes, ignores)) + end + + sig { + params( + klass: T.any(T.class_of(Dependency), T.class_of(Requirement)), + root_dependent: T.any(Formula, CaskDependent), + includes: T::Array[Symbol], + ignores: T::Array[Symbol], + ).returns(T.any(T::Array[Dependency], Requirements)) + } + def recursive_includes(klass, root_dependent, includes, ignores) cache_key = "recursive_includes_#{includes}_#{ignores}" klass.expand(root_dependent, cache_key:) do |dependent, dep| @@ -43,6 +65,13 @@ module DependenciesHelpers end end + sig { + params( + dependables: T.any(Dependencies, Requirements, T::Array[Dependency], T::Array[Requirement]), + ignores: T::Array[Symbol], + includes: T::Array[Symbol], + ).returns(T::Array[T.any(Dependency, Requirement)]) + } def select_includes(dependables, ignores, includes) dependables.select do |dep| next false if ignores.any? { |ignore| dep.public_send(ignore) } @@ -51,14 +80,18 @@ module DependenciesHelpers end end + sig { + params(formulae_or_casks: T::Array[T.any(Formula, Keg, Cask::Cask)]) + .returns(T::Array[T.any(Formula, CaskDependent)]) + } def dependents(formulae_or_casks) formulae_or_casks.map do |formula_or_cask| - if formula_or_cask.is_a?(Formula) - formula_or_cask + case formula_or_cask + when Formula then formula_or_cask + when Cask::Cask then CaskDependent.new(formula_or_cask) else - CaskDependent.new(formula_or_cask) + raise TypeError, "Unsupported type: #{formula_or_cask.class}" end end end - module_function :dependents end diff --git a/Library/Homebrew/dependencies_helpers.rbi b/Library/Homebrew/dependencies_helpers.rbi new file mode 100644 index 0000000000..8ee3283fab --- /dev/null +++ b/Library/Homebrew/dependencies_helpers.rbi @@ -0,0 +1,12 @@ +# typed: strict + +module DependenciesHelpers + include Kernel + + # This sig is in an RBI to avoid both circular dependencies and unnecessary requires + sig { + params(args: T.any(Homebrew::Cmd::Deps::Args, Homebrew::Cmd::Uses::Args)) + .returns([T::Array[Symbol], T::Array[Symbol]]) + } + def args_includes_ignores(args); end +end diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 2f9d3f0b63..24e69cb463 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -261,8 +261,8 @@ module Homebrew audit_token_conflicts: args.token_conflicts? || nil, quarantine: true, any_named_args: !no_named_args, - only: args.only, - except: args.except, + only: args.only || [], + except: args.except || [], ).to_a end end.uniq diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 141f4c8fd6..04307077bc 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -559,7 +559,7 @@ module Homebrew ohai "Detecting if #{local_filename} is relocatable..." if bottle_path.size > 1 * 1024 * 1024 - prefix_check = if Homebrew.default_prefix?(prefix) + prefix_check = if prefix == HOMEBREW_DEFAULT_PREFIX File.join(prefix, "opt") else prefix diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index f635e5b229..8e4245a91a 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -115,7 +115,7 @@ module Homebrew end end - formulae_and_casks = formulae_and_casks&.sort_by do |formula_or_cask| + formulae_and_casks = formulae_and_casks.sort_by do |formula_or_cask| formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name end diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 7b1f87ca6b..830d995c8f 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -40,6 +40,8 @@ module Homebrew description: "Create a basic template for a Ruby build." switch "--rust", description: "Create a basic template for a Rust build." + switch "--zig", + description: "Create a basic template for a Zig build." switch "--no-fetch", description: "Homebrew will not download to the cache and will thus not add its SHA-256 " \ "to the formula for you, nor will it check the GitHub API for GitHub projects " \ @@ -58,7 +60,7 @@ module Homebrew description: "Ignore errors for disallowed formula names and names that shadow aliases." conflicts "--autotools", "--cmake", "--crystal", "--go", "--meson", "--node", - "--perl", "--python", "--ruby", "--rust", "--cask" + "--perl", "--python", "--ruby", "--rust", "--zig", "--cask" conflicts "--cask", "--HEAD" conflicts "--cask", "--set-license" @@ -173,6 +175,8 @@ module Homebrew :ruby elsif args.rust? :rust + elsif args.zig? + :zig end fc = FormulaCreator.new( @@ -220,6 +224,7 @@ module Homebrew path = fc.write_formula! formula = Homebrew.with_no_api_env do + CoreTap.instance.clear_cache Formula[fc.name] end PyPI.update_python_resources! formula, ignore_non_pypi_packages: true if args.python? diff --git a/Library/Homebrew/dev-cmd/formula-analytics.rb b/Library/Homebrew/dev-cmd/formula-analytics.rb index 9d92285a57..3da14afbca 100755 --- a/Library/Homebrew/dev-cmd/formula-analytics.rb +++ b/Library/Homebrew/dev-cmd/formula-analytics.rb @@ -229,7 +229,7 @@ module Homebrew if record["prefix"] == "custom-prefix" "#{record["prefix"]} (#{record["os"]} #{record["arch"]})" else - (record["prefix"]).to_s + record["prefix"].to_s end when :os_versions format_os_version_dimension(record["os_name_and_version"]) diff --git a/Library/Homebrew/dev-cmd/update-python-resources.rb b/Library/Homebrew/dev-cmd/update-python-resources.rb index c80cf01c20..c40a3e6641 100644 --- a/Library/Homebrew/dev-cmd/update-python-resources.rb +++ b/Library/Homebrew/dev-cmd/update-python-resources.rb @@ -39,7 +39,7 @@ module Homebrew sig { override.void } def run args.named.to_formulae.each do |formula| - ignore_errors = if T.must(formula.tap).name == "homebrew/core" + ignore_errors = if formula.tap&.official? false else args.ignore_errors? diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 64f7185255..45757ece68 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -16,10 +16,10 @@ require "system_command" module Homebrew # Module containing diagnostic checks. module Diagnostic - def self.missing_deps(formulae, hide = nil) + def self.missing_deps(formulae, hide = []) missing = {} formulae.each do |f| - missing_dependencies = f.missing_dependencies(hide:) + missing_dependencies = f.missing_dependencies(hide: hide) next if missing_dependencies.empty? yield f.full_name, missing_dependencies if block_given? @@ -63,7 +63,7 @@ module Homebrew end end - sig { params(list: T::Array[String], string: String).returns(String) } + sig { params(list: T::Array[T.any(Formula, Pathname, String)], string: String).returns(String) } def inject_file_list(list, string) list.reduce(string.dup) { |acc, elem| acc << " #{elem}\n" } .freeze @@ -748,14 +748,12 @@ module Homebrew def check_for_unlinked_but_not_keg_only unlinked = Formula.racks.reject do |rack| - if (HOMEBREW_LINKED_KEGS/rack.basename).directory? - true - else - begin - Formulary.from_rack(rack).keg_only? - rescue FormulaUnavailableError, TapFormulaAmbiguityError - false - end + next true if (HOMEBREW_LINKED_KEGS/rack.basename).directory? + + begin + Formulary.from_rack(rack).keg_only? + rescue FormulaUnavailableError, TapFormulaAmbiguityError + false end end.map(&:basename) return if unlinked.empty? @@ -1040,6 +1038,64 @@ module Homebrew end end + def non_core_taps + @non_core_taps ||= Tap.installed.reject(&:core_tap?).reject(&:core_cask_tap?) + end + + def check_for_duplicate_formulae + return if ENV["HOMEBREW_TEST_BOT"].present? + + core_formula_names = CoreTap.instance.formula_names + shadowed_formula_full_names = non_core_taps.flat_map do |tap| + tap_formula_names = tap.formula_names.map { |s| s.delete_prefix("#{tap.name}/") } + (core_formula_names & tap_formula_names).map { |f| "#{tap.name}/#{f}" } + end.compact.sort + return if shadowed_formula_full_names.empty? + + installed_formula_tap_names = Formula.installed.filter_map(&:tap).uniq.reject(&:official?).map(&:name) + shadowed_formula_tap_names = shadowed_formula_full_names.map { |s| s.rpartition("/").first }.uniq + unused_shadowed_formula_tap_names = (shadowed_formula_tap_names - installed_formula_tap_names).sort + + resolution = if unused_shadowed_formula_tap_names.empty? + "Their taps are in use, so you must use these full names throughout Homebrew." + else + "Some of these can be resolved with:\n brew untap #{unused_shadowed_formula_tap_names.join(" ")}" + end + + <<~EOS + The following formulae have the same name as core formulae: + #{shadowed_formula_full_names.join("\n ")} + #{resolution} + EOS + end + + def check_for_duplicate_casks + return if ENV["HOMEBREW_TEST_BOT"].present? + + core_cask_names = CoreCaskTap.instance.cask_tokens + shadowed_cask_full_names = non_core_taps.flat_map do |tap| + tap_cask_names = tap.cask_tokens.map { |s| s.delete_prefix("#{tap.name}/") } + (core_cask_names & tap_cask_names).map { |f| "#{tap.name}/#{f}" } + end.compact.sort + return if shadowed_cask_full_names.empty? + + installed_cask_tap_names = Cask::Caskroom.casks.filter_map(&:tap).uniq.reject(&:official?).map(&:name) + shadowed_cask_tap_names = shadowed_cask_full_names.map { |s| s.rpartition("/").first }.uniq + unused_shadowed_cask_tap_names = (shadowed_cask_tap_names - installed_cask_tap_names).sort + + resolution = if unused_shadowed_cask_tap_names.empty? + "Their taps are in use, so you must use these full names throughout Homebrew." + else + "Some of these can be resolved with:\n brew untap #{unused_shadowed_cask_tap_names.join(" ")}" + end + + <<~EOS + The following casks have the same name as core casks: + #{shadowed_cask_full_names.join("\n ")} + #{resolution} + EOS + end + def all methods.map(&:to_s).grep(/^check_/).sort end diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index bdc89ed3da..5ccf2326ce 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -490,6 +490,10 @@ module Homebrew description: "If set, pass `--greedy` to all cask upgrade commands.", boolean: true, }, + HOMEBREW_UPGRADE_GREEDY_CASKS: { + description: "A space-separated list of casks. Homebrew will act as " \ + "if `--greedy` was passed when upgrading any cask on this list.", + }, HOMEBREW_VERBOSE: { description: "If set, always assume `--verbose` when running commands.", boolean: true, diff --git a/Library/Homebrew/extend/on_system.rbi b/Library/Homebrew/extend/on_system.rbi index 15534bb4b4..dd0b178347 100644 --- a/Library/Homebrew/extend/on_system.rbi +++ b/Library/Homebrew/extend/on_system.rbi @@ -4,3 +4,23 @@ module OnSystem::MacOSOnly sig { params(arm: T.nilable(String), intel: T.nilable(String)).returns(T.nilable(String)) } def on_arch_conditional(arm: nil, intel: nil); end end + +module OnSystem::MacOSAndLinux + sig { + params( + macos: T.nilable(T.any(T::Array[T.any(String, Pathname)], String, Pathname)), + linux: T.nilable(T.any(T::Array[T.any(String, Pathname)], String, Pathname)), + ).returns(T.nilable(T.any(T::Array[T.any(String, Pathname)], String, Pathname))) + } + def on_system_conditional(macos: nil, linux: nil); end + + sig { + type_parameters(:U) + .params(block: T.proc.returns(T.type_parameter(:U))) + .returns(T.type_parameter(:U)) + } + def on_macos(&block); end + + sig { params(arm: T.nilable(String), intel: T.nilable(String)).returns(T.nilable(String)) } + def on_arch_conditional(arm: nil, intel: nil); end +end diff --git a/Library/Homebrew/extend/os/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/extend/os/cask/artifact/abstract_uninstall.rb new file mode 100644 index 0000000000..9298c18f91 --- /dev/null +++ b/Library/Homebrew/extend/os/cask/artifact/abstract_uninstall.rb @@ -0,0 +1,5 @@ +# typed: strict +# frozen_string_literal: true + +require "extend/os/mac/cask/artifact/abstract_uninstall" if OS.mac? +require "extend/os/linux/cask/artifact/abstract_uninstall" if OS.linux? diff --git a/Library/Homebrew/extend/os/cask/artifact/symlinked.rb b/Library/Homebrew/extend/os/cask/artifact/symlinked.rb new file mode 100644 index 0000000000..e9df4618bd --- /dev/null +++ b/Library/Homebrew/extend/os/cask/artifact/symlinked.rb @@ -0,0 +1,5 @@ +# typed: strict +# frozen_string_literal: true + +require "extend/os/mac/cask/artifact/symlinked" if OS.mac? +require "extend/os/linux/cask/artifact/symlinked" if OS.linux? diff --git a/Library/Homebrew/extend/os/cask/dsl.rb b/Library/Homebrew/extend/os/cask/dsl.rb new file mode 100644 index 0000000000..1ee72f032f --- /dev/null +++ b/Library/Homebrew/extend/os/cask/dsl.rb @@ -0,0 +1,4 @@ +# typed: strict +# frozen_string_literal: true + +require "extend/os/mac/cask/dsl" if OS.mac? diff --git a/Library/Homebrew/extend/os/linux/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/extend/os/linux/cask/artifact/abstract_uninstall.rb new file mode 100644 index 0000000000..761fc2bc03 --- /dev/null +++ b/Library/Homebrew/extend/os/linux/cask/artifact/abstract_uninstall.rb @@ -0,0 +1,23 @@ +# typed: strict +# frozen_string_literal: true + +module OS + module Linux + module Cask + module Artifact + module AbstractUninstall + extend T::Helpers + + requires_ancestor { ::Cask::Artifact::AbstractUninstall } + + sig { params(target: Pathname).returns(T::Boolean) } + def undeletable?(target) + !target.parent.writable? + end + end + end + end + end +end + +Cask::Artifact::AbstractUninstall.prepend(OS::Linux::Cask::Artifact::AbstractUninstall) diff --git a/Library/Homebrew/extend/os/linux/cask/artifact/moved.rb b/Library/Homebrew/extend/os/linux/cask/artifact/moved.rb index 3f6c420b47..03928272d6 100644 --- a/Library/Homebrew/extend/os/linux/cask/artifact/moved.rb +++ b/Library/Homebrew/extend/os/linux/cask/artifact/moved.rb @@ -20,4 +20,4 @@ module OS end end -Cask::Artifact::Moved.prepend(OS::Linux::Cask::Config) +Cask::Artifact::Moved.prepend(OS::Linux::Cask::Artifact::Moved) diff --git a/Library/Homebrew/extend/os/linux/cask/artifact/symlinked.rb b/Library/Homebrew/extend/os/linux/cask/artifact/symlinked.rb new file mode 100644 index 0000000000..3d8d78f597 --- /dev/null +++ b/Library/Homebrew/extend/os/linux/cask/artifact/symlinked.rb @@ -0,0 +1,26 @@ +# typed: strict +# frozen_string_literal: true + +module OS + module Linux + module Cask + module Artifact + module Symlinked + extend T::Helpers + + requires_ancestor { ::Cask::Artifact::Symlinked } + + sig { params(command: T.class_of(SystemCommand)).void } + def create_filesystem_link(command) + ::Cask::Utils.gain_permissions_mkpath(target.dirname, command:) + + command.run! "/bin/ln", args: ["--no-dereference", "--force", "--symbolic", source, target], + sudo: !target.dirname.writable? + end + end + end + end + end +end + +Cask::Artifact::Symlinked.prepend(OS::Linux::Cask::Artifact::Symlinked) diff --git a/Library/Homebrew/extend/os/linux/cask/installer.rb b/Library/Homebrew/extend/os/linux/cask/installer.rb index 76ac45eb7f..ab267068a8 100644 --- a/Library/Homebrew/extend/os/linux/cask/installer.rb +++ b/Library/Homebrew/extend/os/linux/cask/installer.rb @@ -15,6 +15,14 @@ module OS def check_stanza_os_requirements return if artifacts.all?(::Cask::Artifact::Font) + install_artifacts = artifacts.reject { |artifact| artifact.instance_of?(::Cask::Artifact::Zap) } + return if install_artifacts.all? do |artifact| + artifact.is_a?(::Cask::Artifact::Binary) || + artifact.is_a?(::Cask::Artifact::ShellCompletion) || + artifact.is_a?(::Cask::Artifact::Artifact) || + artifact.is_a?(::Cask::Artifact::Manpage) + end + raise ::Cask::CaskError, "macOS is required for this software." end end diff --git a/Library/Homebrew/extend/os/linux/cmd/update-report.rb b/Library/Homebrew/extend/os/linux/cmd/update-report.rb index 25947f07c4..e70a6c03f8 100644 --- a/Library/Homebrew/extend/os/linux/cmd/update-report.rb +++ b/Library/Homebrew/extend/os/linux/cmd/update-report.rb @@ -24,7 +24,7 @@ module Homebrew end next unless recursive_runtime_dependencies.map(&:name).include? "gcc" - keg = formula.installed_kegs.last + keg = formula.installed_kegs.fetch(-1) tab = keg.tab # Force reinstallation upon `brew upgrade` to fix the bottle RPATH. tab.source["versions"]["version_scheme"] = -1 diff --git a/Library/Homebrew/extend/os/linux/dependency_collector.rb b/Library/Homebrew/extend/os/linux/dependency_collector.rb index 2f7485eef2..1da5bf3313 100644 --- a/Library/Homebrew/extend/os/linux/dependency_collector.rb +++ b/Library/Homebrew/extend/os/linux/dependency_collector.rb @@ -33,6 +33,7 @@ module OS GLIBC = "glibc" GCC = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA + private_constant :GLIBC, :GCC sig { void } def init_global_dep_tree_if_needed! @@ -47,9 +48,9 @@ module OS built_global_dep_tree! end - sig { params(name: String).returns(T.nilable(Formula)) } + sig { params(name: String).returns(T.nilable(::Formula)) } def formula_for(name) - @formula_for ||= T.let({}, T.nilable(T::Hash[String, Formula])) + @formula_for ||= T.let({}, T.nilable(T::Hash[String, ::Formula])) @formula_for[name] ||= ::Formula[name] rescue FormulaUnavailableError nil diff --git a/Library/Homebrew/extend/os/mac/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/extend/os/mac/cask/artifact/abstract_uninstall.rb new file mode 100644 index 0000000000..2871527d17 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/cask/artifact/abstract_uninstall.rb @@ -0,0 +1,25 @@ +# typed: strict +# frozen_string_literal: true + +require "cask/macos" + +module OS + module Mac + module Cask + module Artifact + module AbstractUninstall + extend T::Helpers + + requires_ancestor { ::Cask::Artifact::AbstractUninstall } + + sig { params(target: Pathname).returns(T::Boolean) } + def undeletable?(target) + MacOS.undeletable?(target) + end + end + end + end + end +end + +Cask::Artifact::AbstractUninstall.prepend(OS::Mac::Cask::Artifact::AbstractUninstall) diff --git a/Library/Homebrew/extend/os/mac/cask/artifact/symlinked.rb b/Library/Homebrew/extend/os/mac/cask/artifact/symlinked.rb new file mode 100644 index 0000000000..90dbe68c64 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/cask/artifact/symlinked.rb @@ -0,0 +1,30 @@ +# typed: strict +# frozen_string_literal: true + +require "cask/macos" + +module OS + module Mac + module Cask + module Artifact + module Symlinked + extend T::Helpers + + requires_ancestor { ::Cask::Artifact::Symlinked } + + sig { params(command: T.class_of(SystemCommand)).void } + def create_filesystem_link(command) + ::Cask::Utils.gain_permissions_mkpath(target.dirname, command:) + + command.run! "/bin/ln", args: ["-h", "-f", "-s", "--", source, target], + sudo: !target.dirname.writable? + + add_altname_metadata(source, target.basename, command:) + end + end + end + end + end +end + +Cask::Artifact::Symlinked.prepend(OS::Mac::Cask::Artifact::Symlinked) diff --git a/Library/Homebrew/extend/os/mac/cask/dsl.rb b/Library/Homebrew/extend/os/mac/cask/dsl.rb new file mode 100644 index 0000000000..252c6a16f5 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/cask/dsl.rb @@ -0,0 +1,23 @@ +# typed: strict +# frozen_string_literal: true + +require "cask/macos" + +module OS + module Mac + module Cask + module DSL + extend T::Helpers + + requires_ancestor { ::Cask::DSL } + + sig { returns(T.nilable(MacOSVersion)) } + def os_version + MacOS.full_version + end + end + end + end +end + +Cask::DSL.prepend(OS::Mac::Cask::DSL) diff --git a/Library/Homebrew/extend/os/mac/formula.rb b/Library/Homebrew/extend/os/mac/formula.rb index c802e31806..506ed41426 100644 --- a/Library/Homebrew/extend/os/mac/formula.rb +++ b/Library/Homebrew/extend/os/mac/formula.rb @@ -32,6 +32,18 @@ module OS args end + + sig { + params( + prefix: T.any(String, Pathname), + release_mode: Symbol, + ).returns(T::Array[String]) + } + def std_zig_args(prefix: self.prefix, release_mode: :fast) + args = super + args << "-fno-rosetta" if ::Hardware::CPU.arm? + args + end end end end diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index be6928a15a..5b56011faf 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -240,6 +240,7 @@ module OS private CELLAR_RX = %r{\A#{HOMEBREW_CELLAR}/(?[^/]+)/[^/]+} + private_constant :CELLAR_RX # Replace HOMEBREW_CELLAR references with HOMEBREW_PREFIX/opt references # if the Cellar reference is to a different keg. diff --git a/Library/Homebrew/formula-analytics/requirements.txt b/Library/Homebrew/formula-analytics/requirements.txt index a4a2880d79..5aefc1d901 100644 --- a/Library/Homebrew/formula-analytics/requirements.txt +++ b/Library/Homebrew/formula-analytics/requirements.txt @@ -8,53 +8,53 @@ certifi==2025.1.31 \ --hash=sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651 \ --hash=sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe # via influxdb3-python -influxdb3-python==0.10.0 \ - --hash=sha256:d279e5f8a597d49b44035263b1cf1472a3861ceba930fd08e1e3b1721a07d3cf \ - --hash=sha256:f3d44dff4c4bbfdcb1fa1c4013ccfa317fbbd7df5812eb46395421166ffb385a +influxdb3-python==0.11.0 \ + --hash=sha256:07bea8e1150be9707f818cda9634600a42487ee14802208f3f0357af2847f6e3 \ + --hash=sha256:dd5a1197f776f9836935d797be2dbc9e09f75465188492409e0b5931e6a033c4 # via -r requirements.in -pyarrow==19.0.0 \ - --hash=sha256:239ca66d9a05844bdf5af128861af525e14df3c9591bcc05bac25918e650d3a2 \ - --hash=sha256:2795064647add0f16563e57e3d294dbfc067b723f0fd82ecd80af56dad15f503 \ - --hash=sha256:29cd86c8001a94f768f79440bf83fee23963af5e7bc68ce3a7e5f120e17edf89 \ - --hash=sha256:2a0144a712d990d60f7f42b7a31f0acaccf4c1e43e957f7b1ad58150d6f639c1 \ - --hash=sha256:2a1a109dfda558eb011e5f6385837daffd920d54ca00669f7a11132d0b1e6042 \ - --hash=sha256:2b6d3ce4288793350dc2d08d1e184fd70631ea22a4ff9ea5c4ff182130249d9b \ - --hash=sha256:2f672f5364b2d7829ef7c94be199bb88bf5661dd485e21d2d37de12ccb78a136 \ - --hash=sha256:3c1c162c4660e0978411a4761f91113dde8da3433683efa473501254563dcbe8 \ - --hash=sha256:450a7d27e840e4d9a384b5c77199d489b401529e75a3b7a3799d4cd7957f2f9c \ - --hash=sha256:4624c89d6f777c580e8732c27bb8e77fd1433b89707f17c04af7635dd9638351 \ - --hash=sha256:4d8b0c0de0a73df1f1bf439af1b60f273d719d70648e898bc077547649bb8352 \ - --hash=sha256:5418d4d0fab3a0ed497bad21d17a7973aad336d66ad4932a3f5f7480d4ca0c04 \ - --hash=sha256:597360ffc71fc8cceea1aec1fb60cb510571a744fffc87db33d551d5de919bec \ - --hash=sha256:5e8a28b918e2e878c918f6d89137386c06fe577cd08d73a6be8dafb317dc2d73 \ - --hash=sha256:62ef8360ff256e960f57ce0299090fb86423afed5e46f18f1225f960e05aae3d \ - --hash=sha256:66732e39eaa2247996a6b04c8aa33e3503d351831424cdf8d2e9a0582ac54b34 \ - --hash=sha256:718947fb6d82409013a74b176bf93e0f49ef952d8a2ecd068fecd192a97885b7 \ - --hash=sha256:8d47c691765cf497aaeed4954d226568563f1b3b74ff61139f2d77876717084b \ - --hash=sha256:8e3a839bf36ec03b4315dc924d36dcde5444a50066f1c10f8290293c0427b46a \ - --hash=sha256:9348a0137568c45601b031a8d118275069435f151cbb77e6a08a27e8125f59d4 \ - --hash=sha256:a08e2a8a039a3f72afb67a6668180f09fddaa38fe0d21f13212b4aba4b5d2451 \ - --hash=sha256:a218670b26fb1bc74796458d97bcab072765f9b524f95b2fccad70158feb8b17 \ - --hash=sha256:a22a4bc0937856263df8b94f2f2781b33dd7f876f787ed746608e06902d691a5 \ - --hash=sha256:a7bbe7109ab6198688b7079cbad5a8c22de4d47c4880d8e4847520a83b0d1b68 \ - --hash=sha256:a92aff08e23d281c69835e4a47b80569242a504095ef6a6223c1f6bb8883431d \ - --hash=sha256:b34d3bde38eba66190b215bae441646330f8e9da05c29e4b5dd3e41bde701098 \ - --hash=sha256:b903afaa5df66d50fc38672ad095806443b05f202c792694f3a604ead7c6ea6e \ - --hash=sha256:be686bf625aa7b9bada18defb3a3ea3981c1099697239788ff111d87f04cd263 \ - --hash=sha256:c0423393e4a07ff6fea08feb44153302dd261d0551cc3b538ea7a5dc853af43a \ - --hash=sha256:c318eda14f6627966997a7d8c374a87d084a94e4e38e9abbe97395c215830e0c \ - --hash=sha256:c3b78eff5968a1889a0f3bc81ca57e1e19b75f664d9c61a42a604bf9d8402aae \ - --hash=sha256:c73268cf557e688efb60f1ccbc7376f7e18cd8e2acae9e663e98b194c40c1a2d \ - --hash=sha256:c751c1c93955b7a84c06794df46f1cec93e18610dcd5ab7d08e89a81df70a849 \ - --hash=sha256:ce42275097512d9e4e4a39aade58ef2b3798a93aa3026566b7892177c266f735 \ - --hash=sha256:cf3bf0ce511b833f7bc5f5bb3127ba731e97222023a444b7359f3a22e2a3b463 \ - --hash=sha256:da410b70a7ab8eb524112f037a7a35da7128b33d484f7671a264a4c224ac131d \ - --hash=sha256:e675a3ad4732b92d72e4d24009707e923cab76b0d088e5054914f11a797ebe44 \ - --hash=sha256:e82c3d5e44e969c217827b780ed8faf7ac4c53f934ae9238872e749fa531f7c9 \ - --hash=sha256:edfe6d3916e915ada9acc4e48f6dafca7efdbad2e6283db6fd9385a1b23055f1 \ - --hash=sha256:f094742275586cdd6b1a03655ccff3b24b2610c3af76f810356c4c71d24a2a6c \ - --hash=sha256:f208c3b58a6df3b239e0bb130e13bc7487ed14f39a9ff357b6415e3f6339b560 \ - --hash=sha256:f43f5aef2a13d4d56adadae5720d1fed4c1356c993eda8b59dace4b5983843c1 +pyarrow==19.0.1 \ + --hash=sha256:008a4009efdb4ea3d2e18f05cd31f9d43c388aad29c636112c2966605ba33466 \ + --hash=sha256:0148bb4fc158bfbc3d6dfe5001d93ebeed253793fff4435167f6ce1dc4bddeae \ + --hash=sha256:1b93ef2c93e77c442c979b0d596af45e4665d8b96da598db145b0fec014b9136 \ + --hash=sha256:1c7556165bd38cf0cd992df2636f8bcdd2d4b26916c6b7e646101aff3c16f76f \ + --hash=sha256:335d170e050bcc7da867a1ed8ffb8b44c57aaa6e0843b156a501298657b1e972 \ + --hash=sha256:3bf266b485df66a400f282ac0b6d1b500b9d2ae73314a153dbe97d6d5cc8a99e \ + --hash=sha256:41f9706fbe505e0abc10e84bf3a906a1338905cbbcf1177b71486b03e6ea6608 \ + --hash=sha256:4982f8e2b7afd6dae8608d70ba5bd91699077323f812a0448d8b7abdff6cb5d3 \ + --hash=sha256:49a3aecb62c1be1d822f8bf629226d4a96418228a42f5b40835c1f10d42e4db6 \ + --hash=sha256:4d5d1ec7ec5324b98887bdc006f4d2ce534e10e60f7ad995e7875ffa0ff9cb14 \ + --hash=sha256:58d9397b2e273ef76264b45531e9d552d8ec8a6688b7390b5be44c02a37aade8 \ + --hash=sha256:5a9137cf7e1640dce4c190551ee69d478f7121b5c6f323553b319cac936395f6 \ + --hash=sha256:5bd1618ae5e5476b7654c7b55a6364ae87686d4724538c24185bbb2952679960 \ + --hash=sha256:65cf9feebab489b19cdfcfe4aa82f62147218558d8d3f0fc1e9dea0ab8e7905a \ + --hash=sha256:699799f9c80bebcf1da0983ba86d7f289c5a2a5c04b945e2f2bcf7e874a91911 \ + --hash=sha256:6c5941c1aac89a6c2f2b16cd64fe76bcdb94b2b1e99ca6459de4e6f07638d755 \ + --hash=sha256:6ebfb5171bb5f4a52319344ebbbecc731af3f021e49318c74f33d520d31ae0c4 \ + --hash=sha256:7a544ec12de66769612b2d6988c36adc96fb9767ecc8ee0a4d270b10b1c51e00 \ + --hash=sha256:7c1bca1897c28013db5e4c83944a2ab53231f541b9e0c3f4791206d0c0de389a \ + --hash=sha256:80b2ad2b193e7d19e81008a96e313fbd53157945c7be9ac65f44f8937a55427b \ + --hash=sha256:8464c9fbe6d94a7fe1599e7e8965f350fd233532868232ab2596a71586c5a429 \ + --hash=sha256:8f04d49a6b64cf24719c080b3c2029a3a5b16417fd5fd7c4041f94233af732f3 \ + --hash=sha256:96606c3ba57944d128e8a8399da4812f56c7f61de8c647e3470b417f795d0ef9 \ + --hash=sha256:99bc1bec6d234359743b01e70d4310d0ab240c3d6b0da7e2a93663b0158616f6 \ + --hash=sha256:ad76aef7f5f7e4a757fddcdcf010a8290958f09e3470ea458c80d26f4316ae89 \ + --hash=sha256:b4c4156a625f1e35d6c0b2132635a237708944eb41df5fbe7d50f20d20c17832 \ + --hash=sha256:b9766a47a9cb56fefe95cb27f535038b5a195707a08bf61b180e642324963b46 \ + --hash=sha256:c0fe3dbbf054a00d1f162fda94ce236a899ca01123a798c561ba307ca38af5f0 \ + --hash=sha256:c6cb2335a411b713fdf1e82a752162f72d4a7b5dbc588e32aa18383318b05866 \ + --hash=sha256:cc55d71898ea30dc95900297d191377caba257612f384207fe9f8293b5850f90 \ + --hash=sha256:d03c9d6f2a3dffbd62671ca070f13fc527bb1867b4ec2b98c7eeed381d4f389a \ + --hash=sha256:d383591f3dcbe545f6cc62daaef9c7cdfe0dff0fb9e1c8121101cabe9098cfa6 \ + --hash=sha256:d9d46e06846a41ba906ab25302cf0fd522f81aa2a85a71021826f34639ad31ef \ + --hash=sha256:d9dedeaf19097a143ed6da37f04f4051aba353c95ef507764d344229b2b740ae \ + --hash=sha256:e45274b20e524ae5c39d7fc1ca2aa923aab494776d2d4b316b49ec7572ca324c \ + --hash=sha256:ee8dec072569f43835932a3b10c55973593abc00936c202707a4ad06af7cb294 \ + --hash=sha256:f24faab6ed18f216a37870d8c5623f9c044566d75ec586ef884e13a02a9d62c5 \ + --hash=sha256:f2a21d39fbdb948857f67eacb5bbaaf36802de044ec36fbef7a1c8f0dd3a4ab2 \ + --hash=sha256:f3ad4c0eb4e2a9aeb990af6c09e6fa0b195c8c0e7b272ecc8d4d2b6574809d34 \ + --hash=sha256:fc28912a2dc924dddc2087679cc8b7263accc71b9ff025a1362b004711661a69 \ + --hash=sha256:fca15aabbe9b8355800d923cc2e82c8ef514af321e18b437c3d782aa884eaeec \ + --hash=sha256:fd44d66093a239358d07c42a91eebf5015aa54fccba959db899f932218ac9cc8 # via influxdb3-python python-dateutil==2.9.0.post0 \ --hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \ @@ -78,7 +78,7 @@ urllib3==2.3.0 \ # via influxdb3-python # The following packages are considered to be unsafe in a requirements file: -setuptools==75.8.0 \ - --hash=sha256:c5afc8f407c626b8313a86e10311dd3f661c6cd9c09d4bf8c15c0e11f9f2b0e6 \ - --hash=sha256:e3982f444617239225d675215d51f6ba05f845d4eec313da4418fdbb56fb27e3 +setuptools==75.8.2 \ + --hash=sha256:4880473a969e5f23f2a2be3646b2dfd84af9028716d398e46192f84bc36900d2 \ + --hash=sha256:558e47c15f1811c1fa7adbd0096669bf76c1d3f433f58324df69f3f5ecac4e8f # via influxdb3-python diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 1bfd73a0e2..eafbfe021a 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1,7 +1,6 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true -require "attrable" require "cache_store" require "did_you_mean" require "formula_support" @@ -79,7 +78,6 @@ class Formula include Homebrew::Livecheck::Constants extend Forwardable extend Cachable - extend Attrable extend APIHashable extend T::Helpers @@ -233,44 +231,44 @@ class Formula # Now that we have an instance, it's too late to make any changes to the class-level definition. self.class.freeze - @name = name - @unresolved_path = path - @path = path.resolved_path - @alias_path = alias_path - @alias_name = (File.basename(alias_path) if alias_path) - @revision = self.class.revision || 0 - @version_scheme = self.class.version_scheme || 0 + @name = T.let(name, String) + @unresolved_path = T.let(path, Pathname) + @path = T.let(path.resolved_path, Pathname) + @alias_path = T.let(alias_path, T.nilable(Pathname)) + @alias_name = T.let((File.basename(alias_path) if alias_path), T.nilable(String)) + @revision = T.let(self.class.revision || 0, Integer) + @version_scheme = T.let(self.class.version_scheme || 0, Integer) + @head = T.let(nil, T.nilable(SoftwareSpec)) + @stable = T.let(nil, T.nilable(SoftwareSpec)) - @force_bottle = force_bottle + @force_bottle = T.let(force_bottle, T::Boolean) - @tap = tap + @tap = T.let(tap, T.nilable(Tap)) @tap ||= if path == Formulary.core_path(name) CoreTap.instance else Tap.from_path(path) end - @full_name = full_name_with_optional_tap(name) - @full_alias_name = full_name_with_optional_tap(@alias_name) + @full_name = T.let(T.must(full_name_with_optional_tap(name)), String) + @full_alias_name = T.let(full_name_with_optional_tap(@alias_name), T.nilable(String)) self.class.spec_syms.each do |sym| spec_eval sym end - @active_spec = determine_active_spec(spec) - @active_spec_sym = if head? - :head - else - :stable - end + @active_spec = T.let(determine_active_spec(spec), SoftwareSpec) + @active_spec_sym = T.let(head? ? :head : :stable, Symbol) validate_attributes! - @build = active_spec.build - @pin = FormulaPin.new(self) - @follow_installed_alias = true - @prefix_returns_versioned_prefix = false - @oldname_locks = [] + @build = T.let(active_spec.build, T.any(BuildOptions, Tab)) + @pin = T.let(FormulaPin.new(self), FormulaPin) + @follow_installed_alias = T.let(true, T::Boolean) + @prefix_returns_versioned_prefix = T.let(false, T.nilable(T::Boolean)) + @oldname_locks = T.let([], T::Array[FormulaLock]) + @on_system_blocks_exist = T.let(false, T::Boolean) end + sig { params(spec_sym: Symbol).void } def active_spec=(spec_sym) spec = send(spec_sym) raise FormulaSpecificationError, "#{spec_sym} spec is not available for #{full_name}" unless spec @@ -287,6 +285,7 @@ class Formula Requirement.clear_cache end + sig { params(build_options: T.any(BuildOptions, Tab)).void } def build=(build_options) old_options = @build @build = build_options @@ -301,6 +300,7 @@ class Formula private # Allow full name logic to be re-used between names, aliases and installed aliases. + sig { params(name: T.nilable(String)).returns(T.nilable(String)) } def full_name_with_optional_tap(name) if name.nil? || @tap.nil? || @tap.core_tap? name @@ -309,6 +309,7 @@ class Formula end end + sig { params(name: T.any(String, Symbol)).void } def spec_eval(name) spec = self.class.send(name).dup return unless spec.url @@ -321,11 +322,13 @@ class Formula sig { params(spec: SoftwareSpec).void } def add_global_deps_to_spec(spec); end + sig { params(requested: T.any(String, Symbol)).returns(SoftwareSpec) } def determine_active_spec(requested) spec = send(requested) || stable || head spec || raise(FormulaSpecificationError, "#{full_name}: formula requires at least a URL") end + sig { void } def validate_attributes! if name.blank? || name.match?(/\s/) || !Utils.safe_filename?(name) raise FormulaValidationError.new(full_name, :name, name) @@ -359,15 +362,13 @@ class Formula end sig { returns(T.nilable(String)) } - def installed_alias_name - installed_alias_path&.basename&.to_s - end + def installed_alias_name = installed_alias_path&.basename&.to_s - def full_installed_alias_name - full_name_with_optional_tap(installed_alias_name) - end + sig { returns(T.nilable(String)) } + def full_installed_alias_name = full_name_with_optional_tap(installed_alias_name) # The path that was specified to find this formula. + sig { returns(T.nilable(Pathname)) } def specified_path return Homebrew::API::Formula.cached_json_file_path if loaded_from_api? return alias_path if alias_path&.exist? @@ -380,21 +381,25 @@ class Formula end # The name specified to find this formula. + sig { returns(String) } def specified_name alias_name || name end # The name (including tap) specified to find this formula. + sig { returns(String) } def full_specified_name full_alias_name || full_name end # The name specified to install this formula. + sig { returns(String) } def installed_specified_name installed_alias_name || name end # The name (including tap) specified to install this formula. + sig { returns(String) } def full_installed_specified_name full_installed_alias_name || full_name end @@ -429,7 +434,7 @@ class Formula # The Bottle object for the currently active {SoftwareSpec}. sig { returns(T.nilable(Bottle)) } def bottle - @bottle ||= Bottle.new(self, bottle_specification) if bottled? + @bottle ||= T.let(Bottle.new(self, bottle_specification), T.nilable(Bottle)) if bottled? end # The Bottle object for given tag. @@ -440,22 +445,22 @@ class Formula # The description of the software. # @!method desc - # @see .desc= + # @see .desc delegate desc: :"self.class" # The SPDX ID of the software license. # @!method license - # @see .license= + # @see .license delegate license: :"self.class" # The homepage for the software. # @!method homepage - # @see .homepage= + # @see .homepage delegate homepage: :"self.class" # The livecheck specification for the software. # @!method livecheck - # @see .livecheck= + # @see .livecheck delegate livecheck: :"self.class" # Is a livecheck specification defined for the software? @@ -513,15 +518,11 @@ class Formula # The {PkgVersion} for this formula with {version} and {#revision} information. sig { returns(PkgVersion) } - def pkg_version - PkgVersion.new(version, revision) - end + def pkg_version = PkgVersion.new(version, revision) # If this is a `@`-versioned formula. sig { returns(T::Boolean) } - def versioned_formula? - name.include?("@") - end + def versioned_formula? = name.include?("@") # Returns any other `@`-versioned formulae names for any formula (including versioned formulae). sig { returns(T::Array[String]) } @@ -592,12 +593,13 @@ class Formula # @api internal sig { returns(T::Array[String]) } def oldnames - @oldnames ||= if (tap = self.tap) - Tap.tap_migration_oldnames(tap, name) + - tap.formula_reverse_renames.fetch(name, []) - else - [] - end + @oldnames ||= T.let( + if (tap = self.tap) + Tap.tap_migration_oldnames(tap, name) + tap.formula_reverse_renames.fetch(name, []) + else + [] + end, T.nilable(T::Array[String]) + ) end # All aliases for the formula. @@ -605,11 +607,13 @@ class Formula # @api internal sig { returns(T::Array[String]) } def aliases - @aliases ||= if (tap = self.tap) - tap.alias_reverse_table.fetch(full_name, []).map { _1.split("/").last } - else - [] - end + @aliases ||= T.let( + if (tap = self.tap) + tap.alias_reverse_table.fetch(full_name, []).map { _1.split("/").fetch(-1) } + else + [] + end, T.nilable(T::Array[String]) + ) end # The {Resource}s for the currently active {SoftwareSpec}. @@ -672,6 +676,7 @@ class Formula # You probably want {#opt_prefix} instead. # # @api internal + sig { returns(Pathname) } def linked_keg linked_keg = possible_names.map { |name| HOMEBREW_LINKED_KEGS/name } .find(&:directory?) @@ -680,6 +685,7 @@ class Formula HOMEBREW_LINKED_KEGS/name end + sig { returns(T.nilable(PkgVersion)) } def latest_head_version head_versions = installed_prefixes.filter_map do |pn| pn_pkgversion = PkgVersion.parse(pn.basename.to_s) @@ -691,11 +697,13 @@ class Formula end end + sig { returns(T.nilable(Pathname)) } def latest_head_prefix head_version = latest_head_version prefix(head_version) if head_version end + sig { params(version: PkgVersion, fetch_head: T::Boolean).returns(T::Boolean) } def head_version_outdated?(version, fetch_head: false) tab = Tab.for_keg(prefix(version)) @@ -712,9 +720,10 @@ class Formula end # The latest prefix for this formula. Checks for {#head} and then {#stable}'s {#prefix} + sig { returns(Pathname) } def latest_installed_prefix if head && (head_version = latest_head_version) && !head_version_outdated?(head_version) - latest_head_prefix + T.must(latest_head_prefix) elsif stable && (stable_prefix = prefix(PkgVersion.new(T.must(stable).version, revision))).directory? stable_prefix else @@ -742,17 +751,14 @@ class Formula # # @api internal sig { returns(T::Boolean) } - def linked? - linked_keg.symlink? - end + def linked? = linked_keg.symlink? # Is the formula linked to `opt`? sig { returns(T::Boolean) } - def optlinked? - opt_prefix.symlink? - end + def optlinked? = opt_prefix.symlink? # If a formula's linked keg points to the prefix. + sig { params(version: T.any(String, PkgVersion)).returns(T::Boolean) } def prefix_linked?(version = pkg_version) return false unless linked? @@ -770,11 +776,10 @@ class Formula # The parent of the prefix; the named directory in the cellar containing all # installed versions of this software. sig { returns(Pathname) } - def rack - HOMEBREW_CELLAR/name - end + def rack = HOMEBREW_CELLAR/name # All currently installed prefix directories. + sig { returns(T::Array[Pathname]) } def installed_prefixes possible_names.map { |name| HOMEBREW_CELLAR/name } .select(&:directory?) @@ -808,9 +813,7 @@ class Formula # # @api public sig { returns(Pathname) } - def bin - prefix/"bin" - end + def bin = prefix/"bin" # The directory where the formula's documentation should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -818,9 +821,7 @@ class Formula # # @api public sig { returns(Pathname) } - def doc - share/"doc"/name - end + def doc = share/"doc"/name # The directory where the formula's headers should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -836,9 +837,7 @@ class Formula # # @api public sig { returns(Pathname) } - def include - prefix/"include" - end + def include = prefix/"include" # The directory where the formula's info files should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -846,9 +845,7 @@ class Formula # # @api public sig { returns(Pathname) } - def info - share/"info" - end + def info = share/"info" # The directory where the formula's libraries should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -864,9 +861,7 @@ class Formula # # @api public sig { returns(Pathname) } - def lib - prefix/"lib" - end + def lib = prefix/"lib" # The directory where the formula's binaries should be installed. # This is not symlinked into `HOMEBREW_PREFIX`. @@ -883,9 +878,7 @@ class Formula # # @api public sig { returns(Pathname) } - def libexec - prefix/"libexec" - end + def libexec = prefix/"libexec" # The root directory where the formula's manual pages should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -895,9 +888,7 @@ class Formula # # @api public sig { returns(Pathname) } - def man - share/"man" - end + def man = share/"man" # The directory where the formula's man1 pages should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -913,9 +904,7 @@ class Formula # # @api public sig { returns(Pathname) } - def man1 - man/"man1" - end + def man1 = man/"man1" # The directory where the formula's man2 pages should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -923,9 +912,7 @@ class Formula # # @api public sig { returns(Pathname) } - def man2 - man/"man2" - end + def man2 = man/"man2" # The directory where the formula's man3 pages should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -941,9 +928,7 @@ class Formula # # @api public sig { returns(Pathname) } - def man3 - man/"man3" - end + def man3 = man/"man3" # The directory where the formula's man4 pages should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -951,9 +936,7 @@ class Formula # # @api public sig { returns(Pathname) } - def man4 - man/"man4" - end + def man4 = man/"man4" # The directory where the formula's man5 pages should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -961,9 +944,7 @@ class Formula # # @api public sig { returns(Pathname) } - def man5 - man/"man5" - end + def man5 = man/"man5" # The directory where the formula's man6 pages should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -971,9 +952,7 @@ class Formula # # @api public sig { returns(Pathname) } - def man6 - man/"man6" - end + def man6 = man/"man6" # The directory where the formula's man7 pages should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -981,9 +960,7 @@ class Formula # # @api public sig { returns(Pathname) } - def man7 - man/"man7" - end + def man7 = man/"man7" # The directory where the formula's man8 pages should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -991,9 +968,7 @@ class Formula # # @api public sig { returns(Pathname) } - def man8 - man/"man8" - end + def man8 = man/"man8" # The directory where the formula's `sbin` binaries should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -1002,9 +977,7 @@ class Formula # # @api public sig { returns(Pathname) } - def sbin - prefix/"sbin" - end + def sbin = prefix/"sbin" # The directory where the formula's shared files should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -1038,9 +1011,7 @@ class Formula # # @api public sig { returns(Pathname) } - def share - prefix/"share" - end + def share = prefix/"share" # The directory where the formula's shared files should be installed, # with the name of the formula appended to avoid linking conflicts. @@ -1057,9 +1028,7 @@ class Formula # # @api public sig { returns(Pathname) } - def pkgshare - prefix/"share"/name - end + def pkgshare = prefix/"share"/name # The directory where Emacs Lisp files should be installed, with the # formula name appended to avoid linking conflicts. @@ -1074,9 +1043,7 @@ class Formula # # @api public sig { returns(Pathname) } - def elisp - prefix/"share/emacs/site-lisp"/name - end + def elisp = prefix/"share/emacs/site-lisp"/name # The directory where the formula's Frameworks should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -1085,9 +1052,7 @@ class Formula # # @api public sig { returns(Pathname) } - def frameworks - prefix/"Frameworks" - end + def frameworks = prefix/"Frameworks" # The directory where the formula's kernel extensions should be installed. # This is symlinked into `HOMEBREW_PREFIX` after installation or with @@ -1096,9 +1061,7 @@ class Formula # # @api public sig { returns(Pathname) } - def kext_prefix - prefix/"Library/Extensions" - end + def kext_prefix = prefix/"Library/Extensions" # The directory where the formula's configuration files should be installed. # Anything using `etc.install` will not overwrite other files on e.g. upgrades @@ -1108,9 +1071,7 @@ class Formula # # @api public sig { returns(Pathname) } - def etc - (HOMEBREW_PREFIX/"etc").extend(InstallRenamed) - end + def etc = (HOMEBREW_PREFIX/"etc").extend(InstallRenamed) # A subdirectory of `etc` with the formula name suffixed. # e.g. `$HOMEBREW_PREFIX/etc/openssl@1.1` @@ -1119,9 +1080,7 @@ class Formula # # @api public sig { returns(Pathname) } - def pkgetc - (HOMEBREW_PREFIX/"etc"/name).extend(InstallRenamed) - end + def pkgetc = (HOMEBREW_PREFIX/"etc"/name).extend(InstallRenamed) # The directory where the formula's variable files should be installed. # This directory is not inside the `HOMEBREW_CELLAR` so it persists @@ -1129,9 +1088,7 @@ class Formula # # @api public sig { returns(Pathname) } - def var - HOMEBREW_PREFIX/"var" - end + def var = HOMEBREW_PREFIX/"var" # The directory where the formula's zsh function files should be # installed. @@ -1140,9 +1097,7 @@ class Formula # # @api public sig { returns(Pathname) } - def zsh_function - share/"zsh/site-functions" - end + def zsh_function = share/"zsh/site-functions" # The directory where the formula's fish function files should be # installed. @@ -1151,9 +1106,7 @@ class Formula # # @api public sig { returns(Pathname) } - def fish_function - share/"fish/vendor_functions.d" - end + def fish_function = share/"fish/vendor_functions.d" # The directory where the formula's Bash completion files should be # installed. @@ -1162,9 +1115,7 @@ class Formula # # @api public sig { returns(Pathname) } - def bash_completion - prefix/"etc/bash_completion.d" - end + def bash_completion = prefix/"etc/bash_completion.d" # The directory where the formula's zsh completion files should be # installed. @@ -1173,9 +1124,7 @@ class Formula # # @api public sig { returns(Pathname) } - def zsh_completion - share/"zsh/site-functions" - end + def zsh_completion = share/"zsh/site-functions" # The directory where the formula's fish completion files should be # installed. @@ -1184,23 +1133,24 @@ class Formula # # @api public sig { returns(Pathname) } - def fish_completion - share/"fish/vendor_completions.d" - end + def fish_completion = share/"fish/vendor_completions.d" + + # The directory where formula's powershell completion files should be + # installed. + # This is symlinked into `HOMEBREW_PREFIX` after installation or with + # `brew link` for formulae that are not keg-only. + sig { returns(Pathname) } + def pwsh_completion = share/"pwsh/completions" # The directory used for as the prefix for {#etc} and {#var} files on # installation so, despite not being in `HOMEBREW_CELLAR`, they are installed # there after pouring a bottle. sig { returns(Pathname) } - def bottle_prefix - prefix/".bottle" - end + def bottle_prefix = prefix/".bottle" # The directory where the formula's installation or test logs will be written. sig { returns(Pathname) } - def logs - HOMEBREW_LOGS + name - end + def logs = HOMEBREW_LOGS + name # The prefix, if any, to use in filenames for logging current activity. sig { returns(String) } @@ -1213,9 +1163,10 @@ class Formula end # Runs a block with the given log type in effect for its duration. - def with_logging(log_type) + sig { params(log_type: String, _block: T.proc.void).void } + def with_logging(log_type, &_block) old_log_type = @active_log_type - @active_log_type = log_type + @active_log_type = T.let(log_type, T.nilable(String)) yield ensure @active_log_type = old_log_type @@ -1253,6 +1204,7 @@ class Formula # ``` # # @see https://www.unix.com/man-page/all/5/plist/ plist(5) man page + sig { returns(NilClass) } def plist odisabled "`Formula#plist`", "`Homebrew::Service`" nil @@ -1260,37 +1212,28 @@ class Formula # The generated launchd {.plist} service name. sig { returns(String) } - def plist_name - service.plist_name - end + def plist_name = service.plist_name # The generated service name. sig { returns(String) } - def service_name - service.service_name - end + def service_name = service.service_name # The generated launchd {.service} file path. sig { returns(Pathname) } - def launchd_service_path - opt_prefix/"#{plist_name}.plist" - end + def launchd_service_path = opt_prefix/"#{plist_name}.plist" # The generated systemd {.service} file path. sig { returns(Pathname) } - def systemd_service_path - opt_prefix/"#{service_name}.service" - end + def systemd_service_path = opt_prefix/"#{service_name}.service" # The generated systemd {.timer} file path. sig { returns(Pathname) } - def systemd_timer_path - opt_prefix/"#{service_name}.timer" - end + def systemd_timer_path = opt_prefix/"#{service_name}.timer" # The service specification of the software. + sig { returns(Homebrew::Service) } def service - @service ||= Homebrew::Service.new(self, &self.class.service) + @service ||= T.let(Homebrew::Service.new(self, &self.class.service), T.nilable(Homebrew::Service)) end # A stable path for this formula, when installed. Contains the formula name @@ -1308,81 +1251,61 @@ class Formula # # @api public sig { returns(Pathname) } - def opt_prefix - HOMEBREW_PREFIX/"opt"/name - end + def opt_prefix = HOMEBREW_PREFIX/"opt"/name # Same as {#bin}, but relative to {#opt_prefix} instead of {#prefix}. # # @api public sig { returns(Pathname) } - def opt_bin - opt_prefix/"bin" - end + def opt_bin = opt_prefix/"bin" # Same as {#include}, but relative to {#opt_prefix} instead of {#prefix}. # # @api public sig { returns(Pathname) } - def opt_include - opt_prefix/"include" - end + def opt_include = opt_prefix/"include" # Same as {#lib}, but relative to {#opt_prefix} instead of {#prefix}. # # @api public sig { returns(Pathname) } - def opt_lib - opt_prefix/"lib" - end + def opt_lib = opt_prefix/"lib" # Same as {#libexec}, but relative to {#opt_prefix} instead of {#prefix}. # # @api public sig { returns(Pathname) } - def opt_libexec - opt_prefix/"libexec" - end + def opt_libexec = opt_prefix/"libexec" # Same as {#sbin}, but relative to {#opt_prefix} instead of {#prefix}. # # @api public sig { returns(Pathname) } - def opt_sbin - opt_prefix/"sbin" - end + def opt_sbin = opt_prefix/"sbin" # Same as {#share}, but relative to {#opt_prefix} instead of {#prefix}. # # @api public sig { returns(Pathname) } - def opt_share - opt_prefix/"share" - end + def opt_share = opt_prefix/"share" # Same as {#pkgshare}, but relative to {#opt_prefix} instead of {#prefix}. # # @api public sig { returns(Pathname) } - def opt_pkgshare - opt_prefix/"share"/name - end + def opt_pkgshare = opt_prefix/"share"/name # Same as {#elisp}, but relative to {#opt_prefix} instead of {#prefix}. # # @api public sig { returns(Pathname) } - def opt_elisp - opt_prefix/"share/emacs/site-lisp"/name - end + def opt_elisp = opt_prefix/"share/emacs/site-lisp"/name # Same as {#frameworks}, but relative to {#opt_prefix} instead of {#prefix}. # # @api public sig { returns(Pathname) } - def opt_frameworks - opt_prefix/"Frameworks" - end + def opt_frameworks = opt_prefix/"Frameworks" # Indicates that this formula supports bottles. (Not necessarily that one # should be used in the current installation run.) @@ -1391,9 +1314,7 @@ class Formula # are supported. # Replaced by {.pour_bottle?}'s `satisfy` method if it is specified. sig { returns(T::Boolean) } - def pour_bottle? - true - end + def pour_bottle? = true delegate pour_bottle_check_unsatisfied_reason: :"self.class" @@ -1418,7 +1339,7 @@ class Formula sig { void } def run_post_install - @prefix_returns_versioned_prefix = true + @prefix_returns_versioned_prefix = T.let(true, T.nilable(T::Boolean)) build = self.build begin @@ -1443,7 +1364,7 @@ class Formula end ensure self.build = build - @prefix_returns_versioned_prefix = false + @prefix_returns_versioned_prefix = T.let(false, T.nilable(T::Boolean)) end end @@ -1473,9 +1394,7 @@ class Formula # end # ``` sig { overridable.returns(T.nilable(String)) } - def caveats - nil - end + def caveats = nil # Rarely, you don't want your library symlinked into the main prefix. # See `gettext.rb` for an example. @@ -1494,13 +1413,14 @@ class Formula # @see .skip_clean sig { params(path: Pathname).returns(T::Boolean) } def skip_clean?(path) - return true if path.extname == ".la" && self.class.skip_clean_paths.include?(:la) + return true if path.extname == ".la" && T.must(self.class.skip_clean_paths).include?(:la) to_check = path.relative_path_from(prefix).to_s - self.class.skip_clean_paths.include? to_check + T.must(self.class.skip_clean_paths).include? to_check end # @see .link_overwrite + sig { params(path: Pathname).returns(T::Boolean) } def link_overwrite?(path) # Don't overwrite files not created by Homebrew. return false if path.stat.uid != HOMEBREW_ORIGINAL_BREW_FILE.stat.uid @@ -1528,10 +1448,10 @@ class Formula end end to_check = path.relative_path_from(HOMEBREW_PREFIX).to_s - self.class.link_overwrite_paths.any? do |p| - p == to_check || - to_check.start_with?("#{p.chomp("/")}/") || - /^#{Regexp.escape(p).gsub('\*', ".*?")}$/.match?(to_check) + T.must(self.class.link_overwrite_paths).any? do |p| + p.to_s == to_check || + to_check.start_with?("#{p.to_s.chomp("/")}/") || + /^#{Regexp.escape(p.to_s).gsub('\*', ".*?")}$/.match?(to_check) end end @@ -1592,15 +1512,12 @@ class Formula delegate disable_replacement: :"self.class" sig { returns(T::Boolean) } - def skip_cxxstdlib_check? - false - end + def skip_cxxstdlib_check? = false sig { returns(T::Boolean) } - def require_universal_deps? - false - end + def require_universal_deps? = false + sig { void } def patch return if patchlist.empty? @@ -1608,6 +1525,20 @@ class Formula patchlist.each(&:apply) end + sig { params(is_data: T::Boolean).void } + def selective_patch(is_data: false) + patches = patchlist.select { |p| p.is_a?(DATAPatch) == is_data } + return if patches.empty? + + patchtype = if is_data + "DATA" + else + "non-DATA" + end + ohai "Applying #{patchtype} patches" + patches.each(&:apply) + end + # Yields |self,staging| with current working directory set to the uncompressed tarball # where staging is a {Mktemp} staging context. sig(:final) { @@ -1615,7 +1546,7 @@ class Formula _blk: T.proc.params(arg0: Formula, arg1: Mktemp).void).void } def brew(fetch: true, keep_tmp: false, debug_symbols: false, interactive: false, &_blk) - @prefix_returns_versioned_prefix = true + @prefix_returns_versioned_prefix = T.let(true, T.nilable(T::Boolean)) active_spec.fetch if fetch stage(interactive:, debug_symbols:) do |staging| staging.retain! if keep_tmp || debug_symbols @@ -1644,12 +1575,13 @@ class Formula end end ensure - @prefix_returns_versioned_prefix = false + @prefix_returns_versioned_prefix = T.let(false, T.nilable(T::Boolean)) end + sig { returns(T::Array[String]) } def lock - @lock = FormulaLock.new(name) - @lock.lock + @lock = T.let(FormulaLock.new(name), T.nilable(FormulaLock)) + T.must(@lock).lock oldnames.each do |oldname| next unless (oldname_rack = HOMEBREW_CELLAR/oldname).exist? @@ -1661,6 +1593,7 @@ class Formula end end + sig { returns(T::Array[FormulaLock]) } def unlock @lock&.unlock @oldname_locks.each(&:unlock) @@ -1682,6 +1615,7 @@ class Formula !oldnames_to_migrate.empty? && !rack.exist? end + sig { params(fetch_head: T::Boolean).returns(T::Array[Keg]) } def outdated_kegs(fetch_head: false) raise Migrator::MigrationNeededError.new(oldnames_to_migrate.first, name) if migration_needed? @@ -1722,6 +1656,7 @@ class Formula installed_alias_target_changed? && !latest_formula.latest_version_installed? end + sig { returns(T.nilable(Formula)) } def current_installed_alias_target Formulary.factory(T.must(installed_alias_name)) if installed_alias_path end @@ -1738,9 +1673,7 @@ class Formula # Is this formula the target of an alias used to install an old formula? sig { returns(T::Boolean) } - def supersedes_an_installed_formula? - old_installed_formulae.any? - end + def supersedes_an_installed_formula? = old_installed_formulae.any? # Has the alias used to install the formula changed, or are different # formulae already installed with this alias? @@ -1751,10 +1684,12 @@ class Formula # If the alias has changed value, return the new formula. # Otherwise, return self. + sig { returns(Formula) } def latest_formula - installed_alias_target_changed? ? current_installed_alias_target : self + installed_alias_target_changed? ? T.must(current_installed_alias_target) : self end + sig { returns(T::Array[Formula]) } def old_installed_formulae # If this formula isn't the current target of the alias, # it doesn't make sense to say that other formulae are older versions of it @@ -1774,18 +1709,13 @@ class Formula true end - delegate pinnable?: :@pin + def_delegators :@pin, :pinnable?, :pinned_version, :pin, :unpin # !attr[r] pinned? # @api internal delegate pinned?: :@pin - delegate pinned_version: :@pin - - delegate pin: :@pin - - delegate unpin: :@pin - + sig { params(other: T.untyped).returns(T::Boolean) } def ==(other) self.class == other.class && name == other.name && @@ -1793,16 +1723,17 @@ class Formula end alias eql? == - def hash - name.hash - end + sig { returns(Integer) } + def hash = name.hash + sig { params(other: BasicObject).returns(T.nilable(Integer)) } def <=>(other) - return unless other.is_a?(Formula) - - name <=> other.name + case other + when Formula then name <=> other.name + end end + sig { returns(T::Array[String]) } def possible_names [name, *oldnames, *aliases].compact end @@ -1922,7 +1853,7 @@ class Formula # # @api public sig { - params(prefix: T.any(String, Pathname, FalseClass), + params(prefix: T.any(FalseClass, String, Pathname), build_isolation: T::Boolean).returns(T::Array[String]) } def std_pip_args(prefix: self.prefix, build_isolation: false) @@ -1932,6 +1863,29 @@ class Formula args end + # Standard parameters for zig builds. + # + # `release_mode` can be set to either `:safe`, `:fast`, or `:small` + # with `:fast` being the default value + # + # @api public + sig { + params(prefix: T.any(String, Pathname), + release_mode: Symbol).returns(T::Array[String]) + } + def std_zig_args(prefix: self.prefix, release_mode: :fast) + raise ArgumentError, "Invalid Zig release mode: #{release_mode}" if [:safe, :fast, :small].exclude?(release_mode) + + release_mode_downcased = release_mode.to_s.downcase + release_mode_capitalized = release_mode.to_s.capitalize + [ + "--prefix", prefix.to_s, + "--release=#{release_mode_downcased}", + "-Doptimize=Release#{release_mode_capitalized}", + "--summary", "all" + ] + end + # Shared library names according to platform conventions. # # Optionally specify a `version` to restrict the shared library to a specific @@ -1988,9 +1942,7 @@ class Formula # # @api public sig { returns(String) } - def loader_path - "@loader_path" - end + def loader_path = "@loader_path" # Creates a new `Time` object for use in the formula as the build time. # @@ -2045,7 +1997,8 @@ class Formula end private :extract_macho_slice_from - # Generate shell completions for a formula for `bash`, `zsh` and `fish`, using the formula's executable. + # Generate shell completions for a formula for `bash`, `zsh`, `fish`, and + # optionally `pwsh` using the formula's executable. # # ### Examples # @@ -2061,6 +2014,19 @@ class Formula # "completions", "fish") # ``` # + # If your executable can generate completions for PowerShell, + # you must pass ":pwsh" explicitly along with any other supported shells. + # This will pass "powershell" as the completion argument. + # + # ```ruby + # generate_completions_from_executable(bin/"foo", "completions", shells: [:bash, :pwsh]) + # + # # translates to + # (bash_completion/"foo").write Utils.safe_popen_read({ "SHELL" => "bash" }, bin/"foo", "completions", "bash") + # (pwsh_completion/"foo").write Utils.safe_popen_read({ "SHELL" => "pwsh" }, bin/"foo", + # "completions", "powershell") + # ``` + # # Selecting shells and using a different `base_name`. # # ```ruby @@ -2160,28 +2126,31 @@ class Formula bash: bash_completion/base_name, zsh: zsh_completion/"_#{base_name}", fish: fish_completion/"#{base_name}.fish", + pwsh: pwsh_completion/"#{base_name}.ps1", } shells.each do |shell| popen_read_env = { "SHELL" => shell.to_s } script_path = completion_script_path_map[shell] + # Go's cobra and Rust's clap accept "powershell". + shell_argument = (shell == :pwsh) ? "powershell" : shell.to_s shell_parameter = if shell_parameter_format.nil? - shell.to_s + shell_argument.to_s elsif shell_parameter_format == :flag - "--#{shell}" + "--#{shell_argument}" elsif shell_parameter_format == :arg - "--shell=#{shell}" + "--shell=#{shell_argument}" elsif shell_parameter_format == :none nil elsif shell_parameter_format == :click prog_name = File.basename(executable).upcase.tr("-", "_") - popen_read_env["_#{prog_name}_COMPLETE"] = "#{shell}_source" + popen_read_env["_#{prog_name}_COMPLETE"] = "#{shell_argument}_source" nil elsif shell_parameter_format == :clap - popen_read_env["COMPLETE"] = shell.to_s + popen_read_env["COMPLETE"] = shell_argument.to_s nil else - "#{shell_parameter_format}#{shell}" + "#{shell_parameter_format}#{shell_argument}" end popen_read_args = %w[] @@ -2198,32 +2167,40 @@ class Formula end # an array of all core {Formula} names + sig { returns(T::Array[String]) } def self.core_names CoreTap.instance.formula_names end # an array of all tap {Formula} names + sig { returns(T::Array[String]) } def self.tap_names - @tap_names ||= Tap.reject(&:core_tap?).flat_map(&:formula_names).sort + @tap_names ||= T.let(Tap.reject(&:core_tap?).flat_map(&:formula_names).sort, T.nilable(T::Array[String])) end # an array of all tap {Formula} files + sig { returns(T::Array[Pathname]) } def self.tap_files - @tap_files ||= Tap.reject(&:core_tap?).flat_map(&:formula_files) + @tap_files ||= T.let(Tap.reject(&:core_tap?).flat_map(&:formula_files), T.nilable(T::Array[Pathname])) end # an array of all {Formula} names + sig { returns(T::Array[String]) } def self.names - @names ||= (core_names + tap_names.map { |name| name.split("/").last }).uniq.sort + @names ||= T.let((core_names + tap_names.map do |name| + name.split("/").fetch(-1) + end).uniq.sort, T.nilable(T::Array[String])) end # an array of all {Formula} names, which the tap formulae have the fully-qualified name + sig { returns(T::Array[String]) } def self.full_names - @full_names ||= core_names + tap_names + @full_names ||= T.let(core_names + tap_names, T.nilable(T::Array[String])) end # an array of all {Formula} # this should only be used when users specify `--all` to a command + sig { params(eval_all: T::Boolean).returns(T::Array[Formula]) } def self.all(eval_all: false) if !eval_all && !Homebrew::EnvConfig.eval_all? raise ArgumentError, "Formula#all without `--eval-all` or HOMEBREW_EVAL_ALL" @@ -2241,6 +2218,7 @@ class Formula end # An array of all racks currently installed. + sig { returns(T::Array[Pathname]) } def self.racks Formula.cache[:racks] ||= if HOMEBREW_CELLAR.directory? HOMEBREW_CELLAR.subdirs.reject do |rack| @@ -2258,6 +2236,7 @@ class Formula end # An array of all installed {Formula} + sig { returns(T::Array[Formula]) } def self.installed Formula.cache[:installed] ||= racks.flat_map do |rack| Formulary.from_rack(rack) @@ -2266,6 +2245,7 @@ class Formula end.uniq(&:name) end + sig { params(alias_path: T.nilable(Pathname)).returns(T::Array[Formula]) } def self.installed_with_alias_path(alias_path) return [] if alias_path.nil? @@ -2273,36 +2253,46 @@ class Formula end # an array of all alias files of core {Formula} + sig { returns(T::Array[Pathname]) } def self.core_alias_files CoreTap.instance.alias_files end # an array of all core aliases + sig { returns(T::Array[String]) } def self.core_aliases CoreTap.instance.aliases end # an array of all tap aliases + sig { returns(T::Array[String]) } def self.tap_aliases - @tap_aliases ||= Tap.reject(&:core_tap?).flat_map(&:aliases).sort + @tap_aliases ||= T.let(Tap.reject(&:core_tap?).flat_map(&:aliases).sort, T.nilable(T::Array[String])) end # an array of all aliases + sig { returns(T::Array[String]) } def self.aliases - @aliases ||= (core_aliases + tap_aliases.map { |name| name.split("/").last }).uniq.sort + @aliases ||= T.let((core_aliases + tap_aliases.map do |name| + name.split("/").fetch(-1) + end).uniq.sort, T.nilable(T::Array[String])) end # an array of all aliases as fully-qualified names + sig { returns(T::Array[String]) } def self.alias_full_names - @alias_full_names ||= core_aliases + tap_aliases + @alias_full_names ||= T.let(core_aliases + tap_aliases, T.nilable(T::Array[String])) end # Returns a list of approximately matching formula names, but not the complete match + sig { params(name: String).returns(T::Array[String]) } def self.fuzzy_search(name) - @spell_checker ||= DidYouMean::SpellChecker.new(dictionary: Set.new(names + full_names).to_a) - @spell_checker.correct(name) + @spell_checker ||= T.let(DidYouMean::SpellChecker.new(dictionary: Set.new(names + full_names).to_a), + T.nilable(DidYouMean::SpellChecker)) + T.cast(@spell_checker.correct(name), T::Array[String]) end + sig { params(name: T.any(Pathname, String)).returns(Formula) } def self.[](name) Formulary.factory(name) end @@ -2328,6 +2318,7 @@ class Formula requirements.none?(MacOSRequirement) && requirements.none?(LinuxRequirement) end + sig { params(options: T::Hash[Symbol, String]).void } def print_tap_action(options = {}) return unless tap? @@ -2335,6 +2326,7 @@ class Formula ohai "#{verb} #{name} from #{tap}" end + sig { returns(T.nilable(String)) } def tap_git_head tap&.git_head rescue TapUnavailableError @@ -2346,12 +2338,13 @@ class Formula # !attr[r] conflicts # @api internal sig { returns(T::Array[FormulaConflict]) } - def conflicts = self.class.conflicts + def conflicts = T.must(self.class.conflicts) # Returns a list of Dependency objects in an installable order, which # means if a depends on b then b will be ordered before a in this list # # @api internal + sig { params(block: T.nilable(T.proc.params(arg0: Formula, arg1: Dependency).void)).returns(T::Array[Dependency]) } def recursive_dependencies(&block) cache_key = "Formula#recursive_dependencies" unless block Dependency.expand(self, cache_key:, &block) @@ -2360,6 +2353,7 @@ class Formula # The full set of Requirements for this formula's dependency tree. # # @api internal + sig { params(block: T.nilable(T.proc.params(arg0: Formula, arg1: Requirement).void)).returns(Requirements) } def recursive_requirements(&block) cache_key = "Formula#recursive_requirements" unless block Requirement.expand(self, cache_key:, &block) @@ -2389,6 +2383,7 @@ class Formula # Returns the {PkgVersion} for this formula if it is installed. # If not, return `nil`. + sig { returns(T.nilable(PkgVersion)) } def any_installed_version any_installed_keg&.version end @@ -2396,6 +2391,7 @@ class Formula # Returns a list of Dependency objects that are required at runtime. # # @api internal + sig { params(read_from_tab: T::Boolean, undeclared: T::Boolean).returns(T::Array[Dependency]) } def runtime_dependencies(read_from_tab: true, undeclared: true) deps = if read_from_tab && undeclared && (tab_deps = any_installed_keg&.runtime_dependencies) @@ -2417,6 +2413,7 @@ class Formula end # Returns a list of {Formula} objects that are required at runtime. + sig { params(read_from_tab: T::Boolean, undeclared: T::Boolean).returns(T::Array[Formula]) } def runtime_formula_dependencies(read_from_tab: true, undeclared: true) cache_key = "#{full_name}-#{read_from_tab}-#{undeclared}" @@ -2431,6 +2428,7 @@ class Formula end end + sig { returns(T::Array[Formula]) } def runtime_installed_formula_dependents # `any_installed_keg` and `runtime_dependencies` `select`s ensure # that we don't end up with something `Formula#runtime_dependencies` can't @@ -2450,8 +2448,8 @@ class Formula # Returns a list of formulae depended on by this formula that aren't # installed. - def missing_dependencies(hide: nil) - hide ||= [] + sig { params(hide: T::Array[String]).returns(T::Array[Formula]) } + def missing_dependencies(hide: []) runtime_formula_dependencies.select do |f| hide.include?(f.name) || f.installed_prefixes.empty? end @@ -2471,6 +2469,7 @@ class Formula Checksum.new(Digest::SHA256.file(path).hexdigest) if path.exist? end + sig { params(dependables: T::Hash[Symbol, T.untyped]).returns(T::Array[T::Hash[Symbol, T.untyped]]) } def merge_spec_dependables(dependables) # We have a hash of specs names (stable/head) to dependency lists. # Merge all of the dependency lists together, removing any duplicates. @@ -2486,6 +2485,7 @@ class Formula end private :merge_spec_dependables + sig { returns(T::Hash[String, T.untyped]) } def to_hash hsh = { "name" => name, @@ -2572,6 +2572,7 @@ class Formula hsh end + sig { returns(T::Hash[String, T.untyped]) } def to_hash_with_variations hash = to_hash @@ -2613,6 +2614,7 @@ class Formula end # Returns the bottle information for a formula. + sig { returns(T::Hash[String, T.untyped]) } def bottle_hash hash = {} stable_spec = stable @@ -2643,6 +2645,7 @@ class Formula hash end + sig { returns(T::Hash[String, T::Hash[String, T.untyped]]) } def urls_hash hash = {} @@ -2668,6 +2671,7 @@ class Formula hash end + sig { returns(T::Array[T::Hash[String, T.untyped]]) } def serialized_requirements requirements = self.class.spec_syms.to_h do |sym| [sym, send(sym)&.requirements] @@ -2693,11 +2697,13 @@ class Formula end end + sig { returns(T.nilable(String)) } def caveats_with_placeholders caveats&.gsub(HOMEBREW_PREFIX, HOMEBREW_PREFIX_PLACEHOLDER) &.gsub(HOMEBREW_CELLAR, HOMEBREW_CELLAR_PLACEHOLDER) end + sig { returns(T::Hash[String, T.untyped]) } def dependencies_hash # Create a hash of spec names (stable/head) to the list of dependencies under each dependencies = self.class.spec_syms.to_h do |sym| @@ -2762,6 +2768,7 @@ class Formula hash end + sig { params(spec_symbol: Symbol).returns(T.nilable(T::Hash[String, T.untyped])) } def internal_dependencies_hash(spec_symbol) raise ArgumentError, "Unsupported spec: #{spec_symbol}" unless [:stable, :head].include?(spec_symbol) return unless (spec = public_send(spec_symbol)) @@ -2780,6 +2787,7 @@ class Formula end end + sig { returns(T.nilable(T::Boolean)) } def on_system_blocks_exist? self.class.on_system_blocks_exist? || @on_system_blocks_exist end @@ -2796,13 +2804,15 @@ class Formula active_spec.fetch(verify_download_integrity:, timeout:, quiet:) end + sig { params(filename: T.any(Pathname, String)).void } def verify_download_integrity(filename) odeprecated "Formula#verify_download_integrity", "Resource#verify_download_integrity on Formula#resource" active_spec.verify_download_integrity(filename) end + sig { params(keep_tmp: T::Boolean).returns(T.untyped) } def run_test(keep_tmp: false) - @prefix_returns_versioned_prefix = true + @prefix_returns_versioned_prefix = T.let(true, T.nilable(T::Boolean)) test_env = { TMPDIR: HOMEBREW_TEMP, @@ -2819,9 +2829,9 @@ class Formula mktemp("#{name}-test") do |staging| staging.retain! if keep_tmp - @testpath = T.must(staging.tmpdir) + @testpath = T.let(staging.tmpdir, T.nilable(Pathname)) test_env[:HOME] = @testpath - setup_home @testpath + setup_home T.must(@testpath) begin with_logging("test") do with_env(test_env) do @@ -2835,8 +2845,8 @@ class Formula end end ensure - @prefix_returns_versioned_prefix = false - @testpath = nil + @prefix_returns_versioned_prefix = T.let(false, T.nilable(T::Boolean)) + @testpath = T.let(nil, T.nilable(Pathname)) end sig { returns(T::Boolean) } @@ -2844,8 +2854,10 @@ class Formula method(:test).owner != Formula end + sig { returns(T.nilable(T::Boolean)) } def test; end + sig { params(file: T.any(Pathname, String)).returns(Pathname) } def test_fixtures(file) HOMEBREW_LIBRARY_PATH/"test/support/fixtures"/file end @@ -2863,6 +2875,7 @@ class Formula # system "make", "install" # end # ``` + sig { void } def install; end # Sometimes we have to change a bit before we install. Mostly we @@ -2923,6 +2936,7 @@ class Formula end # Returns a list of Dependency objects that are declared in the formula. + sig { returns(T::Array[Dependency]) } def declared_runtime_dependencies cache_key = "Formula#declared_runtime_dependencies" unless build.any_args_or_options? Dependency.expand(self, cache_key:) do |_, dependency| @@ -2939,6 +2953,7 @@ class Formula # Returns a list of Dependency objects that are not declared in the formula # but the formula links to. + sig { returns(T::Array[Dependency]) } def undeclared_runtime_dependencies keg = any_installed_keg return [] unless keg @@ -3014,6 +3029,8 @@ class Formula pretty_args -= std_go_args when "meson" pretty_args -= std_meson_args + when "zig" + pretty_args -= std_zig_args when %r{(^|/)(pip|python)(?:[23](?:\.\d{1,2})?)?$} pretty_args -= std_pip_args end @@ -3023,7 +3040,7 @@ class Formula end ohai "#{cmd} #{pretty_args * " "}".strip - @exec_count ||= 0 + @exec_count ||= T.let(0, T.nilable(Integer)) @exec_count += 1 logfn = format("#{logs}/#{active_log_prefix}%02d.%s", exec_count: @exec_count, @@ -3071,7 +3088,7 @@ class Formula end end - Process.wait(T.must(pid)) + Process.wait(pid) $stdout.flush @@ -3162,6 +3179,7 @@ class Formula # A version of `FileUtils.mkdir` that also changes to that folder in # a block. + sig { params(name: T.any(String, Pathname), block: T.nilable(T.proc.void)).returns(T.untyped) } def mkdir(name, &block) result = FileUtils.mkdir_p(name) return result unless block @@ -3181,6 +3199,7 @@ class Formula end end + sig { void } def fetch_patches patchlist.select(&:external?).each(&:fetch) end @@ -3192,7 +3211,7 @@ class Formula T.must(bottle).fetch_tab end - sig { returns(Hash) } + sig { returns(T::Hash[String, T.untyped]) } def bottle_tab_attributes return {} unless bottled? @@ -3201,15 +3220,23 @@ class Formula private + sig { void } def prepare_patches patchlist.grep(DATAPatch) { |p| p.path = path } end # Returns the prefix for a given formula version number. - def versioned_prefix(version) - rack/version - end + sig { params(version: T.any(String, Pathname, PkgVersion)).returns(Pathname) } + def versioned_prefix(version) = rack/version.to_s + sig { + params( + cmd: T.any(String, Pathname), + args: T::Array[T.any(String, Integer, Pathname, Symbol)], + out: IO, + logfn: T.nilable(String), + ).void + } def exec_cmd(cmd, args, out, logfn) ENV["HOMEBREW_CC_LOG_PATH"] = logfn @@ -3238,6 +3265,7 @@ class Formula end # Common environment variables used at both build and test time. + sig { returns(T::Hash[Symbol, String]) } def common_stage_test_env { _JAVA_OPTIONS: "-Duser.home=#{HOMEBREW_CACHE}/java_cache", @@ -3250,10 +3278,11 @@ class Formula } end - def stage(interactive: false, debug_symbols: false) + sig { params(interactive: T::Boolean, debug_symbols: T::Boolean, _block: T.proc.params(arg0: Mktemp).void).void } + def stage(interactive: false, debug_symbols: false, &_block) active_spec.stage(debug_symbols:) do |staging| - @source_modified_time = active_spec.source_modified_time - @buildpath = Pathname.pwd + @source_modified_time = T.let(active_spec.source_modified_time, T.nilable(Time)) + @buildpath = T.let(Pathname.pwd, T.nilable(Pathname)) env_home = T.must(buildpath)/".brew_home" mkdir_p env_home @@ -3277,37 +3306,38 @@ class Formula yield staging end ensure - @buildpath = nil + @buildpath = T.let(nil, T.nilable(Pathname)) end end end # The methods below define the formula DSL. class << self - extend Attrable - 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. + sig { params(child: T::Class[Formula]).void } 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 - @loaded_from_api = false - @network_access_allowed = SUPPORTED_NETWORK_ACCESS_PHASES.to_h do |phase| + @stable = T.let(SoftwareSpec.new(flags: build_flags), T.nilable(SoftwareSpec)) + @head = T.let(HeadSoftwareSpec.new(flags: build_flags), T.nilable(HeadSoftwareSpec)) + @livecheck = T.let(Livecheck.new(self), T.nilable(Livecheck)) + @conflicts = T.let([], T.nilable(T::Array[FormulaConflict])) + @skip_clean_paths = T.let(Set.new, T.nilable(T::Set[T.any(String, Symbol)])) + @link_overwrite_paths = T.let(Set.new, T.nilable(T::Set[String])) + @loaded_from_api = T.let(false, T.nilable(T::Boolean)) + @on_system_blocks_exist = T.let(false, T.nilable(T::Boolean)) + @network_access_allowed = T.let(SUPPORTED_NETWORK_ACCESS_PHASES.to_h do |phase| [phase, DEFAULT_NETWORK_ACCESS_ALLOWED] - end + end, T.nilable(T::Hash[Symbol, T::Boolean])) end end + sig { returns(T.self_type) } def freeze specs.each(&:freeze) @livecheck.freeze @@ -3317,14 +3347,20 @@ class Formula super end + sig { returns(T::Hash[Symbol, T::Boolean]) } + def network_access_allowed = T.must(@network_access_allowed) + # Whether this formula was loaded using the formulae.brew.sh API - attr_predicate :loaded_from_api? + sig { returns(T::Boolean) } + def loaded_from_api? = !!@loaded_from_api # 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`). - attr_predicate :on_system_blocks_exist? + sig { returns(T::Boolean) } + def on_system_blocks_exist? = !!@on_system_blocks_exist # The reason for why this software is not linked (by default) to {::HOMEBREW_PREFIX}. + sig { returns(T.nilable(KegOnlyReason)) } attr_reader :keg_only_reason # A one-line description of the software. Used by users to get an overview @@ -3337,9 +3373,11 @@ class Formula # desc "Example formula" # ``` # - # @!attribute [w] desc # @api public - attr_rw :desc + sig { params(val: String).returns(T.nilable(String)) } + def desc(val = T.unsafe(nil)) + val.nil? ? @desc : @desc = T.let(val, T.nilable(String)) + end # The SPDX ID of the open-source license that the formula uses. # Shows when running `brew info`. @@ -3387,15 +3425,18 @@ class Formula # ] # ``` # - # @!attribute [w] license # @see https://docs.brew.sh/License-Guidelines Homebrew License Guidelines # @see https://spdx.github.io/spdx-spec/latest/annexes/spdx-license-expressions/ SPDX license expression guide # @api public + sig { + params(args: T.any(NilClass, String, Symbol, T::Hash[T.any(String, Symbol), T.anything])) + .returns(T.any(NilClass, String, Symbol, T::Hash[T.any(String, Symbol), T.anything])) + } def license(args = nil) if args.nil? @licenses else - @licenses = args + @licenses = T.let(args, T.any(NilClass, String, Symbol, T::Hash[T.any(String, Symbol), T.anything])) end end @@ -3417,18 +3458,16 @@ class Formula # ```ruby # allow_network_access! [:build, :test] # ``` - # - # @!attribute [w] allow_network_access! sig { params(phases: T.any(Symbol, T::Array[Symbol])).void } def allow_network_access!(phases = []) phases_array = Array(phases) if phases_array.empty? - @network_access_allowed.each_key { |phase| @network_access_allowed[phase] = true } + network_access_allowed.each_key { |phase| network_access_allowed[phase] = true } else phases_array.each do |phase| raise ArgumentError, "Unknown phase: #{phase}" unless SUPPORTED_NETWORK_ACCESS_PHASES.include?(phase) - @network_access_allowed[phase] = true + network_access_allowed[phase] = true end end end @@ -3451,18 +3490,16 @@ class Formula # ```ruby # deny_network_access! [:build, :test] # ``` - # - # @!attribute [w] deny_network_access! sig { params(phases: T.any(Symbol, T::Array[Symbol])).void } def deny_network_access!(phases = []) phases_array = Array(phases) if phases_array.empty? - @network_access_allowed.each_key { |phase| @network_access_allowed[phase] = false } + network_access_allowed.each_key { |phase| network_access_allowed[phase] = false } else phases_array.each do |phase| raise ArgumentError, "Unknown phase: #{phase}" unless SUPPORTED_NETWORK_ACCESS_PHASES.include?(phase) - @network_access_allowed[phase] = false + network_access_allowed[phase] = false end end end @@ -3473,7 +3510,7 @@ class Formula raise ArgumentError, "Unknown phase: #{phase}" unless SUPPORTED_NETWORK_ACCESS_PHASES.include?(phase) env_var = Homebrew::EnvConfig.send(:"formula_#{phase}_network") - env_var.nil? ? @network_access_allowed[phase] : env_var == "allow" + env_var.nil? ? network_access_allowed[phase] : env_var == "allow" end # The homepage for the software. Used by users to get more information @@ -3487,9 +3524,11 @@ class Formula # homepage "https://www.example.com" # ``` # - # @!attribute [w] homepage # @api public - attr_rw :homepage + sig { params(val: String).returns(T.nilable(String)) } + def homepage(val = T.unsafe(nil)) + val.nil? ? @homepage : @homepage = T.let(val, T.nilable(String)) + end # Checks whether a `livecheck` specification is defined or not. # @@ -3520,16 +3559,23 @@ class Formula @service_block.present? end - sig { returns(T::Array[FormulaConflict]) } + sig { returns(T.nilable(T::Array[FormulaConflict])) } attr_reader :conflicts - attr_reader :skip_clean_paths, :link_overwrite_paths, :pour_bottle_only_if + sig { returns(T.nilable(T::Set[T.any(String, Symbol)])) } + attr_reader :skip_clean_paths + + sig { returns(T.nilable(T::Set[String])) } + attr_reader :link_overwrite_paths + + sig { returns(T.nilable(Symbol)) } + attr_reader :pour_bottle_only_if # If `pour_bottle?` returns `false` the user-visible reason to display for # why they cannot use the bottle. + sig { returns(T.nilable(String)) } attr_accessor :pour_bottle_check_unsatisfied_reason - # @!attribute [w] revision # Used for creating new Homebrew versions of software without new upstream # versions. For example, if we bump the major version of a library that this # {Formula} {.depends_on} then we may need to update the `revision` of this @@ -3543,9 +3589,11 @@ class Formula # ``` # # @api public - attr_rw :revision + sig { params(val: Integer).returns(T.nilable(Integer)) } + def revision(val = T.unsafe(nil)) + val.nil? ? @revision : @revision = T.let(val, T.nilable(Integer)) + end - # @!attribute [w] version_scheme # Used for creating new Homebrew version schemes. For example, if we want # to change version scheme from one to another, then we may need to update # `version_scheme` of this {Formula} to be able to use new version scheme, @@ -3561,13 +3609,16 @@ class Formula # ``` # # @api public - attr_rw :version_scheme - - def spec_syms - [:stable, :head].freeze + sig { params(val: Integer).returns(T.nilable(Integer)) } + def version_scheme(val = T.unsafe(nil)) + val.nil? ? @version_scheme : @version_scheme = T.let(val, T.nilable(Integer)) end + sig { returns(T::Array[Symbol]) } + def spec_syms = [:stable, :head].freeze + # A list of the {.stable} and {.head} {SoftwareSpec}s. + sig { returns(T::Array[SoftwareSpec]) } def specs spec_syms.map do |sym| send(sym) @@ -3596,13 +3647,10 @@ class Formula # revision: "db8e4de5b2d6653f66aea53094624468caad15d2" # ``` # - # @!attribute [w] url # @api public - def url(val, specs = {}) - stable.url(val, specs) - end + sig { params(val: String, specs: T::Hash[Symbol, T.any(String, Symbol)]).void } + def url(val, specs = {}) = stable.url(val, specs) - # @!attribute [w] version # The version string for the {.stable} version of the formula. # The version is autodetected from the URL and/or tag so only needs to be # declared if it cannot be autodetected correctly. @@ -3614,11 +3662,9 @@ class Formula # ``` # # @api public - def version(val = nil) - stable.version(val) - end + sig { params(val: T.nilable(String)).returns(T.nilable(Version)) } + def version(val = nil) = stable.version(val) - # @!attribute [w] mirror # Additional URLs for the {.stable} version of the formula. # These are only used if the {.url} fails to download. It's optional and # there can be more than one. Generally we add them when the main {.url} @@ -3633,11 +3679,9 @@ class Formula # ``` # # @api public - def mirror(val) - stable.mirror(val) - end + sig { params(val: String).void } + def mirror(val) = stable.mirror(val) - # @!attribute [w] sha256 # @scope class # To verify the cached download's integrity and security we verify the # SHA-256 hash matches what we've declared in the {Formula}. To quickly fill @@ -3651,9 +3695,8 @@ class Formula # ``` # # @api public - def sha256(val) - stable.sha256(val) - end + sig { params(val: String).void } + def sha256(val) = stable.sha256(val) # Adds a {.bottle} {SoftwareSpec}. # This provides a pre-built binary package built by the Homebrew maintainers for you. @@ -3680,15 +3723,13 @@ class Formula # # @api public sig { params(block: T.proc.bind(BottleSpecification).void).void } - def bottle(&block) - stable.bottle(&block) - end + def bottle(&block) = stable.bottle(&block) - def build - stable.build - end + sig { returns(BuildOptions) } + def build = stable.build # Get the `BUILD_FLAGS` from the formula's namespace set in `Formulary::load_formula`. + sig { returns(T::Array[String]) } def build_flags namespace = T.must(to_s.split("::")[0..-2]).join("::") return [] if namespace.empty? @@ -3697,7 +3738,6 @@ class Formula mod.const_get(:BUILD_FLAGS) end - # @!attribute [w] stable # Allows adding {.depends_on} and {Patch}es just to the {.stable} {SoftwareSpec}. # This is required instead of using a conditional. # It is preferable to also pull the {url} and {sha256= sha256} into the block if one is added. @@ -3715,13 +3755,13 @@ class Formula # ``` # # @api public + sig { params(block: T.nilable(T.proc.returns(SoftwareSpec))).returns(T.untyped) } def stable(&block) - return @stable unless block + return T.must(@stable) unless block - @stable.instance_eval(&block) + T.must(@stable).instance_eval(&block) end - # @!attribute [w] head # Adds a {.head} {SoftwareSpec}. # This can be installed by passing the `--HEAD` option to allow # installing software directly from a branch of a version-control repository. @@ -3745,11 +3785,15 @@ class Formula # ```ruby # head "https://hg.is.awesome.but.git.has.won.example.com/", using: :hg # ``` + sig { + params(val: T.nilable(String), specs: T::Hash[Symbol, T.untyped], block: T.nilable(T.proc.void)) + .returns(T.untyped) + } def head(val = nil, specs = {}, &block) if block - @head.instance_eval(&block) + T.must(@head).instance_eval(&block) elsif val - @head.url(val, specs) + T.must(@head).url(val, specs) else @head end @@ -3779,6 +3823,7 @@ class Formula # Specify a Go resource. # # @api public + sig { params(name: String, block: T.nilable(T.proc.void)).void } def go_resource(name, &block) odisabled "`Formula.go_resource`", "Go modules" specs.each { |spec| spec.go_resource(name, &block) } @@ -3847,6 +3892,7 @@ class Formula # ``` # # @api public + sig { params(dep: T.any(String, Symbol, T::Hash[String, T.untyped], T::Class[Requirement])).void } def depends_on(dep) specs.each { |spec| spec.depends_on(dep) } end @@ -3867,7 +3913,6 @@ class Formula specs.each { |spec| spec.uses_from_macos(dep, bounds) } end - # @!attribute [w] option # Options can be used as arguments to `brew install`. # To switch features on/off: `"with-something"` or `"with-otherthing"`. # To use other software: `"with-other-software"` or `"without-foo"`. @@ -3894,11 +3939,11 @@ class Formula # ``` # # @api public + sig { params(name: String, description: String).void } def option(name, description = "") specs.each { |spec| spec.option(name, description) } end - # @!attribute [w] deprecated_option # Deprecated options are used to rename options and migrate users who used # them to newer ones. They are mostly used for migrating non-`with` options # (e.g. `enable-debug`) to `with` options (e.g. `with-debug`). @@ -3910,6 +3955,7 @@ class Formula # ``` # # @api public + sig { params(hash: T::Hash[String, String]).void } def deprecated_option(hash) specs.each { |spec| spec.deprecated_option(hash) } end @@ -3964,6 +4010,9 @@ class Formula # # @see https://docs.brew.sh/Formula-Cookbook#patches Patches # @api public + sig { + params(strip: T.any(String, Symbol), src: T.any(NilClass, String, Symbol), block: T.nilable(T.proc.void)).void + } def patch(strip = :p1, src = nil, &block) specs.each { |spec| spec.patch(strip, src, &block) } end @@ -3977,9 +4026,10 @@ class Formula # ``` # # @api public + sig { params(names: T.untyped).void } def conflicts_with(*names) - opts = names.last.is_a?(Hash) ? names.pop : {} - names.each { |name| conflicts << FormulaConflict.new(name, opts[:because]) } + opts = T.let(names.last.is_a?(Hash) ? names.pop : {}, T::Hash[Symbol, T.untyped]) + names.each { |name| T.must(conflicts) << FormulaConflict.new(name, opts[:because]) } end # Skip cleaning paths in a formula. @@ -4001,10 +4051,11 @@ class Formula # ``` # # @api public + sig { params(paths: T.any(String, Symbol)).returns(T::Set[T.any(String, Symbol)]) } def skip_clean(*paths) paths.flatten! # Specifying :all is deprecated and will become an error - skip_clean_paths.merge(paths) + T.must(skip_clean_paths).merge(paths) end # Software that will not be symlinked into the `brew --prefix` and will @@ -4031,13 +4082,15 @@ class Formula # ``` # # @api public + sig { params(reason: T.any(String, Symbol), explanation: String).void } def keg_only(reason, explanation = "") - @keg_only_reason = KegOnlyReason.new(reason, explanation) + @keg_only_reason = T.let(KegOnlyReason.new(reason, explanation), T.nilable(KegOnlyReason)) end # Pass `:skip` to this method to disable post-install stdlib checking. # # @api public + sig { params(check_type: Symbol).void } def cxxstdlib_check(check_type) define_method(:skip_cxxstdlib_check?) { true } if check_type == :skip end @@ -4073,6 +4126,7 @@ class Formula # ``` # # @api public + sig { params(compiler: T.any(Symbol, T::Hash[Symbol, String]), block: T.nilable(T.proc.void)).void } def fails_with(compiler, &block) specs.each { |spec| spec.fails_with(compiler, &block) } end @@ -4088,6 +4142,7 @@ class Formula # @see .fails_with # # @api public + sig { params(standards: String).void } def needs(*standards) specs.each { |spec| spec.needs(*standards) } end @@ -4128,9 +4183,8 @@ class Formula # @see https://docs.brew.sh/Formula-Cookbook#add-a-test-to-the-formula Tests # @return [Boolean] # @api public - def test(&block) - define_method(:test, &block) - end + sig { params(block: T.proc.returns(T.untyped)).returns(T.untyped) } + def test(&block) = define_method(:test, &block) # {Livecheck} can be used to check for newer versions of the software. # This method evaluates the DSL specified in the `livecheck` block of the @@ -4148,12 +4202,12 @@ class Formula # end # ``` # - # @!attribute [w] livecheck # @api public + sig { params(block: T.nilable(T.proc.bind(Livecheck).returns(T.untyped))).returns(T.untyped) } def livecheck(&block) return @livecheck unless block - @livecheck_defined = true + @livecheck_defined = T.let(true, T.nilable(T::Boolean)) @livecheck.instance_eval(&block) end @@ -4170,12 +4224,12 @@ class Formula # end # ``` # - # @!attribute [w] service # @api public + sig { params(block: T.nilable(T.proc.returns(T.untyped))).returns(T.nilable(T.proc.returns(T.untyped))) } def service(&block) return @service_block unless block - @service_block = block + @service_block = T.let(block, T.nilable(T.proc.returns(T.untyped))) end # Defines whether the {Formula}'s bottle can be used on the given Homebrew @@ -4203,9 +4257,15 @@ class Formula # ``` # # @api public + sig { + params( + only_if: T.nilable(Symbol), + block: T.nilable(T.proc.params(arg0: T.untyped).returns(T.any(T::Boolean, Symbol))), + ).void + } def pour_bottle?(only_if: nil, &block) - @pour_bottle_check = PourBottleCheck.new(self) - @pour_bottle_only_if = only_if + @pour_bottle_check = T.let(PourBottleCheck.new(self), T.nilable(PourBottleCheck)) + @pour_bottle_only_if = T.let(only_if, T.nilable(Symbol)) if only_if.present? && block.present? raise ArgumentError, "Do not pass both a preset condition and a block to `pour_bottle?`" @@ -4238,7 +4298,7 @@ class Formula raise ArgumentError, "Invalid preset `pour_bottle?` condition" if only_if.present? end - @pour_bottle_check.instance_eval(&block) + @pour_bottle_check.instance_eval(&T.unsafe(block)) end # Deprecates a {Formula} (on the given date) so a warning is @@ -4262,13 +4322,14 @@ class Formula # @see https://docs.brew.sh/Deprecating-Disabling-and-Removing-Formulae # @see DeprecateDisable::FORMULA_DEPRECATE_DISABLE_REASONS # @api public + sig { params(date: String, because: T.any(NilClass, String, Symbol), replacement: T.nilable(String)).void } def deprecate!(date:, because:, replacement: nil) - @deprecation_date = Date.parse(date) - return if @deprecation_date > Date.today + @deprecation_date = T.let(Date.parse(date), T.nilable(Date)) + return if T.must(@deprecation_date) > Date.today - @deprecation_reason = because - @deprecation_replacement = replacement - @deprecated = true + @deprecation_reason = T.let(because, T.any(NilClass, String, Symbol)) + @deprecation_replacement = T.let(replacement, T.nilable(String)) + T.must(@deprecated = T.let(true, T.nilable(T::Boolean))) end # Whether this {Formula} is deprecated (i.e. warns on installation). @@ -4282,22 +4343,22 @@ class Formula # The date that this {Formula} was or becomes deprecated. # Returns `nil` if no date is specified. # - # @return Date # @see .deprecate! + sig { returns(T.nilable(Date)) } attr_reader :deprecation_date # The reason for deprecation of a {Formula}. # # @return [nil] if no reason was provided or the formula is not deprecated. - # @return [String, Symbol] # @see .deprecate! + sig { returns(T.any(NilClass, String, Symbol)) } attr_reader :deprecation_reason # The replacement for a deprecated {Formula}. # # @return [nil] if no replacement was provided or the formula is not deprecated. - # @return [String] # @see .deprecate! + sig { returns(T.nilable(String)) } attr_reader :deprecation_replacement # Disables a {Formula} (on the given date) so it cannot be @@ -4321,19 +4382,20 @@ class Formula # @see https://docs.brew.sh/Deprecating-Disabling-and-Removing-Formulae # @see DeprecateDisable::FORMULA_DEPRECATE_DISABLE_REASONS # @api public + sig { params(date: String, because: T.any(NilClass, String, Symbol), replacement: T.nilable(String)).void } def disable!(date:, because:, replacement: nil) - @disable_date = Date.parse(date) + @disable_date = T.let(Date.parse(date), T.nilable(Date)) - if @disable_date > Date.today - @deprecation_reason = because - @deprecation_replacement = replacement - @deprecated = true + if T.must(@disable_date) > Date.today + @deprecation_reason = T.let(because, T.any(NilClass, String, Symbol)) + @deprecation_replacement = T.let(replacement, T.nilable(String)) + @deprecated = T.let(true, T.nilable(T::Boolean)) return end - @disable_reason = because - @disable_replacement = replacement - @disabled = true + @disable_reason = T.let(because, T.nilable(T.any(String, Symbol))) + @disable_replacement = T.let(replacement, T.nilable(String)) + @disabled = T.let(true, T.nilable(T::Boolean)) end # Whether this {Formula} is disabled (i.e. cannot be installed). @@ -4348,22 +4410,22 @@ class Formula # The date that this {Formula} was or becomes disabled. # Returns `nil` if no date is specified. # - # @return Date # @see .disable! + sig { returns(T.nilable(Date)) } attr_reader :disable_date # The reason this {Formula} is disabled. # Returns `nil` if no reason was provided or the formula is not disabled. # - # @return [String, Symbol] # @see .disable! + sig { returns(T.any(NilClass, String, Symbol)) } attr_reader :disable_reason # The replacement for a disabled {Formula}. # Returns `nil` if no reason was provided or the formula is not disabled. # - # @return [String] # @see .disable! + sig { returns(T.nilable(String)) } attr_reader :disable_replacement # Permit overwriting certain files while linking. @@ -4380,9 +4442,10 @@ class Formula # ```ruby # link_overwrite "share/man/man1/baz-*" # ``` + sig { params(paths: String).returns(T::Set[String]) } def link_overwrite(*paths) paths.flatten! - link_overwrite_paths.merge(paths) + T.must(link_overwrite_paths).merge(paths) end end end diff --git a/Library/Homebrew/formula.rbi b/Library/Homebrew/formula.rbi deleted file mode 100644 index 2beea9c311..0000000000 --- a/Library/Homebrew/formula.rbi +++ /dev/null @@ -1,6 +0,0 @@ -# typed: strict - -class Formula - # This method is included by `OnSystem` - def self.on_macos(&block); end -end diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index 26e4f2f066..0e70e79cc3 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -307,7 +307,7 @@ module FormulaCellarChecks return unless formula.service? return unless formula.service.command? - "Service command does not exist" unless File.exist?(formula.service.command.first) + "Service command does not exist" unless File.exist?(T.must(formula.service.command).first) end sig { params(formula: Formula).returns(T.nilable(String)) } diff --git a/Library/Homebrew/formula_creator.rb b/Library/Homebrew/formula_creator.rb index 4c60c468c6..609d23e8d7 100644 --- a/Library/Homebrew/formula_creator.rb +++ b/Library/Homebrew/formula_creator.rb @@ -100,9 +100,9 @@ module Homebrew sig { params(name: String).returns(String) } def latest_versioned_formula(name) name_prefix = "#{name}@" - Tap.fetch("homebrew/core").formula_names - .select { |f| f.start_with?(name_prefix) } - .max_by { |v| Gem::Version.new(v.sub(name_prefix, "")) } || "python" + CoreTap.instance.formula_names + .select { |f| f.start_with?(name_prefix) } + .max_by { |v| Gem::Version.new(v.sub(name_prefix, "")) } || "python" end sig { returns(String) } @@ -151,6 +151,8 @@ module Homebrew uses_from_macos "ruby" <% elsif @mode == :rust %> depends_on "rust" => :build + <% elsif @mode == :zig %> + depends_on "zig" => :build <% elsif @mode.nil? %> # depends_on "cmake" => :build <% end %> @@ -217,6 +219,8 @@ module Homebrew bin.env_script_all_files(libexec/"bin", GEM_HOME: ENV["GEM_HOME"]) <% elsif @mode == :rust %> system "cargo", "install", *std_cargo_args + <% elsif @mode == :zig %> + system "zig", "build", *std_zig_args <% else %> # Remove unrecognized options if they cause configure to fail # https://rubydoc.brew.sh/Formula.html#std_configure_args-instance_method diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 430fd47db7..e84bea4082 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -29,7 +29,6 @@ require "utils/fork" # Installer for a formula. class FormulaInstaller include FormulaCellarChecks - extend Attrable ETC_VAR_DIRS = T.let([HOMEBREW_PREFIX/"etc", HOMEBREW_PREFIX/"var"].freeze, T::Array[Pathname]) @@ -45,12 +44,6 @@ class FormulaInstaller sig { returns(T::Boolean) } attr_accessor :link_keg - attr_predicate :installed_as_dependency?, :installed_on_request? - attr_predicate :show_summary_heading?, :show_header? - attr_predicate :force_bottle?, :ignore_deps?, :only_deps?, :interactive?, :git?, :force?, :overwrite?, :keep_tmp? - attr_predicate :debug_symbols? - attr_predicate :verbose?, :debug?, :quiet? - sig { params( formula: Formula, @@ -148,6 +141,54 @@ class FormulaInstaller @formula = T.let(T.must(previously_fetched_formula), Formula) if previously_fetched_formula end + sig { returns(T::Boolean) } + def debug? = @debug + + sig { returns(T::Boolean) } + def debug_symbols? = @debug_symbols + + sig { returns(T::Boolean) } + def force? = @force + + sig { returns(T::Boolean) } + def force_bottle? = @force_bottle + + sig { returns(T::Boolean) } + def git? = @git + + sig { returns(T::Boolean) } + def ignore_deps? = @ignore_deps + + sig { returns(T::Boolean) } + def installed_as_dependency? = @installed_as_dependency + + sig { returns(T::Boolean) } + def installed_on_request? = @installed_on_request + + sig { returns(T::Boolean) } + def interactive? = @interactive + + sig { returns(T::Boolean) } + def keep_tmp? = @keep_tmp + + sig { returns(T::Boolean) } + def only_deps? = @only_deps + + sig { returns(T::Boolean) } + def overwrite? = @overwrite + + sig { returns(T::Boolean) } + def quiet? = @quiet + + sig { returns(T::Boolean) } + def show_header? = @show_header + + sig { returns(T::Boolean) } + def show_summary_heading? = @show_summary_heading + + sig { returns(T::Boolean) } + def verbose? = @verbose + sig { returns(T::Set[Formula]) } def self.attempted @attempted ||= T.let(Set.new, T.nilable(T::Set[Formula])) @@ -809,11 +850,8 @@ on_request: installed_on_request?, options:) options |= inherited_options options &= df.options - installed_on_request = if df.any_version_installed? && tab.present? && tab.installed_on_request - true - else - false - end + installed_on_request = df.any_version_installed? && tab.present? && tab.installed_on_request + installed_on_request ||= false fi = FormulaInstaller.new( df, @@ -1230,7 +1268,7 @@ on_request: installed_on_request?, options:) return keg_formula_path if formula.loaded_from_api? return keg_formula_path if formula.local_bottle_path.present? - tap_formula_path = formula.specified_path + tap_formula_path = T.must(formula.specified_path) return keg_formula_path unless tap_formula_path.exist? begin diff --git a/Library/Homebrew/github_packages.rb b/Library/Homebrew/github_packages.rb index 29c21e9661..8e9c37f5ca 100644 --- a/Library/Homebrew/github_packages.rb +++ b/Library/Homebrew/github_packages.rb @@ -136,6 +136,8 @@ class GitHubPackages IMAGE_MANIFEST_SCHEMA_URI = "https://opencontainers.org/schema/image/manifest" GITHUB_PACKAGE_TYPE = "homebrew_bottle" + private_constant :IMAGE_CONFIG_SCHEMA_URI, :IMAGE_INDEX_SCHEMA_URI, :IMAGE_LAYOUT_SCHEMA_URI, + :IMAGE_MANIFEST_SCHEMA_URI, :GITHUB_PACKAGE_TYPE def load_schemas! schema_uri("content-descriptor", diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb index 492faf73c4..e8584f487a 100644 --- a/Library/Homebrew/github_runner_matrix.rb +++ b/Library/Homebrew/github_runner_matrix.rb @@ -5,6 +5,10 @@ require "test_runner_formula" require "github_runner" class GitHubRunnerMatrix + NEWEST_HOMEBREW_CORE_MACOS_RUNNER = :sequoia + OLDEST_HOMEBREW_CORE_MACOS_RUNNER = :ventura + NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER = :sonoma + RunnerSpec = T.type_alias { T.any(LinuxRunnerSpec, MacOSRunnerSpec) } private_constant :RunnerSpec @@ -77,6 +81,7 @@ class GitHubRunnerMatrix # https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#usage-limits GITHUB_ACTIONS_LONG_TIMEOUT = 2160 # 36 hours GITHUB_ACTIONS_SHORT_TIMEOUT = 60 + private_constant :SELF_HOSTED_LINUX_RUNNER, :GITHUB_ACTIONS_LONG_TIMEOUT, :GITHUB_ACTIONS_SHORT_TIMEOUT sig { returns(LinuxRunnerSpec) } def linux_runner_spec @@ -97,6 +102,7 @@ class GitHubRunnerMatrix VALID_PLATFORMS = T.let([:macos, :linux].freeze, T::Array[Symbol]) VALID_ARCHES = T.let([:arm64, :x86_64].freeze, T::Array[Symbol]) + private_constant :VALID_PLATFORMS, :VALID_ARCHES sig { params( @@ -116,10 +122,6 @@ class GitHubRunnerMatrix runner.freeze end - NEWEST_HOMEBREW_CORE_MACOS_RUNNER = :sequoia - OLDEST_HOMEBREW_CORE_MACOS_RUNNER = :ventura - NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER = :sonoma - sig { params(macos_version: MacOSVersion).returns(T::Boolean) } def runner_enabled?(macos_version) macos_version <= NEWEST_HOMEBREW_CORE_MACOS_RUNNER && macos_version >= OLDEST_HOMEBREW_CORE_MACOS_RUNNER @@ -130,6 +132,9 @@ class GitHubRunnerMatrix NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sequoia OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sonoma GITHUB_ACTIONS_RUNNER_TIMEOUT = 360 + private_constant :NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER, :OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER, + :NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER, :OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER, + :GITHUB_ACTIONS_RUNNER_TIMEOUT sig { void } def generate_runners! diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 0b0f67d256..c7035fcf8c 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -147,6 +147,7 @@ class Keg share/man/man1 share/man/man2 share/man/man3 share/man/man4 share/man/man5 share/man/man6 share/man/man7 share/man/man8 share/zsh share/zsh/site-functions + share/pwsh share/pwsh/completions var/log ].map { |dir| HOMEBREW_PREFIX/dir } + must_exist_subdirectories + [ HOMEBREW_CACHE, @@ -354,6 +355,7 @@ class Keg when :zsh dir = path/"share/zsh/site-functions" dir if dir.directory? && dir.children.any? { |f| f.basename.to_s.start_with?("_") } + when :pwsh then path/"share/pwsh/completions" end dir&.directory? && !dir.children.empty? end @@ -388,6 +390,7 @@ class Keg (path/"share/emacs/site-lisp"/name).children.any? { |f| ELISP_EXTENSIONS.include? f.extname } end + sig { returns(PkgVersion) } def version require "pkg_version" PkgVersion.parse(path.basename.to_s) @@ -554,6 +557,32 @@ class Keg path.find { |pn| FileUtils.rm_rf pn if pn.basename.to_s == "__pycache__" } end + def normalize_pod2man_outputs! + # Only process uncompressed manpages, which end in a digit + manpages = Dir[path/"share/man/*/*.[1-9]"] + generated_regex = /^\.\\"\s*Automatically generated by .*\n/ + manpages.each do |f| + manpage = Pathname.new(f) + next unless manpage.file? + + content = manpage.read + content = content.gsub(generated_regex, "") + content = content.lines.map do |line| + next line unless line.start_with?(".TH") + + # Split the line by spaces, but preserve quoted strings + parts = line.split(/\s(?=(?:[^"]|"[^"]*")*$)/) + next line if parts.length != 6 + + # pod2man embeds the perl version used into the 5th field of the footer + T.must(parts[4]).gsub!(/^"perl v.*"$/, "\"\"") + "#{parts.join(" ")}\n" + end.join + + manpage.atomic_write(content) + end + end + def binary_executable_or_library_files [] end diff --git a/Library/Homebrew/language/java.rb b/Library/Homebrew/language/java.rb index c89cbe7334..e0248c41cd 100644 --- a/Library/Homebrew/language/java.rb +++ b/Library/Homebrew/language/java.rb @@ -16,7 +16,7 @@ module Language next false unless f.any_version_installed? unless version.zero? - major = f.any_installed_version.major + major = T.must(f.any_installed_version).major next false if major < version next false if major > version && !can_be_newer end diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index 58ba404901..6428bce228 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -340,7 +340,10 @@ module Language version = rp.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/}o version = "@#{version.captures.first}" unless version.nil? - new_target = rp.sub %r{#{HOMEBREW_CELLAR}/python#{version}/[^/]+}, Formula["python#{version}"].opt_prefix + new_target = rp.sub( + %r{#{HOMEBREW_CELLAR}/python#{version}/[^/]+}, + Formula["python#{version}"].opt_prefix.to_s, + ) f.unlink f.make_symlink new_target end @@ -351,7 +354,10 @@ module Language version = prefix_path.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/}o version = "@#{version.captures.first}" unless version.nil? - prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/python#{version}/[^/]+}, Formula["python#{version}"].opt_prefix + prefix_path.sub!( + %r{^#{HOMEBREW_CELLAR}/python#{version}/[^/]+}, + Formula["python#{version}"].opt_prefix.to_s, + ) prefix_file.atomic_write prefix_path end @@ -362,7 +368,7 @@ module Language cfg = cfg_file.read framework = "Frameworks/Python.framework/Versions" cfg.match(%r{= *(#{HOMEBREW_CELLAR}/(python@[\d.]+)/[^/]+(?:/#{framework}/[\d.]+)?/bin)}) do |match| - cfg.sub! match[1].to_s, Formula[match[2]].opt_bin + cfg.sub! match[1].to_s, Formula[T.must(match[2])].opt_bin.to_s cfg_file.atomic_write cfg end end diff --git a/Library/Homebrew/linkage_cache_store.rb b/Library/Homebrew/linkage_cache_store.rb index 5a9c251535..2fb45df2e9 100644 --- a/Library/Homebrew/linkage_cache_store.rb +++ b/Library/Homebrew/linkage_cache_store.rb @@ -65,6 +65,7 @@ class LinkageCacheStore < CacheStore private HASH_LINKAGE_TYPES = [:keg_files_dylibs].freeze + private_constant :HASH_LINKAGE_TYPES # @param type [Symbol] # @return [Hash] diff --git a/Library/Homebrew/livecheck.rb b/Library/Homebrew/livecheck.rb index ebfcc7ec52..10e7a91f99 100644 --- a/Library/Homebrew/livecheck.rb +++ b/Library/Homebrew/livecheck.rb @@ -2,6 +2,7 @@ # frozen_string_literal: true require "livecheck/constants" +require "livecheck/options" require "cask/cask" # The {Livecheck} class implements the DSL methods used in a formula's, cask's @@ -15,6 +16,10 @@ require "cask/cask" class Livecheck extend Forwardable + # Options to modify livecheck's behavior. + sig { returns(Homebrew::Livecheck::Options) } + attr_reader :options + # A very brief description of why the formula/cask/resource is skipped (e.g. # `No longer developed or maintained`). sig { returns(T.nilable(String)) } @@ -24,13 +29,10 @@ class Livecheck sig { returns(T.nilable(Proc)) } attr_reader :strategy_block - # Options used by `Strategy` methods to modify `curl` behavior. - sig { returns(T.nilable(T::Hash[Symbol, T.untyped])) } - attr_reader :url_options - sig { params(package_or_resource: T.any(Cask::Cask, T.class_of(Formula), Resource)).void } def initialize(package_or_resource) @package_or_resource = package_or_resource + @options = T.let(Homebrew::Livecheck::Options.new, Homebrew::Livecheck::Options) @referenced_cask_name = T.let(nil, T.nilable(String)) @referenced_formula_name = T.let(nil, T.nilable(String)) @regex = T.let(nil, T.nilable(Regexp)) @@ -40,7 +42,6 @@ class Livecheck @strategy_block = T.let(nil, T.nilable(Proc)) @throttle = T.let(nil, T.nilable(Integer)) @url = T.let(nil, T.any(NilClass, String, Symbol)) - @url_options = T.let(nil, T.nilable(T::Hash[Symbol, T.untyped])) end # Sets the `@referenced_cask_name` instance variable to the provided `String` @@ -169,16 +170,18 @@ class Livecheck sig { params( # URL to check for version information. - url: T.any(String, Symbol), - post_form: T.nilable(T::Hash[T.any(String, Symbol), String]), - post_json: T.nilable(T::Hash[T.any(String, Symbol), String]), + url: T.any(String, Symbol), + homebrew_curl: T.nilable(T::Boolean), + post_form: T.nilable(T::Hash[Symbol, String]), + post_json: T.nilable(T::Hash[Symbol, String]), ).returns(T.nilable(T.any(String, Symbol))) } - def url(url = T.unsafe(nil), post_form: nil, post_json: nil) + def url(url = T.unsafe(nil), homebrew_curl: nil, post_form: nil, post_json: nil) raise ArgumentError, "Only use `post_form` or `post_json`, not both" if post_form && post_json - options = { post_form:, post_json: }.compact - @url_options = options if options.present? + @options.homebrew_curl = homebrew_curl unless homebrew_curl.nil? + @options.post_form = post_form unless post_form.nil? + @options.post_json = post_json unless post_json.nil? case url when nil @@ -190,6 +193,7 @@ class Livecheck end end + delegate url_options: :@options delegate version: :@package_or_resource delegate arch: :@package_or_resource private :version, :arch @@ -198,15 +202,15 @@ class Livecheck sig { returns(T::Hash[String, T.untyped]) } def to_hash { - "cask" => @referenced_cask_name, - "formula" => @referenced_formula_name, - "regex" => @regex, - "skip" => @skip, - "skip_msg" => @skip_msg, - "strategy" => @strategy, - "throttle" => @throttle, - "url" => @url, - "url_options" => @url_options, + "options" => @options.to_hash, + "cask" => @referenced_cask_name, + "formula" => @referenced_formula_name, + "regex" => @regex, + "skip" => @skip, + "skip_msg" => @skip_msg, + "strategy" => @strategy, + "throttle" => @throttle, + "url" => @url, } end end diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb index 4c0832dec0..13effefbb0 100644 --- a/Library/Homebrew/livecheck/livecheck.rb +++ b/Library/Homebrew/livecheck/livecheck.rb @@ -13,6 +13,9 @@ module Homebrew # command. These methods print the requested livecheck information # for formulae. module Livecheck + NO_CURRENT_VERSION_MSG = "Unable to identify current version" + NO_VERSIONS_MSG = "Unable to get versions" + UNSTABLE_VERSION_KEYWORDS = T.let(%w[ alpha beta @@ -25,19 +28,17 @@ module Homebrew ].freeze, T::Array[String]) private_constant :UNSTABLE_VERSION_KEYWORDS - sig { returns(T::Hash[T::Class[T.anything], String]) } - private_class_method def self.livecheck_strategy_names - return T.must(@livecheck_strategy_names) if defined?(@livecheck_strategy_names) + sig { params(strategy_class: T::Class[Strategic]).returns(String) } + private_class_method def self.livecheck_strategy_names(strategy_class) + @livecheck_strategy_names ||= T.let({}, T.nilable(T::Hash[T::Class[Strategic], String])) + @livecheck_strategy_names[strategy_class] ||= Utils.demodulize(strategy_class.name) + end - # Cache demodulized strategy names, to avoid repeating this work - @livecheck_strategy_names = T.let({}, T.nilable(T::Hash[T::Class[T.anything], String])) - Strategy.constants.sort.each do |const_symbol| - constant = Strategy.const_get(const_symbol) - next unless constant.is_a?(Class) - - T.must(@livecheck_strategy_names)[constant] = Utils.demodulize(T.must(constant.name)) - end - T.must(@livecheck_strategy_names).freeze + sig { params(strategy_class: T::Class[Strategic]).returns(T::Array[Symbol]) } + private_class_method def self.livecheck_find_versions_parameters(strategy_class) + @livecheck_find_versions_parameters ||= T.let({}, T.nilable(T::Hash[T::Class[Strategic], T::Array[Symbol]])) + @livecheck_find_versions_parameters[strategy_class] ||= + T::Utils.signature_for_method(strategy_class.method(:find_versions)).parameters.map(&:second) end # Uses `formulae_and_casks_to_check` to identify taps in use other than @@ -249,13 +250,20 @@ module Homebrew # comparison. current = if formula if formula.head_only? - Version.new(formula.any_installed_version.version.commit) - else - T.must(formula.stable).version + formula_commit = formula.any_installed_version&.version&.commit + Version.new(formula_commit) if formula_commit + elsif (stable = formula.stable) + stable.version end else Version.new(formula_or_cask.version) end + unless current + raise Livecheck::Error, NO_CURRENT_VERSION_MSG unless json + next if quiet + + next status_hash(formula_or_cask, "error", [NO_CURRENT_VERSION_MSG], full_name: use_full_name, verbose:) + end current_str = current.to_s current = LivecheckVersion.create(formula_or_cask, current) @@ -289,7 +297,7 @@ module Homebrew verbose:, ) if res_version_info.empty? - status_hash(resource, "error", ["Unable to get versions"], verbose:) + status_hash(resource, "error", [NO_VERSIONS_MSG], verbose:) else res_version_info end @@ -299,13 +307,12 @@ module Homebrew end if latest.blank? - no_versions_msg = "Unable to get versions" - raise Livecheck::Error, no_versions_msg unless json + raise Livecheck::Error, NO_VERSIONS_MSG unless json next if quiet next version_info if version_info.is_a?(Hash) && version_info[:status] && version_info[:messages] - latest_info = status_hash(formula_or_cask, "error", [no_versions_msg], full_name: use_full_name, + latest_info = status_hash(formula_or_cask, "error", [NO_VERSIONS_MSG], full_name: use_full_name, verbose:) if check_for_resources unless verbose @@ -613,8 +620,9 @@ module Homebrew livecheck = formula_or_cask.livecheck referenced_livecheck = referenced_formula_or_cask&.livecheck + livecheck_options = livecheck.options || referenced_livecheck&.options + livecheck_url_options = livecheck_options.url_options.compact livecheck_url = livecheck.url || referenced_livecheck&.url - livecheck_url_options = livecheck.url_options || referenced_livecheck&.url_options livecheck_regex = livecheck.regex || referenced_livecheck&.regex livecheck_strategy = livecheck.strategy || referenced_livecheck&.strategy livecheck_strategy_block = livecheck.strategy_block || referenced_livecheck&.strategy_block @@ -659,7 +667,9 @@ module Homebrew block_provided: livecheck_strategy_block.present?, ) strategy = Strategy.from_symbol(livecheck_strategy) || strategies.first - strategy_name = livecheck_strategy_names[strategy] + next unless strategy + + strategy_name = livecheck_strategy_names(strategy) if strategy.respond_to?(:preprocess_url) url = strategy.preprocess_url(url) @@ -674,10 +684,10 @@ module Homebrew elsif original_url.present? && original_url != "None" puts "URL: #{original_url}" end - puts "URL Options: #{livecheck_url_options}" if livecheck_url_options.present? puts "URL (processed): #{url}" if url != original_url + puts "URL Options: #{livecheck_url_options}" if livecheck_url_options.present? if strategies.present? && verbose - puts "Strategies: #{strategies.map { |s| livecheck_strategy_names[s] }.join(", ")}" + puts "Strategies: #{strategies.map { |s| livecheck_strategy_names(s) }.join(", ")}" end puts "Strategy: #{strategy_name}" if strategy.present? puts "Regex: #{livecheck_regex.inspect}" if livecheck_regex.present? @@ -695,23 +705,25 @@ module Homebrew next if strategy.blank? - homebrew_curl = case strategy_name - when "PageMatch", "HeaderMatch" - use_homebrew_curl?(referenced_package, url) + if (livecheck_homebrew_curl = livecheck_options.homebrew_curl).nil? + case strategy_name + when "PageMatch", "HeaderMatch" + if (homebrew_curl = use_homebrew_curl?(referenced_package, url)) + livecheck_options = livecheck_options.merge({ homebrew_curl: }) + livecheck_homebrew_curl = homebrew_curl + end + end end - puts "Homebrew curl?: Yes" if debug && homebrew_curl.present? + puts "Homebrew curl?: #{livecheck_homebrew_curl ? "Yes" : "No"}" if debug && !livecheck_homebrew_curl.nil? - strategy_args = { - regex: livecheck_regex, - url_options: livecheck_url_options, - homebrew_curl:, - } - # TODO: Set `cask`/`url` args based on the presence of the keyword arg - # in the strategy's `#find_versions` method once we figure out why - # `strategy.method(:find_versions).parameters` isn't working as - # expected. - strategy_args[:cask] = cask if strategy_name == "ExtractPlist" && cask.present? - strategy_args[:url] = url + # Only use arguments that the strategy's `#find_versions` method + # supports + find_versions_parameters = livecheck_find_versions_parameters(strategy) + strategy_args = {} + strategy_args[:cask] = cask if find_versions_parameters.include?(:cask) + strategy_args[:url] = url if find_versions_parameters.include?(:url) + strategy_args[:regex] = livecheck_regex if find_versions_parameters.include?(:regex) + strategy_args[:options] = livecheck_options if find_versions_parameters.include?(:options) strategy_args.compact! strategy_data = strategy.find_versions(**strategy_args, &livecheck_strategy_block) @@ -811,10 +823,9 @@ module Homebrew end version_info[:meta][:url][:final] = strategy_data[:final_url] if strategy_data[:final_url] version_info[:meta][:url][:options] = livecheck_url_options if livecheck_url_options.present? - version_info[:meta][:url][:homebrew_curl] = homebrew_curl if homebrew_curl.present? end version_info[:meta][:strategy] = strategy_name if strategy.present? - version_info[:meta][:strategies] = strategies.map { |s| livecheck_strategy_names[s] } if strategies.present? + version_info[:meta][:strategies] = strategies.map { |s| livecheck_strategy_names(s) } if strategies.present? version_info[:meta][:regex] = regex.inspect if regex.present? version_info[:meta][:cached] = true if strategy_data[:cached] == true version_info[:meta][:throttle] = livecheck_throttle if livecheck_throttle @@ -858,9 +869,10 @@ module Homebrew resource_version_info = {} livecheck = resource.livecheck + livecheck_options = livecheck.options + livecheck_url_options = livecheck_options.url_options.compact livecheck_reference = livecheck.formula livecheck_url = livecheck.url - livecheck_url_options = livecheck.url_options livecheck_regex = livecheck.regex livecheck_strategy = livecheck.strategy livecheck_strategy_block = livecheck.strategy_block @@ -883,7 +895,9 @@ module Homebrew block_provided: livecheck_strategy_block.present?, ) strategy = Strategy.from_symbol(livecheck_strategy) || strategies.first - strategy_name = livecheck_strategy_names[strategy] + next unless strategy + + strategy_name = livecheck_strategy_names(strategy) if strategy.respond_to?(:preprocess_url) url = strategy.preprocess_url(url) @@ -898,10 +912,10 @@ module Homebrew elsif original_url.present? && original_url != "None" puts "URL: #{original_url}" end - puts "URL Options: #{livecheck_url_options}" if livecheck_url_options.present? puts "URL (processed): #{url}" if url != original_url + puts "URL Options: #{livecheck_url_options}" if livecheck_url_options.present? if strategies.present? && verbose - puts "Strategies: #{strategies.map { |s| livecheck_strategy_names[s] }.join(", ")}" + puts "Strategies: #{strategies.map { |s| livecheck_strategy_names(s) }.join(", ")}" end puts "Strategy: #{strategy_name}" if strategy.present? puts "Regex: #{livecheck_regex.inspect}" if livecheck_regex.present? @@ -922,16 +936,22 @@ module Homebrew puts if debug && strategy.blank? && livecheck_reference != :parent next if strategy.blank? && livecheck_reference != :parent + if debug && !(livecheck_homebrew_curl = livecheck_options.homebrew_curl).nil? + puts "Homebrew curl?: #{livecheck_homebrew_curl ? "Yes" : "No"}" + end + if livecheck_reference == :parent match_version_map = { formula_latest => Version.new(formula_latest) } cached = true else - strategy_args = { - url:, - regex: livecheck_regex, - url_options: livecheck_url_options, - homebrew_curl: false, - }.compact + # Only use arguments that the strategy's `#find_versions` method + # supports + find_versions_parameters = livecheck_find_versions_parameters(strategy) + strategy_args = {} + strategy_args[:url] = url if find_versions_parameters.include?(:url) + strategy_args[:regex] = livecheck_regex if find_versions_parameters.include?(:regex) + strategy_args[:options] = livecheck_options if find_versions_parameters.include?(:options) + strategy_args.compact! strategy_data = strategy.find_versions(**strategy_args, &livecheck_strategy_block) match_version_map = strategy_data[:matches] @@ -986,7 +1006,7 @@ module Homebrew res_current = T.must(resource.version) res_latest = Version.new(match_version_map.values.max_by { |v| LivecheckVersion.create(resource, v) }) - return status_hash(resource, "error", ["Unable to get versions"], verbose:) if res_latest.blank? + return status_hash(resource, "error", [NO_VERSIONS_MSG], verbose:) if res_latest.blank? is_outdated = res_current < res_latest is_newer_than_upstream = res_current > res_latest @@ -1023,7 +1043,7 @@ module Homebrew end resource_version_info[:meta][:strategy] = strategy_name if strategy.present? if strategies.present? - resource_version_info[:meta][:strategies] = strategies.map { |s| livecheck_strategy_names[s] } + resource_version_info[:meta][:strategies] = strategies.map { |s| livecheck_strategy_names(s) } end resource_version_info[:meta][:regex] = regex.inspect if regex.present? resource_version_info[:meta][:cached] = true if cached == true diff --git a/Library/Homebrew/livecheck/options.rb b/Library/Homebrew/livecheck/options.rb new file mode 100644 index 0000000000..307d393b14 --- /dev/null +++ b/Library/Homebrew/livecheck/options.rb @@ -0,0 +1,105 @@ +# typed: strong +# frozen_string_literal: true + +module Homebrew + module Livecheck + # Options to modify livecheck's behavior. These primarily come from + # `livecheck` blocks but they can also be set by livecheck at runtime. + # + # Option values use a `nil` default to indicate that the value has not been + # set. + class Options < T::Struct + # Whether to use brewed curl. + prop :homebrew_curl, T.nilable(T::Boolean) + + # Form data to use when making a `POST` request. + prop :post_form, T.nilable(T::Hash[Symbol, String]) + + # JSON data to use when making a `POST` request. + prop :post_json, T.nilable(T::Hash[Symbol, String]) + + # Returns a `Hash` of options that are provided as arguments to `url`. + sig { returns(T::Hash[Symbol, T.untyped]) } + def url_options + { + homebrew_curl:, + post_form:, + post_json:, + } + end + + # Returns a `Hash` of all instance variables, using `String` keys. + sig { returns(T::Hash[String, T.untyped]) } + def to_hash + T.let(serialize, T::Hash[String, T.untyped]) + end + + # Returns a `Hash` of all instance variables, using `Symbol` keys. + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h = to_hash.transform_keys(&:to_sym) + + # Returns a new object formed by merging `other` values with a copy of + # `self`. + # + # `nil` values are removed from `other` before merging if it is an + # `Options` object, as these are unitiailized values. This ensures that + # existing values in `self` aren't unexpectedly overwritten with defaults. + sig { params(other: T.any(Options, T::Hash[Symbol, T.untyped])).returns(Options) } + def merge(other) + return dup if other.empty? + + this_hash = to_h + other_hash = other.is_a?(Options) ? other.to_h : other + return dup if this_hash == other_hash + + new_options = this_hash.merge(other_hash) + Options.new(**new_options) + end + + # Merges values from `other` into `self` and returns `self`. + # + # `nil` values are removed from `other` before merging if it is an + # `Options` object, as these are unitiailized values. This ensures that + # existing values in `self` aren't unexpectedly overwritten with defaults. + sig { params(other: T.any(Options, T::Hash[Symbol, T.untyped])).returns(Options) } + def merge!(other) + return self if other.empty? + + if other.is_a?(Options) + return self if self == other + + other.instance_variables.each do |ivar| + next if (v = T.let(other.instance_variable_get(ivar), Object)).nil? + + instance_variable_set(ivar, v) + end + else + other.each do |k, v| + cmd = :"#{k}=" + send(cmd, v) if respond_to?(cmd) + end + end + + self + end + + sig { params(other: Object).returns(T::Boolean) } + def ==(other) + return false unless other.is_a?(Options) + + @homebrew_curl == other.homebrew_curl && + @post_form == other.post_form && + @post_json == other.post_json + end + alias eql? == + + # Whether the object has only default values. + sig { returns(T::Boolean) } + def empty? = to_hash.empty? + + # Whether the object has any non-default values. + sig { returns(T::Boolean) } + def present? = !empty? + end + end +end diff --git a/Library/Homebrew/livecheck/strategic.rb b/Library/Homebrew/livecheck/strategic.rb new file mode 100644 index 0000000000..fd47d0ea88 --- /dev/null +++ b/Library/Homebrew/livecheck/strategic.rb @@ -0,0 +1,40 @@ +# typed: strong +# frozen_string_literal: true + +module Homebrew + module Livecheck + # The interface for livecheck strategies. Because third-party strategies + # are not required to extend this module, we do not provide any default + # method implementations here. + module Strategic + extend T::Helpers + interface! + + # Whether the strategy can be applied to the provided URL. + # + # @param url [String] the URL to match against + sig { abstract.params(url: String).returns(T::Boolean) } + def match?(url); end + + # Checks the content at the URL for new versions. Implementations may not + # support all options. + # + # @param url the URL of the content to check + # @param regex a regex for matching versions in content + # @param provided_content content to check instead of + # fetching + # @param options options to modify behavior + # @param block a block to match the content + sig { + abstract.params( + url: String, + regex: T.nilable(Regexp), + provided_content: T.nilable(String), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) + } + def find_versions(url:, regex: nil, provided_content: nil, options: Options.new, &block); end + end + end +end diff --git a/Library/Homebrew/livecheck/strategy.rb b/Library/Homebrew/livecheck/strategy.rb index ca67feef36..56d0ecb168 100644 --- a/Library/Homebrew/livecheck/strategy.rb +++ b/Library/Homebrew/livecheck/strategy.rb @@ -2,6 +2,7 @@ # frozen_string_literal: true require "utils/curl" +require "livecheck/options" module Homebrew module Livecheck @@ -172,8 +173,8 @@ module Homebrew # @return [Array] sig { params( - post_form: T.nilable(T::Hash[T.any(String, Symbol), String]), - post_json: T.nilable(T::Hash[T.any(String, Symbol), String]), + post_form: T.nilable(T::Hash[Symbol, String]), + post_json: T.nilable(T::Hash[Symbol, String]), ).returns(T::Array[String]) } def self.post_args(post_form: nil, post_json: nil) @@ -193,23 +194,16 @@ module Homebrew # collected into an array of hashes. # # @param url [String] the URL to fetch - # @param url_options [Hash] options to modify curl behavior - # @param homebrew_curl [Boolean] whether to use brewed curl with the URL + # @param options [Options] options to modify behavior # @return [Array] - sig { - params( - url: String, - url_options: T::Hash[Symbol, T.untyped], - homebrew_curl: T::Boolean, - ).returns(T::Array[T::Hash[String, String]]) - } - def self.page_headers(url, url_options: {}, homebrew_curl: false) + sig { params(url: String, options: Options).returns(T::Array[T::Hash[String, String]]) } + def self.page_headers(url, options: Options.new) headers = [] - if url_options[:post_form].present? || url_options[:post_json].present? + if options.post_form || options.post_json curl_post_args = ["--request", "POST", *post_args( - post_form: url_options[:post_form], - post_json: url_options[:post_json], + post_form: options.post_form, + post_json: options.post_json, )] end @@ -221,7 +215,7 @@ module Homebrew MAX_REDIRECTIONS.to_s, url, wanted_headers: ["location", "content-disposition"], - use_homebrew_curl: homebrew_curl, + use_homebrew_curl: options.homebrew_curl || false, user_agent:, **DEFAULT_CURL_OPTIONS, ) @@ -242,21 +236,14 @@ module Homebrew # array with the error message instead. # # @param url [String] the URL of the content to check - # @param url_options [Hash] options to modify curl behavior - # @param homebrew_curl [Boolean] whether to use brewed curl with the URL + # @param options [Options] options to modify behavior # @return [Hash] - sig { - params( - url: String, - url_options: T::Hash[Symbol, T.untyped], - homebrew_curl: T::Boolean, - ).returns(T::Hash[Symbol, T.untyped]) - } - def self.page_content(url, url_options: {}, homebrew_curl: false) - if url_options[:post_form].present? || url_options[:post_json].present? + sig { params(url: String, options: Options).returns(T::Hash[Symbol, T.untyped]) } + def self.page_content(url, options: Options.new) + if options.post_form || options.post_json curl_post_args = ["--request", "POST", *post_args( - post_form: url_options[:post_form], - post_json: url_options[:post_json], + post_form: options.post_form, + post_json: options.post_json, )] end @@ -266,7 +253,9 @@ module Homebrew *curl_post_args, *PAGE_CONTENT_CURL_ARGS, url, **DEFAULT_CURL_OPTIONS, - use_homebrew_curl: homebrew_curl || !curl_supports_fail_with_body?, + use_homebrew_curl: options.homebrew_curl || + !curl_supports_fail_with_body? || + false, user_agent: ) next unless status.success? diff --git a/Library/Homebrew/livecheck/strategy.rbi b/Library/Homebrew/livecheck/strategy.rbi deleted file mode 100644 index 218530f2c3..0000000000 --- a/Library/Homebrew/livecheck/strategy.rbi +++ /dev/null @@ -1,9 +0,0 @@ -# typed: strict - -module Homebrew - module Livecheck - module Strategy - include Kernel - end - end -end diff --git a/Library/Homebrew/livecheck/strategy/apache.rb b/Library/Homebrew/livecheck/strategy/apache.rb index 9c3554d398..8464772050 100644 --- a/Library/Homebrew/livecheck/strategy/apache.rb +++ b/Library/Homebrew/livecheck/strategy/apache.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -26,6 +28,8 @@ module Homebrew # # @api public class Apache + extend Strategic + # The `Regexp` used to determine if the strategy applies to the URL. URL_MATCH_REGEX = %r{ ^https?:// @@ -42,8 +46,7 @@ module Homebrew # Whether the strategy can be applied to the provided URL. # # @param url [String] the URL to match against - # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -54,7 +57,6 @@ module Homebrew # `livecheck` block. # # @param url [String] the URL used to generate values - # @return [Hash] sig { params(url: String).returns(T::Hash[Symbol, T.untyped]) } def self.generate_input_values(url) values = {} @@ -85,19 +87,25 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) generated = generate_input_values(url) - PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions( + url: generated[:url], + regex: regex || generated[:regex], + options:, + &block + ) end end end diff --git a/Library/Homebrew/livecheck/strategy/bitbucket.rb b/Library/Homebrew/livecheck/strategy/bitbucket.rb index 56a53b18c5..6624e07490 100644 --- a/Library/Homebrew/livecheck/strategy/bitbucket.rb +++ b/Library/Homebrew/livecheck/strategy/bitbucket.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -28,6 +30,8 @@ module Homebrew # # @api public class Bitbucket + extend Strategic + # The `Regexp` used to determine if the strategy applies to the URL. URL_MATCH_REGEX = %r{ ^https?://bitbucket\.org @@ -41,8 +45,7 @@ module Homebrew # Whether the strategy can be applied to the provided URL. # # @param url [String] the URL to match against - # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -53,7 +56,6 @@ module Homebrew # `livecheck` block. # # @param url [String] the URL used to generate values - # @return [Hash] sig { params(url: String).returns(T::Hash[Symbol, T.untyped]) } def self.generate_input_values(url) values = {} @@ -93,19 +95,25 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) generated = generate_input_values(url) - PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions( + url: generated[:url], + regex: regex || generated[:regex], + options:, + &block + ) end end end diff --git a/Library/Homebrew/livecheck/strategy/cpan.rb b/Library/Homebrew/livecheck/strategy/cpan.rb index 828e4034d3..5480a7be8d 100644 --- a/Library/Homebrew/livecheck/strategy/cpan.rb +++ b/Library/Homebrew/livecheck/strategy/cpan.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -18,6 +20,8 @@ module Homebrew # # @api public class Cpan + extend Strategic + NICE_NAME = "CPAN" # The `Regexp` used to determine if the strategy applies to the URL. @@ -32,8 +36,7 @@ module Homebrew # Whether the strategy can be applied to the provided URL. # # @param url [String] the URL to match against - # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -44,7 +47,6 @@ module Homebrew # `livecheck` block. # # @param url [String] the URL used to generate values - # @return [Hash] sig { params(url: String).returns(T::Hash[Symbol, T.untyped]) } def self.generate_input_values(url) values = {} @@ -72,19 +74,25 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) generated = generate_input_values(url) - PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions( + url: generated[:url], + regex: regex || generated[:regex], + options:, + &block + ) end end end diff --git a/Library/Homebrew/livecheck/strategy/crate.rb b/Library/Homebrew/livecheck/strategy/crate.rb index e37e3da27d..41a871b398 100644 --- a/Library/Homebrew/livecheck/strategy/crate.rb +++ b/Library/Homebrew/livecheck/strategy/crate.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -17,6 +19,8 @@ module Homebrew # # @api public class Crate + extend Strategic + # The default regex used to identify versions when a regex isn't # provided. DEFAULT_REGEX = /^v?(\d+(?:\.\d+)+)$/i @@ -31,7 +35,7 @@ module Homebrew match[1] end end.freeze, T.proc.params( - arg0: T::Hash[String, T.untyped], + arg0: T::Hash[String, T.anything], arg1: Regexp, ).returns(T.any(String, T::Array[String]))) @@ -45,8 +49,7 @@ module Homebrew # Whether the strategy can be applied to the provided URL. # # @param url [String] the URL to match against - # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -55,7 +58,6 @@ module Homebrew # various input values used by the strategy to check for new versions. # # @param url [String] the URL used to generate values - # @return [Hash] sig { params(url: String).returns(T::Hash[Symbol, T.untyped]) } def self.generate_input_values(url) values = {} @@ -67,25 +69,24 @@ module Homebrew end # Generates a URL and checks the content at the URL for new versions - # using {Json#versions_from_content}. + # using {Json.versions_from_content}. # # @param url [String] the URL of the content to check # @param regex [Regexp, nil] a regex for matching versions in content # @param provided_content [String, nil] content to check instead of # fetching - # @param homebrew_curl [Boolean] whether to use brewed curl with the URL + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override.params( url: String, regex: T.nilable(Regexp), provided_content: T.nilable(String), - homebrew_curl: T::Boolean, - unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **unused, &block) + def self.find_versions(url:, regex: nil, provided_content: nil, options: Options.new, &block) match_data = { matches: {}, regex:, url: } match_data[:cached] = true if provided_content.is_a?(String) @@ -97,13 +98,7 @@ module Homebrew content = if provided_content provided_content else - match_data.merge!( - Strategy.page_content( - match_data[:url], - url_options: unused.fetch(:url_options, {}), - homebrew_curl:, - ), - ) + match_data.merge!(Strategy.page_content(match_data[:url], options:)) match_data[:content] end return match_data unless content diff --git a/Library/Homebrew/livecheck/strategy/electron_builder.rb b/Library/Homebrew/livecheck/strategy/electron_builder.rb index ea68ab04ed..d055b276c9 100644 --- a/Library/Homebrew/livecheck/strategy/electron_builder.rb +++ b/Library/Homebrew/livecheck/strategy/electron_builder.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -10,6 +12,8 @@ module Homebrew # This strategy is not applied automatically and it's necessary to use # `strategy :electron_builder` in a `livecheck` block to apply it. class ElectronBuilder + extend Strategic + NICE_NAME = "electron-builder" # A priority of zero causes livecheck to skip the strategy. We do this @@ -22,8 +26,7 @@ module Homebrew # Whether the strategy can be applied to the provided URL. # # @param url [String] the URL to match against - # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -34,27 +37,28 @@ module Homebrew # @param regex [Regexp, nil] a regex used for matching versions # @param provided_content [String, nil] content to use in place of # fetching via `Strategy#page_content` + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override.params( url: String, regex: T.nilable(Regexp), provided_content: T.nilable(String), - unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, provided_content: nil, **unused, &block) - if regex.present? && block.blank? + def self.find_versions(url:, regex: nil, provided_content: nil, options: Options.new, &block) + if regex.present? && !block_given? raise ArgumentError, - "#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block" + "#{Utils.demodulize(name)} only supports a regex when using a `strategy` block" end Yaml.find_versions( url:, regex:, provided_content:, - **unused, + options:, &block || proc { |yaml| yaml["version"] } ) end diff --git a/Library/Homebrew/livecheck/strategy/extract_plist.rb b/Library/Homebrew/livecheck/strategy/extract_plist.rb index e0778d01bc..27f0596003 100644 --- a/Library/Homebrew/livecheck/strategy/extract_plist.rb +++ b/Library/Homebrew/livecheck/strategy/extract_plist.rb @@ -2,6 +2,7 @@ # frozen_string_literal: true require "bundle_version" +require "livecheck/strategic" require "unversioned_cask_checker" module Homebrew @@ -17,6 +18,8 @@ module Homebrew # This strategy is not applied automatically and it's necessary to use # `strategy :extract_plist` in a `livecheck` block to apply it. class ExtractPlist + extend Strategic + # A priority of zero causes livecheck to skip the strategy. We do this # for {ExtractPlist} so we can selectively apply it when appropriate. PRIORITY = 0 @@ -28,7 +31,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -79,24 +82,23 @@ module Homebrew # @param url [String, nil] an alternative URL to check for version # information # @param regex [Regexp, nil] a regex for use in a strategy block + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override(allow_incompatible: true).params( cask: Cask::Cask, url: T.nilable(String), regex: T.nilable(Regexp), - _unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(cask:, url: nil, regex: nil, **_unused, &block) - if regex.present? && block.blank? + def self.find_versions(cask:, url: nil, regex: nil, options: Options.new, &block) + if regex.present? && !block_given? raise ArgumentError, - "#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block" - end - unless T.unsafe(cask) - raise ArgumentError, "The #{Utils.demodulize(T.must(name))} strategy only supports casks." + "#{Utils.demodulize(name)} only supports a regex when using a `strategy` block" end + raise ArgumentError, "The #{Utils.demodulize(name)} strategy only supports casks." unless T.unsafe(cask) match_data = { matches: {}, regex:, url: } diff --git a/Library/Homebrew/livecheck/strategy/git.rb b/Library/Homebrew/livecheck/strategy/git.rb index b263404888..5b4c07205e 100644 --- a/Library/Homebrew/livecheck/strategy/git.rb +++ b/Library/Homebrew/livecheck/strategy/git.rb @@ -2,6 +2,7 @@ # frozen_string_literal: true require "addressable" +require "livecheck/strategic" require "system_command" module Homebrew @@ -25,6 +26,7 @@ module Homebrew # # @api public class Git + extend Strategic extend SystemCommand::Mixin # Used to cache processed URLs, to avoid duplicating effort. @@ -104,7 +106,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) url = preprocess_url(url) (DownloadStrategyDetector.detect(url) <= GitDownloadStrategy) == true @@ -186,16 +188,17 @@ module Homebrew # # @param url [String] the URL of the Git repository to check # @param regex [Regexp, nil] a regex used for matching versions + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override(allow_incompatible: true).params( url: String, regex: T.nilable(Regexp), - _unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **_unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) match_data = { matches: {}, regex:, url: } tags_data = tag_info(url, regex) diff --git a/Library/Homebrew/livecheck/strategy/github_latest.rb b/Library/Homebrew/livecheck/strategy/github_latest.rb index 4655ce1d1f..365a1b3814 100644 --- a/Library/Homebrew/livecheck/strategy/github_latest.rb +++ b/Library/Homebrew/livecheck/strategy/github_latest.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -28,6 +30,8 @@ module Homebrew # # @api public class GithubLatest + extend Strategic + NICE_NAME = "GitHub - Latest" # A priority of zero causes livecheck to skip the strategy. We do this @@ -39,7 +43,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) GithubReleases.match?(url) end @@ -70,16 +74,17 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override(allow_incompatible: true).params( url: String, regex: Regexp, - _unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: GithubReleases::DEFAULT_REGEX, **_unused, &block) + def self.find_versions(url:, regex: GithubReleases::DEFAULT_REGEX, options: Options.new, &block) match_data = { matches: {}, regex:, url: } generated = generate_input_values(url) diff --git a/Library/Homebrew/livecheck/strategy/github_releases.rb b/Library/Homebrew/livecheck/strategy/github_releases.rb index a37b3a5611..aae1615219 100644 --- a/Library/Homebrew/livecheck/strategy/github_releases.rb +++ b/Library/Homebrew/livecheck/strategy/github_releases.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -29,6 +31,8 @@ module Homebrew # # @api public class GithubReleases + extend Strategic + NICE_NAME = "GitHub - Releases" # A priority of zero causes livecheck to skip the strategy. We do this @@ -56,7 +60,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -108,7 +112,7 @@ module Homebrew content.compact_blank.filter_map do |release| next if release["draft"] || release["prerelease"] - value = T.let(nil, T.untyped) + value = T.let(nil, T.nilable(String)) VERSION_KEYS.find do |key| match = release[key]&.match(regex) next if match.blank? @@ -124,16 +128,17 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override(allow_incompatible: true).params( url: String, regex: Regexp, - _unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: DEFAULT_REGEX, **_unused, &block) + def self.find_versions(url:, regex: DEFAULT_REGEX, options: Options.new, &block) match_data = { matches: {}, regex:, url: } generated = generate_input_values(url) diff --git a/Library/Homebrew/livecheck/strategy/gnome.rb b/Library/Homebrew/livecheck/strategy/gnome.rb index 9a8828d992..a03f8a0801 100644 --- a/Library/Homebrew/livecheck/strategy/gnome.rb +++ b/Library/Homebrew/livecheck/strategy/gnome.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -25,6 +27,8 @@ module Homebrew # # @api public class Gnome + extend Strategic + NICE_NAME = "GNOME" # The `Regexp` used to determine if the strategy applies to the URL. @@ -38,7 +42,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -74,22 +78,23 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) generated = generate_input_values(url) version_data = PageMatch.find_versions( - url: generated[:url], - regex: regex || generated[:regex], - **unused, + url: generated[:url], + regex: regex || generated[:regex], + options:, &block ) diff --git a/Library/Homebrew/livecheck/strategy/gnu.rb b/Library/Homebrew/livecheck/strategy/gnu.rb index 027c689506..fd335915ae 100644 --- a/Library/Homebrew/livecheck/strategy/gnu.rb +++ b/Library/Homebrew/livecheck/strategy/gnu.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -29,6 +31,8 @@ module Homebrew # # @api public class Gnu + extend Strategic + NICE_NAME = "GNU" # The `Regexp` used to determine if the strategy applies to the URL. @@ -42,7 +46,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) && url.exclude?("savannah.") end @@ -84,19 +88,25 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) generated = generate_input_values(url) - PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions( + url: generated[:url], + regex: regex || generated[:regex], + options:, + &block + ) end end end diff --git a/Library/Homebrew/livecheck/strategy/hackage.rb b/Library/Homebrew/livecheck/strategy/hackage.rb index fea597c1a0..72d42c8508 100644 --- a/Library/Homebrew/livecheck/strategy/hackage.rb +++ b/Library/Homebrew/livecheck/strategy/hackage.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -17,6 +19,8 @@ module Homebrew # # @api public class Hackage + extend Strategic + # A `Regexp` used in determining if the strategy applies to the URL and # also as part of extracting the package name from the URL basename. PACKAGE_NAME_REGEX = /(?.+?)-\d+/i @@ -35,7 +39,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -70,19 +74,25 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) generated = generate_input_values(url) - PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions( + url: generated[:url], + regex: regex || generated[:regex], + options:, + &block + ) end end end diff --git a/Library/Homebrew/livecheck/strategy/header_match.rb b/Library/Homebrew/livecheck/strategy/header_match.rb index e6f2c3a3aa..5e275b81c5 100644 --- a/Library/Homebrew/livecheck/strategy/header_match.rb +++ b/Library/Homebrew/livecheck/strategy/header_match.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -10,6 +12,8 @@ module Homebrew # This strategy is not applied automatically and it's necessary to use # `strategy :header_match` in a `livecheck` block to apply it. class HeaderMatch + extend Strategic + NICE_NAME = "Header match" # A priority of zero causes livecheck to skip the strategy. We do this @@ -26,7 +30,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -67,25 +71,20 @@ module Homebrew # # @param url [String] the URL to fetch # @param regex [Regexp, nil] a regex used for matching versions - # @param homebrew_curl [Boolean] whether to use brewed curl with the URL + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - homebrew_curl: T::Boolean, - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, homebrew_curl: false, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) match_data = { matches: {}, regex:, url: } - headers = Strategy.page_headers( - url, - url_options: unused.fetch(:url_options, {}), - homebrew_curl:, - ) + headers = Strategy.page_headers(url, options:) # Merge the headers from all responses into one hash merged_headers = headers.reduce(&:merge) diff --git a/Library/Homebrew/livecheck/strategy/json.rb b/Library/Homebrew/livecheck/strategy/json.rb index e7ac5e51d4..c676330a92 100644 --- a/Library/Homebrew/livecheck/strategy/json.rb +++ b/Library/Homebrew/livecheck/strategy/json.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -23,6 +25,8 @@ module Homebrew # # @api public class Json + extend Strategic + NICE_NAME = "JSON" # A priority of zero causes livecheck to skip the strategy. We do this @@ -39,7 +43,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -74,7 +78,7 @@ module Homebrew ).returns(T::Array[String]) } def self.versions_from_content(content, regex = nil, &block) - return [] if content.blank? || block.blank? + return [] if content.blank? || !block_given? json = parse_json(content) return [] if json.blank? @@ -94,35 +98,28 @@ module Homebrew # @param regex [Regexp, nil] a regex used for matching versions # @param provided_content [String, nil] page content to use in place of # fetching via `Strategy#page_content` - # @param homebrew_curl [Boolean] whether to use brewed curl with the URL + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override.params( url: String, regex: T.nilable(Regexp), provided_content: T.nilable(String), - homebrew_curl: T::Boolean, - unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **unused, &block) - raise ArgumentError, "#{Utils.demodulize(T.must(name))} requires a `strategy` block" if block.blank? + def self.find_versions(url:, regex: nil, provided_content: nil, options: Options.new, &block) + raise ArgumentError, "#{Utils.demodulize(name)} requires a `strategy` block" unless block_given? match_data = { matches: {}, regex:, url: } - return match_data if url.blank? || block.blank? + return match_data if url.blank? content = if provided_content.is_a?(String) match_data[:cached] = true provided_content else - match_data.merge!( - Strategy.page_content( - url, - url_options: unused.fetch(:url_options, {}), - homebrew_curl:, - ), - ) + match_data.merge!(Strategy.page_content(url, options:)) match_data[:content] end return match_data if content.blank? diff --git a/Library/Homebrew/livecheck/strategy/launchpad.rb b/Library/Homebrew/livecheck/strategy/launchpad.rb index 8fc33cfea1..b821795fdb 100644 --- a/Library/Homebrew/livecheck/strategy/launchpad.rb +++ b/Library/Homebrew/livecheck/strategy/launchpad.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -23,6 +25,8 @@ module Homebrew # # @api public class Launchpad + extend Strategic + # The `Regexp` used to determine if the strategy applies to the URL. URL_MATCH_REGEX = %r{ ^https?://(?:[^/]+?\.)*launchpad\.net @@ -37,7 +41,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -67,19 +71,25 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: Regexp, - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: Regexp, + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: DEFAULT_REGEX, **unused, &block) + def self.find_versions(url:, regex: DEFAULT_REGEX, options: Options.new, &block) generated = generate_input_values(url) - PageMatch.find_versions(url: generated[:url], regex:, **unused, &block) + PageMatch.find_versions( + url: generated[:url], + regex:, + options:, + &block + ) end end end diff --git a/Library/Homebrew/livecheck/strategy/npm.rb b/Library/Homebrew/livecheck/strategy/npm.rb index b020e6a48e..b6aab7f4d1 100644 --- a/Library/Homebrew/livecheck/strategy/npm.rb +++ b/Library/Homebrew/livecheck/strategy/npm.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -17,6 +19,8 @@ module Homebrew # # @api public class Npm + extend Strategic + NICE_NAME = "npm" # The `Regexp` used to determine if the strategy applies to the URL. @@ -29,7 +33,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -65,19 +69,25 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) generated = generate_input_values(url) - PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions( + url: generated[:url], + regex: regex || generated[:regex], + options:, + &block + ) end end end diff --git a/Library/Homebrew/livecheck/strategy/page_match.rb b/Library/Homebrew/livecheck/strategy/page_match.rb index 7f2daaae1d..c7d098b92b 100644 --- a/Library/Homebrew/livecheck/strategy/page_match.rb +++ b/Library/Homebrew/livecheck/strategy/page_match.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -16,6 +18,8 @@ module Homebrew # # @api public class PageMatch + extend Strategic + NICE_NAME = "Page match" # A priority of zero causes livecheck to skip the strategy. We do this @@ -32,7 +36,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -77,37 +81,30 @@ module Homebrew # @param regex [Regexp, nil] a regex used for matching versions # @param provided_content [String, nil] page content to use in place of # fetching via `Strategy#page_content` - # @param homebrew_curl [Boolean] whether to use brewed curl with the URL + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override.params( url: String, regex: T.nilable(Regexp), provided_content: T.nilable(String), - homebrew_curl: T::Boolean, - unused: T.untyped, + options: Options, block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } - def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **unused, &block) - if regex.blank? && block.blank? - raise ArgumentError, "#{Utils.demodulize(T.must(name))} requires a regex or `strategy` block" + def self.find_versions(url:, regex: nil, provided_content: nil, options: Options.new, &block) + if regex.blank? && !block_given? + raise ArgumentError, "#{Utils.demodulize(name)} requires a regex or `strategy` block" end match_data = { matches: {}, regex:, url: } - return match_data if url.blank? || (regex.blank? && block.blank?) + return match_data if url.blank? content = if provided_content.is_a?(String) match_data[:cached] = true provided_content else - match_data.merge!( - Strategy.page_content( - url, - url_options: unused.fetch(:url_options, {}), - homebrew_curl:, - ), - ) + match_data.merge!(Strategy.page_content(url, options:)) match_data[:content] end return match_data if content.blank? diff --git a/Library/Homebrew/livecheck/strategy/pypi.rb b/Library/Homebrew/livecheck/strategy/pypi.rb index 8711a2264a..e9101d5e6a 100644 --- a/Library/Homebrew/livecheck/strategy/pypi.rb +++ b/Library/Homebrew/livecheck/strategy/pypi.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -16,6 +18,8 @@ module Homebrew # # @api public class Pypi + extend Strategic + NICE_NAME = "PyPI" # The default `strategy` block used to extract version information when @@ -26,7 +30,7 @@ module Homebrew regex ? version[regex, 1] : version end.freeze, T.proc.params( - json: T::Hash[String, T.untyped], + json: T::Hash[String, T.anything], regex: T.nilable(Regexp), ).returns(T.nilable(String))) @@ -50,7 +54,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -79,17 +83,18 @@ module Homebrew # @param regex [Regexp] a regex used for matching versions in content # @param provided_content [String, nil] content to check instead of # fetching + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override.params( url: String, regex: T.nilable(Regexp), provided_content: T.nilable(String), - unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, provided_content: nil, **unused, &block) + def self.find_versions(url:, regex: nil, provided_content: nil, options: Options.new, &block) match_data = { matches: {}, regex:, url: } generated = generate_input_values(url) @@ -99,7 +104,7 @@ module Homebrew url: generated[:url], regex:, provided_content:, - **unused, + options:, &block || DEFAULT_BLOCK ) end diff --git a/Library/Homebrew/livecheck/strategy/sourceforge.rb b/Library/Homebrew/livecheck/strategy/sourceforge.rb index 539000b4f2..eb3effc313 100644 --- a/Library/Homebrew/livecheck/strategy/sourceforge.rb +++ b/Library/Homebrew/livecheck/strategy/sourceforge.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -31,6 +33,8 @@ module Homebrew # # @api public class Sourceforge + extend Strategic + NICE_NAME = "SourceForge" # The `Regexp` used to determine if the strategy applies to the URL. @@ -45,7 +49,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -84,22 +88,23 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) generated = generate_input_values(url) PageMatch.find_versions( - url: generated[:url] || url, - regex: regex || generated[:regex], - **unused, + url: generated[:url] || url, + regex: regex || generated[:regex], + options:, &block ) end diff --git a/Library/Homebrew/livecheck/strategy/sparkle.rb b/Library/Homebrew/livecheck/strategy/sparkle.rb index 6a298a14ae..b57ae0d16c 100644 --- a/Library/Homebrew/livecheck/strategy/sparkle.rb +++ b/Library/Homebrew/livecheck/strategy/sparkle.rb @@ -2,6 +2,7 @@ # frozen_string_literal: true require "bundle_version" +require "livecheck/strategic" module Homebrew module Livecheck @@ -12,6 +13,8 @@ module Homebrew # This strategy is not applied automatically and it's necessary to use # `strategy :sparkle` in a `livecheck` block to apply it. class Sparkle + extend Strategic + # A priority of zero causes livecheck to skip the strategy. We do this # for {Sparkle} so we can selectively apply it when appropriate. PRIORITY = 0 @@ -26,7 +29,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -214,32 +217,25 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp, nil] a regex for use in a strategy block - # @param homebrew_curl [Boolean] whether to use brewed curl with the URL + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - homebrew_curl: T::Boolean, - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, homebrew_curl: false, **unused, &block) - if regex.present? && block.blank? + def self.find_versions(url:, regex: nil, options: Options.new, &block) + if regex.present? && !block_given? raise ArgumentError, - "#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block" + "#{Utils.demodulize(name)} only supports a regex when using a `strategy` block" end match_data = { matches: {}, regex:, url: } - match_data.merge!( - Strategy.page_content( - url, - url_options: unused.fetch(:url_options, {}), - homebrew_curl:, - ), - ) + match_data.merge!(Strategy.page_content(url, options:)) content = match_data.delete(:content) return match_data if content.blank? diff --git a/Library/Homebrew/livecheck/strategy/xml.rb b/Library/Homebrew/livecheck/strategy/xml.rb index f0dfffa13e..5c391be719 100644 --- a/Library/Homebrew/livecheck/strategy/xml.rb +++ b/Library/Homebrew/livecheck/strategy/xml.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -27,6 +29,8 @@ module Homebrew # # @api public class Xml + extend Strategic + NICE_NAME = "XML" # A priority of zero causes livecheck to skip the strategy. We do this @@ -43,7 +47,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -111,7 +115,7 @@ module Homebrew ).returns(T::Array[String]) } def self.versions_from_content(content, regex = nil, &block) - return [] if content.blank? || block.blank? + return [] if content.blank? || !block_given? require "rexml" xml = parse_xml(content) @@ -134,35 +138,28 @@ module Homebrew # @param regex [Regexp, nil] a regex used for matching versions # @param provided_content [String, nil] page content to use in place of # fetching via `Strategy#page_content` - # @param homebrew_curl [Boolean] whether to use brewed curl with the URL + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override.params( url: String, regex: T.nilable(Regexp), provided_content: T.nilable(String), - homebrew_curl: T::Boolean, - unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **unused, &block) - raise ArgumentError, "#{Utils.demodulize(T.must(name))} requires a `strategy` block" if block.blank? + def self.find_versions(url:, regex: nil, provided_content: nil, options: Options.new, &block) + raise ArgumentError, "#{Utils.demodulize(name)} requires a `strategy` block" unless block_given? match_data = { matches: {}, regex:, url: } - return match_data if url.blank? || block.blank? + return match_data if url.blank? content = if provided_content.is_a?(String) match_data[:cached] = true provided_content else - match_data.merge!( - Strategy.page_content( - url, - url_options: unused.fetch(:url_options, {}), - homebrew_curl:, - ), - ) + match_data.merge!(Strategy.page_content(url, options:)) match_data[:content] end return match_data if content.blank? diff --git a/Library/Homebrew/livecheck/strategy/xorg.rb b/Library/Homebrew/livecheck/strategy/xorg.rb index ab5f4cef66..d62233a69a 100644 --- a/Library/Homebrew/livecheck/strategy/xorg.rb +++ b/Library/Homebrew/livecheck/strategy/xorg.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -39,6 +41,8 @@ module Homebrew # # @api public class Xorg + extend Strategic + NICE_NAME = "X.Org" # A `Regexp` used in determining if the strategy applies to the URL and @@ -65,7 +69,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -109,16 +113,17 @@ module Homebrew # # @param url [String] the URL of the content to check # @param regex [Regexp] a regex used for matching versions in content + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( - url: String, - regex: T.nilable(Regexp), - unused: T.untyped, - block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + override(allow_incompatible: true).params( + url: String, + regex: T.nilable(Regexp), + options: Options, + block: T.nilable(Proc), + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, **unused, &block) + def self.find_versions(url:, regex: nil, options: Options.new, &block) generated = generate_input_values(url) generated_url = generated[:url] @@ -128,12 +133,12 @@ module Homebrew url: generated_url, regex: regex || generated[:regex], provided_content: cached_content, - **unused, + options:, &block ) # Cache any new page content - @page_data[generated_url] = match_data[:content] if match_data[:content].present? + @page_data[generated_url] = match_data[:content] unless match_data[:content].empty? match_data end diff --git a/Library/Homebrew/livecheck/strategy/yaml.rb b/Library/Homebrew/livecheck/strategy/yaml.rb index e3feaf02e5..41c08ff11b 100644 --- a/Library/Homebrew/livecheck/strategy/yaml.rb +++ b/Library/Homebrew/livecheck/strategy/yaml.rb @@ -1,6 +1,8 @@ # typed: strict # frozen_string_literal: true +require "livecheck/strategic" + module Homebrew module Livecheck module Strategy @@ -23,6 +25,8 @@ module Homebrew # # @api public class Yaml + extend Strategic + NICE_NAME = "YAML" # A priority of zero causes livecheck to skip the strategy. We do this @@ -39,7 +43,7 @@ module Homebrew # # @param url [String] the URL to match against # @return [Boolean] - sig { params(url: String).returns(T::Boolean) } + sig { override.params(url: String).returns(T::Boolean) } def self.match?(url) URL_MATCH_REGEX.match?(url) end @@ -72,7 +76,7 @@ module Homebrew ).returns(T::Array[String]) } def self.versions_from_content(content, regex = nil, &block) - return [] if content.blank? || block.blank? + return [] if content.blank? || !block_given? yaml = parse_yaml(content) return [] if yaml.blank? @@ -94,35 +98,28 @@ module Homebrew # @param regex [Regexp, nil] a regex used for matching versions # @param provided_content [String, nil] page content to use in place of # fetching via `Strategy#page_content` - # @param homebrew_curl [Boolean] whether to use brewed curl with the URL + # @param options [Options] options to modify behavior # @return [Hash] sig { - params( + override.params( url: String, regex: T.nilable(Regexp), provided_content: T.nilable(String), - homebrew_curl: T::Boolean, - unused: T.untyped, + options: Options, block: T.nilable(Proc), - ).returns(T::Hash[Symbol, T.untyped]) + ).returns(T::Hash[Symbol, T.anything]) } - def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **unused, &block) - raise ArgumentError, "#{Utils.demodulize(T.must(name))} requires a `strategy` block" if block.blank? + def self.find_versions(url:, regex: nil, provided_content: nil, options: Options.new, &block) + raise ArgumentError, "#{Utils.demodulize(name)} requires a `strategy` block" unless block_given? match_data = { matches: {}, regex:, url: } - return match_data if url.blank? || block.blank? + return match_data if url.blank? content = if provided_content.is_a?(String) match_data[:cached] = true provided_content else - match_data.merge!( - Strategy.page_content( - url, - url_options: unused.fetch(:url_options, {}), - homebrew_curl:, - ), - ) + match_data.merge!(Strategy.page_content(url, options:)) match_data[:content] end return match_data if content.blank? diff --git a/Library/Homebrew/locale.rb b/Library/Homebrew/locale.rb index 49b28c0795..040647f218 100644 --- a/Library/Homebrew/locale.rb +++ b/Library/Homebrew/locale.rb @@ -81,11 +81,9 @@ class Locale end [:language, :script, :region].all? do |var| - if other.public_send(var).nil? - true - else - public_send(var) == other.public_send(var) - end + next true if other.public_send(var).nil? + + public_send(var) == other.public_send(var) end end diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index b469bcacda..82851e5ad6 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -1,7 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" require "dependable" require "dependency" require "dependencies" @@ -179,11 +178,23 @@ class Requirement class << self include BuildEnvironment::DSL - extend Attrable attr_reader :env_proc, :build - attr_rw :fatal, :cask, :download + sig { params(val: String).returns(T.nilable(String)) } + def cask(val = T.unsafe(nil)) + val.nil? ? @cask : @cask = val + end + + sig { params(val: String).returns(T.nilable(String)) } + def download(val = T.unsafe(nil)) + val.nil? ? @download : @download = val + end + + sig { params(val: T::Boolean).returns(T.nilable(T::Boolean)) } + def fatal(val = T.unsafe(nil)) + val.nil? ? @fatal : @fatal = val + end def satisfy(options = nil, &block) return @satisfied if options.nil? && !block diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb index df691aac82..a8eeb2c7e2 100644 --- a/Library/Homebrew/resource.rb +++ b/Library/Homebrew/resource.rb @@ -74,7 +74,7 @@ class Resource # # @api public def stage(target = nil, debug_symbols: false, &block) - raise ArgumentError, "Target directory or block is required" if !target && block.blank? + raise ArgumentError, "Target directory or block is required" if !target && !block_given? prepare_patches fetch_patches(skip_downloaded: true) @@ -155,8 +155,6 @@ class Resource # regex /foo-(\d+(?:\.\d+)+)\.tar/ # end # ``` - # - # @!attribute [w] livecheck def livecheck(&block) return @livecheck unless block diff --git a/Library/Homebrew/rubocops/blank.rb b/Library/Homebrew/rubocops/blank.rb index f71839eafb..d0efa0bf82 100644 --- a/Library/Homebrew/rubocops/blank.rb +++ b/Library/Homebrew/rubocops/blank.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module RuboCop @@ -44,6 +44,7 @@ module RuboCop ) PATTERN + sig { params(node: RuboCop::AST::Node).void } def on_or(node) nil_or_empty?(node) do |var1, var2| return if var1 != var2 @@ -57,14 +58,16 @@ module RuboCop private + sig { params(corrector: RuboCop::Cop::Corrector, node: RuboCop::AST::Node).void } def autocorrect(corrector, node) variable1, _variable2 = nil_or_empty?(node) range = node.source_range corrector.replace(range, replacement(variable1)) end + sig { params(node: T.nilable(RuboCop::AST::Node)).returns(String) } def replacement(node) - node.respond_to?(:source) ? "#{node.source}.blank?" : "blank?" + node.respond_to?(:source) ? "#{node&.source}.blank?" : "blank?" end end end diff --git a/Library/Homebrew/rubocops/bottle.rb b/Library/Homebrew/rubocops/bottle.rb index 0255f1e4ae..e6de4adc11 100644 --- a/Library/Homebrew/rubocops/bottle.rb +++ b/Library/Homebrew/rubocops/bottle.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -174,12 +174,14 @@ module RuboCop end end + sig { params(nodes: T::Array[RuboCop::AST::SendNode]).returns(T::Array[T.any(String, Symbol)]) } def sha256_order(nodes) nodes.map do |node| sha256_bottle_tag node end end + sig { params(node: AST::SendNode).returns(T.any(String, Symbol)) } def sha256_bottle_tag(node) hash_pair = node.last_argument.pairs.last if hash_pair.key.sym_type? diff --git a/Library/Homebrew/rubocops/cask/array_alphabetization.rb b/Library/Homebrew/rubocops/cask/array_alphabetization.rb index 2237052fce..6f2f60d71b 100644 --- a/Library/Homebrew/rubocops/cask/array_alphabetization.rb +++ b/Library/Homebrew/rubocops/cask/array_alphabetization.rb @@ -7,6 +7,7 @@ module RuboCop class ArrayAlphabetization < Base extend AutoCorrector + sig { params(node: RuboCop::AST::SendNode).void } def on_send(node) return unless [:zap, :uninstall].include?(node.method_name) diff --git a/Library/Homebrew/rubocops/checksum.rb b/Library/Homebrew/rubocops/checksum.rb index c1776b2d74..44d749db0d 100644 --- a/Library/Homebrew/rubocops/checksum.rb +++ b/Library/Homebrew/rubocops/checksum.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -23,6 +23,7 @@ module RuboCop end end + sig { params(checksum: T.nilable(RuboCop::AST::Node)).void } def audit_sha256(checksum) return if checksum.nil? @@ -37,7 +38,7 @@ module RuboCop return unless regex_match_group(checksum, /[^a-f0-9]+/i) - add_offense(@offensive_source_range, message: "sha256 contains invalid characters") + add_offense(T.must(@offensive_source_range), message: "sha256 contains invalid characters") end end @@ -54,9 +55,9 @@ module RuboCop next unless regex_match_group(checksum, /[A-F]+/) add_offense(@offensive_source_range, message: "sha256 should be lowercase") do |corrector| - correction = @offensive_node.source.downcase - corrector.insert_before(@offensive_node.source_range, correction) - corrector.remove(@offensive_node.source_range) + correction = T.must(@offensive_node).source.downcase + corrector.insert_before(T.must(@offensive_node).source_range, correction) + corrector.remove(T.must(@offensive_node).source_range) end end end diff --git a/Library/Homebrew/rubocops/compact_blank.rb b/Library/Homebrew/rubocops/compact_blank.rb index b020db3447..ed3f17011a 100644 --- a/Library/Homebrew/rubocops/compact_blank.rb +++ b/Library/Homebrew/rubocops/compact_blank.rb @@ -62,6 +62,7 @@ module RuboCop (sym :blank?))) PATTERN + sig { params(node: RuboCop::AST::SendNode).void } def on_send(node) return unless bad_method?(node) @@ -74,6 +75,7 @@ module RuboCop private + sig { params(node: RuboCop::AST::SendNode).returns(T::Boolean) } def bad_method?(node) return true if reject_with_block_pass?(node) @@ -93,6 +95,7 @@ module RuboCop arguments.length == 2 && arguments[1].source == receiver_in_block.source end + sig { params(node: RuboCop::AST::SendNode).returns(Parser::Source::Range) } def offense_range(node) end_pos = if node.parent&.block_type? && node.parent&.send_node == node node.parent.source_range.end_pos @@ -103,6 +106,7 @@ module RuboCop range_between(node.loc.selector.begin_pos, end_pos) end + sig { params(node: RuboCop::AST::SendNode).returns(String) } def preferred_method(node) node.method?(:reject) ? "compact_blank" : "compact_blank!" end diff --git a/Library/Homebrew/rubocops/conflicts.rb b/Library/Homebrew/rubocops/conflicts.rb index 36eadf0465..f7ee2f9124 100644 --- a/Library/Homebrew/rubocops/conflicts.rb +++ b/Library/Homebrew/rubocops/conflicts.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -22,7 +22,7 @@ module RuboCop reason = parameters(conflicts_with_call).last.values.first offending_node(reason) - name = Regexp.new(@formula_name, Regexp::IGNORECASE) + name = Regexp.new(T.must(@formula_name), Regexp::IGNORECASE) reason_text = string_content(reason).sub(name, "") first_word = reason_text.split.first @@ -45,7 +45,7 @@ module RuboCop if !tap_style_exception?(:versioned_formulae_conflicts_allowlist) && method_called_ever?(body_node, :conflicts_with) problem MSG do |corrector| - corrector.replace(@offensive_node.source_range, "keg_only :versioned_formula") + corrector.replace(T.must(@offensive_node).source_range, "keg_only :versioned_formula") end end end diff --git a/Library/Homebrew/rubocops/deprecate_disable.rb b/Library/Homebrew/rubocops/deprecate_disable.rb index 127ec5de57..4078f910a9 100644 --- a/Library/Homebrew/rubocops/deprecate_disable.rb +++ b/Library/Homebrew/rubocops/deprecate_disable.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -61,13 +61,13 @@ module RuboCop if reason_string.start_with?("it ") problem "Do not start the reason with `it`" do |corrector| - corrector.replace(@offensive_node.source_range, "\"#{reason_string[3..]}\"") + corrector.replace(T.must(@offensive_node).source_range, "\"#{reason_string[3..]}\"") end end if PUNCTUATION_MARKS.include?(reason_string[-1]) problem "Do not end the reason with a punctuation mark" do |corrector| - corrector.replace(@offensive_node.source_range, "\"#{reason_string.chop}\"") + corrector.replace(T.must(@offensive_node).source_range, "\"#{reason_string.chop}\"") end end end diff --git a/Library/Homebrew/rubocops/desc.rb b/Library/Homebrew/rubocops/desc.rb index c68ac5d8e8..ca3da3ffd7 100644 --- a/Library/Homebrew/rubocops/desc.rb +++ b/Library/Homebrew/rubocops/desc.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -17,7 +17,7 @@ module RuboCop def audit_formula(formula_nodes) body_node = formula_nodes.body_node - @name = @formula_name + @name = T.let(@formula_name, T.nilable(String)) desc_call = find_node_method_by_name(body_node, :desc) offending_node(formula_nodes.class_node) if body_node.nil? audit_desc(:formula, @name, desc_call) diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb index bc771d8523..47cdbc3ed3 100644 --- a/Library/Homebrew/rubocops/extend/formula_cop.rb +++ b/Library/Homebrew/rubocops/extend/formula_cop.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/shared/helper_functions" @@ -14,9 +14,10 @@ module RuboCop abstract! exclude_from_registry + sig { returns(T.nilable(String)) } attr_accessor :file_path - @registry = Registry.global + @registry = T.let(Registry.global, RuboCop::Cop::Registry) class FormulaNodes < T::Struct prop :node, RuboCop::AST::ClassNode @@ -26,15 +27,18 @@ module RuboCop end # This method is called by RuboCop and is the main entry point. + sig { params(node: RuboCop::AST::ClassNode).void } def on_class(node) - @file_path = processed_source.file_path + @file_path = T.let(processed_source.file_path, T.nilable(String)) return unless file_path_allowed? return unless formula_class?(node) - class_node, parent_class_node, @body = *node - @formula_name = Pathname.new(@file_path).basename(".rb").to_s - @tap_style_exceptions = nil - audit_formula(FormulaNodes.new(node:, class_node:, parent_class_node:, body_node: @body)) + class_node, parent_class_node, body = *node + @body = T.let(body, T.nilable(RuboCop::AST::Node)) + + @formula_name = T.let(Pathname.new(@file_path).basename(".rb").to_s, T.nilable(String)) + @tap_style_exceptions = T.let(nil, T.nilable(T::Hash[Symbol, T::Array[String]])) + audit_formula(FormulaNodes.new(node:, class_node:, parent_class_node:, body_node: T.must(@body))) end sig { abstract.params(formula_nodes: FormulaNodes).void } @@ -44,7 +48,13 @@ module RuboCop # # @param urls [Array] url/mirror method call nodes # @param regex [Regexp] pattern to match URLs - def audit_urls(urls, regex) + sig { + params( + urls: T::Array[RuboCop::AST::Node], regex: Regexp, + _block: T.proc.params(arg0: T::Array[RuboCop::AST::Node], arg1: String, arg2: Integer).void + ).void + } + def audit_urls(urls, regex, &_block) urls.each_with_index do |url_node, index| url_string_node = parameters(url_node).first url_string = string_content(url_string_node) @@ -59,6 +69,7 @@ module RuboCop # Returns if the formula depends on dependency_name. # # @param dependency_name dependency's name + sig { params(dependency_name: T.any(String, Symbol), types: Symbol).returns(T::Boolean) } def depends_on?(dependency_name, *types) return false if @body.nil? @@ -69,13 +80,20 @@ module RuboCop end return false if idx.nil? - @offensive_node = dependency_nodes[idx] + @offensive_node = T.let(dependency_nodes[idx], T.nilable(RuboCop::AST::Node)) true end # Returns true if given dependency name and dependency type exist in given dependency method call node. # TODO: Add case where key of hash is an array + sig { + params( + node: RuboCop::AST::Node, name: T.nilable(T.any(String, Symbol)), type: Symbol, + ).returns( + T::Boolean, + ) + } def depends_on_name_type?(node, name = nil, type = :required) name_match = !name # Match only by type when name is nil @@ -88,8 +106,8 @@ module RuboCop name_match ||= dependency_name_hash_match?(node, name) if type_match when :any type_match = true - name_match ||= required_dependency_name?(node, name) - name_match ||= dependency_name_hash_match?(node, name) + name_match ||= required_dependency_name?(node, name) || false + name_match ||= dependency_name_hash_match?(node, name) || false else type_match = false end @@ -115,13 +133,15 @@ module RuboCop EOS # Return all the caveats' string nodes in an array. + sig { returns(T::Array[RuboCop::AST::Node]) } def caveats_strings return [] if @body.nil? - find_strings(find_method_def(@body, :caveats)) + find_strings(find_method_def(@body, :caveats)).to_a end # Returns the sha256 str node given a sha256 call node. + sig { params(call: RuboCop::AST::Node).returns(T.nilable(RuboCop::AST::Node)) } def get_checksum_node(call) return if parameters(call).empty? || parameters(call).nil? @@ -144,7 +164,8 @@ module RuboCop end # Yields to a block with comment text as parameter. - def audit_comments + sig { params(_block: T.proc.params(arg0: String).void).void } + def audit_comments(&_block) processed_source.comments.each do |comment_node| @offensive_node = comment_node yield comment_node.text @@ -152,20 +173,26 @@ module RuboCop end # Returns true if the formula is versioned. + sig { returns(T::Boolean) } def versioned_formula? + return false if @formula_name.nil? + @formula_name.include?("@") end # Returns the formula tap. + sig { returns(T.nilable(String)) } def formula_tap - return unless (match_obj = @file_path.match(%r{/(homebrew-\w+)/})) + return unless (match_obj = @file_path&.match(%r{/(homebrew-\w+)/})) match_obj[1] end # Returns the style exceptions directory from the file path. + sig { returns(T.nilable(String)) } def style_exceptions_dir - file_directory = File.dirname(@file_path) + file_directory = File.dirname(@file_path) if @file_path + return unless file_directory # if we're in a sharded subdirectory, look below that. directory_name = File.basename(file_directory) @@ -189,6 +216,7 @@ module RuboCop # Returns whether the given formula exists in the given style exception list. # Defaults to the current formula being checked. + sig { params(list: Symbol, formula: T.nilable(String)).returns(T::Boolean) } def tap_style_exception?(list, formula = nil) if @tap_style_exceptions.nil? && !formula_tap.nil? @tap_style_exceptions = {} @@ -209,11 +237,12 @@ module RuboCop return false if @tap_style_exceptions.nil? || @tap_style_exceptions.count.zero? return false unless @tap_style_exceptions.key? list - @tap_style_exceptions[list].include?(formula || @formula_name) + T.must(@tap_style_exceptions[list]).include?(formula || @formula_name) end private + sig { params(node: RuboCop::AST::Node).returns(T::Boolean) } def formula_class?(node) _, class_node, = *node class_names = %w[ @@ -223,19 +252,24 @@ module RuboCop AmazonWebServicesFormula ] - class_node && class_names.include?(string_content(class_node)) + !!(class_node && class_names.include?(string_content(class_node))) end + sig { returns(T::Boolean) } def file_path_allowed? return true if @file_path.nil? # file_path is nil when source is directly passed to the cop, e.g. in specs !@file_path.include?("/Library/Homebrew/test/") end + sig { returns(T::Array[Symbol]) } def on_system_methods - @on_system_methods ||= [:intel, :arm, :macos, :linux, :system, *MacOSVersion::SYMBOLS.keys].map do |m| - :"on_#{m}" - end + @on_system_methods ||= T.let( + [:intel, :arm, :macos, :linux, :system, *MacOSVersion::SYMBOLS.keys].map do |m| + :"on_#{m}" + end, + T.nilable(T::Array[Symbol]), + ) end end end diff --git a/Library/Homebrew/rubocops/io_read.rb b/Library/Homebrew/rubocops/io_read.rb index 7e20f3e7b5..4eb74b39ec 100644 --- a/Library/Homebrew/rubocops/io_read.rb +++ b/Library/Homebrew/rubocops/io_read.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module RuboCop @@ -10,6 +10,7 @@ module RuboCop RESTRICT_ON_SEND = [:read, :readlines].freeze + sig { params(node: RuboCop::AST::SendNode).void } def on_send(node) return if node.receiver != s(:const, nil, :IO) return if safe?(node.arguments.first) @@ -19,10 +20,11 @@ module RuboCop private + sig { params(node: RuboCop::AST::Node).returns(T::Boolean) } def safe?(node) if node.str_type? !node.str_content.empty? && !node.str_content.start_with?("|") - elsif node.dstr_type? || (node.send_type? && node.method?(:+)) + elsif node.dstr_type? || (node.send_type? && T.cast(node, RuboCop::AST::SendNode).method?(:+)) safe?(node.children.first) else false diff --git a/Library/Homebrew/rubocops/keg_only.rb b/Library/Homebrew/rubocops/keg_only.rb index 765f05ba3b..309d8f1d66 100644 --- a/Library/Homebrew/rubocops/keg_only.rb +++ b/Library/Homebrew/rubocops/keg_only.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -29,24 +29,25 @@ module RuboCop reason = parameters(keg_only_node).first offending_node(reason) - name = Regexp.new(@formula_name, Regexp::IGNORECASE) + name = Regexp.new(T.must(@formula_name), Regexp::IGNORECASE) reason = string_content(reason).sub(name, "") first_word = reason.split.first if /\A[A-Z]/.match?(reason) && !reason.start_with?(*allowlist) problem "'#{first_word}' from the `keg_only` reason should be '#{first_word.downcase}'." do |corrector| reason[0] = reason[0].downcase - corrector.replace(@offensive_node.source_range, "\"#{reason}\"") + corrector.replace(T.must(@offensive_node).source_range, "\"#{reason}\"") end end return unless reason.end_with?(".") problem "`keg_only` reason should not end with a period." do |corrector| - corrector.replace(@offensive_node.source_range, "\"#{reason.chop}\"") + corrector.replace(T.must(@offensive_node).source_range, "\"#{reason.chop}\"") end end + sig { params(node: RuboCop::AST::Node).void } def autocorrect(node) lambda do |corrector| reason = string_content(node) diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 599e31d650..698aee4fc1 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "macos_version" @@ -40,7 +40,7 @@ module RuboCop return if begin_pos-end_pos == 3 problem "Use a space in class inheritance: " \ - "class #{@formula_name.capitalize} < #{class_name(parent_class_node)}" + "class #{T.must(@formula_name).capitalize} < #{class_name(parent_class_node)}" end end @@ -86,6 +86,8 @@ module RuboCop # This cop makes sure that idiomatic `assert_*` statements are used. class AssertStatements < FormulaCop + extend AutoCorrector + sig { override.params(formula_nodes: FormulaNodes).void } def audit_formula(formula_nodes) return if (body_node = formula_nodes.body_node).nil? @@ -96,17 +98,41 @@ module RuboCop end if method_called_ever?(method, :exist?) && !method_called_ever?(method, :!) - problem "Use `assert_predicate , :exist?` instead of `#{method.source}`" + problem "Use `assert_path_exists ` instead of `#{method.source}`" end if method_called_ever?(method, :exist?) && method_called_ever?(method, :!) - problem "Use `refute_predicate , :exist?` instead of `#{method.source}`" + problem "Use `refute_path_exists ` instead of `#{method.source}`" end if method_called_ever?(method, :executable?) && !method_called_ever?(method, :!) problem "Use `assert_predicate , :executable?` instead of `#{method.source}`" end end + + find_every_method_call_by_name(body_node, :assert_predicate).each do |method| + args = parameters(method) + next if args[1].source != ":exist?" + + offending_node(method) + problem "Use `assert_path_exists ` instead of `#{method.source}`" do |corrector| + correct = "assert_path_exists #{args.first.source}" + correct += ", #{args[2].source}" if args.length == 3 + corrector.replace(T.must(@offensive_node).source_range, correct) + end + end + + find_every_method_call_by_name(body_node, :refute_predicate).each do |method| + args = parameters(method) + next if args[1].source != ":exist?" + + offending_node(method) + problem "Use `refute_path_exists ` instead of `#{method.source}`" do |corrector| + correct = "refute_path_exists #{args.first.source}" + correct += ", #{args[2].source}" if args.length == 3 + corrector.replace(T.must(@offensive_node).source_range, correct) + end + end end end @@ -181,9 +207,11 @@ module RuboCop end end + sig { params(node: RuboCop::AST::Node).returns(T::Boolean) } def unless_modifier?(node) return false unless node.if_type? + node = T.cast(node, RuboCop::AST::IfNode) node.modifier_form? && node.unless? end @@ -207,8 +235,8 @@ module RuboCop find_method_with_args(body_node, :depends_on, "mpich") do problem "Formulae in homebrew/core should use 'depends_on \"open-mpi\"' " \ - "instead of '#{@offensive_node.source}'." do |corrector| - corrector.replace(@offensive_node.source_range, "depends_on \"open-mpi\"") + "instead of '#{T.must(@offensive_node).source}'." do |corrector| + corrector.replace(T.must(@offensive_node).source_range, "depends_on \"open-mpi\"") end end end @@ -224,17 +252,19 @@ module RuboCop return if (body_node = formula_nodes.body_node).nil? find_method_with_args(body_node, :local_npm_install_args) do - problem "Use 'std_npm_args' instead of '#{@offensive_node.method_name}'." do |corrector| - corrector.replace(@offensive_node.source_range, "std_npm_args(prefix: false)") + problem "Use 'std_npm_args' instead of '#{T.cast(@offensive_node, + RuboCop::AST::SendNode).method_name}'." do |corrector| + corrector.replace(T.must(@offensive_node).source_range, "std_npm_args(prefix: false)") end end find_method_with_args(body_node, :std_npm_install_args) do |method| - problem "Use 'std_npm_args' instead of '#{@offensive_node.method_name}'." do |corrector| + problem "Use 'std_npm_args' instead of '#{T.cast(@offensive_node, + RuboCop::AST::SendNode).method_name}'." do |corrector| if (param = parameters(method).first.source) == "libexec" - corrector.replace(@offensive_node.source_range, "std_npm_args") + corrector.replace(T.must(@offensive_node).source_range, "std_npm_args") else - corrector.replace(@offensive_node.source_range, "std_npm_args(prefix: #{param})") + corrector.replace(T.must(@offensive_node).source_range, "std_npm_args(prefix: #{param})") end end end @@ -264,8 +294,8 @@ module RuboCop find_method_with_args(body_node, :depends_on, "quictls") do problem "Formulae in homebrew/core should use 'depends_on \"openssl@3\"' " \ - "instead of '#{@offensive_node.source}'." do |corrector| - corrector.replace(@offensive_node.source_range, "depends_on \"openssl@3\"") + "instead of '#{T.must(@offensive_node).source}'." do |corrector| + corrector.replace(T.must(@offensive_node).source_range, "depends_on \"openssl@3\"") end end end @@ -281,7 +311,7 @@ module RuboCop return if formula_tap != "homebrew-core" return unless depends_on?("pyoxidizer") - problem "Formulae in homebrew/core should not use '#{@offensive_node.source}'." + problem "Formulae in homebrew/core should not use '#{T.must(@offensive_node).source}'." end end @@ -307,7 +337,8 @@ module RuboCop find_instance_method_call(body_node, "Utils", unsafe_command) do |method| unless test_methods.include?(method.source_range) problem "Use `Utils.safe_#{unsafe_command}` instead of `Utils.#{unsafe_command}`" do |corrector| - corrector.replace(@offensive_node.loc.selector, "safe_#{@offensive_node.method_name}") + corrector.replace(T.must(@offensive_node).loc.selector, + "safe_#{T.cast(@offensive_node, RuboCop::AST::SendNode).method_name}") end end end @@ -478,7 +509,10 @@ module RuboCop class MacOSOnLinux < FormulaCop include OnSystemConditionalsHelper - ON_MACOS_BLOCKS = [:macos, *MACOS_VERSION_OPTIONS].map { |os| :"on_#{os}" }.freeze + ON_MACOS_BLOCKS = T.let( + [:macos, *MACOS_VERSION_OPTIONS].map { |os| :"on_#{os}" }.freeze, + T::Array[Symbol], + ) sig { override.params(formula_nodes: FormulaNodes).void } def audit_formula(formula_nodes) @@ -499,7 +533,7 @@ module RuboCop correctable_shell_completion_node(install) do |node, shell, base_name, executable, subcmd, shell_parameter| # generate_completions_from_executable only applicable if shell is passed - next unless shell_parameter.match?(/(bash|zsh|fish)/) + next unless shell_parameter.match?(/(bash|zsh|fish|pwsh)/) base_name = base_name.delete_prefix("_").delete_suffix(".fish") shell = shell.to_s.delete_suffix("_completion").to_sym @@ -507,6 +541,7 @@ module RuboCop .delete_suffix("bash") .delete_suffix("zsh") .delete_suffix("fish") + .delete_suffix("pwsh") shell_parameter_format = if shell_parameter_stripped.empty? nil elsif shell_parameter_stripped == "--" @@ -529,8 +564,8 @@ module RuboCop 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) + problem "Use `#{replacement}` instead of `#{T.must(@offensive_node).source}`." do |corrector| + corrector.replace(T.must(@offensive_node).source_range, replacement) end end @@ -539,7 +574,7 @@ module RuboCop 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}`." + problem "Use `generate_completions_from_executable` DSL instead of `#{T.must(@offensive_node).source}`." end end @@ -608,7 +643,7 @@ module RuboCop 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), "") + corrector.replace(T.must(@offensive_node).source_range.adjust(begin_pos: -4, end_pos: 1), "") end end @@ -616,17 +651,18 @@ module RuboCop 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 + T.must(@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(", ")}]") + T.must(@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) + problem "Use `#{replacement}` instead of `#{T.must(@offensive_node).source}`." do |corrector| + corrector.replace(T.must(@offensive_node).source_range, replacement) end end end @@ -783,7 +819,7 @@ module RuboCop end find_method_with_args(body_node, :system, /^(otool|install_name_tool|lipo)/) do - problem "Use ruby-macho instead of calling #{@offensive_node.source}" + problem "Use ruby-macho instead of calling #{T.must(@offensive_node).source}" end problem "Use new-style test definitions (test do)" if find_method_def(body_node, :test) @@ -854,10 +890,11 @@ module RuboCop end end + sig { params(node: RuboCop::AST::Node).returns(T::Boolean) } def modifier?(node) return false unless node.if_type? - node.modifier_form? + T.cast(node, RuboCop::AST::IfNode).modifier_form? end def_node_search :conditional_dependencies, <<~EOS @@ -892,7 +929,7 @@ module RuboCop # Avoid build-time checks in homebrew/core find_every_method_call_by_name(formula_nodes.body_node, :system).each do |method| - next if @formula_name.start_with?("lib") + next if @formula_name&.start_with?("lib") next if tap_style_exception? :make_check_allowlist params = parameters(method) @@ -933,18 +970,16 @@ module RuboCop find_method_with_args(body_node, :depends_on, "rustup") do problem "Formulae in homebrew/core should use 'depends_on \"rust\"' " \ - "instead of '#{@offensive_node.source}'." do |corrector| - corrector.replace(@offensive_node.source_range, "depends_on \"rust\"") + "instead of '#{T.must(@offensive_node).source}'." do |corrector| + corrector.replace(T.must(@offensive_node).source_range, "depends_on \"rust\"") end end - # TODO: Enforce order of dependency types so we don't need to check for - # depends_on "rustup" => [:test, :build] [:build, [:build, :test], [:test, :build]].each do |type| find_method_with_args(body_node, :depends_on, "rustup" => type) do problem "Formulae in homebrew/core should use 'depends_on \"rust\" => #{type}' " \ - "instead of '#{@offensive_node.source}'." do |corrector| - corrector.replace(@offensive_node.source_range, "depends_on \"rust\" => #{type}") + "instead of '#{T.must(@offensive_node).source}'." do |corrector| + corrector.replace(T.must(@offensive_node).source_range, "depends_on \"rust\" => #{type}") end end end diff --git a/Library/Homebrew/rubocops/move_to_extend_os.rb b/Library/Homebrew/rubocops/move_to_extend_os.rb index 00aa8742c6..018f82bbc7 100644 --- a/Library/Homebrew/rubocops/move_to_extend_os.rb +++ b/Library/Homebrew/rubocops/move_to_extend_os.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module RuboCop @@ -12,6 +12,7 @@ module RuboCop (send (const nil? :OS) {:mac? | :linux?}) PATTERN + sig { params(node: RuboCop::AST::Node).void } def on_send(node) return unless os_check?(node) diff --git a/Library/Homebrew/rubocops/negate_include.rb b/Library/Homebrew/rubocops/negate_include.rb index 37ffd6092c..05e1502c30 100644 --- a/Library/Homebrew/rubocops/negate_include.rb +++ b/Library/Homebrew/rubocops/negate_include.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module RuboCop @@ -32,6 +32,7 @@ module RuboCop (send (send $!nil? :include? $_) :!) PATTERN + sig { params(node: RuboCop::AST::SendNode).void } def on_send(node) return unless (receiver, obj = negate_include_call?(node)) diff --git a/Library/Homebrew/rubocops/patches.rb b/Library/Homebrew/rubocops/patches.rb index 32d2f87e9e..781117d9f1 100644 --- a/Library/Homebrew/rubocops/patches.rb +++ b/Library/Homebrew/rubocops/patches.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -14,7 +14,7 @@ module RuboCop sig { override.params(formula_nodes: FormulaNodes).void } def audit_formula(formula_nodes) node = formula_nodes.node - @full_source_content = source_buffer(node).source + @full_source_content = T.let(source_buffer(node).source, T.nilable(String)) return if (body_node = formula_nodes.body_node).nil? @@ -43,6 +43,7 @@ module RuboCop private + sig { params(patch_url_node: RuboCop::AST::Node).void } def patch_problems(patch_url_node) patch_url = string_content(patch_url_node) @@ -103,6 +104,7 @@ module RuboCop end end + sig { params(patch: RuboCop::AST::Node).void } def inline_patch_problems(patch) return if !patch_data?(patch) || patch_end? @@ -119,13 +121,17 @@ module RuboCop /^__END__$/.match?(@full_source_content) end + sig { params(node: RuboCop::AST::Node).void } def offending_patch_end_node(node) - @offensive_node = node - @source_buf = source_buffer(node) - @line_no = node.loc.last_line + 1 - @column = 0 - @length = 7 # "__END__".size - @offense_source_range = source_range(@source_buf, @line_no, @column, @length) + @offensive_node = T.let(node, T.nilable(RuboCop::AST::Node)) + @source_buf = T.let(source_buffer(node), T.nilable(Parser::Source::Buffer)) + @line_no = T.let(node.loc.last_line + 1, T.nilable(Integer)) + @column = T.let(0, T.nilable(Integer)) + @length = T.let(7, T.nilable(Integer)) # "__END__".size + @offense_source_range = T.let( + source_range(@source_buf, @line_no, @column, @length), + T.nilable(Parser::Source::Range), + ) end end end diff --git a/Library/Homebrew/rubocops/presence.rb b/Library/Homebrew/rubocops/presence.rb index c924de724e..e710713d13 100644 --- a/Library/Homebrew/rubocops/presence.rb +++ b/Library/Homebrew/rubocops/presence.rb @@ -78,6 +78,7 @@ module RuboCop } PATTERN + sig { params(node: RuboCop::AST::IfNode).void } def on_if(node) return if ignore_if_node?(node) diff --git a/Library/Homebrew/rubocops/present.rb b/Library/Homebrew/rubocops/present.rb index c77a2eed5a..ebca2f5aba 100644 --- a/Library/Homebrew/rubocops/present.rb +++ b/Library/Homebrew/rubocops/present.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module RuboCop @@ -37,6 +37,7 @@ module RuboCop ) PATTERN + sig { params(node: RuboCop::AST::AndNode).void } def on_and(node) exists_and_not_empty?(node) do |var1, var2| return if var1 != var2 @@ -49,6 +50,7 @@ module RuboCop end end + sig { params(node: RuboCop::AST::OrNode).void } def on_or(node) exists_and_not_empty?(node) do |var1, var2| return if var1 != var2 @@ -59,6 +61,7 @@ module RuboCop end end + sig { params(corrector: RuboCop::Cop::Corrector, node: RuboCop::AST::Node).void } def autocorrect(corrector, node) variable1, _variable2 = exists_and_not_empty?(node) range = node.source_range @@ -67,8 +70,9 @@ module RuboCop private + sig { params(node: T.nilable(RuboCop::AST::Node)).returns(String) } def replacement(node) - node.respond_to?(:source) ? "#{node.source}.present?" : "present?" + node.respond_to?(:source) ? "#{node&.source}.present?" : "present?" end end end diff --git a/Library/Homebrew/rubocops/safe_navigation_with_blank.rb b/Library/Homebrew/rubocops/safe_navigation_with_blank.rb index 74f83fe32a..473ceeea92 100644 --- a/Library/Homebrew/rubocops/safe_navigation_with_blank.rb +++ b/Library/Homebrew/rubocops/safe_navigation_with_blank.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module RuboCop @@ -36,6 +36,7 @@ module RuboCop (if $(csend ... :blank?) ...) PATTERN + sig { params(node: RuboCop::AST::IfNode).void } def on_if(node) return unless safe_navigation_blank_in_conditional?(node) diff --git a/Library/Homebrew/rubocops/service.rb b/Library/Homebrew/rubocops/service.rb index d7f76b17ad..32300d97c6 100644 --- a/Library/Homebrew/rubocops/service.rb +++ b/Library/Homebrew/rubocops/service.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -10,14 +10,17 @@ module RuboCop class Service < FormulaCop extend AutoCorrector - CELLAR_PATH_AUDIT_CORRECTIONS = { - bin: :opt_bin, - libexec: :opt_libexec, - pkgshare: :opt_pkgshare, - prefix: :opt_prefix, - sbin: :opt_sbin, - share: :opt_share, - }.freeze + CELLAR_PATH_AUDIT_CORRECTIONS = T.let( + { + bin: :opt_bin, + libexec: :opt_libexec, + pkgshare: :opt_pkgshare, + prefix: :opt_prefix, + sbin: :opt_sbin, + share: :opt_share, + }.freeze, + T::Hash[Symbol, Symbol], + ) # At least one of these methods must be defined in a service block. REQUIRED_METHOD_CALLS = [:run, :name].freeze diff --git a/Library/Homebrew/rubocops/shared/desc_helper.rb b/Library/Homebrew/rubocops/shared/desc_helper.rb index ac2504a5f7..6e458f1378 100644 --- a/Library/Homebrew/rubocops/shared/desc_helper.rb +++ b/Library/Homebrew/rubocops/shared/desc_helper.rb @@ -17,6 +17,7 @@ module RuboCop macOS ].freeze + sig { params(type: Symbol, name: T.nilable(String), desc_call: T.nilable(RuboCop::AST::Node)).void } def audit_desc(type, name, desc_call) # Check if a desc is present. if desc_call.nil? @@ -26,7 +27,7 @@ module RuboCop @offensive_node = desc_call - desc = desc_call.first_argument + desc = T.cast(desc_call, RuboCop::AST::SendNode).first_argument # Check if the desc is empty. desc_length = string_content(desc).length @@ -56,7 +57,7 @@ module RuboCop end # Check if the desc starts with the formula's or cask's name. - name_regex = name.delete("-").chars.join('[\s\-]?') + name_regex = T.must(name).delete("-").chars.join('[\s\-]?') if regex_match_group(desc, /^#{name_regex}\b/i) desc_problem "Description shouldn't start with the #{type} name." end diff --git a/Library/Homebrew/rubocops/shared/helper_functions.rb b/Library/Homebrew/rubocops/shared/helper_functions.rb index 823d4c26c0..42147e6f67 100644 --- a/Library/Homebrew/rubocops/shared/helper_functions.rb +++ b/Library/Homebrew/rubocops/shared/helper_functions.rb @@ -32,7 +32,10 @@ module RuboCop @line_no = line_number(node) @source_buf = source_buffer(node) @offensive_node = node - @offensive_source_range = source_range(@source_buf, @line_no, @column, @length) + @offensive_source_range = T.let( + source_range(@source_buf, @line_no, @column, @length), + T.nilable(Parser::Source::Range), + ) match_object end @@ -53,6 +56,7 @@ module RuboCop end # Source buffer is required as an argument to report style violations. + sig { params(node: RuboCop::AST::Node).returns(Parser::Source::Buffer) } def source_buffer(node) node.source_range.source_buffer end diff --git a/Library/Homebrew/rubocops/shared/homepage_helper.rb b/Library/Homebrew/rubocops/shared/homepage_helper.rb index b0f743190c..f5f53d3544 100644 --- a/Library/Homebrew/rubocops/shared/homepage_helper.rb +++ b/Library/Homebrew/rubocops/shared/homepage_helper.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/shared/helper_functions" @@ -9,8 +9,15 @@ module RuboCop module HomepageHelper include HelperFunctions + sig { + params( + type: Symbol, content: String, + homepage_node: RuboCop::AST::Node, + homepage_parameter_node: RuboCop::AST::Node + ).void + } def audit_homepage(type, content, homepage_node, homepage_parameter_node) - @offensive_node = homepage_node + @offensive_node = T.let(homepage_node, T.nilable(RuboCop::AST::Node)) problem "#{type.to_s.capitalize} should have a homepage." if content.empty? diff --git a/Library/Homebrew/rubocops/shared/on_system_conditionals_helper.rb b/Library/Homebrew/rubocops/shared/on_system_conditionals_helper.rb index 8d074add7a..f973dd72b6 100644 --- a/Library/Homebrew/rubocops/shared/on_system_conditionals_helper.rb +++ b/Library/Homebrew/rubocops/shared/on_system_conditionals_helper.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "macos_version" @@ -13,16 +13,23 @@ module RuboCop ARCH_OPTIONS = [:arm, :intel].freeze BASE_OS_OPTIONS = [:macos, :linux].freeze - MACOS_VERSION_OPTIONS = MacOSVersion::SYMBOLS.keys.freeze - ON_SYSTEM_OPTIONS = [*ARCH_OPTIONS, *BASE_OS_OPTIONS, *MACOS_VERSION_OPTIONS, :system].freeze + MACOS_VERSION_OPTIONS = T.let(MacOSVersion::SYMBOLS.keys.freeze, T::Array[Symbol]) + ON_SYSTEM_OPTIONS = T.let( + [*ARCH_OPTIONS, *BASE_OS_OPTIONS, *MACOS_VERSION_OPTIONS, :system].freeze, + T::Array[Symbol], + ) MACOS_MODULE_NAMES = ["MacOS", "OS::Mac"].freeze - MACOS_VERSION_CONDITIONALS = { - "==" => nil, - "<=" => :or_older, - ">=" => :or_newer, - }.freeze + MACOS_VERSION_CONDITIONALS = T.let( + { + "==" => nil, + "<=" => :or_older, + ">=" => :or_newer, + }.freeze, + T::Hash[String, T.nilable(Symbol)], + ) + sig { params(body_node: RuboCop::AST::Node, parent_name: Symbol).void } def audit_on_system_blocks(body_node, parent_name) parent_string = if body_node.def_type? "def #{parent_name}" @@ -77,6 +84,12 @@ module RuboCop end end + sig { + params( + body_node: RuboCop::AST::Node, allowed_methods: T::Array[Symbol], + allowed_blocks: T::Array[Symbol] + ).void + } def audit_arch_conditionals(body_node, allowed_methods: [], allowed_blocks: []) ARCH_OPTIONS.each do |arch_option| else_method = (arch_option == :arm) ? :on_intel : :on_arm @@ -100,6 +113,12 @@ module RuboCop end end + sig { + params( + body_node: RuboCop::AST::Node, allowed_methods: T::Array[Symbol], + allowed_blocks: T::Array[Symbol] + ).void + } def audit_base_os_conditionals(body_node, allowed_methods: [], allowed_blocks: []) BASE_OS_OPTIONS.each do |base_os_option| os_method, else_method = if base_os_option == :macos @@ -116,12 +135,21 @@ module RuboCop end end + sig { + params( + body_node: RuboCop::AST::Node, + allowed_methods: T::Array[Symbol], + allowed_blocks: T::Array[Symbol], + recommend_on_system: T::Boolean, + ).void + } def audit_macos_version_conditionals(body_node, allowed_methods: [], allowed_blocks: [], recommend_on_system: true) MACOS_VERSION_OPTIONS.each do |macos_version_option| if_macos_version_node_search(body_node, os_version: macos_version_option) do |if_node, operator, else_node| next if node_is_allowed?(if_node, allowed_methods:, allowed_blocks:) + else_node = T.let(else_node, T.nilable(RuboCop::AST::Node)) autocorrect = else_node.blank? && MACOS_VERSION_CONDITIONALS.key?(operator.to_s) on_system_method_string = if recommend_on_system && operator == :< "on_system" @@ -148,6 +176,13 @@ module RuboCop end end + sig { + params( + body_node: RuboCop::AST::Node, + allowed_methods: T::Array[Symbol], + allowed_blocks: T::Array[Symbol], + ).void + } def audit_macos_references(body_node, allowed_methods: [], allowed_blocks: []) MACOS_MODULE_NAMES.each do |macos_module_name| find_const(body_node, macos_module_name) do |node| @@ -161,6 +196,16 @@ module RuboCop private + sig { + params( + if_node: RuboCop::AST::IfNode, + if_statement_string: String, + on_system_method_string: String, + else_method: T.nilable(Symbol), + else_node: T.nilable(RuboCop::AST::Node), + autocorrect: T::Boolean, + ).void + } def if_statement_problem(if_node, if_statement_string, on_system_method_string, else_method: nil, else_node: nil, autocorrect: true) offending_node(if_node) @@ -180,6 +225,12 @@ module RuboCop end end + sig { + params( + node: RuboCop::AST::Node, allowed_methods: T::Array[Symbol], + allowed_blocks: T::Array[Symbol] + ).returns(T::Boolean) + } def node_is_allowed?(node, allowed_methods: [], allowed_blocks: []) # TODO: check to see if it's legal valid = T.let(false, T::Boolean) diff --git a/Library/Homebrew/rubocops/shell_commands.rb b/Library/Homebrew/rubocops/shell_commands.rb index a776e58e8b..6dafc4d145 100644 --- a/Library/Homebrew/rubocops/shell_commands.rb +++ b/Library/Homebrew/rubocops/shell_commands.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "extend/array" @@ -64,8 +64,12 @@ module RuboCop ].freeze private_constant :TARGET_METHODS - RESTRICT_ON_SEND = TARGET_METHODS.map(&:second).uniq.freeze + RESTRICT_ON_SEND = T.let( + TARGET_METHODS.map(&:second).uniq.freeze, + T::Array[T.nilable(Symbol)], + ) + sig { params(node: RuboCop::AST::SendNode).void } def on_send(node) TARGET_METHODS.each do |target_class, target_method| next if node.method_name != target_method @@ -119,6 +123,7 @@ module RuboCop RESTRICT_ON_SEND = [:exec].freeze + sig { params(node: RuboCop::AST::SendNode).void } def on_send(node) return if node.receiver.present? && node.receiver != s(:const, nil, :Kernel) return if node.arguments.count != 1 diff --git a/Library/Homebrew/rubocops/text.rb b/Library/Homebrew/rubocops/text.rb index d7f0101fea..6bbe47f371 100644 --- a/Library/Homebrew/rubocops/text.rb +++ b/Library/Homebrew/rubocops/text.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -133,7 +133,7 @@ module RuboCop problem "`env :userpaths` in homebrew/core formulae is deprecated" end - share_path_starts_with(body_node, @formula_name) do |share_node| + share_path_starts_with(body_node, T.must(@formula_name)) do |share_node| offending_node(share_node) problem "Use `pkgshare` instead of `share/\"#{@formula_name}\"`" end @@ -162,11 +162,13 @@ module RuboCop # Check whether value starts with the formula name and then a "/", " " or EOS. # If we're checking for "#{bin}", we also check for "-" since similar binaries also don't need interpolation. + sig { params(path: String, starts_with: String, bin: T::Boolean).returns(T::Boolean) } def path_starts_with?(path, starts_with, bin: false) ending = bin ? "/|-|$" : "/| |$" path.match?(/^#{Regexp.escape(starts_with)}(#{ending})/) end + sig { params(path: String, starts_with: String).returns(T::Boolean) } def path_starts_with_bin?(path, starts_with) return false if path.include?(" ") diff --git a/Library/Homebrew/rubocops/urls.rb b/Library/Homebrew/rubocops/urls.rb index af13b6cfb5..a37ba8705e 100644 --- a/Library/Homebrew/rubocops/urls.rb +++ b/Library/Homebrew/rubocops/urls.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" @@ -30,7 +30,7 @@ module RuboCop # Check for binary URLs audit_urls(urls, /(darwin|macos|osx)/i) do |match, url| - next if @formula_name.include?(match.to_s.downcase) + next if T.must(@formula_name).include?(match.to_s.downcase) next if url.match?(/.(patch|diff)(\?full_index=1)?$/) next if tap_style_exception? :not_a_binary_url_prefix_allowlist next if tap_style_exception? :binary_bootstrap_formula_urls_allowlist diff --git a/Library/Homebrew/rubocops/uses_from_macos.rb b/Library/Homebrew/rubocops/uses_from_macos.rb index 2639f09d22..621f3bc3ed 100644 --- a/Library/Homebrew/rubocops/uses_from_macos.rb +++ b/Library/Homebrew/rubocops/uses_from_macos.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "rubocops/extend/formula_cop" diff --git a/Library/Homebrew/search.rb b/Library/Homebrew/search.rb index b33a4ccbf1..343c11eef3 100644 --- a/Library/Homebrew/search.rb +++ b/Library/Homebrew/search.rb @@ -69,7 +69,11 @@ module Homebrew aliases = Formula.alias_full_names results = search(Formula.full_names + aliases, string_or_regex).sort - results |= Formula.fuzzy_search(string_or_regex).map { |n| Formulary.factory(n).full_name } + if string_or_regex.is_a?(String) + results |= Formula.fuzzy_search(string_or_regex).map do |n| + Formulary.factory(n).full_name + end + end results.filter_map do |name| formula, canonical_full_name = begin diff --git a/Library/Homebrew/service.rbi b/Library/Homebrew/service.rbi deleted file mode 100644 index 5777dab11b..0000000000 --- a/Library/Homebrew/service.rbi +++ /dev/null @@ -1,7 +0,0 @@ -# typed: strict - -module Homebrew - class Service - def on_system_conditional(macos: nil, linux: nil); end - end -end diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index bd5974db22..fdd77a37b7 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -1,7 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" require "resource" require "download_strategy" require "checksum" diff --git a/Library/Homebrew/sorbet/rbi/dsl/arch_requirement.rbi b/Library/Homebrew/sorbet/rbi/dsl/arch_requirement.rbi deleted file mode 100644 index 5de043433f..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/arch_requirement.rbi +++ /dev/null @@ -1,8 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `ArchRequirement`. -# Please instead update this file by running `bin/tapioca dsl ArchRequirement`. - - -class ArchRequirement; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/bottle_specification.rbi b/Library/Homebrew/sorbet/rbi/dsl/bottle_specification.rbi deleted file mode 100644 index d076578f16..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/bottle_specification.rbi +++ /dev/null @@ -1,11 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `BottleSpecification`. -# Please instead update this file by running `bin/tapioca dsl BottleSpecification`. - - -class BottleSpecification - sig { params(arg: T.untyped).returns(T.untyped) } - def rebuild(arg = nil); end -end diff --git a/Library/Homebrew/sorbet/rbi/dsl/cask/audit.rbi b/Library/Homebrew/sorbet/rbi/dsl/cask/audit.rbi deleted file mode 100644 index 9f9cb7d83a..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/cask/audit.rbi +++ /dev/null @@ -1,23 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `Cask::Audit`. -# Please instead update this file by running `bin/tapioca dsl Cask::Audit`. - - -class Cask::Audit - sig { returns(T::Boolean) } - def new_cask?; end - - sig { returns(T::Boolean) } - def online?; end - - sig { returns(T::Boolean) } - def signing?; end - - sig { returns(T::Boolean) } - def strict?; end - - sig { returns(T::Boolean) } - def token_conflicts?; end -end diff --git a/Library/Homebrew/sorbet/rbi/dsl/cask/cask.rbi b/Library/Homebrew/sorbet/rbi/dsl/cask/cask.rbi index 0c1b092222..235c60d69b 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/cask/cask.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/cask/cask.rbi @@ -6,6 +6,198 @@ class Cask::Cask - sig { returns(T::Boolean) } - def loaded_from_api?; end + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def app(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def appcast(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def appdir(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def arch(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def artifact(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def artifacts(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def audio_unit_plugin(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def auto_updates(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def bash_completion(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def binary(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def caveats(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def colorpicker(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def conflicts_with(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def container(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def depends_on(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) } + def depends_on_set_in_block?(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def deprecate!(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) } + def deprecated?(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def deprecation_date(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def deprecation_reason(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def deprecation_replacement(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def desc(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def dictionary(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def disable!(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def disable_date(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def disable_reason(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def disable_replacement(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) } + def disabled?(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) } + def discontinued?(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def fish_completion(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def font(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def homepage(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def input_method(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def installer(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def internet_plugin(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def keyboard_layout(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def language(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def livecheck(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) } + def livecheck_defined?(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) } + def livecheckable?(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def manpage(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def mdimporter(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def name(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.nilable(MacOSVersion)) } + def on_system_block_min_os(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) } + def on_system_blocks_exist?(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def pkg(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def postflight(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def preflight(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def prefpane(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def qlplugin(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def screen_saver(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def service(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def sha256(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def stage_only(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def staged_path(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def suite(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def uninstall(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def uninstall_postflight(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def uninstall_preflight(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.nilable(::Cask::URL)) } + def url(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def version(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def vst3_plugin(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def vst_plugin(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def zap(*args, &block); end + + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def zsh_completion(*args, &block); end end diff --git a/Library/Homebrew/sorbet/rbi/dsl/cask/dsl.rbi b/Library/Homebrew/sorbet/rbi/dsl/cask/dsl.rbi deleted file mode 100644 index 93510e134b..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/cask/dsl.rbi +++ /dev/null @@ -1,23 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `Cask::DSL`. -# Please instead update this file by running `bin/tapioca dsl Cask::DSL`. - - -class Cask::DSL - sig { returns(T::Boolean) } - def depends_on_set_in_block?; end - - sig { returns(T::Boolean) } - def deprecated?; end - - sig { returns(T::Boolean) } - def disabled?; end - - sig { returns(T::Boolean) } - def livecheck_defined?; end - - sig { returns(T::Boolean) } - def on_system_blocks_exist?; end -end diff --git a/Library/Homebrew/sorbet/rbi/dsl/cask/dsl/caveats.rbi b/Library/Homebrew/sorbet/rbi/dsl/cask/dsl/caveats.rbi index 8a9839ac27..394dbec9d5 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/cask/dsl/caveats.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/cask/dsl/caveats.rbi @@ -5,7 +5,4 @@ # Please instead update this file by running `bin/tapioca dsl Cask::DSL::Caveats`. -class Cask::DSL::Caveats - sig { returns(T::Boolean) } - def discontinued?; end -end +class Cask::DSL::Caveats; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/cask/installer.rbi b/Library/Homebrew/sorbet/rbi/dsl/cask/installer.rbi deleted file mode 100644 index 6fafb97179..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/cask/installer.rbi +++ /dev/null @@ -1,47 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `Cask::Installer`. -# Please instead update this file by running `bin/tapioca dsl Cask::Installer`. - - -class Cask::Installer - sig { returns(T::Boolean) } - def adopt?; end - - sig { returns(T::Boolean) } - def binaries?; end - - sig { returns(T::Boolean) } - def force?; end - - sig { returns(T::Boolean) } - def installed_as_dependency?; end - - sig { returns(T::Boolean) } - def installed_on_request?; end - - sig { returns(T::Boolean) } - def quarantine?; end - - sig { returns(T::Boolean) } - def quiet?; end - - sig { returns(T::Boolean) } - def reinstall?; end - - sig { returns(T::Boolean) } - def require_sha?; end - - sig { returns(T::Boolean) } - def skip_cask_deps?; end - - sig { returns(T::Boolean) } - def upgrade?; end - - sig { returns(T::Boolean) } - def verbose?; end - - sig { returns(T::Boolean) } - def zap?; end -end diff --git a/Library/Homebrew/sorbet/rbi/dsl/cask_dependent/requirement.rbi b/Library/Homebrew/sorbet/rbi/dsl/cask_dependent/requirement.rbi deleted file mode 100644 index e9718170d2..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/cask_dependent/requirement.rbi +++ /dev/null @@ -1,8 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `CaskDependent::Requirement`. -# Please instead update this file by running `bin/tapioca dsl CaskDependent::Requirement`. - - -class CaskDependent::Requirement; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/codesign_requirement.rbi b/Library/Homebrew/sorbet/rbi/dsl/codesign_requirement.rbi deleted file mode 100644 index a15cb3779f..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/codesign_requirement.rbi +++ /dev/null @@ -1,8 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `CodesignRequirement`. -# Please instead update this file by running `bin/tapioca dsl CodesignRequirement`. - - -class CodesignRequirement; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/debrew.rbi b/Library/Homebrew/sorbet/rbi/dsl/debrew.rbi deleted file mode 100644 index 89b6cf7412..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/debrew.rbi +++ /dev/null @@ -1,13 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `Debrew`. -# Please instead update this file by running `bin/tapioca dsl Debrew`. - - -module Debrew - class << self - sig { returns(T::Boolean) } - def active?; end - end -end diff --git a/Library/Homebrew/sorbet/rbi/dsl/formula.rbi b/Library/Homebrew/sorbet/rbi/dsl/formula.rbi index 3ced914c9c..8e7c2d0290 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/formula.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/formula.rbi @@ -140,24 +140,4 @@ class Formula sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } def version(*args, &block); end - - class << self - sig { params(arg: T.untyped).returns(T.untyped) } - def desc(arg = nil); end - - sig { params(arg: T.untyped).returns(T.untyped) } - def homepage(arg = nil); end - - sig { returns(T::Boolean) } - def loaded_from_api?; end - - sig { returns(T::Boolean) } - def on_system_blocks_exist?; end - - sig { params(arg: T.untyped).returns(T.untyped) } - def revision(arg = nil); end - - sig { params(arg: T.untyped).returns(T.untyped) } - def version_scheme(arg = nil); end - end end diff --git a/Library/Homebrew/sorbet/rbi/dsl/formula_installer.rbi b/Library/Homebrew/sorbet/rbi/dsl/formula_installer.rbi deleted file mode 100644 index e6cdede310..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/formula_installer.rbi +++ /dev/null @@ -1,56 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `FormulaInstaller`. -# Please instead update this file by running `bin/tapioca dsl FormulaInstaller`. - - -class FormulaInstaller - sig { returns(T::Boolean) } - def debug?; end - - sig { returns(T::Boolean) } - def debug_symbols?; end - - sig { returns(T::Boolean) } - def force?; end - - sig { returns(T::Boolean) } - def force_bottle?; end - - sig { returns(T::Boolean) } - def git?; end - - sig { returns(T::Boolean) } - def ignore_deps?; end - - sig { returns(T::Boolean) } - def installed_as_dependency?; end - - sig { returns(T::Boolean) } - def installed_on_request?; end - - sig { returns(T::Boolean) } - def interactive?; end - - sig { returns(T::Boolean) } - def keep_tmp?; end - - sig { returns(T::Boolean) } - def only_deps?; end - - sig { returns(T::Boolean) } - def overwrite?; end - - sig { returns(T::Boolean) } - def quiet?; end - - sig { returns(T::Boolean) } - def show_header?; end - - sig { returns(T::Boolean) } - def show_summary_heading?; end - - sig { returns(T::Boolean) } - def verbose?; end -end diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cleanup.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/cleanup.rbi deleted file mode 100644 index 852b2b5cc7..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cleanup.rbi +++ /dev/null @@ -1,17 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `Homebrew::Cleanup`. -# Please instead update this file by running `bin/tapioca dsl Homebrew::Cleanup`. - - -class Homebrew::Cleanup - sig { returns(T::Boolean) } - def dry_run?; end - - sig { returns(T::Boolean) } - def prune?; end - - sig { returns(T::Boolean) } - def scrub?; end -end diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/create.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/create.rbi index 3d94822e23..150ac9e871 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/create.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/create.rbi @@ -64,4 +64,7 @@ class Homebrew::DevCmd::Create::Args < Homebrew::CLI::Args sig { returns(T.nilable(String)) } def set_version; end + + sig { returns(T::Boolean) } + def zig?; end end diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi index 0405588ab3..80238758ce 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi @@ -310,6 +310,9 @@ module Homebrew::EnvConfig sig { returns(T::Boolean) } def upgrade_greedy?; end + sig { returns(T.nilable(::String)) } + def upgrade_greedy_casks; end + sig { returns(T::Boolean) } def verbose?; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/linux_requirement.rbi b/Library/Homebrew/sorbet/rbi/dsl/linux_requirement.rbi deleted file mode 100644 index 6ad28e5e60..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/linux_requirement.rbi +++ /dev/null @@ -1,8 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `LinuxRequirement`. -# Please instead update this file by running `bin/tapioca dsl LinuxRequirement`. - - -class LinuxRequirement; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/livecheck.rbi b/Library/Homebrew/sorbet/rbi/dsl/livecheck.rbi index f900f942d9..94aca262d1 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/livecheck.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/livecheck.rbi @@ -5,4 +5,7 @@ # Please instead update this file by running `bin/tapioca dsl Livecheck`. -class Livecheck; end +class Livecheck + sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) } + def url_options(*args, &block); end +end diff --git a/Library/Homebrew/sorbet/rbi/dsl/mac_os_requirement.rbi b/Library/Homebrew/sorbet/rbi/dsl/mac_os_requirement.rbi deleted file mode 100644 index 9e31d54eb8..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/mac_os_requirement.rbi +++ /dev/null @@ -1,8 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `MacOSRequirement`. -# Please instead update this file by running `bin/tapioca dsl MacOSRequirement`. - - -class MacOSRequirement; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/requirement.rbi b/Library/Homebrew/sorbet/rbi/dsl/requirement.rbi deleted file mode 100644 index e755f8ef24..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/requirement.rbi +++ /dev/null @@ -1,19 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `Requirement`. -# Please instead update this file by running `bin/tapioca dsl Requirement`. - - -class Requirement - class << self - sig { params(arg: T.untyped).returns(T.untyped) } - def cask(arg = nil); end - - sig { params(arg: T.untyped).returns(T.untyped) } - def download(arg = nil); end - - sig { params(arg: T.untyped).returns(T.untyped) } - def fatal(arg = nil); end - end -end diff --git a/Library/Homebrew/sorbet/rbi/dsl/system_command.rbi b/Library/Homebrew/sorbet/rbi/dsl/system_command.rbi deleted file mode 100644 index e2e8a6a2aa..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/system_command.rbi +++ /dev/null @@ -1,20 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `SystemCommand`. -# Please instead update this file by running `bin/tapioca dsl SystemCommand`. - - -class SystemCommand - sig { returns(T::Boolean) } - def must_succeed?; end - - sig { returns(T::Boolean) } - def reset_uid?; end - - sig { returns(T::Boolean) } - def sudo?; end - - sig { returns(T::Boolean) } - def sudo_as_root?; end -end diff --git a/Library/Homebrew/sorbet/rbi/dsl/xcode_requirement.rbi b/Library/Homebrew/sorbet/rbi/dsl/xcode_requirement.rbi deleted file mode 100644 index 6a812e438d..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/xcode_requirement.rbi +++ /dev/null @@ -1,8 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `XcodeRequirement`. -# Please instead update this file by running `bin/tapioca dsl XcodeRequirement`. - - -class XcodeRequirement; end diff --git a/Library/Homebrew/sorbet/rbi/gems/lint_roller@1.1.0.rbi b/Library/Homebrew/sorbet/rbi/gems/lint_roller@1.1.0.rbi new file mode 100644 index 0000000000..ef073b8c76 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/gems/lint_roller@1.1.0.rbi @@ -0,0 +1,240 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `lint_roller` gem. +# Please instead update this file by running `bin/tapioca gem lint_roller`. + + +# source://lint_roller//lib/lint_roller/context.rb#1 +module LintRoller; end + +# source://lint_roller//lib/lint_roller/about.rb#2 +class LintRoller::About < ::Struct + # Returns the value of attribute description + # + # @return [Object] the current value of description + def description; end + + # Sets the attribute description + # + # @param value [Object] the value to set the attribute description to. + # @return [Object] the newly set value + def description=(_); end + + # Returns the value of attribute homepage + # + # @return [Object] the current value of homepage + def homepage; end + + # Sets the attribute homepage + # + # @param value [Object] the value to set the attribute homepage to. + # @return [Object] the newly set value + def homepage=(_); end + + # Returns the value of attribute name + # + # @return [Object] the current value of name + def name; end + + # Sets the attribute name + # + # @param value [Object] the value to set the attribute name to. + # @return [Object] the newly set value + def name=(_); end + + # Returns the value of attribute version + # + # @return [Object] the current value of version + def version; end + + # Sets the attribute version + # + # @param value [Object] the value to set the attribute version to. + # @return [Object] the newly set value + def version=(_); end + + class << self + def [](*_arg0); end + def inspect; end + def keyword_init?; end + def members; end + def new(*_arg0); end + end +end + +# source://lint_roller//lib/lint_roller/context.rb#2 +class LintRoller::Context < ::Struct + # Returns the value of attribute engine + # + # @return [Object] the current value of engine + def engine; end + + # Sets the attribute engine + # + # @param value [Object] the value to set the attribute engine to. + # @return [Object] the newly set value + def engine=(_); end + + # Returns the value of attribute engine_version + # + # @return [Object] the current value of engine_version + def engine_version; end + + # Sets the attribute engine_version + # + # @param value [Object] the value to set the attribute engine_version to. + # @return [Object] the newly set value + def engine_version=(_); end + + # Returns the value of attribute rule_format + # + # @return [Object] the current value of rule_format + def rule_format; end + + # Sets the attribute rule_format + # + # @param value [Object] the value to set the attribute rule_format to. + # @return [Object] the newly set value + def rule_format=(_); end + + # Returns the value of attribute runner + # + # @return [Object] the current value of runner + def runner; end + + # Sets the attribute runner + # + # @param value [Object] the value to set the attribute runner to. + # @return [Object] the newly set value + def runner=(_); end + + # Returns the value of attribute runner_version + # + # @return [Object] the current value of runner_version + def runner_version; end + + # Sets the attribute runner_version + # + # @param value [Object] the value to set the attribute runner_version to. + # @return [Object] the newly set value + def runner_version=(_); end + + # Returns the value of attribute target_ruby_version + # + # @return [Object] the current value of target_ruby_version + def target_ruby_version; end + + # Sets the attribute target_ruby_version + # + # @param value [Object] the value to set the attribute target_ruby_version to. + # @return [Object] the newly set value + def target_ruby_version=(_); end + + class << self + def [](*_arg0); end + def inspect; end + def keyword_init?; end + def members; end + def new(*_arg0); end + end +end + +# source://lint_roller//lib/lint_roller/error.rb#2 +class LintRoller::Error < ::StandardError; end + +# source://lint_roller//lib/lint_roller/plugin.rb#2 +class LintRoller::Plugin + # `config' is a Hash of options passed to the plugin by the user + # + # @return [Plugin] a new instance of Plugin + # + # source://lint_roller//lib/lint_roller/plugin.rb#4 + def initialize(config = T.unsafe(nil)); end + + # @raise [Error] + # + # source://lint_roller//lib/lint_roller/plugin.rb#8 + def about; end + + # `context' is an instance of LintRoller::Context provided by the runner + # + # @raise [Error] + # + # source://lint_roller//lib/lint_roller/plugin.rb#18 + def rules(context); end + + # `context' is an instance of LintRoller::Context provided by the runner + # + # @return [Boolean] + # + # source://lint_roller//lib/lint_roller/plugin.rb#13 + def supported?(context); end +end + +# source://lint_roller//lib/lint_roller/rules.rb#2 +class LintRoller::Rules < ::Struct + # Returns the value of attribute config_format + # + # @return [Object] the current value of config_format + def config_format; end + + # Sets the attribute config_format + # + # @param value [Object] the value to set the attribute config_format to. + # @return [Object] the newly set value + def config_format=(_); end + + # Returns the value of attribute error + # + # @return [Object] the current value of error + def error; end + + # Sets the attribute error + # + # @param value [Object] the value to set the attribute error to. + # @return [Object] the newly set value + def error=(_); end + + # Returns the value of attribute type + # + # @return [Object] the current value of type + def type; end + + # Sets the attribute type + # + # @param value [Object] the value to set the attribute type to. + # @return [Object] the newly set value + def type=(_); end + + # Returns the value of attribute value + # + # @return [Object] the current value of value + def value; end + + # Sets the attribute value + # + # @param value [Object] the value to set the attribute value to. + # @return [Object] the newly set value + def value=(_); end + + class << self + def [](*_arg0); end + def inspect; end + def keyword_init?; end + def members; end + def new(*_arg0); end + end +end + +# source://lint_roller//lib/lint_roller/support/merges_upstream_metadata.rb#2 +module LintRoller::Support; end + +# source://lint_roller//lib/lint_roller/support/merges_upstream_metadata.rb#3 +class LintRoller::Support::MergesUpstreamMetadata + # source://lint_roller//lib/lint_roller/support/merges_upstream_metadata.rb#4 + def merge(plugin_yaml, upstream_yaml); end +end + +# source://lint_roller//lib/lint_roller/version.rb#2 +LintRoller::VERSION = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/gems/parallel_tests@4.9.0.rbi b/Library/Homebrew/sorbet/rbi/gems/parallel_tests@5.0.1.rbi similarity index 86% rename from Library/Homebrew/sorbet/rbi/gems/parallel_tests@4.9.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/parallel_tests@5.0.1.rbi index 361da9d361..1212b5c716 100644 --- a/Library/Homebrew/sorbet/rbi/gems/parallel_tests@4.9.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/parallel_tests@5.0.1.rbi @@ -14,47 +14,52 @@ module ParallelTests # # @return [Boolean] # - # source://parallel_tests//lib/parallel_tests.rb#52 + # source://parallel_tests//lib/parallel_tests.rb#66 def bundler_enabled?; end - # source://parallel_tests//lib/parallel_tests.rb#97 + # source://parallel_tests//lib/parallel_tests.rb#111 def delta; end - # source://parallel_tests//lib/parallel_tests.rb#16 + # source://parallel_tests//lib/parallel_tests.rb#28 + def determine_multiple(multiple); end + + # used by external libraries, do not rename or change api + # + # source://parallel_tests//lib/parallel_tests.rb#18 def determine_number_of_processes(count); end # @return [Boolean] # - # source://parallel_tests//lib/parallel_tests.rb#68 + # source://parallel_tests//lib/parallel_tests.rb#82 def first_process?; end # @return [Boolean] # - # source://parallel_tests//lib/parallel_tests.rb#72 + # source://parallel_tests//lib/parallel_tests.rb#86 def last_process?; end - # source://parallel_tests//lib/parallel_tests.rb#93 + # source://parallel_tests//lib/parallel_tests.rb#107 def now; end - # source://parallel_tests//lib/parallel_tests.rb#89 + # source://parallel_tests//lib/parallel_tests.rb#103 def number_of_running_processes; end - # source://parallel_tests//lib/parallel_tests.rb#41 + # source://parallel_tests//lib/parallel_tests.rb#55 def pid_file_path; end - # source://parallel_tests//lib/parallel_tests.rb#37 + # source://parallel_tests//lib/parallel_tests.rb#51 def pids; end - # source://parallel_tests//lib/parallel_tests.rb#45 + # source://parallel_tests//lib/parallel_tests.rb#59 def stop_all_processes; end - # source://parallel_tests//lib/parallel_tests.rb#84 + # source://parallel_tests//lib/parallel_tests.rb#98 def wait_for_other_processes_to_finish; end - # source://parallel_tests//lib/parallel_tests.rb#24 + # source://parallel_tests//lib/parallel_tests.rb#38 def with_pid_file; end - # source://parallel_tests//lib/parallel_tests.rb#80 + # source://parallel_tests//lib/parallel_tests.rb#94 def with_ruby_binary(command); end end end @@ -146,6 +151,9 @@ class ParallelTests::CLI def use_colors?; end end +# source://parallel_tests//lib/parallel_tests.rb#9 +ParallelTests::DEFAULT_MULTIPLY_PROCESSES = T.let(T.unsafe(nil), Float) + # source://parallel_tests//lib/parallel_tests/grouper.rb#3 class ParallelTests::Grouper class << self diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.38.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.38.1.rbi similarity index 97% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.38.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.38.1.rbi index 242c55fb5d..fde98603c7 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.38.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.38.1.rbi @@ -645,409 +645,409 @@ end module RuboCop::AST::CollectionNode extend ::RuboCop::SimpleForwardable - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def &(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def *(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def +(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def -(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def <<(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def [](*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def []=(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def all?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def any?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def append(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def assoc(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def at(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def bsearch(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def bsearch_index(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def chain(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def chunk(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def chunk_while(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def clear(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def collect(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def collect!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def collect_concat(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def combination(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def compact(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def compact!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def concat(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def count(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def cycle(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def deconstruct(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def delete(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def delete_at(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def delete_if(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def detect(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def difference(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def dig(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def drop(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def drop_while(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each_cons(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each_entry(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each_index(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each_slice(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each_with_index(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each_with_object(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def empty?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def entries(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def fetch(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def fill(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def filter(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def filter!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def filter_map(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def find(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def find_all(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def find_index(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def first(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def flat_map(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def flatten(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def flatten!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def grep(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def grep_v(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def group_by(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def include?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def index(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def inject(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def insert(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def intersect?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def intersection(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def join(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def keep_if(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def last(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def lazy(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def length(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def map(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def map!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def max(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def max_by(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def member?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def min(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def min_by(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def minmax(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def minmax_by(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def none?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def one?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def pack(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def partition(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def permutation(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def place(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def pop(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def prepend(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def product(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def push(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def rassoc(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def reduce(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def reject(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def reject!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def repeated_combination(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def repeated_permutation(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def replace(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def reverse(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def reverse!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def reverse_each(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def rindex(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def rotate(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def rotate!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def sample(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def select(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def select!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def shelljoin(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def shift(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def shuffle(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def shuffle!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def size(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def slice(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def slice!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def slice_after(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def slice_before(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def slice_when(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def sort(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def sort!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def sort_by(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def sort_by!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def sum(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def take(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def take_while(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def tally(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def to_ary(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def to_h(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def to_set(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def transpose(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def union(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def uniq(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def uniq!(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def unshift(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def values_at(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def zip(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def |(*_arg0, **_arg1, &_arg2); end end @@ -1557,7 +1557,7 @@ class RuboCop::AST::HashElementNode::HashElementDelta private - # source://rubocop-ast//lib/rubocop/ast/node/mixin/hash_element_node.rb#106 + # source://rubocop-ast//lib/rubocop/ast/node/mixin/hash_element_node.rb#108 def delta(first, second, alignment = T.unsafe(nil)); end # Returns the value of attribute first. @@ -1567,7 +1567,7 @@ class RuboCop::AST::HashElementNode::HashElementDelta # @return [Boolean] # - # source://rubocop-ast//lib/rubocop/ast/node/mixin/hash_element_node.rb#117 + # source://rubocop-ast//lib/rubocop/ast/node/mixin/hash_element_node.rb#119 def keyword_splat?; end # Returns the value of attribute second. @@ -3730,7 +3730,7 @@ class RuboCop::AST::NodePattern # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#73 def ast; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def captures(*_arg0, **_arg1, &_arg2); end # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#111 @@ -3759,7 +3759,7 @@ class RuboCop::AST::NodePattern # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#73 def match_code; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def named_parameters(*_arg0, **_arg1, &_arg2); end # Returns the value of attribute pattern. @@ -3767,7 +3767,7 @@ class RuboCop::AST::NodePattern # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#73 def pattern; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def positional_parameters(*_arg0, **_arg1, &_arg2); end # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#95 @@ -3880,7 +3880,7 @@ class RuboCop::AST::NodePattern::Compiler # source://rubocop-ast//lib/rubocop/ast/node_pattern/compiler.rb#15 def initialize; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def bind(*_arg0, **_arg1, &_arg2); end # Returns the value of attribute binding. @@ -4027,7 +4027,7 @@ class RuboCop::AST::NodePattern::Compiler::Debug < ::RuboCop::AST::NodePattern:: # source://rubocop-ast//lib/rubocop/ast/node_pattern/compiler/debug.rb#123 def initialize; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def comments(*_arg0, **_arg1, &_arg2); end # source://rubocop-ast//lib/rubocop/ast/node_pattern/compiler/debug.rb#128 @@ -4041,7 +4041,7 @@ class RuboCop::AST::NodePattern::Compiler::Debug < ::RuboCop::AST::NodePattern:: # source://rubocop-ast//lib/rubocop/ast/node_pattern/compiler/debug.rb#132 def parser; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def tokens(*_arg0, **_arg1, &_arg2); end end @@ -4911,7 +4911,7 @@ RuboCop::AST::NodePattern::Node::AnyOrder::ARITIES = T.let(T.unsafe(nil), Hash) # # source://rubocop-ast//lib/rubocop/ast/node_pattern/node.rb#96 class RuboCop::AST::NodePattern::Node::Capture < ::RuboCop::AST::NodePattern::Node - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def arity(*_arg0, **_arg1, &_arg2); end # @return [Boolean] @@ -4925,7 +4925,7 @@ class RuboCop::AST::NodePattern::Node::Capture < ::RuboCop::AST::NodePattern::No # source://rubocop-ast//lib/rubocop/ast/node_pattern/node.rb#104 def nb_captures; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def rest?(*_arg0, **_arg1, &_arg2); end end @@ -5166,28 +5166,28 @@ class RuboCop::AST::NodePattern::Parser < ::Racc::Parser # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#465 def _reduce_none(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def emit_atom(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def emit_call(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def emit_capture(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def emit_list(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def emit_unary_op(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def emit_union(*_arg0, **_arg1, &_arg2); end # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.rb#40 def inspect; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def next_token(*_arg0, **_arg1, &_arg2); end # (Similar API to `parser` gem) @@ -5497,6 +5497,9 @@ RuboCop::AST::NodePattern::Sets::SET_INSTANCE_EVAL_CLASS_EVAL_MODULE_EVAL = T.le # source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10 RuboCop::AST::NodePattern::Sets::SET_INSTANCE_EXEC_CLASS_EXEC_MODULE_EXEC = T.let(T.unsafe(nil), Set) +# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10 +RuboCop::AST::NodePattern::Sets::SET_INTEGER_BIGDECIMAL_COMPLEX_RATIONAL = T.let(T.unsafe(nil), Set) + # source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10 RuboCop::AST::NodePattern::Sets::SET_IO_FILE = T.let(T.unsafe(nil), Set) @@ -7443,337 +7446,340 @@ class RuboCop::AST::YieldNode < ::RuboCop::AST::Node end class RuboCop::CommentConfig - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#34 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#34 def initialize(processed_source); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#63 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#63 def comment_only_line?(line_number); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def config(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#51 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#51 def cop_disabled_line_ranges; end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#39 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#39 def cop_enabled_at_line?(cop, line_number); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#47 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#47 def cop_opted_in?(cop); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#55 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#55 def extra_enabled_comments; end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#30 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#30 def processed_source; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def registry(*_arg0, **_arg1, &_arg2); end private - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#96 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#96 def analyze; end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#124 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#124 def analyze_cop(analysis, directive); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#144 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#144 def analyze_disabled(analysis, directive); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#155 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#155 def analyze_rest(analysis, directive); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#135 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#135 def analyze_single_line(analysis, directive); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#164 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#164 def cop_line_ranges(analysis); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#170 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#170 def each_directive; end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#69 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#69 def extra_enabled_comments_with_names(extras:, names:); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#190 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#190 def handle_enable_all(directive, names, extras); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#204 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#204 def handle_switch(directive, names, extras); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#115 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#115 def inject_disabled_cops_directives(analyses); end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#183 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#183 def non_comment_token_line_numbers; end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#83 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#83 def opt_in_cops; end - # source://rubocop/1.71.0/lib/rubocop/comment_config.rb#179 + # source://rubocop/1.72.2/lib/rubocop/comment_config.rb#179 def qualified_cop_name(cop_name); end end class RuboCop::Config - # source://rubocop/1.71.0/lib/rubocop/config.rb#31 + # source://rubocop/1.72.2/lib/rubocop/config.rb#31 def initialize(hash = T.unsafe(nil), loaded_path = T.unsafe(nil)); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def [](*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def []=(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#179 + # source://rubocop/1.72.2/lib/rubocop/config.rb#183 def active_support_extensions_enabled?; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#94 + # source://rubocop/1.72.2/lib/rubocop/config.rb#98 def add_excludes_from_higher_level(highest_config); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#206 + # source://rubocop/1.72.2/lib/rubocop/config.rb#210 def allowed_camel_case_file?(file); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#250 + # source://rubocop/1.72.2/lib/rubocop/config.rb#254 def base_dir_for_path_parameters; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#280 + # source://rubocop/1.72.2/lib/rubocop/config.rb#284 def bundler_lock_file_path; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#52 + # source://rubocop/1.72.2/lib/rubocop/config.rb#56 def check; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#147 + # source://rubocop/1.72.2/lib/rubocop/config.rb#151 def clusivity_config_for_badge?(badge); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#167 + # source://rubocop/1.72.2/lib/rubocop/config.rb#171 def cop_enabled?(name); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def delete(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#106 + # source://rubocop/1.72.2/lib/rubocop/config.rb#110 def deprecation_check; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def dig(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#171 + # source://rubocop/1.72.2/lib/rubocop/config.rb#175 def disabled_new_cops?; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each_key(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#175 + # source://rubocop/1.72.2/lib/rubocop/config.rb#179 def enabled_new_cops?; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def fetch(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#228 + # source://rubocop/1.72.2/lib/rubocop/config.rb#232 def file_to_exclude?(file); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#187 + # source://rubocop/1.72.2/lib/rubocop/config.rb#191 def file_to_include?(file); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#163 + # source://rubocop/1.72.2/lib/rubocop/config.rb#167 def for_all_cops; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#133 + # source://rubocop/1.72.2/lib/rubocop/config.rb#137 def for_badge(badge); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#120 + # source://rubocop/1.72.2/lib/rubocop/config.rb#124 def for_cop(cop); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#158 + # source://rubocop/1.72.2/lib/rubocop/config.rb#162 def for_department(department_name); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#127 + # source://rubocop/1.72.2/lib/rubocop/config.rb#131 def for_enabled_cop(cop); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#305 + # source://rubocop/1.72.2/lib/rubocop/config.rb#309 def gem_versions_in_target; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#309 + # source://rubocop/1.72.2/lib/rubocop/config.rb#313 def inspect; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#77 + # source://rubocop/1.72.2/lib/rubocop/config.rb#81 def internal?; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def key?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def keys(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#48 + # source://rubocop/1.72.2/lib/rubocop/config.rb#52 def loaded_features; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#21 + # source://rubocop/1.72.2/lib/rubocop/config.rb#21 def loaded_path; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#82 + # source://rubocop/1.72.2/lib/rubocop/config.rb#48 + def loaded_plugins; end + + # source://rubocop/1.72.2/lib/rubocop/config.rb#86 def make_excludes_absolute; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def map(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def merge(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#260 + # source://rubocop/1.72.2/lib/rubocop/config.rb#264 def parser_engine; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#241 + # source://rubocop/1.72.2/lib/rubocop/config.rb#245 def path_relative_to_config(path); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#237 + # source://rubocop/1.72.2/lib/rubocop/config.rb#241 def patterns_to_exclude; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#233 + # source://rubocop/1.72.2/lib/rubocop/config.rb#237 def patterns_to_include; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#291 + # source://rubocop/1.72.2/lib/rubocop/config.rb#295 def pending_cops; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#220 + # source://rubocop/1.72.2/lib/rubocop/config.rb#224 def possibly_include_hidden?; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def replace(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#72 + # source://rubocop/1.72.2/lib/rubocop/config.rb#76 def signature; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#275 + # source://rubocop/1.72.2/lib/rubocop/config.rb#279 def smart_loaded_path; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#183 + # source://rubocop/1.72.2/lib/rubocop/config.rb#187 def string_literals_frozen_by_default?; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#264 + # source://rubocop/1.72.2/lib/rubocop/config.rb#268 def target_rails_version; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def target_ruby_version(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def to_h(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def to_hash(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#68 + # source://rubocop/1.72.2/lib/rubocop/config.rb#72 def to_s; end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def transform_values(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def validate(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#59 + # source://rubocop/1.72.2/lib/rubocop/config.rb#63 def validate_after_resolution; end private - # source://rubocop/1.71.0/lib/rubocop/config.rb#359 + # source://rubocop/1.72.2/lib/rubocop/config.rb#363 def department_of(qualified_cop_name); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#347 + # source://rubocop/1.72.2/lib/rubocop/config.rb#351 def enable_cop?(qualified_cop_name, cop_options); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#334 + # source://rubocop/1.72.2/lib/rubocop/config.rb#338 def gem_version_to_major_minor_float(gem_version); end - # source://rubocop/1.71.0/lib/rubocop/config.rb#340 + # source://rubocop/1.72.2/lib/rubocop/config.rb#344 def read_gem_versions_from_target_lockfile; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#321 + # source://rubocop/1.72.2/lib/rubocop/config.rb#325 def read_rails_version_from_bundler_lock_file; end - # source://rubocop/1.71.0/lib/rubocop/config.rb#316 + # source://rubocop/1.72.2/lib/rubocop/config.rb#320 def target_rails_version_from_bundler_lock_file; end class << self - # source://rubocop/1.71.0/lib/rubocop/config.rb#23 + # source://rubocop/1.72.2/lib/rubocop/config.rb#23 def create(hash, path, check: T.unsafe(nil)); end end end class RuboCop::ConfigValidator - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#28 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#28 def initialize(config); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def for_all_cops(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#19 def smart_loaded_path(*_arg0, **_arg1, &_arg2); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#65 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#65 def target_ruby_version; end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#34 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#34 def validate; end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#61 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#61 def validate_after_resolution; end private - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#100 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#100 def alert_about_unrecognized_cops(invalid_cop_names); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#263 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#263 def check_cop_config_value(hash, parent = T.unsafe(nil)); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#73 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#73 def check_obsoletions; end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#80 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#80 def check_target_ruby; end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#204 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#204 def each_invalid_parameter(cop_name); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#116 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#116 def list_unknown_cops(invalid_cop_names); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#283 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#283 def param_error_message(parent, key, value, supposed_values); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#251 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#251 def reject_conflicting_safe_settings; end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#242 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#242 def reject_mutually_exclusive_defaults; end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#138 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#138 def suggestion(name); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#71 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#71 def target_ruby; end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#216 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#216 def validate_enforced_styles(valid_cop_names); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#165 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#165 def validate_new_cops_parameter; end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#190 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#190 def validate_parameter_names(valid_cop_names); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#176 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#176 def validate_parameter_shape(valid_cop_names); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#236 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#236 def validate_support_and_has_list(name, formats, valid); end - # source://rubocop/1.71.0/lib/rubocop/config_validator.rb#154 + # source://rubocop/1.72.2/lib/rubocop/config_validator.rb#154 def validate_syntax_cop; end end diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@3.4.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@3.5.0.rbi similarity index 98% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@3.4.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@3.5.0.rbi index bed4a17447..ecbf2b1954 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@3.4.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@3.5.0.rbi @@ -371,10 +371,10 @@ class RuboCop::Cop::RSpec::BeNil < ::RuboCop::Cop::RSpec::Base private - # source://rubocop-rspec//lib/rubocop/cop/rspec/be_nil.rb#64 + # source://rubocop-rspec//lib/rubocop/cop/rspec/be_nil.rb#68 def check_be_nil_style(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/be_nil.rb#56 + # source://rubocop-rspec//lib/rubocop/cop/rspec/be_nil.rb#60 def check_be_style(node); end end @@ -489,39 +489,39 @@ class RuboCop::Cop::RSpec::ChangeByZero < ::RuboCop::Cop::RSpec::Base private - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#134 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#132 def autocorrect(corrector, node, change_node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#141 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#139 def autocorrect_compound(corrector, node); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#120 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#118 def compound_expectations?(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#151 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#149 def insert_operator(corrector, node, change_node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#125 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#123 def message(change_node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#129 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#127 def message_compound(change_node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#175 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#173 def negated_matcher; end - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#179 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#177 def preferred_method; end - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#105 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#104 def register_offense(node, change_node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#164 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#162 def remove_by_zero(corrector, node, change_node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#160 + # source://rubocop-rspec//lib/rubocop/cop/rspec/change_by_zero.rb#158 def replace_node(node, change_node); end end @@ -1924,41 +1924,41 @@ class RuboCop::Cop::RSpec::ExampleWording < ::RuboCop::Cop::RSpec::Base # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#63 def it_description(param0 = T.unsafe(nil)); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#71 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#70 def on_block(node); end private - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#89 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#87 def add_wording_offense(node, message); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#136 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#134 def custom_transform; end - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#99 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#97 def docstring(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#140 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#138 def ignored_words; end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#144 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#142 def insufficient_docstring?(description_node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#148 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#146 def insufficient_examples; end - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#153 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#151 def preprocess(message); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#109 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#107 def replacement_text(node); end # Recursive processing is required to process nested dstr nodes # that is the case for \-separated multiline strings with interpolation. # - # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#125 + # source://rubocop-rspec//lib/rubocop/cop/rspec/example_wording.rb#123 def text(node); end end @@ -2269,65 +2269,65 @@ RuboCop::Cop::RSpec::ExpectOutput::MSG = T.let(T.unsafe(nil), String) # A helper for `explicit` style # -# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#121 +# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#129 module RuboCop::Cop::RSpec::ExplicitHelper include ::RuboCop::RSpec::Language extend ::RuboCop::AST::NodePattern::Macros - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#182 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#190 def predicate_matcher?(param0 = T.unsafe(nil)); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#195 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#203 def predicate_matcher_block?(param0 = T.unsafe(nil)); end private - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#135 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#143 def allowed_explicit_matchers; end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#139 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#147 def check_explicit(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#219 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#227 def corrector_explicit(corrector, to_node, actual, matcher, block_child); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#175 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#183 def heredoc_argument?(matcher); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#213 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#221 def message_explicit(matcher); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#226 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#234 def move_predicate(corrector, actual, matcher, block_child); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#204 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#212 def predicate_matcher_name?(name); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#162 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#170 def replaceable_matcher?(matcher); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#255 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#261 def replacement_matcher(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#237 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#244 def to_predicate_method(matcher); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#171 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#179 def uncorrectable_matcher?(node, matcher); end end -# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#127 +# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#135 RuboCop::Cop::RSpec::ExplicitHelper::BUILT_IN_MATCHERS = T.let(T.unsafe(nil), Array) -# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#125 +# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#133 RuboCop::Cop::RSpec::ExplicitHelper::MSG_EXPLICIT = T.let(T.unsafe(nil), String) # Help methods for file. @@ -2405,15 +2405,16 @@ class RuboCop::Cop::RSpec::Focus < ::RuboCop::Cop::RSpec::Base private - # source://rubocop-rspec//lib/rubocop/cop/rspec/focus.rb#104 + # source://rubocop-rspec//lib/rubocop/cop/rspec/focus.rb#108 def correct_send(corrector, focus); end - # @yield [node] - # - # source://rubocop-rspec//lib/rubocop/cop/rspec/focus.rb#91 - def focus_metadata(node, &block); end + # source://rubocop-rspec//lib/rubocop/cop/rspec/focus.rb#89 + def on_focused_block(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/focus.rb#97 + # source://rubocop-rspec//lib/rubocop/cop/rspec/focus.rb#95 + def on_metadata(node); end + + # source://rubocop-rspec//lib/rubocop/cop/rspec/focus.rb#101 def with_surrounding(focus); end end @@ -2673,15 +2674,15 @@ class RuboCop::Cop::RSpec::ImplicitExpect < ::RuboCop::Cop::RSpec::Base private - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_expect.rb#78 - def is_expected_range(source_map); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_expect.rb#69 def offending_expect(node); end # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_expect.rb#86 def offense_message(offending_source); end + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_expect.rb#78 + def range_for_is_expected(source_map); end + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_expect.rb#94 def replacement_source(offending_source); end end @@ -2770,45 +2771,45 @@ class RuboCop::Cop::RSpec::ImplicitSubject < ::RuboCop::Cop::RSpec::Base # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#100 def autocorrect(corrector, node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#159 + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#167 def example_of(node); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#135 + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#143 def implicit_subject_in_non_its?(node); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#139 + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#147 def implicit_subject_in_non_its_and_non_single_line?(node); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#143 + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#151 def implicit_subject_in_non_its_and_non_single_statement?(node); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#122 + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#126 def invalid?(node); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#147 + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#155 def its?(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#113 + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#117 def message(_node); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#151 + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#159 def single_line?(node); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#155 + # source://rubocop-rspec//lib/rubocop/cop/rspec/implicit_subject.rb#163 def single_statement?(node); end end @@ -2872,25 +2873,25 @@ class RuboCop::Cop::RSpec::IndexedLet < ::RuboCop::Cop::RSpec::Base private - # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#105 + # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#107 def allowed_identifiers; end - # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#99 + # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#101 def cop_config_patterns_values; end - # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#79 + # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#81 def filter_indexed_lets(candidates); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#88 + # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#90 def indexed_let?(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#95 + # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#97 def let_name_stripped_index(node); end end -# source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#77 +# source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#78 RuboCop::Cop::RSpec::IndexedLet::INDEX_REGEX = T.let(T.unsafe(nil), Regexp) # source://rubocop-rspec//lib/rubocop/cop/rspec/indexed_let.rb#51 @@ -2906,45 +2907,50 @@ module RuboCop::Cop::RSpec::InflectedHelper include ::RuboCop::RSpec::Language extend ::RuboCop::AST::NodePattern::Macros - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#39 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#45 def be_bool?(param0 = T.unsafe(nil)); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#44 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#50 def be_boolthy?(param0 = T.unsafe(nil)); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#29 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#31 def predicate_in_actual?(param0 = T.unsafe(nil)); end private # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#48 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#54 def boolean_matcher?(node); end + # @return [Boolean] + # + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#40 + def cannot_replace_predicate?(send_node); end + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#16 def check_inflected(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#60 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#66 def message_inflected(predicate); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#56 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#62 def predicate?(sym); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#85 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#89 def remove_predicate(corrector, predicate); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#96 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#100 def rewrite_matcher(corrector, predicate, matcher); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#67 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#72 def to_predicate_matcher(name); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#107 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#111 def true?(to_symbol, matcher); end end @@ -4010,7 +4016,7 @@ class RuboCop::Cop::RSpec::MultipleExpectations < ::RuboCop::Cop::RSpec::Base # source://rubocop-rspec//lib/rubocop/cop/rspec/multiple_expectations.rb#86 def expect?(param0 = T.unsafe(nil)); end - # source://rubocop/1.70.0/lib/rubocop/cop/exclude_limit.rb#11 + # source://rubocop/1.73.1/lib/rubocop/cop/exclude_limit.rb#11 def max=(value); end # source://rubocop-rspec//lib/rubocop/cop/rspec/multiple_expectations.rb#93 @@ -4125,7 +4131,7 @@ RuboCop::Cop::RSpec::MultipleExpectations::TRUE_NODE = T.let(T.unsafe(nil), Proc class RuboCop::Cop::RSpec::MultipleMemoizedHelpers < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::RSpec::Variable - # source://rubocop/1.70.0/lib/rubocop/cop/exclude_limit.rb#11 + # source://rubocop/1.73.1/lib/rubocop/cop/exclude_limit.rb#11 def max=(value); end # source://rubocop-rspec//lib/rubocop/cop/rspec/multiple_memoized_helpers.rb#91 @@ -4467,7 +4473,7 @@ end class RuboCop::Cop::RSpec::NestedGroups < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::RSpec::TopLevelGroup - # source://rubocop/1.70.0/lib/rubocop/cop/exclude_limit.rb#11 + # source://rubocop/1.73.1/lib/rubocop/cop/exclude_limit.rb#11 def max=(value); end # source://rubocop-rspec//lib/rubocop/cop/rspec/nested_groups.rb#107 @@ -4891,21 +4897,21 @@ RuboCop::Cop::RSpec::PendingWithoutReason::MSG = T.let(T.unsafe(nil), String) # # good - the above code is rewritten to it by this cop # expect(foo.something?).to be_truthy # -# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#318 +# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#324 class RuboCop::Cop::RSpec::PredicateMatcher < ::RuboCop::Cop::RSpec::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::RSpec::InflectedHelper include ::RuboCop::Cop::RSpec::ExplicitHelper extend ::RuboCop::Cop::AutoCorrector - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#335 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#345 def on_block(node); end - # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#326 + # source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#332 def on_send(node); end end -# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#324 +# source://rubocop-rspec//lib/rubocop/cop/rspec/predicate_matcher.rb#330 RuboCop::Cop::RSpec::PredicateMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # Check for `once` and `twice` receive counts matchers usage. @@ -7051,9 +7057,6 @@ class RuboCop::RSpec::AlignLetBrace def token; end end -# source://rubocop-rspec//lib/rubocop/rspec.rb#7 -RuboCop::RSpec::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname) - # Wrapper for RSpec DSL methods # # source://rubocop-rspec//lib/rubocop/rspec/concept.rb#6 @@ -7251,17 +7254,6 @@ class RuboCop::RSpec::Hook < ::RuboCop::RSpec::Concept def valid_scope?(node); end end -# Because RuboCop doesn't yet support plugins, we have to monkey patch in a -# bit of our configuration. -# -# source://rubocop-rspec//lib/rubocop/rspec/inject.rb#7 -module RuboCop::RSpec::Inject - class << self - # source://rubocop-rspec//lib/rubocop/rspec/inject.rb#8 - def defaults!; end - end -end - # Contains node matchers for common RSpec DSL. # # RSpec allows for configuring aliases for commonly used DSL elements, e.g. @@ -7466,8 +7458,25 @@ module RuboCop::RSpec::Node def recursive_literal_or_const?; end end -# source://rubocop-rspec//lib/rubocop/rspec.rb#6 -RuboCop::RSpec::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname) +# A plugin that integrates RuboCop RSpec with RuboCop's plugin system. +# +# source://rubocop-rspec//lib/rubocop/rspec/plugin.rb#8 +class RuboCop::RSpec::Plugin < ::LintRoller::Plugin + # :nocov: + # + # source://rubocop-rspec//lib/rubocop/rspec/plugin.rb#10 + def about; end + + # source://rubocop-rspec//lib/rubocop/rspec/plugin.rb#24 + def rules(_context); end + + # :nocov: + # + # @return [Boolean] + # + # source://rubocop-rspec//lib/rubocop/rspec/plugin.rb#20 + def supported?(context); end +end # Version information for the RSpec RuboCop plugin. # @@ -7486,46 +7495,46 @@ class RuboCop::RSpec::Wording # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#14 def initialize(text, ignore:, replace:); end - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#21 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#20 def rewrite; end private - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#80 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#78 def append_suffix(word, suffix); end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#65 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#63 def ignored_word?(word); end # Returns the value of attribute ignores. # - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#39 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#37 def ignores; end - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#51 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#49 def remove_should_and_pluralize; end - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#41 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#39 def replace_prefix(pattern, replacement); end # Returns the value of attribute replacements. # - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#39 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#37 def replacements; end - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#69 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#67 def substitute(word); end # Returns the value of attribute text. # - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#39 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#37 def text; end # @return [Boolean] # - # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#47 + # source://rubocop-rspec//lib/rubocop/rspec/wording.rb#45 def uppercase?(word); end end diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.71.2.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.73.2.rbi similarity index 96% rename from Library/Homebrew/sorbet/rbi/gems/rubocop@1.71.2.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop@1.73.2.rbi index 474f695686..d02343407d 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.71.2.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.73.2.rbi @@ -617,7 +617,7 @@ class RuboCop::CLI::Command::SuggestExtensions < ::RuboCop::CLI::Command::Base # @api private # - # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#111 + # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#117 def dependent_gems; end # @api private @@ -627,7 +627,7 @@ class RuboCop::CLI::Command::SuggestExtensions < ::RuboCop::CLI::Command::Base # @api private # - # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#103 + # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#109 def installed_and_not_loaded_extensions; end # @api private @@ -637,7 +637,7 @@ class RuboCop::CLI::Command::SuggestExtensions < ::RuboCop::CLI::Command::Base # @api private # - # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#115 + # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#121 def installed_gems; end # @api private @@ -647,7 +647,7 @@ class RuboCop::CLI::Command::SuggestExtensions < ::RuboCop::CLI::Command::Base # @api private # - # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#107 + # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#113 def lockfile; end # @api private @@ -672,7 +672,7 @@ class RuboCop::CLI::Command::SuggestExtensions < ::RuboCop::CLI::Command::Base # @api private # - # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#119 + # source://rubocop//lib/rubocop/cli/command/suggest_extensions.rb#125 def puts(*args); end # @api private @@ -840,7 +840,7 @@ class RuboCop::CommentConfig # source://rubocop//lib/rubocop/comment_config.rb#63 def comment_only_line?(line_number); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def config(*_arg0, **_arg1, &_arg2); end # source://rubocop//lib/rubocop/comment_config.rb#51 @@ -864,7 +864,7 @@ class RuboCop::CommentConfig # source://rubocop//lib/rubocop/comment_config.rb#30 def processed_source; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def registry(*_arg0, **_arg1, &_arg2); end private @@ -1040,23 +1040,23 @@ class RuboCop::Config # source://rubocop//lib/rubocop/config.rb#31 def initialize(hash = T.unsafe(nil), loaded_path = T.unsafe(nil)); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def [](*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def []=(*_arg0, **_arg1, &_arg2); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#179 + # source://rubocop//lib/rubocop/config.rb#183 def active_support_extensions_enabled?; end - # source://rubocop//lib/rubocop/config.rb#94 + # source://rubocop//lib/rubocop/config.rb#98 def add_excludes_from_higher_level(highest_config); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#206 + # source://rubocop//lib/rubocop/config.rb#210 def allowed_camel_case_file?(file); end # Paths specified in configuration files starting with .rubocop are @@ -1065,74 +1065,74 @@ class RuboCop::Config # config/default.yml, for example, are not relative to RuboCop's config # directory since that wouldn't work. # - # source://rubocop//lib/rubocop/config.rb#250 + # source://rubocop//lib/rubocop/config.rb#254 def base_dir_for_path_parameters; end # @return [String, nil] # - # source://rubocop//lib/rubocop/config.rb#280 + # source://rubocop//lib/rubocop/config.rb#284 def bundler_lock_file_path; end - # source://rubocop//lib/rubocop/config.rb#52 + # source://rubocop//lib/rubocop/config.rb#56 def check; end # @api private # @return [Boolean] whether config for this badge has 'Include' or 'Exclude' keys # - # source://rubocop//lib/rubocop/config.rb#147 + # source://rubocop//lib/rubocop/config.rb#151 def clusivity_config_for_badge?(badge); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#167 + # source://rubocop//lib/rubocop/config.rb#171 def cop_enabled?(name); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def delete(*_arg0, **_arg1, &_arg2); end - # source://rubocop//lib/rubocop/config.rb#106 + # source://rubocop//lib/rubocop/config.rb#110 def deprecation_check; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def dig(*_arg0, **_arg1, &_arg2); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#171 + # source://rubocop//lib/rubocop/config.rb#175 def disabled_new_cops?; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def each_key(*_arg0, **_arg1, &_arg2); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#175 + # source://rubocop//lib/rubocop/config.rb#179 def enabled_new_cops?; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def fetch(*_arg0, **_arg1, &_arg2); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#228 + # source://rubocop//lib/rubocop/config.rb#232 def file_to_exclude?(file); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#187 + # source://rubocop//lib/rubocop/config.rb#191 def file_to_include?(file); end - # source://rubocop//lib/rubocop/config.rb#163 + # source://rubocop//lib/rubocop/config.rb#167 def for_all_cops; end # Note: the 'Enabled' attribute is same as that returned by `for_cop` # # @return [Config] for the given cop merged with that of its department (if any) # - # source://rubocop//lib/rubocop/config.rb#133 + # source://rubocop//lib/rubocop/config.rb#137 def for_badge(badge); end # Note: the 'Enabled' attribute is calculated according to the department's @@ -1140,7 +1140,7 @@ class RuboCop::Config # # @return [Config] for the given cop / cop name. # - # source://rubocop//lib/rubocop/config.rb#120 + # source://rubocop//lib/rubocop/config.rb#124 def for_cop(cop); end # Note: the 'Enabled' attribute will be present only if specified @@ -1148,7 +1148,7 @@ class RuboCop::Config # # @return [Config] for the given department name. # - # source://rubocop//lib/rubocop/config.rb#158 + # source://rubocop//lib/rubocop/config.rb#162 def for_department(department_name); end # If the given cop is enabled, returns its configuration hash. @@ -1156,31 +1156,31 @@ class RuboCop::Config # # @return [Config, Hash] for the given cop / cop name. # - # source://rubocop//lib/rubocop/config.rb#127 + # source://rubocop//lib/rubocop/config.rb#131 def for_enabled_cop(cop); end # Returns target's locked gem versions (i.e. from Gemfile.lock or gems.locked) # - # source://rubocop//lib/rubocop/config.rb#305 + # source://rubocop//lib/rubocop/config.rb#309 def gem_versions_in_target; end - # source://rubocop//lib/rubocop/config.rb#309 + # source://rubocop//lib/rubocop/config.rb#313 def inspect; end # True if this is a config file that is shipped with RuboCop # # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#77 + # source://rubocop//lib/rubocop/config.rb#81 def internal?; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def key?(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def keys(*_arg0, **_arg1, &_arg2); end - # source://rubocop//lib/rubocop/config.rb#48 + # source://rubocop//lib/rubocop/config.rb#52 def loaded_features; end # Returns the value of attribute loaded_path. @@ -1188,28 +1188,31 @@ class RuboCop::Config # source://rubocop//lib/rubocop/config.rb#21 def loaded_path; end - # source://rubocop//lib/rubocop/config.rb#82 + # source://rubocop//lib/rubocop/config.rb#48 + def loaded_plugins; end + + # source://rubocop//lib/rubocop/config.rb#86 def make_excludes_absolute; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def map(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def merge(*_arg0, **_arg1, &_arg2); end - # source://rubocop//lib/rubocop/config.rb#260 + # source://rubocop//lib/rubocop/config.rb#264 def parser_engine; end - # source://rubocop//lib/rubocop/config.rb#241 + # source://rubocop//lib/rubocop/config.rb#245 def path_relative_to_config(path); end - # source://rubocop//lib/rubocop/config.rb#237 + # source://rubocop//lib/rubocop/config.rb#241 def patterns_to_exclude; end - # source://rubocop//lib/rubocop/config.rb#233 + # source://rubocop//lib/rubocop/config.rb#237 def patterns_to_include; end - # source://rubocop//lib/rubocop/config.rb#291 + # source://rubocop//lib/rubocop/config.rb#295 def pending_cops; end # Returns true if there's a chance that an Include pattern matches hidden @@ -1217,74 +1220,74 @@ class RuboCop::Config # # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#220 + # source://rubocop//lib/rubocop/config.rb#224 def possibly_include_hidden?; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def replace(*_arg0, **_arg1, &_arg2); end - # source://rubocop//lib/rubocop/config.rb#72 + # source://rubocop//lib/rubocop/config.rb#76 def signature; end - # source://rubocop//lib/rubocop/config.rb#275 + # source://rubocop//lib/rubocop/config.rb#279 def smart_loaded_path; end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#183 + # source://rubocop//lib/rubocop/config.rb#187 def string_literals_frozen_by_default?; end - # source://rubocop//lib/rubocop/config.rb#264 + # source://rubocop//lib/rubocop/config.rb#268 def target_rails_version; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def target_ruby_version(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def to_h(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def to_hash(*_arg0, **_arg1, &_arg2); end - # source://rubocop//lib/rubocop/config.rb#68 + # source://rubocop//lib/rubocop/config.rb#72 def to_s; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def transform_values(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def validate(*_arg0, **_arg1, &_arg2); end - # source://rubocop//lib/rubocop/config.rb#59 + # source://rubocop//lib/rubocop/config.rb#63 def validate_after_resolution; end private - # source://rubocop//lib/rubocop/config.rb#359 + # source://rubocop//lib/rubocop/config.rb#363 def department_of(qualified_cop_name); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#347 + # source://rubocop//lib/rubocop/config.rb#351 def enable_cop?(qualified_cop_name, cop_options); end # @param gem_version [Gem::Version] an object like `Gem::Version.new("7.1.2.3")` # @return [Float] The major and minor version, like `7.1` # - # source://rubocop//lib/rubocop/config.rb#334 + # source://rubocop//lib/rubocop/config.rb#338 def gem_version_to_major_minor_float(gem_version); end - # source://rubocop//lib/rubocop/config.rb#340 + # source://rubocop//lib/rubocop/config.rb#344 def read_gem_versions_from_target_lockfile; end # @return [Float, nil] The Rails version as a `major.minor` Float. # - # source://rubocop//lib/rubocop/config.rb#321 + # source://rubocop//lib/rubocop/config.rb#325 def read_rails_version_from_bundler_lock_file; end # @return [Float, nil] The Rails version as a `major.minor` Float. # - # source://rubocop//lib/rubocop/config.rb#316 + # source://rubocop//lib/rubocop/config.rb#320 def target_rails_version_from_bundler_lock_file; end class << self @@ -1424,7 +1427,7 @@ class RuboCop::ConfigLoader extend ::RuboCop::FileFinder class << self - # source://rubocop//lib/rubocop/config_loader.rb#141 + # source://rubocop//lib/rubocop/config_loader.rb#148 def add_excludes_from_files(config, config_file); end # Used to add features that were required inside a config or from @@ -1432,10 +1435,18 @@ class RuboCop::ConfigLoader # # @api private # - # source://rubocop//lib/rubocop/config_loader.rb#202 + # source://rubocop//lib/rubocop/config_loader.rb#237 def add_loaded_features(loaded_features); end - # source://rubocop//lib/rubocop/config_loader.rb#84 + # Used to add plugins that were required inside a config or from + # the CLI using `--plugin`. + # + # @api private + # + # source://rubocop//lib/rubocop/config_loader.rb#230 + def add_loaded_plugins(loaded_plugins); end + + # source://rubocop//lib/rubocop/config_loader.rb#91 def add_missing_namespaces(path, hash); end # source://rubocop//lib/rubocop/config_loader.rb#41 @@ -1447,10 +1458,10 @@ class RuboCop::ConfigLoader # user's home directory is checked. If there's no .rubocop.yml # there either, the path to the default file is returned. # - # source://rubocop//lib/rubocop/config_loader.rb#108 + # source://rubocop//lib/rubocop/config_loader.rb#115 def configuration_file_for(target_dir); end - # source://rubocop//lib/rubocop/config_loader.rb#112 + # source://rubocop//lib/rubocop/config_loader.rb#119 def configuration_from_file(config_file, check: T.unsafe(nil)); end # Returns the value of attribute debug. @@ -1470,7 +1481,7 @@ class RuboCop::ConfigLoader # source://rubocop//lib/rubocop/config_loader.rb#33 def debug?; end - # source://rubocop//lib/rubocop/config_loader.rb#151 + # source://rubocop//lib/rubocop/config_loader.rb#158 def default_configuration; end # Sets the attribute default_configuration @@ -1533,17 +1544,20 @@ class RuboCop::ConfigLoader # source://rubocop//lib/rubocop/config_loader.rb#33 def ignore_unrecognized_cops=(_arg0); end - # @api private + # This API is primarily intended for testing and documenting plugins. + # When testing a plugin using `rubocop/rspec/support`, the plugin is loaded automatically, + # so this API is usually not needed. It is intended to be used only when implementing tests + # that do not use `rubocop/rspec/support`. # - # source://rubocop//lib/rubocop/config_loader.rb#159 - def inject_defaults!(project_root); end + # source://rubocop//lib/rubocop/config_loader.rb#170 + def inject_defaults!(config_yml_path); end - # source://rubocop//lib/rubocop/config_loader.rb#51 + # source://rubocop//lib/rubocop/config_loader.rb#53 def load_file(file, check: T.unsafe(nil)); end # @raise [TypeError] # - # source://rubocop//lib/rubocop/config_loader.rb#71 + # source://rubocop//lib/rubocop/config_loader.rb#78 def load_yaml_configuration(absolute_path); end # Returns the value of attribute loaded_features. @@ -1551,24 +1565,29 @@ class RuboCop::ConfigLoader # source://rubocop//lib/rubocop/config_loader.rb#36 def loaded_features; end + # Returns the value of attribute loaded_plugins. + # + # source://rubocop//lib/rubocop/config_loader.rb#36 + def loaded_plugins; end + # Return a recursive merge of two hashes. That is, a normal hash merge, # with the addition that any value that is a hash, and occurs in both # arguments, will also be merged. And so on. # - # source://rubocop//lib/rubocop/config_loader.rb#99 + # source://rubocop//lib/rubocop/config_loader.rb#106 def merge(base_hash, derived_hash); end # Merges the given configuration with the default one. # - # source://rubocop//lib/rubocop/config_loader.rb#195 + # source://rubocop//lib/rubocop/config_loader.rb#223 def merge_with_default(config, config_file, unset_nil: T.unsafe(nil)); end - # source://rubocop//lib/rubocop/config_loader.rb#132 + # source://rubocop//lib/rubocop/config_loader.rb#139 def pending_cops_only_qualified(pending_cops); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config_loader.rb#136 + # source://rubocop//lib/rubocop/config_loader.rb#143 def possible_new_cops?(config); end # Returns the path RuboCop inferred as the root of the project. No file @@ -1576,37 +1595,37 @@ class RuboCop::ConfigLoader # # @deprecated Use `RuboCop::ConfigFinder.project_root` instead. # - # source://rubocop//lib/rubocop/config_loader.rb#170 + # source://rubocop//lib/rubocop/config_loader.rb#198 def project_root; end - # source://rubocop//lib/rubocop/config_loader.rb#179 + # source://rubocop//lib/rubocop/config_loader.rb#207 def warn_on_pending_cops(pending_cops); end - # source://rubocop//lib/rubocop/config_loader.rb#187 + # source://rubocop//lib/rubocop/config_loader.rb#215 def warn_pending_cop(cop); end private - # source://rubocop//lib/rubocop/config_loader.rb#216 + # source://rubocop//lib/rubocop/config_loader.rb#251 def check_duplication(yaml_code, absolute_path); end - # source://rubocop//lib/rubocop/config_loader.rb#208 + # source://rubocop//lib/rubocop/config_loader.rb#243 def file_path(file); end # Read the specified file, or exit with a friendly, concise message on # stderr. Care is taken to use the standard OS exit code for a "file not # found" error. # - # source://rubocop//lib/rubocop/config_loader.rb#236 + # source://rubocop//lib/rubocop/config_loader.rb#271 def read_file(absolute_path); end - # source://rubocop//lib/rubocop/config_loader.rb#212 + # source://rubocop//lib/rubocop/config_loader.rb#247 def resolver; end - # source://rubocop//lib/rubocop/config_loader.rb#242 + # source://rubocop//lib/rubocop/config_loader.rb#277 def yaml_tree_to_hash(yaml_tree); end - # source://rubocop//lib/rubocop/config_loader.rb#252 + # source://rubocop//lib/rubocop/config_loader.rb#287 def yaml_tree_to_hash!(yaml_tree); end end end @@ -1624,7 +1643,7 @@ RuboCop::ConfigLoader::RUBOCOP_HOME = T.let(T.unsafe(nil), String) # # @api private # -# source://rubocop//lib/rubocop/config_loader_resolver.rb#9 +# source://rubocop//lib/rubocop/config_loader_resolver.rb#10 class RuboCop::ConfigLoaderResolver # When one .rubocop.yml file inherits from another .rubocop.yml file, the Include paths in the # base configuration are relative to the directory where the base configuration file is. For the @@ -1633,7 +1652,7 @@ class RuboCop::ConfigLoaderResolver # # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#45 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#63 def fix_include_paths(base_config_path, hash, path, key, value); end # Return a recursive merge of two hashes. That is, a normal hash merge, @@ -1643,7 +1662,7 @@ class RuboCop::ConfigLoaderResolver # # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#99 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#117 def merge(base_hash, derived_hash, **opts); end # Merges the given configuration with the default one. If @@ -1654,7 +1673,7 @@ class RuboCop::ConfigLoaderResolver # # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#75 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#93 def merge_with_default(config, config_file, unset_nil:); end # An `Enabled: true` setting in user configuration for a cop overrides an @@ -1662,7 +1681,7 @@ class RuboCop::ConfigLoaderResolver # # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#119 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#137 def override_department_setting_for_cops(base_hash, derived_hash); end # If a cop was previously explicitly enabled, but then superseded by the @@ -1670,112 +1689,111 @@ class RuboCop::ConfigLoaderResolver # # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#136 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#154 def override_enabled_for_disabled_departments(base_hash, derived_hash); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#19 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#37 def resolve_inheritance(path, hash, file, debug); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#55 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#73 def resolve_inheritance_from_gems(hash); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#10 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#11 + def resolve_plugins(rubocop_config, plugins); end + + # @api private + # + # source://rubocop//lib/rubocop/config_loader_resolver.rb#17 def resolve_requires(path, hash); end private # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#215 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#233 def base_configs(path, inherit_from, file); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#183 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#201 def determine_inherit_mode(hash, key); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#152 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#170 def disabled?(hash, department); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#156 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#174 def duplicate_setting?(base_hash, derived_hash, key, inherited_file); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#177 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#195 def duplicate_setting_warning(opts, key); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#278 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#292 def gem_config_path(gem_name, relative_config_path); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#256 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#270 def handle_disabled_by_default(config, new_default_configuration); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#227 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#245 def inherited_file(path, inherit_from, file); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#211 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#229 def merge_hashes?(base_hash, derived_hash, key); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#252 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#266 def remote_config?(file); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#248 - def remote_file?(uri); end - - # @api private - # @return [Boolean] - # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#203 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#221 def should_merge?(mode, key); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#207 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#225 def should_override?(mode, key); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#189 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#207 def should_union?(derived_hash, base_hash, root_mode, key); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#274 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#288 def transform(config, &block); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#165 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#183 def warn_on_duplicate_setting(base_hash, derived_hash, key, **opts); end end @@ -2359,10 +2377,10 @@ class RuboCop::ConfigValidator # source://rubocop//lib/rubocop/config_validator.rb#28 def initialize(config); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def for_all_cops(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def smart_loaded_path(*_arg0, **_arg1, &_arg2); end # source://rubocop//lib/rubocop/config_validator.rb#65 @@ -2528,7 +2546,7 @@ module RuboCop::Cop::Alignment def within?(inner, outer); end end -# source://rubocop//lib/rubocop/cop/mixin/alignment.rb#10 +# source://rubocop//lib/rubocop/cop/mixin/alignment.rb#8 RuboCop::Cop::Alignment::SPACE = T.let(T.unsafe(nil), String) # This class does autocorrection of nodes that should just be moved to @@ -2669,7 +2687,7 @@ module RuboCop::Cop::AllowedPattern # @return [Boolean] # # source://rubocop//lib/rubocop/cop/mixin/allowed_pattern.rb#21 - def ignored_line?; end + def ignored_line?(line); end # @return [Boolean] # @@ -2680,7 +2698,7 @@ module RuboCop::Cop::AllowedPattern # @return [Boolean] # # source://rubocop//lib/rubocop/cop/mixin/allowed_pattern.rb#34 - def matches_ignored_pattern?; end + def matches_ignored_pattern?(line); end end # This module encapsulates the ability to allow certain receivers in a cop. @@ -5260,7 +5278,7 @@ class RuboCop::Cop::Corrector < ::Parser::Source::TreeRewriter # Legacy # - # source://parser/3.3.7.0/lib/parser/source/tree_rewriter.rb#252 + # source://parser/3.3.7.1/lib/parser/source/tree_rewriter.rb#252 def rewrite; end # Swaps sources at the given ranges. @@ -6886,99 +6904,99 @@ end # # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#7 module RuboCop::Cop::HashShorthandSyntax - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#14 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#32 def on_hash_for_mixed_shorthand(hash_node); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#26 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#44 def on_pair(node); end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#126 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#144 def brackets?(method_dispatch_node); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#156 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#174 def breakdown_value_types_of_hash(hash_node); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#103 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#121 def def_node_that_require_parentheses(node); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#185 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#203 def each_omittable_value_pair(hash_value_type_breakdown, &block); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#181 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#199 def each_omitted_value_pair(hash_value_type_breakdown, &block); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#81 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#99 def enforced_shorthand_syntax; end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#118 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#136 def find_ancestor_method_dispatch_node(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#168 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#186 def hash_with_mixed_shorthand_syntax?(hash_value_type_breakdown); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#172 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#190 def hash_with_values_that_cant_be_omitted?(hash_value_type_breakdown); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#176 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#194 def ignore_explicit_omissible_hash_shorthand_syntax?(hash_value_type_breakdown); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#75 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#93 def ignore_hash_shorthand_syntax?(pair_node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#69 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#87 def ignore_mixed_hash_shorthand_syntax?(hash_node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#141 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#159 def last_expression?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#149 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#167 def method_dispatch_as_argument?(method_dispatch_node); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#189 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#207 def mixed_shorthand_syntax_check(hash_value_type_breakdown); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#205 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#223 def no_mixed_shorthand_syntax_check(hash_value_type_breakdown); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#49 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#67 def register_offense(node, message, replacement); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#85 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#103 def require_hash_value?(hash_key_source, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#94 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#112 def require_hash_value_for_around_hash_literal?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#130 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#148 def use_element_of_hash_literal_as_receiver?(ancestor, parent); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#135 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#153 def use_modifier_form_without_parenthesized_method_call?(ancestor); end end @@ -6991,12 +7009,12 @@ RuboCop::Cop::HashShorthandSyntax::DO_NOT_MIX_MSG_PREFIX = T.let(T.unsafe(nil), # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#11 RuboCop::Cop::HashShorthandSyntax::DO_NOT_MIX_OMIT_VALUE_MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#216 +# source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#14 class RuboCop::Cop::HashShorthandSyntax::DefNode < ::Struct - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#225 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#23 def first_argument; end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#229 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#27 def last_argument; end # Returns the value of attribute node @@ -7010,7 +7028,7 @@ class RuboCop::Cop::HashShorthandSyntax::DefNode < ::Struct # @return [Object] the newly set value def node=(_); end - # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#217 + # source://rubocop//lib/rubocop/cop/mixin/hash_shorthand_syntax.rb#15 def selector; end class << self @@ -7048,16 +7066,16 @@ module RuboCop::Cop::HashSubset private - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#166 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#181 def decorate_source(value); end - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#174 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#189 def except_key(node); end - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#153 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#168 def except_key_source(key); end - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#145 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#160 def extract_body_if_negated(body); end # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#59 @@ -7070,15 +7088,15 @@ module RuboCop::Cop::HashSubset # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#123 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#138 def included?(body, negated); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#131 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#146 def not_included?(body, negated); end - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#182 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#197 def offense_range(node); end # @raise [NotImplementedError] @@ -7088,22 +7106,22 @@ module RuboCop::Cop::HashSubset # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#88 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#95 def range_include?(send_node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#135 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#150 def safe_to_register_offense?(block, except_key); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#108 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#123 def semantically_except_method?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#119 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#134 def semantically_slice_method?(node); end # @raise [NotImplementedError] @@ -7114,8 +7132,18 @@ module RuboCop::Cop::HashSubset # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#100 + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#88 + def slices_key?(send_node, method, key_arg, value_arg); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#115 def supported_subset_method?(method); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#107 + def using_value_variable?(send_node, value_arg); end end # source://rubocop//lib/rubocop/cop/mixin/hash_subset.rb#16 @@ -7137,71 +7165,71 @@ RuboCop::Cop::HashSubset::SUBSET_METHODS = T.let(T.unsafe(nil), Array) module RuboCop::Cop::HashTransformMethod extend ::RuboCop::AST::NodePattern::Macros - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#13 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#87 def array_receiver?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#17 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#91 def on_block(node); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#34 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#108 def on_csend(node); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#27 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#101 def on_send(node); end private - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#108 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#182 def execute_correction(corrector, node, correction); end # @abstract # @raise [NotImplementedError] # @return [Captures] # - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#83 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#157 def extract_captures(_match); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#60 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#134 def handle_possible_offense(node, match, match_desc); end # @abstract # @raise [NotImplementedError] # @return [String] # - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#90 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#164 def new_method_name; end # @abstract Implemented with `def_node_matcher` # @raise [NotImplementedError] # - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#41 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#115 def on_bad_each_with_object(_node); end # @abstract Implemented with `def_node_matcher` # @raise [NotImplementedError] # - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#46 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#120 def on_bad_hash_brackets_map(_node); end # @abstract Implemented with `def_node_matcher` # @raise [NotImplementedError] # - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#51 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#125 def on_bad_map_to_h(_node); end # @abstract Implemented with `def_node_matcher` # @raise [NotImplementedError] # - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#56 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#130 def on_bad_to_h(_node); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#94 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#168 def prepare_correction(node); end end # Internal helper class to hold autocorrect data # -# source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#136 +# source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#31 class RuboCop::Cop::HashTransformMethod::Autocorrection < ::Struct # Returns the value of attribute block_node # @@ -7236,16 +7264,16 @@ class RuboCop::Cop::HashTransformMethod::Autocorrection < ::Struct # @return [Object] the newly set value def match=(_); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#177 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#72 def set_new_arg_name(transformed_argname, corrector); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#181 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#76 def set_new_body_expression(transforming_body_expr, corrector); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#167 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#62 def set_new_method_name(new_method_name, corrector); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#161 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#56 def strip_prefix_and_suffix(node, corrector); end # Returns the value of attribute trailing @@ -7262,16 +7290,16 @@ class RuboCop::Cop::HashTransformMethod::Autocorrection < ::Struct class << self def [](*_arg0); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#137 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#32 def from_each_with_object(node, match); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#141 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#36 def from_hash_brackets_map(node, match); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#145 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#40 def from_map_to_h(node, match); end - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#157 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#52 def from_to_h(node, match); end def inspect; end @@ -7283,16 +7311,16 @@ end # Internal helper class to hold match data # -# source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#118 +# source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#13 class RuboCop::Cop::HashTransformMethod::Captures < ::Struct # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#119 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#14 def noop_transformation?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#124 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#19 def transformation_uses_both_args?; end # Returns the value of attribute transformed_argname @@ -7330,7 +7358,7 @@ class RuboCop::Cop::HashTransformMethod::Captures < ::Struct # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#128 + # source://rubocop//lib/rubocop/cop/mixin/hash_transform_method.rb#23 def use_transformed_argname?; end class << self @@ -7980,73 +8008,73 @@ class RuboCop::Cop::Layout::BlockAlignment < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#74 def block_end_align_target?(param0 = T.unsafe(nil), param1); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#83 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#85 def on_block(node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#83 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#85 def on_numblock(node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#89 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#91 def style_parameter_name; end private - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#245 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#247 def add_space_before(corrector, loc, delta); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#222 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#224 def alt_start_msg(start_loc, source_line_column); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#144 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#146 def autocorrect(corrector, node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#95 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#97 def block_end_align_target(node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#113 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#115 def check_block_alignment(start_node, block_node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#195 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#197 def compute_do_source_line_column(node, end_loc); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#237 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#239 def compute_start_col(ancestor_node, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#109 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#111 def disqualified_parent?(parent, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#105 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#107 def end_align_target?(node, parent); end # In offense message, we want to show the assignment LHS rather than # the entire assignment. # - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#190 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#192 def find_lhs_node(node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#161 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#163 def format_message(start_loc, end_loc, do_source_line_column, error_source_line_column); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#232 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#234 def format_source_line_column(source_line_column); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#214 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#216 def loc_to_source_line_column(loc); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#126 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#128 def register_offense(block_node, start_loc, end_loc, do_source_line_column); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#249 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#251 def remove_space_before(corrector, end_pos, delta); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#171 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#173 def start_for_block_node(block_node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#178 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#180 def start_for_line_node(block_node); end end @@ -9818,17 +9846,17 @@ class RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier < ::RuboCop::Cop::Bas # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#164 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#166 def block_start?(line); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#170 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#172 def body_end?(line); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#158 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#160 def class_def?(line); end # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#124 @@ -9836,7 +9864,7 @@ class RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier < ::RuboCop::Cop::Bas # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#154 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#156 def empty_lines_around?(node); end # @return [Boolean] @@ -9844,30 +9872,50 @@ class RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier < ::RuboCop::Cop::Bas # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#104 def expected_empty_lines?(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#180 + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#225 + def inside_block?(node); end + + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#182 def message(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#189 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#191 def message_for_around_style(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#199 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#201 def message_for_only_before_style(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#176 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#178 def next_empty_line_range(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#148 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#150 def next_line_empty?(last_send_line); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#141 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#229 + def no_empty_lines_around_block_body?; end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#143 def previous_line_empty?(send_line); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#137 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#139 def previous_line_ignoring_comments(processed_source, send_line); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#219 + def should_insert_line_after?(node); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#211 + def should_insert_line_before?(node); end end # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb#48 @@ -10436,7 +10484,15 @@ class RuboCop::Cop::Layout::EmptyLinesAroundMethodBody < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_method_body.rb#38 + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_method_body.rb#47 + def offending_endless_method?(node); end + + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_method_body.rb#52 + def register_offense_for_endless_method(node); end + + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_method_body.rb#43 def style; end end @@ -18114,6 +18170,62 @@ end # source://rubocop//lib/rubocop/cop/lint/constant_resolution.rb#63 RuboCop::Cop::Lint::ConstantResolution::MSG = T.let(T.unsafe(nil), String) +# are strictly formatted. +# +# A comment can be added to the directive by prefixing it with `--`. +# +# @example +# # bad +# # rubocop:disable Layout/LineLength Style/Encoding +# # ^ missing comma +# +# # bad +# # rubocop:disable +# +# # bad +# # rubocop:disable Layout/LineLength # rubocop:disable Style/Encoding +# +# # bad +# # rubocop:wrongmode Layout/LineLength +# +# # good +# # rubocop:disable Layout/LineLength +# +# # good +# # rubocop:disable Layout/LineLength, Style/Encoding +# +# # good +# # rubocop:disable all +# +# # good +# # rubocop:disable Layout/LineLength -- This is a good comment. +# +# source://rubocop//lib/rubocop/cop/lint/cop_directive_syntax.rb#39 +class RuboCop::Cop::Lint::CopDirectiveSyntax < ::RuboCop::Cop::Base + # source://rubocop//lib/rubocop/cop/lint/cop_directive_syntax.rb#48 + def on_new_investigation; end + + private + + # source://rubocop//lib/rubocop/cop/lint/cop_directive_syntax.rb#62 + def offense_message(directive_comment); end +end + +# source://rubocop//lib/rubocop/cop/lint/cop_directive_syntax.rb#40 +RuboCop::Cop::Lint::CopDirectiveSyntax::COMMON_MSG = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/lint/cop_directive_syntax.rb#43 +RuboCop::Cop::Lint::CopDirectiveSyntax::INVALID_MODE_NAME_MSG = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/lint/cop_directive_syntax.rb#45 +RuboCop::Cop::Lint::CopDirectiveSyntax::MALFORMED_COP_NAMES_MSG = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/lint/cop_directive_syntax.rb#44 +RuboCop::Cop::Lint::CopDirectiveSyntax::MISSING_COP_NAME_MSG = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/lint/cop_directive_syntax.rb#42 +RuboCop::Cop::Lint::CopDirectiveSyntax::MISSING_MODE_NAME_MSG = T.let(T.unsafe(nil), String) + # Checks for debug calls (such as `debugger` or `binding.pry`) that should # not be kept for production code. # @@ -18906,71 +19018,66 @@ class RuboCop::Cop::Lint::DuplicateMethods < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#47 def initialize(config = T.unsafe(nil), options = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#88 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#85 def alias_method?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#75 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#73 def method_alias?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#79 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#77 def on_alias(node); end # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#53 def on_def(node); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#62 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#61 def on_defs(node); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#94 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#91 def on_send(node); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#93 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#90 def sym_name(param0 = T.unsafe(nil)); end private - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#107 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#103 def check_const_receiver(node, name, const_name); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#114 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#110 def check_self_receiver(node, name); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#198 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#194 def found_attr(node, args, readable: T.unsafe(nil), writable: T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#126 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#122 def found_instance_method(node, name); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#149 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#145 def found_method(node, method_name); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#139 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#135 def found_sclass_method(node, name); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#176 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#172 def location(node); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#208 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#204 def lookup_constant(node, const_name); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#121 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#117 def message_for_dup(node, method_name, key); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#168 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#164 def method_key(node, method_name); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#184 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#180 def on_attr(node, attr_name, args); end - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#240 - def possible_dsl?(node); end - - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#226 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#222 def qualified_name(enclosing, namespace, mod_name); end - # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#250 + # source://rubocop//lib/rubocop/cop/lint/duplicate_methods.rb#236 def source_location(node); end end @@ -19478,6 +19585,13 @@ RuboCop::Cop::Lint::EmptyClass::METACLASS_MSG = T.let(T.unsafe(nil), String) # if condition # do_something # elsif other_condition +# nil +# end +# +# # good +# if condition +# do_something +# elsif other_condition # do_something_else # end # @example AllowComments: true (default) @@ -19495,10 +19609,9 @@ RuboCop::Cop::Lint::EmptyClass::METACLASS_MSG = T.let(T.unsafe(nil), String) # # noop # end # -# source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#63 +# source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#65 class RuboCop::Cop::Lint::EmptyConditionalBody < ::RuboCop::Cop::Base include ::RuboCop::Cop::CommentsHelp - include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#71 @@ -19506,54 +19619,38 @@ class RuboCop::Cop::Lint::EmptyConditionalBody < ::RuboCop::Cop::Base private - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#177 - def all_branches_body_missing?(node); end - - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#95 - def autocorrect(corrector, node); end - - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#163 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#125 def branch_range(node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#125 - def correct_other_branches(corrector, node); end + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#94 + def can_simplify_conditional?(node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#183 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#133 def deletion_range(range); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#158 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#121 def else_branch?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#152 - def empty_elsif_branch?(node); end - - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#144 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#113 def empty_if_branch?(node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#87 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#108 + def flip_orphaned_else(corrector, node); end + + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#86 def offense_range(node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#101 - def remove_comments(corrector, node); end - - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#109 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#98 def remove_empty_branch(corrector, node); end - - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#137 - def require_other_branches_correction?(node); end end -# source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#68 +# source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#69 RuboCop::Cop::Lint::EmptyConditionalBody::MSG = T.let(T.unsafe(nil), String) # Checks for empty `ensure` blocks. @@ -19906,9 +20003,6 @@ class RuboCop::Cop::Lint::ErbNewArguments < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/lint/erb_new_arguments.rb#160 - def arguments_range(node); end - # source://rubocop//lib/rubocop/cop/lint/erb_new_arguments.rb#115 def autocorrect(corrector, node); end @@ -20013,10 +20107,10 @@ class RuboCop::Cop::Lint::FloatComparison < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/lint/float_comparison.rb#100 + # source://rubocop//lib/rubocop/cop/lint/float_comparison.rb#95 def check_numeric_returning_method(node); end - # source://rubocop//lib/rubocop/cop/lint/float_comparison.rb#85 + # source://rubocop//lib/rubocop/cop/lint/float_comparison.rb#84 def check_send(node); end # @return [Boolean] @@ -20073,7 +20167,7 @@ RuboCop::Cop::Lint::FloatOutOfRange::MSG = T.let(T.unsafe(nil), String) # expected fields for format/sprintf/#% and what is actually # passed as arguments. # -# In addition it checks whether different formats are used in the same +# In addition, it checks whether different formats are used in the same # format string. Do not mix numbered, unnumbered, and named formats in # the same format string. # @@ -20809,12 +20903,15 @@ RuboCop::Cop::Lint::LambdaWithoutLiteralBlock::RESTRICT_ON_SEND = T.let(T.unsafe # end # # # bad -# if some_var && true +# # We're only interested in the left hand side being a truthy literal, +# # because it affects the evaluation of the &&, whereas the right hand +# # side will be conditionally executed/called and can be a literal. +# if true && some_var # do_something # end # # # good -# if some_var && some_condition +# if some_var # do_something # end # @@ -20824,72 +20921,79 @@ RuboCop::Cop::Lint::LambdaWithoutLiteralBlock::RESTRICT_ON_SEND = T.let(T.unsafe # break if condition # end # -# source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#35 +# source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#38 class RuboCop::Cop::Lint::LiteralAsCondition < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#94 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#160 def message(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#59 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#45 + def on_and(node); end + + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#125 def on_case(case_node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#74 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#140 def on_case_match(case_match_node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#41 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#53 def on_if(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#88 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#154 def on_send(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#52 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#95 def on_until(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#52 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#110 def on_until_post(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#45 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#65 def on_while(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#45 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#80 def on_while_post(node); end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#109 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#175 def basic_literal?(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#139 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#207 def check_case(case_node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#100 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#166 def check_for_literal(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#121 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#187 def check_node(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#148 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#216 def condition(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#131 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#232 + def correct_if_node(node, cond, result); end + + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#197 def handle_node(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#117 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#183 def primitive_array?(node); end - # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#156 + # source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#224 def when_conditions_range(when_node); end end -# source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#38 +# source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#42 RuboCop::Cop::Lint::LiteralAsCondition::MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#39 +# source://rubocop//lib/rubocop/cop/lint/literal_as_condition.rb#43 RuboCop::Cop::Lint::LiteralAsCondition::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) # Checks for literal assignments in the conditions of `if`, `while`, and `until`. @@ -23024,7 +23128,6 @@ RuboCop::Cop::Lint::RedundantRegexpQuantifiers::MSG_REDUNDANT_QUANTIFIER = T.let # * 2.0+ ... `enumerator` # * 2.1+ ... `thread` # * 2.2+ ... Add `rational` and `complex` above -# * 2.5+ ... Add `pp` above # * 2.7+ ... Add `ruby2_keywords` above # * 3.1+ ... Add `fiber` above # * 3.2+ ... `set` @@ -23039,43 +23142,32 @@ RuboCop::Cop::Lint::RedundantRegexpQuantifiers::MSG_REDUNDANT_QUANTIFIER = T.let # # good # require 'unloaded_feature' # -# source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#38 +# source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#33 class RuboCop::Cop::Lint::RedundantRequireStatement < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#61 + # source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#47 def on_send(node); end - # source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#57 - def pp_const?(param0 = T.unsafe(nil)); end - - # source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#51 + # source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#42 def redundant_require_statement?(param0 = T.unsafe(nil)); end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#91 - def need_to_require_pp?; end - - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#80 + # source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#66 def redundant_feature?(feature_name); end end -# source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#42 +# source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#37 RuboCop::Cop::Lint::RedundantRequireStatement::MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#45 -RuboCop::Cop::Lint::RedundantRequireStatement::PRETTY_PRINT_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#43 +# source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#38 RuboCop::Cop::Lint::RedundantRequireStatement::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#44 +# source://rubocop//lib/rubocop/cop/lint/redundant_require_statement.rb#39 RuboCop::Cop::Lint::RedundantRequireStatement::RUBY_22_LOADED_FEATURES = T.let(T.unsafe(nil), Array) # Checks for redundant safe navigation calls. @@ -23390,6 +23482,179 @@ RuboCop::Cop::Lint::RedundantStringCoercion::MSG_SELF = T.let(T.unsafe(nil), Str # source://rubocop//lib/rubocop/cop/lint/redundant_string_coercion.rb#29 RuboCop::Cop::Lint::RedundantStringCoercion::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +# Checks for redundant uses of `to_s`, `to_sym`, `to_i`, `to_f`, `to_r`, `to_c`, +# `to_a`, `to_h`, and `to_set`. +# +# When one of these methods is called on an object of the same type, that object +# is returned, making the call unnecessary. The cop detects conversion methods called +# on object literals, class constructors, class `[]` methods, and the `Kernel` methods +# `String()`, `Integer()`, `Float()`, `Rational()`, `Complex()` and `Array()`. +# +# Specifically, these cases are detected for each conversion method: +# +# * `to_s` when called on a string literal, interpolated string, heredoc, +# or with `String.new` or `String()`. +# * `to_sym` when called on a symbol literal or interpolated symbol. +# * `to_i` when called on an integer literal or with `Integer()`. +# * `to_f` when called on a float literal of with `Float()`. +# * `to_r` when called on a rational literal or with `Rational()`. +# * `to_c` when called on a complex literal of with `Complex()`. +# * `to_a` when called on an array literal, or with `Array.new`, `Array()` or `Array[]`. +# * `to_h` when called on a hash literal, or with `Hash.new`, `Hash()` or `Hash[]`. +# * `to_set` when called on `Set.new` or `Set[]`. +# +# In all cases, chaining one same `to_*` conversion methods listed above is redundant. +# +# The cop can also register an offense for chaining conversion methods on methods that are +# expected to return a specific type regardless of receiver (eg. `foo.inspect.to_s`). +# +# @example +# # bad +# "text".to_s +# :sym.to_sym +# 42.to_i +# 8.5.to_f +# 12r.to_r +# 1i.to_c +# [].to_a +# {}.to_h +# Set.new.to_set +# +# # good +# "text" +# :sym +# 42 +# 8.5 +# 12r +# 1i +# [] +# {} +# Set.new +# +# # bad +# Integer(var).to_i +# +# # good +# Integer(var) +# +# # good - chaining to a type constructor with exceptions suppressed +# # in this case, `Integer()` could return `nil` +# Integer(var, exception: false).to_i +# +# # bad - chaining the same conversion +# foo.to_s.to_s +# +# # good +# foo.to_s +# +# # bad - chaining a conversion to a method that is expected to return the same type +# inspect.to_s +# +# # good +# inspect +# +# source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#77 +class RuboCop::Cop::Lint::RedundantTypeConversion < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#151 + def array_constructor?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#146 + def complex_constructor?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#175 + def exception_false_keyword_argument?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#136 + def float_constructor?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#159 + def hash_constructor?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#131 + def integer_constructor?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#180 + def on_csend(node); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#180 + def on_send(node); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#141 + def rational_constructor?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#168 + def set_constructor?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#123 + def string_constructor?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#118 + def type_constructor?(param0 = T.unsafe(nil), param1); end + + private + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#238 + def chained_conversion?(node, receiver); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#244 + def chained_to_typed_method?(node, receiver); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#225 + def constructor?(node, receiver); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#232 + def constructor_suppresses_exceptions?(receiver); end + + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#206 + def find_receiver(node); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#200 + def hash_or_set_with_block?(node); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#219 + def literal_receiver?(node, receiver); end +end + +# Maps each conversion method to the pattern matcher for that type's constructors +# Not every type has a constructor, for instance Symbol. +# +# source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#97 +RuboCop::Cop::Lint::RedundantTypeConversion::CONSTRUCTOR_MAPPING = T.let(T.unsafe(nil), Hash) + +# source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#112 +RuboCop::Cop::Lint::RedundantTypeConversion::CONVERSION_METHODS = T.let(T.unsafe(nil), Set) + +# Maps conversion methods to the node types for the literals of that type +# +# source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#83 +RuboCop::Cop::Lint::RedundantTypeConversion::LITERAL_NODE_TYPES = T.let(T.unsafe(nil), Hash) + +# source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#80 +RuboCop::Cop::Lint::RedundantTypeConversion::MSG = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#113 +RuboCop::Cop::Lint::RedundantTypeConversion::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) + +# Methods that already are expected to return a given type, which makes a further +# conversion redundant. +# +# source://rubocop//lib/rubocop/cop/lint/redundant_type_conversion.rb#110 +RuboCop::Cop::Lint::RedundantTypeConversion::TYPED_METHODS = T.let(T.unsafe(nil), Hash) + # Checks for redundant `with_index`. # # @example @@ -24704,6 +24969,64 @@ end # source://rubocop//lib/rubocop/cop/lint/suppressed_exception.rb#106 RuboCop::Cop::Lint::SuppressedException::MSG = T.let(T.unsafe(nil), String) +# Checks for cases where exceptions unrelated to the numeric constructors `Integer()`, +# `Float()`, `BigDecimal()`, `Complex()`, and `Rational()` may be unintentionally swallowed. +# +# @example +# +# # bad +# Integer(arg) rescue nil +# +# # bad +# begin +# Integer(arg) +# rescue +# nil +# end +# +# # bad +# begin +# Integer(arg) +# rescue +# end +# +# # good +# Integer(arg, exception: false) +# +# source://rubocop//lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb#41 +class RuboCop::Cop::Lint::SuppressedExceptionInNumberConversion < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRubyVersion + + # source://rubocop//lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb#56 + def begin_numeric_constructor_rescue_nil(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb#75 + def constructor_receiver?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb#49 + def numeric_constructor_rescue_nil(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb#65 + def numeric_method?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb#82 + def on_rescue(node); end + + private + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb#103 + def expected_exception_classes_only?(exception_classes); end +end + +# source://rubocop//lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb#46 +RuboCop::Cop::Lint::SuppressedExceptionInNumberConversion::EXPECTED_EXCEPTION_CLASSES = T.let(T.unsafe(nil), Array) + +# source://rubocop//lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb#45 +RuboCop::Cop::Lint::SuppressedExceptionInNumberConversion::MSG = T.let(T.unsafe(nil), String) + # Checks for uses of literal strings converted to # a symbol where a literal symbol could be used instead. # @@ -26290,6 +26613,64 @@ end # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#45 RuboCop::Cop::Lint::UselessAssignment::MSG = T.let(T.unsafe(nil), String) +# Checks for useless constant scoping. Private constants must be defined using +# `private_constant` or `class << self`. Even if `private` access modifier is used, +# it is public scope despite its appearance. +# +# It does not support autocorrection due to behavior change and multiple ways to fix it. +# Or a public constant may be intended. +# +# @example +# +# # bad +# class Foo +# private +# PRIVATE_CONST = 42 +# end +# +# # good +# class Foo +# PRIVATE_CONST = 42 +# private_constant :PRIVATE_CONST +# end +# +# # good +# class Foo +# class << self +# private +# PRIVATE_CONST = 42 +# end +# end +# +# # good +# class Foo +# PUBLIC_CONST = 42 # If private scope is not intended. +# end +# +# source://rubocop//lib/rubocop/cop/lint/useless_constant_scoping.rb#40 +class RuboCop::Cop::Lint::UselessConstantScoping < ::RuboCop::Cop::Base + # source://rubocop//lib/rubocop/cop/lint/useless_constant_scoping.rb#48 + def on_casgn(node); end + + # source://rubocop//lib/rubocop/cop/lint/useless_constant_scoping.rb#44 + def private_constants(param0 = T.unsafe(nil)); end + + private + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/useless_constant_scoping.rb#58 + def after_private_modifier?(left_siblings); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/useless_constant_scoping.rb#68 + def private_constantize?(right_siblings, const_value); end +end + +# source://rubocop//lib/rubocop/cop/lint/useless_constant_scoping.rb#41 +RuboCop::Cop::Lint::UselessConstantScoping::MSG = T.let(T.unsafe(nil), String) + # Checks for calls to `defined?` with strings or symbols as the argument. # Such calls will always return `'expression'`, you probably meant to # check for the existence of a constant, method, or variable instead. @@ -26872,58 +27253,58 @@ class RuboCop::Cop::Lint::Void < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/void.rb#255 + # source://rubocop//lib/rubocop/cop/lint/void.rb#261 def all_keys_entirely_literal?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/void.rb#259 + # source://rubocop//lib/rubocop/cop/lint/void.rb#265 def all_values_entirely_literal?(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#233 + # source://rubocop//lib/rubocop/cop/lint/void.rb#239 def autocorrect_nonmutating_send(corrector, node, suggestion); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#227 + # source://rubocop//lib/rubocop/cop/lint/void.rb#233 def autocorrect_void_expression(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#214 + # source://rubocop//lib/rubocop/cop/lint/void.rb#220 def autocorrect_void_op(corrector, node); end # source://rubocop//lib/rubocop/cop/lint/void.rb#101 def check_begin(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#199 + # source://rubocop//lib/rubocop/cop/lint/void.rb#205 def check_ensure(node); end # source://rubocop//lib/rubocop/cop/lint/void.rb#115 def check_expression(expr); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#157 + # source://rubocop//lib/rubocop/cop/lint/void.rb#163 def check_literal(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#181 + # source://rubocop//lib/rubocop/cop/lint/void.rb#187 def check_nonmutating(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#165 + # source://rubocop//lib/rubocop/cop/lint/void.rb#171 def check_self(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#139 + # source://rubocop//lib/rubocop/cop/lint/void.rb#145 def check_var(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#173 + # source://rubocop//lib/rubocop/cop/lint/void.rb#179 def check_void_expression(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#128 + # source://rubocop//lib/rubocop/cop/lint/void.rb#129 def check_void_op(node, &block); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/void.rb#242 + # source://rubocop//lib/rubocop/cop/lint/void.rb#248 def entirely_literal?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/void.rb#207 + # source://rubocop//lib/rubocop/cop/lint/void.rb#213 def in_void_context?(node); end end @@ -27805,13 +28186,13 @@ class RuboCop::Cop::Metrics::Utils::AbcSizeCalculator # @return [AbcSizeCalculator] a new instance of AbcSizeCalculator # - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#30 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#37 def initialize(node, discount_repeated_attributes: T.unsafe(nil)); end # source://rubocop//lib/rubocop/cop/metrics/utils/abc_size_calculator.rb#42 def calculate; end - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#53 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#60 def calculate_node(node); end # @return [Boolean] @@ -27819,7 +28200,7 @@ class RuboCop::Cop::Metrics::Utils::AbcSizeCalculator # source://rubocop//lib/rubocop/cop/metrics/utils/abc_size_calculator.rb#65 def else_branch?(node); end - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#47 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#54 def evaluate_branch_nodes(node); end # source://rubocop//lib/rubocop/cop/metrics/utils/abc_size_calculator.rb#60 @@ -28043,29 +28424,29 @@ module RuboCop::Cop::Metrics::Utils::RepeatedAttributeDiscount # # @api private # - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#30 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#37 def initialize(node, discount_repeated_attributes: T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#61 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#68 def attribute_call?(param0 = T.unsafe(nil)); end # @api private # - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#53 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#60 def calculate_node(node); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#43 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#50 def discount_repeated_attributes?; end # @api private # - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#47 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#54 def evaluate_branch_nodes(node); end - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#92 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#99 def root_node?(param0 = T.unsafe(nil)); end private @@ -28073,7 +28454,7 @@ module RuboCop::Cop::Metrics::Utils::RepeatedAttributeDiscount # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#66 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#73 def discount_repeated_attribute?(send_node); end # Returns the "known_attributes" for the `node` by walking the receiver tree @@ -28084,7 +28465,7 @@ module RuboCop::Cop::Metrics::Utils::RepeatedAttributeDiscount # # @api private # - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#103 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#110 def find_attributes(node, &block); end # or `nil` if it is not a setter. @@ -28096,13 +28477,13 @@ module RuboCop::Cop::Metrics::Utils::RepeatedAttributeDiscount # @api private # - # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#80 + # source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#87 def update_repeated_attribute(node); end end # @api private # -# source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#117 +# source://rubocop//lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb#29 RuboCop::Cop::Metrics::Utils::RepeatedAttributeDiscount::VAR_SETTER_TO_GETTER = T.let(T.unsafe(nil), Hash) # Identifies repetitions `&.` on the same variable: @@ -28763,6 +29144,21 @@ RuboCop::Cop::Naming::BinaryOperatorParameterName::MSG = T.let(T.unsafe(nil), St # source://rubocop//lib/rubocop/cop/naming/binary_operator_parameter_name.rb#21 RuboCop::Cop::Naming::BinaryOperatorParameterName::OP_LIKE_METHODS = T.let(T.unsafe(nil), Array) +# In Ruby 3.1, anonymous block forwarding has been added. +# +# This cop identifies places where `do_something(&block)` can be replaced +# by `do_something(&)`. +# +# It also supports the opposite style by alternative `explicit` option. +# You can specify the block variable name for autocorrection with `BlockForwardingName`. +# The default variable name is `block`. If the name is already in use, it will not be +# autocorrected. +# +# [NOTE] +# ==== +# Because of a bug in Ruby 3.3.0, when a block is referenced inside of another block, +# no offense will be registered until Ruby 3.4: +# # [source,ruby] # ---- # def foo(&block) @@ -28770,7 +29166,7 @@ RuboCop::Cop::Naming::BinaryOperatorParameterName::OP_LIKE_METHODS = T.let(T.uns # block_method { bar(&block) } # end # ---- -# -- +# ==== # # @example EnforcedStyle: anonymous (default) # @@ -29742,20 +30138,16 @@ end # they end with a `?`. These methods should be changed to remove the # prefix. # -# @example NamePrefix: ['is_', 'has_', 'have_'] (default) +# When `UseSorbetSigs` set to true (optional), the cop will only report +# offenses if the method has a Sorbet `sig` with a return type of +# `T::Boolean`. Dynamic methods are not supported with this configuration. +# +# @example MethodDefinitionMacros: ['def_node_matcher'] # # bad -# def is_even(value) -# end +# def_node_matcher(:is_even) { |value| } # -# # When ForbiddenPrefixes: ['is_', 'has_', 'have_'] (default) # # good -# def even?(value) -# end -# -# # When ForbiddenPrefixes: [] -# # good -# def is_even?(value) -# end +# def_node_matcher(:even?) { |value| } # @example NamePrefix: ['seems_to_be_'] # # bad # def seems_to_be_even(value) @@ -29779,59 +30171,102 @@ end # # good # def is_even?(value) # end +# @example UseSorbetSigs: false (default) +# # bad +# sig { returns(String) } +# def is_this_thing_on +# "yes" +# end +# +# # good - Sorbet signature is not evaluated +# sig { returns(String) } +# def is_this_thing_on? +# "yes" +# end +# @example UseSorbetSigs: true +# # bad +# sig { returns(T::Boolean) } +# def odd(value) +# end +# +# # good +# sig { returns(T::Boolean) } +# def odd?(value) +# end # @example MethodDefinitionMacros: ['define_method', 'define_singleton_method'] (default) # # bad # define_method(:is_even) { |value| } # # # good # define_method(:even?) { |value| } -# @example MethodDefinitionMacros: ['def_node_matcher'] +# @example NamePrefix: ['is_', 'has_', 'have_'] (default) # # bad -# def_node_matcher(:is_even) { |value| } +# def is_even(value) +# end # +# # When ForbiddenPrefixes: ['is_', 'has_', 'have_'] (default) # # good -# def_node_matcher(:even?) { |value| } +# def even?(value) +# end # -# source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#75 +# # When ForbiddenPrefixes: [] +# # good +# def is_even?(value) +# end +# +# source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#103 class RuboCop::Cop::Naming::PredicateName < ::RuboCop::Cop::Base include ::RuboCop::Cop::AllowedMethods - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#79 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#107 def dynamic_method_define(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#98 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#126 def on_def(node); end - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#98 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#126 def on_defs(node); end - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#85 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#113 def on_send(node); end - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#112 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#154 + def sorbet_return_type(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#141 def validate_config; end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#124 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#164 def allowed_method_name?(method_name, prefix); end - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#132 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#172 def expected_name(method_name, prefix); end - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#146 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#186 def forbidden_prefixes; end - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#142 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#182 def message(method_name, new_name); end - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#154 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#198 def method_definition_macros(macro_name); end - # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#150 + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#190 def predicate_prefixes; end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#158 + def sorbet_sig?(node, return_type: T.unsafe(nil)); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#194 + def use_sorbet_sigs?; end end # Makes sure that rescued exceptions variables are named as @@ -29936,8 +30371,15 @@ end # source://rubocop//lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb#64 RuboCop::Cop::Naming::RescuedExceptionsVariableName::MSG = T.let(T.unsafe(nil), String) -# Makes sure that all variables use the configured style, -# snake_case or camelCase, for their names. +# Checks that the configured style (snake_case or camelCase) is used for all variable names. +# This includes local variables, instance variables, class variables, method arguments +# (positional, keyword, rest or block), and block arguments. +# +# The cop can also be configured to forbid using specific names for variables, using +# `ForbiddenIdentifiers` or `ForbiddenPatterns`. In addition to the above, this applies +# to global variables as well. +# +# Method definitions and method calls are not affected by this cop. # # @example EnforcedStyle: snake_case (default) # # bad @@ -29956,9 +30398,21 @@ RuboCop::Cop::Naming::RescuedExceptionsVariableName::MSG = T.let(T.unsafe(nil), # fooBar = 1 # @example AllowedPatterns: ['_v\d+\z'] # # good (with EnforcedStyle: camelCase) -# :release_v1 +# release_v1 = true +# @example ForbiddenIdentifiers: ['fooBar'] +# # bad (in all cases) +# fooBar = 1 +# @fooBar = 1 +# @@fooBar = 1 +# $fooBar = 1 +# @example ForbiddenPatterns: ['_v\d+\z'] +# # bad (in all cases) +# release_v1 = true +# @release_v1 = true +# @@release_v1 = true +# $release_v1 = true # -# source://rubocop//lib/rubocop/cop/naming/variable_name.rb#31 +# source://rubocop//lib/rubocop/cop/naming/variable_name.rb#52 class RuboCop::Cop::Naming::VariableName < ::RuboCop::Cop::Base include ::RuboCop::Cop::AllowedIdentifiers include ::RuboCop::Cop::ConfigurableEnforcedStyle @@ -29966,53 +30420,80 @@ class RuboCop::Cop::Naming::VariableName < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableNaming include ::RuboCop::Cop::AllowedPattern - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_arg(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_blockarg(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_cvasgn(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # Only forbidden names are checked for global variable assignment + # + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#86 + def on_gvasgn(node); end + + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_ivasgn(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_kwarg(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_kwoptarg(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_kwrestarg(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_lvar(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_lvasgn(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_optarg(node); end - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#42 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#64 def on_restarg(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#38 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#60 def valid_name?(node, name, given_style = T.unsafe(nil)); end private - # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#61 + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#99 + def forbidden_identifiers; end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#111 + def forbidden_name?(name); end + + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#103 + def forbidden_patterns; end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#107 + def matches_forbidden_pattern?(name); end + + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#95 def message(style); end + + # source://rubocop//lib/rubocop/cop/naming/variable_name.rb#118 + def register_forbidden_name(node); end end -# source://rubocop//lib/rubocop/cop/naming/variable_name.rb#36 +# source://rubocop//lib/rubocop/cop/naming/variable_name.rb#57 RuboCop::Cop::Naming::VariableName::MSG = T.let(T.unsafe(nil), String) +# source://rubocop//lib/rubocop/cop/naming/variable_name.rb#58 +RuboCop::Cop::Naming::VariableName::MSG_FORBIDDEN = T.let(T.unsafe(nil), String) + # Makes sure that all numbered variables use the # configured style, snake_case, normalcase, or non_integer, # for their numbering. @@ -31037,19 +31518,31 @@ end module RuboCop::Cop::RangeHelp private - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#140 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#152 def add_range(range1, range2); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#81 + # A range containing the first to the last argument + # of a method call or method definition. + # def foo(a, b:) + # ^^^^^ + # bar(1, 2, 3, &blk) + # ^^^^^^^^^^^^^ + # baz { |x, y:, z:| } + # ^^^^^^^^^ + # + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#45 + def arguments_range(node); end + + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#93 def column_offset_between(base_range, range); end # A range containing only the contents of a literal with delimiters (e.g. in # `%i{1 2 3}` this will be the range covering `1 2 3` only). # - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#32 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#33 def contents_range(node); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#99 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#111 def directions(side); end # Returns the column attribute of the range, except if the range is on @@ -31057,46 +31550,46 @@ module RuboCop::Cop::RangeHelp # line, in which case 1 is subtracted from the column value. This gives # the column as it appears when viewing the file in an editor. # - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#91 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#103 def effective_column(range); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#108 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#120 def final_pos(src, pos, increment, continuations, newlines, whitespace); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#116 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#128 def move_pos(src, pos, step, condition, regexp); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#122 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#134 def move_pos_str(src, pos, step, condition, needle); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#36 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#49 def range_between(start_pos, end_pos); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#72 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#84 def range_by_whole_lines(range, include_final_newline: T.unsafe(nil), buffer: T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#133 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#145 def range_with_comments(node); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#129 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#141 def range_with_comments_and_lines(node); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#40 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#53 def range_with_surrounding_comma(range, side = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#55 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#67 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 - # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#11 + # source://rubocop//lib/rubocop/cop/mixin/range_help.rb#12 def source_range(source_buffer, line_number, column, length = T.unsafe(nil)); end end # The Unicode codepoint # -# source://rubocop//lib/rubocop/cop/mixin/range_help.rb#9 +# source://rubocop//lib/rubocop/cop/mixin/range_help.rb#7 RuboCop::Cop::RangeHelp::BYTE_ORDER_MARK = T.let(T.unsafe(nil), Integer) -# source://rubocop//lib/rubocop/cop/mixin/range_help.rb#54 +# source://rubocop//lib/rubocop/cop/mixin/range_help.rb#8 module RuboCop::Cop::RangeHelp::NOT_GIVEN; end # Common functionality for handling Rational literals. @@ -32294,7 +32787,7 @@ class RuboCop::Cop::Style::AccessorGrouping < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#122 def class_send_elements(class_node); end - # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#165 + # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#179 def group_accessors(node, accessors); end # @return [Boolean] @@ -32302,7 +32795,12 @@ class RuboCop::Cop::Style::AccessorGrouping < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#99 def groupable_accessor?(node); end + # @return [Boolean] + # # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#142 + def groupable_sibling_accessor?(node, sibling); end + + # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#149 def groupable_sibling_accessors(send_node); end # @return [Boolean] @@ -32310,10 +32808,10 @@ class RuboCop::Cop::Style::AccessorGrouping < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#134 def grouped_style?; end - # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#151 + # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#155 def message(send_node); end - # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#156 + # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#160 def preferred_accessors(node); end # @return [Boolean] @@ -32321,13 +32819,20 @@ class RuboCop::Cop::Style::AccessorGrouping < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#94 def previous_line_comment?(node); end - # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#171 + # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#185 def separate_accessors(node); end # @return [Boolean] # # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#138 def separated_style?; end + + # Group after constants + # + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#174 + def skip_for_grouping?(node); end end # source://rubocop//lib/rubocop/cop/style/accessor_grouping.rb#59 @@ -32583,6 +33088,39 @@ end # source://rubocop//lib/rubocop/cop/style/and_or.rb#49 RuboCop::Cop::Style::AndOr::MSG = T.let(T.unsafe(nil), String) +# In Ruby 2.7, arguments forwarding has been added. +# +# This cop identifies places where `do_something(*args, &block)` +# can be replaced by `do_something(...)`. +# +# In Ruby 3.1, anonymous block forwarding has been added. +# +# This cop identifies places where `do_something(&block)` can be replaced +# by `do_something(&)`; if desired, this functionality can be disabled +# by setting `UseAnonymousForwarding: false`. +# +# In Ruby 3.2, anonymous args/kwargs forwarding has been added. +# +# This cop also identifies places where `use_args(*args)`/`use_kwargs(**kwargs)` can be +# replaced by `use_args(*)`/`use_kwargs(**)`; if desired, this functionality can be disabled +# by setting `UseAnonymousForwarding: false`. +# +# And this cop has `RedundantRestArgumentNames`, `RedundantKeywordRestArgumentNames`, +# and `RedundantBlockArgumentNames` options. This configuration is a list of redundant names +# that are sufficient for anonymizing meaningless naming. +# +# Meaningless names that are commonly used can be anonymized by default: +# e.g., `*args`, `**options`, `&block`, and so on. +# +# Names not on this list are likely to be meaningful and are allowed by default. +# +# This cop handles not only method forwarding but also forwarding to `super`. +# +# [NOTE] +# ==== +# Because of a bug in Ruby 3.3.0, when a block is referenced inside of another block, +# no offense will be registered until Ruby 3.4: +# # [source,ruby] # ---- # def foo(&block) @@ -32590,7 +33128,7 @@ RuboCop::Cop::Style::AndOr::MSG = T.let(T.unsafe(nil), String) # block_method { bar(&block) } # end # ---- -# -- +# ==== # # @example RedundantBlockArgumentNames: ['blk', 'block', 'proc'] (default) # # bad - But it is good with `EnforcedStyle: explicit` set for `Naming/BlockForwarding`. @@ -37486,8 +38024,11 @@ RuboCop::Cop::Style::EndBlock::MSG = T.let(T.unsafe(nil), String) # Checks for endless methods. # -# It can enforce either the use of endless methods definitions -# for single-lined method bodies, or disallow endless methods. +# It can enforce endless method definitions whenever possible or with single line methods. +# It can also disallow multiline endless method definitions or all endless definitions. +# +# `require_single_line` style enforces endless method definitions for single line methods. +# `require_always` style enforces endless method definitions for single statement methods. # # Other method definition types are not considered by this cop. # @@ -37496,63 +38037,172 @@ RuboCop::Cop::Style::EndBlock::MSG = T.let(T.unsafe(nil), String) # * allow_single_line (default) - only single line endless method definitions are allowed. # * allow_always - all endless method definitions are allowed. # * disallow - all endless method definitions are disallowed. +# * require_single_line - endless method definitions are required for single line methods. +# * require_always - all endless method definitions are required. # # NOTE: Incorrect endless method definitions will always be # corrected to a multi-line definition. # # @example EnforcedStyle: allow_single_line (default) -# # good -# def my_method() = x -# # # bad, multi-line endless method -# def my_method() = x.foo +# def my_method = x.foo # .bar # .baz +# +# # good +# def my_method +# x +# end +# +# # good +# def my_method = x +# +# # good +# def my_method +# x.foo +# .bar +# .baz +# end # @example EnforcedStyle: allow_always # # good -# def my_method() = x +# def my_method +# x +# end # # # good -# def my_method() = x.foo +# def my_method = x +# +# # good +# def my_method = x.foo # .bar # .baz +# +# # good +# def my_method +# x.foo +# .bar +# .baz +# end # @example EnforcedStyle: disallow # # bad -# def my_method() = x +# def my_method = x # # # bad -# def my_method() = x.foo +# def my_method = x.foo # .bar # .baz # -# source://rubocop//lib/rubocop/cop/style/endless_method.rb#49 +# # good +# def my_method +# x +# end +# +# # good +# def my_method +# x.foo +# .bar +# .baz +# end +# @example EnforcedStyle: require_single_line +# # bad +# def my_method +# x +# end +# +# # bad +# def my_method = x.foo +# .bar +# .baz +# +# # good +# def my_method = x +# +# # good +# def my_method +# x.foo +# .bar +# .baz +# end +# @example EnforcedStyle: require_always +# # bad +# def my_method +# x +# end +# +# # bad +# def my_method +# x.foo +# .bar +# .baz +# end +# +# # good +# def my_method = x +# +# # good +# def my_method = x.foo +# .bar +# .baz +# +# source://rubocop//lib/rubocop/cop/style/endless_method.rb#132 class RuboCop::Cop::Style::EndlessMethod < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::EndlessMethodRewriter extend ::RuboCop::Cop::TargetRubyVersion extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/endless_method.rb#61 + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#146 def on_def(node); end private - # source://rubocop//lib/rubocop/cop/style/endless_method.rb#71 + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#217 + def arguments(node, missing = T.unsafe(nil)); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#221 + def can_be_made_endless?(node); end + + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#201 + def correct_to_multiline(corrector, node); end + + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#211 + def endless_replacement(node); end + + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#163 def handle_allow_style(node); end - # source://rubocop//lib/rubocop/cop/style/endless_method.rb#80 + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#195 def handle_disallow_style(node); end + + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#186 + def handle_require_always_style(node); end + + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#172 + def handle_require_single_line_style(node); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/endless_method.rb#225 + def too_long_when_made_endless?(node); end end -# source://rubocop//lib/rubocop/cop/style/endless_method.rb#57 +# source://rubocop//lib/rubocop/cop/style/endless_method.rb#140 RuboCop::Cop::Style::EndlessMethod::CORRECTION_STYLES = T.let(T.unsafe(nil), Array) -# source://rubocop//lib/rubocop/cop/style/endless_method.rb#58 +# source://rubocop//lib/rubocop/cop/style/endless_method.rb#141 RuboCop::Cop::Style::EndlessMethod::MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/style/endless_method.rb#59 +# source://rubocop//lib/rubocop/cop/style/endless_method.rb#142 RuboCop::Cop::Style::EndlessMethod::MSG_MULTI_LINE = T.let(T.unsafe(nil), String) +# source://rubocop//lib/rubocop/cop/style/endless_method.rb#144 +RuboCop::Cop::Style::EndlessMethod::MSG_REQUIRE_ALWAYS = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/style/endless_method.rb#143 +RuboCop::Cop::Style::EndlessMethod::MSG_REQUIRE_SINGLE = T.let(T.unsafe(nil), String) + # Checks for consistent usage of `ENV['HOME']`. If `nil` is used as # the second argument of `ENV.fetch`, it is treated as a bad case like `ENV[]`. # @@ -37864,9 +38514,6 @@ class RuboCop::Cop::Style::ExpandPathArguments < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/style/expand_path_arguments.rb#189 - def arguments_range(node); end - # source://rubocop//lib/rubocop/cop/style/expand_path_arguments.rb#100 def autocorrect(corrector, node); end @@ -40948,61 +41595,61 @@ class RuboCop::Cop::Style::InverseMethods < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#69 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#70 def inverse_block?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#60 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#61 def inverse_candidate?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#91 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#92 def on_block(node); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#77 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#78 def on_csend(node); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#91 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#92 def on_numblock(node); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#77 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#78 def on_send(node); end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#176 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#179 def camel_case_constant?(node); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#120 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#121 def correct_inverse_block(corrector, node); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#111 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#112 def correct_inverse_method(corrector, node); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#127 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#128 def correct_inverse_selector(block, corrector); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#180 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#183 def dot_range(loc); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#165 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#162 def end_parentheses(node, method_call); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#149 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#150 def inverse_blocks; end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#144 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#145 def inverse_methods; end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#190 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#193 def message(method, inverse); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#153 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#154 def negated?(node); end - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#161 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#158 def not_to_receiver(node, method_call); end # When comparing classes, `!(Integer < Numeric)` is not the same as @@ -41010,41 +41657,44 @@ class RuboCop::Cop::Style::InverseMethods < ::RuboCop::Cop::Base # # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#171 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#174 def possible_class_hierarchy_check?(lhs, rhs, method); end + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#187 + def remove_end_parenthesis(corrector, node, method, method_call); end + # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#157 - def relational_comparison_with_safe_navigation?(node); end - - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#184 - def remove_end_parenthesis(corrector, node, method, method_call); end + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#166 + def safe_navigation_incompatible?(node); end class << self - # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#55 + # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#56 def autocorrect_incompatible_with; end end end -# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#51 +# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#52 RuboCop::Cop::Style::InverseMethods::CAMEL_CASE = T.let(T.unsafe(nil), Regexp) # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#48 RuboCop::Cop::Style::InverseMethods::CLASS_COMPARISON_METHODS = T.let(T.unsafe(nil), Array) -# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#49 +# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#50 RuboCop::Cop::Style::InverseMethods::EQUALITY_METHODS = T.let(T.unsafe(nil), Array) # source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#47 RuboCop::Cop::Style::InverseMethods::MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#50 +# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#51 RuboCop::Cop::Style::InverseMethods::NEGATED_EQUALITY_METHODS = T.let(T.unsafe(nil), Array) -# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#53 +# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#54 RuboCop::Cop::Style::InverseMethods::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#49 +RuboCop::Cop::Style::InverseMethods::SAFE_NAVIGATION_INCOMPATIBLE_METHODS = T.let(T.unsafe(nil), Array) + # Checks for usages of `unless` which can be replaced by `if` with inverted condition. # Code without `unless` is easier to read, but that is subjective, so this cop # is disabled by default. @@ -41292,10 +41942,13 @@ class RuboCop::Cop::Style::KeywordParametersOrder < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/style/keyword_parameters_order.rb#58 + # source://rubocop//lib/rubocop/cop/style/keyword_parameters_order.rb#64 def append_newline_to_last_kwoptarg(arguments, corrector); end - # source://rubocop//lib/rubocop/cop/style/keyword_parameters_order.rb#66 + # source://rubocop//lib/rubocop/cop/style/keyword_parameters_order.rb#55 + def autocorrect(corrector, node, defining_node, kwarg_nodes); end + + # source://rubocop//lib/rubocop/cop/style/keyword_parameters_order.rb#72 def remove_kwargs(kwarg_nodes, corrector); end end @@ -41466,7 +42119,7 @@ class RuboCop::Cop::Style::LineEndConcatenation < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#74 + # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#80 def autocorrect(corrector, operator_range); end # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#57 @@ -41474,35 +42127,38 @@ class RuboCop::Cop::Style::LineEndConcatenation < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#101 + # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#107 def eligible_next_successor?(next_successor); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#97 + # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#103 def eligible_operator?(operator); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#105 + # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#111 def eligible_predecessor?(predecessor); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#93 + # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#99 def eligible_successor?(successor); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#87 + # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#93 def eligible_token_set?(predecessor, operator, successor); end + # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#72 + def register_offense(operator); end + # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#124 + # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#130 def standard_string_literal?(token); end - # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#109 + # source://rubocop//lib/rubocop/cop/style/line_end_concatenation.rb#115 def token_after_last_string(successor, base_index); end class << self @@ -41714,10 +42370,10 @@ class RuboCop::Cop::Style::MagicCommentFormat::CommentRange # source://rubocop//lib/rubocop/cop/style/magic_comment_format.rb#125 def directives; end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def loc(*_arg0, **_arg1, &_arg2); end - # source://rubocop-ast/1.38.0/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + # source://rubocop-ast/1.38.1/lib/rubocop/ast/utilities/simple_forwardable.rb#19 def text(*_arg0, **_arg1, &_arg2); end # A magic comment can contain one value (normal style) or @@ -43595,33 +44251,30 @@ class RuboCop::Cop::Style::MultilineMethodSignature < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#69 - def arguments_range(node); end - # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#42 def autocorrect(corrector, node, begin_of_arguments); end - # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#81 + # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#73 def closing_line(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#85 + # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#77 def correction_exceeds_max_line_length?(node); end - # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#93 + # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#85 def definition_width(node); end - # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#89 + # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#81 def indentation_width(node); end # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#65 def last_line_source_of_arguments(arguments); end - # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#97 + # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#89 def max_line_length; end - # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#77 + # source://rubocop//lib/rubocop/cop/style/multiline_method_signature.rb#69 def opening_line(node); end end @@ -43921,7 +44574,7 @@ class RuboCop::Cop::Style::MutableConstant < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle extend ::RuboCop::Cop::AutoCorrector - # source://rubocop-sorbet/0.8.7/lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#18 + # source://rubocop-sorbet/0.8.9/lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#18 def on_assignment(value); end # source://rubocop//lib/rubocop/cop/style/mutable_constant.rb#127 @@ -43939,7 +44592,7 @@ class RuboCop::Cop::Style::MutableConstant < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/mutable_constant.rb#216 def splat_value(param0 = T.unsafe(nil)); end - # source://rubocop-sorbet/0.8.7/lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#12 + # source://rubocop-sorbet/0.8.9/lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb#12 def t_let(param0 = T.unsafe(nil)); end private @@ -47004,13 +47657,33 @@ RuboCop::Cop::Style::RedundantCapitalW::MSG = T.let(T.unsafe(nil), String) # c # end # -# source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#45 +# # bad +# a.nil? ? true : a +# +# # good +# a.nil? || a +# +# # bad +# if a.nil? +# true +# else +# a +# end +# +# # good +# a.nil? || a +# @example AllowedMethods: ['nonzero?'] (default) +# # good +# num.nonzero? ? true : false +# +# source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#65 class RuboCop::Cop::Style::RedundantCondition < ::RuboCop::Cop::Base + include ::RuboCop::Cop::AllowedMethods include ::RuboCop::Cop::CommentsHelp include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#56 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#77 def on_if(node); end private @@ -47020,119 +47693,124 @@ class RuboCop::Cop::Style::RedundantCondition < ::RuboCop::Cop::Base # # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#182 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#225 def argument_with_operator?(argument); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#159 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#202 def asgn_type?(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#76 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#97 def autocorrect(corrector, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#149 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#192 def branches_have_assignment?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#163 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#206 def branches_have_method?(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#255 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#300 def correct_ternary(corrector, node); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#202 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#247 def else_source(else_branch, arithmetic_operation); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#228 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#273 def else_source_if_has_assignment(else_branch); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#218 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#263 def else_source_if_has_method(else_branch); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#190 + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#181 + def if_branch_is_true_type_and_else_is_not?(node); end + + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#233 def if_source(if_branch, arithmetic_operation); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#238 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#283 def make_ternary_form(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#68 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#89 def message(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#97 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#118 def offense?(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#90 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#111 def range_of_offense(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#105 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#126 def redundant_condition?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#270 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#315 def require_braces?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#263 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#308 def require_parentheses?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#176 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#219 def same_method?(if_branch, else_branch); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#170 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#213 def single_argument_method?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#121 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#142 def synonymous_condition_and_branch?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#274 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#319 def use_arithmetic_operation?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#117 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#138 def use_hash_key_access?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#113 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#134 def use_hash_key_assignment?(else_branch); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#109 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#130 def use_if_branch?(else_branch); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#278 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#323 def without_argument_parentheses_method?(node); end end -# source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#52 +# source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#73 RuboCop::Cop::Style::RedundantCondition::ARGUMENT_WITH_OPERATOR_TYPES = T.let(T.unsafe(nil), Array) -# source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#50 +# source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#71 RuboCop::Cop::Style::RedundantCondition::MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#51 +# source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#72 RuboCop::Cop::Style::RedundantCondition::REDUNDANT_CONDITION = T.let(T.unsafe(nil), String) # Checks for redundant returning of true/false in conditionals. @@ -47687,6 +48365,126 @@ RuboCop::Cop::Style::RedundantFilterChain::REPLACEMENT_METHODS = T.let(T.unsafe( # source://rubocop//lib/rubocop/cop/style/redundant_filter_chain.rb#59 RuboCop::Cop::Style::RedundantFilterChain::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +# Checks for calls to `Kernel#format` or `Kernel#sprintf` that are redundant. +# +# Calling `format` with only a single string argument is redundant, as it can be +# replaced by the string itself. +# +# Also looks for `format` calls where the arguments are literals that can be +# inlined into a string easily. This applies to the `%s`, `%d`, `%i`, `%u`, and +# `%f` format specifiers. +# +# @example +# +# # bad +# format('the quick brown fox jumps over the lazy dog.') +# sprintf('the quick brown fox jumps over the lazy dog.') +# +# # good +# 'the quick brown fox jumps over the lazy dog.' +# +# # bad +# format('%s %s', 'foo', 'bar') +# sprintf('%s %s', 'foo', 'bar') +# +# # good +# 'foo bar' +# +# source://rubocop//lib/rubocop/cop/style/redundant_format.rb#47 +class RuboCop::Cop::Style::RedundantFormat < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#66 + def complex_number?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#71 + def find_hash_value_node(param0, param1); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#56 + def format_without_additional_args?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#83 + def on_send(node); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#61 + def rational_number?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#76 + def splatted_arguments?(param0 = T.unsafe(nil)); end + + private + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#125 + def all_fields_literal?(string, arguments); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#212 + def argument_value(argument); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#208 + def argument_values(arguments); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#244 + def complex_value(complex_node); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#102 + def detect_unnecessary_fields(node); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#230 + def dsym_value(dsym_node); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#143 + def find_argument(sequence, arguments, hash); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#184 + def float?(argument); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#234 + def hash_value(hash_node); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#180 + def integer?(argument); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#156 + def matching_argument?(sequence, argument); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#98 + def message(node, prefer); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#174 + def numeric?(argument); end + + # Add correct quotes to the formatted string, preferring retaining the existing + # quotes if possible. + # + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#190 + def quote(string, node); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#240 + def rational_value(rational_node); end + + # source://rubocop//lib/rubocop/cop/style/redundant_format.rb#114 + def register_all_fields_literal(node, string, arguments); end +end + +# source://rubocop//lib/rubocop/cop/style/redundant_format.rb#53 +RuboCop::Cop::Style::RedundantFormat::ACCEPTABLE_LITERAL_TYPES = T.let(T.unsafe(nil), Array) + +# source://rubocop//lib/rubocop/cop/style/redundant_format.rb#50 +RuboCop::Cop::Style::RedundantFormat::MSG = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/style/redundant_format.rb#52 +RuboCop::Cop::Style::RedundantFormat::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) + # Check for uses of `Object#freeze` on immutable objects. # # NOTE: `Regexp` and `Range` literals are frozen objects since Ruby 3.0. @@ -48208,28 +49006,28 @@ class RuboCop::Cop::Style::RedundantParentheses < ::RuboCop::Cop::Base include ::RuboCop::Cop::Parentheses extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#32 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#34 def allowed_pin_operator?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#261 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#275 def first_send_argument?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#266 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#280 def first_super_argument?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#271 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#285 def first_yield_argument?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#169 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#177 def interpolation?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#26 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#28 def method_node_and_args(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#34 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#36 def on_begin(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#29 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#31 def rescue?(param0 = T.unsafe(nil)); end # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#23 @@ -48239,131 +49037,136 @@ class RuboCop::Cop::Style::RedundantParentheses < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#171 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#179 def allow_in_multiline_conditions?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#64 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#70 def allowed_ancestor?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#57 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#63 def allowed_expression?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#69 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#75 def allowed_multiple_expression?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#78 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#84 def allowed_ternary?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#275 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#289 def call_chain_starts_with_int?(begin_node, send_node); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#127 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#133 def check(begin_node); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#175 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#183 def check_send(begin_node, node); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#185 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#193 def check_unary(begin_node, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#209 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#217 def disallowed_literal?(begin_node, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#281 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#295 def do_end_block_in_method_chain?(begin_node, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#105 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#111 def empty_parentheses?(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#138 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#146 def find_offense_message(begin_node, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#110 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#116 def first_arg_begins_with_hash_literal?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#250 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#264 def first_argument?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#50 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#56 def ignore_syntax?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#205 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#213 def keyword_ancestor?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#224 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#238 def keyword_with_redundant_parentheses?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#91 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#97 def like_method_argument_parentheses?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#237 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#251 def method_call_with_redundant_parentheses?(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#119 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#125 def method_chain_begins_with_hash_literal(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#98 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#104 def multiline_control_flow_statements?(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#195 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#203 def offense(node, msg); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#246 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#260 def only_begin_arg?(args); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#42 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#48 def parens_allowed?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#213 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#227 def raised_to_power_negative_numeric?(begin_node, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#201 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#209 def suspect_unary?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#84 + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#90 def ternary_parentheses_required?; end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#44 + def variable?(node); end end # source://rubocop//lib/rubocop/cop/style/redundant_parentheses.rb#20 @@ -51027,9 +51830,9 @@ RuboCop::Cop::Style::SingleLineDoEndBlock::MSG = T.let(T.unsafe(nil), String) # # Endless methods added in Ruby 3.0 are also accepted by this cop. # -# If `Style/EndlessMethod` is enabled with `EnforcedStyle: allow_single_line` or -# `allow_always`, single-line methods will be autocorrected to endless -# methods if there is only one statement in the body. +# If `Style/EndlessMethod` is enabled with `EnforcedStyle: allow_single_line`, `allow_always`, +# `require_single_line`, or `require_always`, single-line methods will be autocorrected +# to endless methods if there is only one statement in the body. # # @example # # bad @@ -51245,12 +52048,9 @@ class RuboCop::Cop::Style::SoleNestedConditional < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#260 + # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#254 def allow_modifier?; end - # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#233 - def arguments_range(node); end - # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#81 def assigned_variables(condition); end @@ -51294,13 +52094,13 @@ class RuboCop::Cop::Style::SoleNestedConditional < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#264 + # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#258 def outer_condition_modify_form?(node, if_branch); end - # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#253 + # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#247 def parenthesized_method_arguments(node); end - # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#243 + # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#237 def replace_condition(condition); end # @return [Boolean] @@ -51318,7 +52118,7 @@ class RuboCop::Cop::Style::SoleNestedConditional < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#239 + # source://rubocop//lib/rubocop/cop/style/sole_nested_conditional.rb#233 def wrap_condition?(node); end class << self @@ -53088,12 +53888,13 @@ end # Checks for trailing comma in array literals. # The configuration options are: # -# * `consistent_comma`: Requires a comma after the -# last item of all non-empty, multiline array literals. -# * `comma`: Requires a comma after last item in an array, -# but only when each item is on its own line. -# * `no_comma`: Does not require a comma after the -# last item in an array +# * `consistent_comma`: Requires a comma after the last item of all non-empty, multiline array +# literals. +# * `comma`: Requires a comma after the last item in an array, but only when each item is on +# its own line. +# * `diff_comma`: Requires a comma after the last item in an array, but only when that item is +# followed by an immediate newline. +# * `no_comma`: Does not require a comma after the last item in an array # # @example EnforcedStyleForMultiline: consistent_comma # # bad @@ -53118,6 +53919,14 @@ end # 1, # 2, # ] +# +# # bad +# a = [1, 2, +# 3, 4] +# +# # good +# a = [1, 2, +# 3, 4,] # @example EnforcedStyleForMultiline: comma # # bad # a = [1, 2,] @@ -53152,6 +53961,37 @@ end # 1, # 2, # ] +# @example EnforcedStyleForMultiline: diff_comma +# # bad +# a = [1, 2,] +# +# # good +# a = [1, 2] +# +# # good +# a = [ +# 1, 2, +# 3, +# ] +# +# # good +# a = [ +# 1, 2, 3, +# ] +# +# # good +# a = [ +# 1, +# 2, +# ] +# +# # bad +# a = [1, 2, +# 3, 4,] +# +# # good +# a = [1, 2, +# 3, 4] # @example EnforcedStyleForMultiline: no_comma (default) # # bad # a = [1, 2,] @@ -53162,14 +54002,14 @@ end # 2 # ] # -# source://rubocop//lib/rubocop/cop/style/trailing_comma_in_array_literal.rb#84 +# source://rubocop//lib/rubocop/cop/style/trailing_comma_in_array_literal.rb#125 class RuboCop::Cop::Style::TrailingCommaInArrayLiteral < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::RangeHelp include ::RuboCop::Cop::TrailingComma extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/trailing_comma_in_array_literal.rb#88 + # source://rubocop//lib/rubocop/cop/style/trailing_comma_in_array_literal.rb#129 def on_array(node); end end @@ -53246,12 +54086,13 @@ RuboCop::Cop::Style::TrailingCommaInBlockArgs::MSG = T.let(T.unsafe(nil), String # Checks for trailing comma in hash literals. # The configuration options are: # -# * `consistent_comma`: Requires a comma after the -# last item of all non-empty, multiline hash literals. -# * `comma`: Requires a comma after the last item in a hash, -# but only when each item is on its own line. -# * `no_comma`: Does not require a comma after the -# last item in a hash +# * `consistent_comma`: Requires a comma after the last item of all non-empty, multiline hash +# literals. +# * `comma`: Requires a comma after the last item in a hash, but only when each item is on its +# own line. +# * `diff_comma`: Requires a comma after the last item in a hash, but only when that item is +# followed by an immediate newline. +# * `no_comma`: Does not require a comma after the last item in a hash # # @example EnforcedStyleForMultiline: consistent_comma # @@ -53277,6 +54118,14 @@ RuboCop::Cop::Style::TrailingCommaInBlockArgs::MSG = T.let(T.unsafe(nil), String # foo: 1, # bar: 2, # } +# +# # bad +# a = { foo: 1, bar: 2, +# baz: 3, qux: 4 } +# +# # good +# a = { foo: 1, bar: 2, +# baz: 3, qux: 4, } # @example EnforcedStyleForMultiline: comma # # # bad @@ -53312,6 +54161,38 @@ RuboCop::Cop::Style::TrailingCommaInBlockArgs::MSG = T.let(T.unsafe(nil), String # foo: 1, # bar: 2, # } +# @example EnforcedStyleForMultiline: diff_comma +# +# # bad +# a = { foo: 1, bar: 2, } +# +# # good +# a = { foo: 1, bar: 2 } +# +# # good +# a = { +# foo: 1, bar: 2, +# qux: 3, +# } +# +# # good +# a = { +# foo: 1, bar: 2, qux: 3, +# } +# +# # good +# a = { +# foo: 1, +# bar: 2, +# } +# +# # bad +# a = { foo: 1, bar: 2, +# baz: 3, qux: 4, } +# +# # good +# a = { foo: 1, bar: 2, +# baz: 3, qux: 4 } # @example EnforcedStyleForMultiline: no_comma (default) # # # bad @@ -53323,14 +54204,14 @@ RuboCop::Cop::Style::TrailingCommaInBlockArgs::MSG = T.let(T.unsafe(nil), String # bar: 2 # } # -# source://rubocop//lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb#87 +# source://rubocop//lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb#129 class RuboCop::Cop::Style::TrailingCommaInHashLiteral < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::RangeHelp include ::RuboCop::Cop::TrailingComma extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb#91 + # source://rubocop//lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb#133 def on_hash(node); end end @@ -54706,7 +55587,7 @@ end # Common methods shared by Style/TrailingCommaInArguments, # Style/TrailingCommaInArrayLiteral and Style/TrailingCommaInHashLiteral # -# source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#7 +# source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#8 module RuboCop::Cop::TrailingComma include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::RangeHelp @@ -54719,63 +55600,68 @@ module RuboCop::Cop::TrailingComma # # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#104 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#109 def allowed_multiline_argument?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#167 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#178 def any_heredoc?(items); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#159 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#170 def autocorrect_range(item); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#133 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#144 def avoid_comma(kind, comma_begin_pos, extra_info); end # Returns true if the node has round/square/curly brackets. # # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#82 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#87 def brackets?(node); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#19 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#20 def check(node, items, kind, begin_pos, end_pos); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#37 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#38 def check_comma(node, kind, comma_pos); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#43 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#44 def check_literal(node, kind); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#30 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#31 def comma_offset(items, range); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#108 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#113 def elements(node); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#54 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#55 def extra_avoid_comma_info; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#171 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#182 def heredoc?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#189 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#200 def heredoc_send?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#76 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#81 def inside_comment?(range, comma_offset); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#93 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#138 + def last_item_precedes_newline?(node); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#98 def method_name_and_arguments_on_same_line?(node); end # Returns true if the round/square/curly brackets of the given node are @@ -54784,32 +55670,32 @@ module RuboCop::Cop::TrailingComma # # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#89 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#94 def multiline?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#123 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#128 def no_elements_on_same_line?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#129 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#134 def on_same_line?(range1, range2); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#147 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#158 def put_comma(items, kind); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#65 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#68 def should_have_comma?(style, node); end - # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#15 + # source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#16 def style_parameter_name; end end -# source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#11 +# source://rubocop//lib/rubocop/cop/mixin/trailing_comma.rb#12 RuboCop::Cop::TrailingComma::MSG = T.let(T.unsafe(nil), String) # Common functionality shared by Uncommunicative cops @@ -55112,40 +55998,44 @@ module RuboCop::Cop::Utils; end class RuboCop::Cop::Utils::FormatString # @return [FormatString] a new instance of FormatString # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#89 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#94 def initialize(string); end - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#93 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#98 def format_sequences; end - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#105 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#110 def max_digit_dollar_num; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#101 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#106 def named_interpolation?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#97 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#102 def valid?; end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#117 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#122 def mixed_formats?; end - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#111 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#116 def parse; end end -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#8 +# Escaping the `#` in `INTERPOLATION` and `TEMPLATE_NAME` is necessary to +# avoid a bug in Ruby 3.2.0 +# See: https://bugs.ruby-lang.org/issues/19379 +# +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#11 RuboCop::Cop::Utils::FormatString::DIGIT_DOLLAR = T.let(T.unsafe(nil), Regexp) -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#9 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#13 RuboCop::Cop::Utils::FormatString::FLAG = T.let(T.unsafe(nil), Regexp) # The syntax of a format sequence is as follows. @@ -55162,148 +56052,107 @@ RuboCop::Cop::Utils::FormatString::FLAG = T.let(T.unsafe(nil), Regexp) # # @see https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-format # -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#43 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#47 class RuboCop::Cop::Utils::FormatString::FormatSequence # @return [FormatSequence] a new instance of FormatSequence # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#46 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#50 def initialize(match); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#61 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#66 def annotated?; end + # Returns the value of attribute arg_number. + # + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#48 + def arg_number; end + # Number of arguments required for the format sequence # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#70 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#75 def arity; end # Returns the value of attribute begin_pos. # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#44 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#48 def begin_pos; end # Returns the value of attribute end_pos. # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#44 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#48 def end_pos; end # Returns the value of attribute flags. # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#44 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#48 def flags; end - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#74 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#79 def max_digit_dollar_num; end # Returns the value of attribute name. # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#44 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#48 def name; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#57 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#62 def percent?; end # Returns the value of attribute precision. # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#44 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#48 def precision; end - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#78 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#83 def style; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#65 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#70 def template?; end # Returns the value of attribute type. # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#44 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#48 def type; end # Returns the value of attribute width. # - # source://rubocop//lib/rubocop/cop/utils/format_string.rb#44 + # source://rubocop//lib/rubocop/cop/utils/format_string.rb#48 def width; end end -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#15 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#12 +RuboCop::Cop::Utils::FormatString::INTERPOLATION = T.let(T.unsafe(nil), Regexp) + +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#19 RuboCop::Cop::Utils::FormatString::NAME = T.let(T.unsafe(nil), Regexp) -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#11 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#15 RuboCop::Cop::Utils::FormatString::NUMBER = T.let(T.unsafe(nil), Regexp) -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#10 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#14 RuboCop::Cop::Utils::FormatString::NUMBER_ARG = T.let(T.unsafe(nil), Regexp) -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#13 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#17 RuboCop::Cop::Utils::FormatString::PRECISION = T.let(T.unsafe(nil), Regexp) -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#18 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#22 RuboCop::Cop::Utils::FormatString::SEQUENCE = T.let(T.unsafe(nil), Regexp) -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#16 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#20 RuboCop::Cop::Utils::FormatString::TEMPLATE_NAME = T.let(T.unsafe(nil), Regexp) -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#14 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#18 RuboCop::Cop::Utils::FormatString::TYPE = T.let(T.unsafe(nil), Regexp) -# source://rubocop//lib/rubocop/cop/utils/format_string.rb#12 +# source://rubocop//lib/rubocop/cop/utils/format_string.rb#16 RuboCop::Cop::Utils::FormatString::WIDTH = T.let(T.unsafe(nil), Regexp) -# Helper to abstract complexity of building range pairs -# with octal escape reconstruction (needed for regexp_parser < 2.7). -# -# source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#8 -class RuboCop::Cop::Utils::RegexpRanges - # @return [RegexpRanges] a new instance of RegexpRanges - # - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#11 - def initialize(root); end - - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#18 - def compound_token; end - - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#24 - def pairs; end - - # Returns the value of attribute root. - # - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#9 - def root; end - - private - - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#78 - def compose_range(expressions, current); end - - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#90 - def escaped_octal?(expr); end - - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#94 - def octal_digit?(char); end - - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#98 - def pop_octal_digits(expressions); end - - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#44 - def populate(expr); end - - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#32 - def populate_all; end - - # source://rubocop//lib/rubocop/cop/utils/regexp_ranges.rb#63 - def process_set(expressions, current); end -end - # This force provides a way to track local variables and scopes of Ruby. # Cops interact with this force need to override some of the hook methods. # @@ -56526,149 +57375,171 @@ RuboCop::Cop::VisibilityHelp::VISIBILITY_SCOPES = T.let(T.unsafe(nil), Set) class RuboCop::DirectiveComment # @return [DirectiveComment] a new instance of DirectiveComment # - # source://rubocop//lib/rubocop/directive_comment.rb#32 + # source://rubocop//lib/rubocop/directive_comment.rb#46 def initialize(comment, cop_registry = T.unsafe(nil)); end # Checks if all cops specified in this directive # # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#82 + # source://rubocop//lib/rubocop/directive_comment.rb#115 def all_cops?; end # Returns the value of attribute comment. # - # source://rubocop//lib/rubocop/directive_comment.rb#30 + # source://rubocop//lib/rubocop/directive_comment.rb#44 def comment; end # Returns array of specified in this directive cop names # - # source://rubocop//lib/rubocop/directive_comment.rb#87 + # source://rubocop//lib/rubocop/directive_comment.rb#120 def cop_names; end # Returns the value of attribute cop_registry. # - # source://rubocop//lib/rubocop/directive_comment.rb#30 + # source://rubocop//lib/rubocop/directive_comment.rb#44 def cop_registry; end # Returns the value of attribute cops. # - # source://rubocop//lib/rubocop/directive_comment.rb#30 + # source://rubocop//lib/rubocop/directive_comment.rb#44 def cops; end # Returns array of specified in this directive department names # when all department disabled # - # source://rubocop//lib/rubocop/directive_comment.rb#98 + # source://rubocop//lib/rubocop/directive_comment.rb#131 def department_names; end - # source://rubocop//lib/rubocop/directive_comment.rb#112 + # source://rubocop//lib/rubocop/directive_comment.rb#145 def directive_count; end # Checks if this directive disables cops # # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#62 + # source://rubocop//lib/rubocop/directive_comment.rb#95 def disabled?; end # Checks if this directive disables all cops # # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#77 + # source://rubocop//lib/rubocop/directive_comment.rb#110 def disabled_all?; end # Checks if this directive enables cops # # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#67 + # source://rubocop//lib/rubocop/directive_comment.rb#100 def enabled?; end # Checks if this directive enables all cops # # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#72 + # source://rubocop//lib/rubocop/directive_comment.rb#105 def enabled_all?; end # Checks if directive departments include cop # # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#103 + # source://rubocop//lib/rubocop/directive_comment.rb#136 def in_directive_department?(cop); end # Returns line number for directive # - # source://rubocop//lib/rubocop/directive_comment.rb#117 + # source://rubocop//lib/rubocop/directive_comment.rb#150 def line_number; end + # @return [Boolean] + # + # source://rubocop//lib/rubocop/directive_comment.rb#59 + def malformed?; end + # Checks if this directive contains all the given cop names # # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#44 + # source://rubocop//lib/rubocop/directive_comment.rb#77 def match?(cop_names); end # Returns match captures to directive comment pattern # - # source://rubocop//lib/rubocop/directive_comment.rb#57 + # source://rubocop//lib/rubocop/directive_comment.rb#90 def match_captures; end + # Checks if the directive comment is missing a cop name + # + # @return [Boolean] + # + # source://rubocop//lib/rubocop/directive_comment.rb#67 + def missing_cop_name?; end + # Returns the value of attribute mode. # - # source://rubocop//lib/rubocop/directive_comment.rb#30 + # source://rubocop//lib/rubocop/directive_comment.rb#44 def mode; end # Checks if cop department has already used in directive comment # # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#108 + # source://rubocop//lib/rubocop/directive_comment.rb#141 def overridden_by_department?(cop); end - # source://rubocop//lib/rubocop/directive_comment.rb#48 + # source://rubocop//lib/rubocop/directive_comment.rb#81 def range; end # Returns an array of cops for this directive comment, without resolving departments # - # source://rubocop//lib/rubocop/directive_comment.rb#92 + # source://rubocop//lib/rubocop/directive_comment.rb#125 def raw_cop_names; end # Checks if this directive relates to single line # # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#39 + # source://rubocop//lib/rubocop/directive_comment.rb#72 def single_line?; end + # @return [Boolean] + # + # source://rubocop//lib/rubocop/directive_comment.rb#54 + def start_with_marker?; end + private - # source://rubocop//lib/rubocop/directive_comment.rb#134 + # source://rubocop//lib/rubocop/directive_comment.rb#167 def all_cop_names; end - # source://rubocop//lib/rubocop/directive_comment.rb#138 + # source://rubocop//lib/rubocop/directive_comment.rb#171 def cop_names_for_department(department); end # @return [Boolean] # - # source://rubocop//lib/rubocop/directive_comment.rb#130 + # source://rubocop//lib/rubocop/directive_comment.rb#163 def department?(name); end - # source://rubocop//lib/rubocop/directive_comment.rb#143 + # source://rubocop//lib/rubocop/directive_comment.rb#176 def exclude_lint_department_cops(cops); end - # source://rubocop//lib/rubocop/directive_comment.rb#123 + # source://rubocop//lib/rubocop/directive_comment.rb#156 def parsed_cop_names; end class << self - # source://rubocop//lib/rubocop/directive_comment.rb#26 + # source://rubocop//lib/rubocop/directive_comment.rb#40 def before_comment(line); end end end +# @api private +# +# source://rubocop//lib/rubocop/directive_comment.rb#21 +RuboCop::DirectiveComment::AVAILABLE_MODES = T.let(T.unsafe(nil), Array) + # @api private # # source://rubocop//lib/rubocop/directive_comment.rb#19 @@ -56686,9 +57557,24 @@ RuboCop::DirectiveComment::COP_NAME_PATTERN = T.let(T.unsafe(nil), String) # @api private # -# source://rubocop//lib/rubocop/directive_comment.rb#21 +# source://rubocop//lib/rubocop/directive_comment.rb#29 RuboCop::DirectiveComment::DIRECTIVE_COMMENT_REGEXP = T.let(T.unsafe(nil), Regexp) +# @api private +# +# source://rubocop//lib/rubocop/directive_comment.rb#27 +RuboCop::DirectiveComment::DIRECTIVE_HEADER_PATTERN = T.let(T.unsafe(nil), String) + +# @api private +# +# source://rubocop//lib/rubocop/directive_comment.rb#23 +RuboCop::DirectiveComment::DIRECTIVE_MARKER_PATTERN = T.let(T.unsafe(nil), String) + +# @api private +# +# source://rubocop//lib/rubocop/directive_comment.rb#25 +RuboCop::DirectiveComment::DIRECTIVE_MARKER_REGEXP = T.let(T.unsafe(nil), Regexp) + # @api private # # source://rubocop//lib/rubocop/directive_comment.rb#9 @@ -56704,6 +57590,16 @@ RuboCop::DirectiveComment::LINT_REDUNDANT_DIRECTIVE_COP = T.let(T.unsafe(nil), S # source://rubocop//lib/rubocop/directive_comment.rb#13 RuboCop::DirectiveComment::LINT_SYNTAX_COP = T.let(T.unsafe(nil), String) +# @api private +# +# source://rubocop//lib/rubocop/directive_comment.rb#36 +RuboCop::DirectiveComment::MALFORMED_DIRECTIVE_WITHOUT_COP_NAME_REGEXP = T.let(T.unsafe(nil), Regexp) + +# @api private +# +# source://rubocop//lib/rubocop/directive_comment.rb#34 +RuboCop::DirectiveComment::TRAILING_COMMENT_MARKER = T.let(T.unsafe(nil), String) + # An Error exception is different from an Offense with severity 'error' # When this exception is raised, it means that RuboCop is unable to perform # a requested action (probably due to misconfiguration) and must stop @@ -58829,7 +59725,7 @@ class RuboCop::Options # @api private # - # source://rubocop//lib/rubocop/options.rb#253 + # source://rubocop//lib/rubocop/options.rb#254 def add_profile_options(opts); end # @api private @@ -58849,7 +59745,7 @@ class RuboCop::Options # @api private # - # source://rubocop//lib/rubocop/options.rb#263 + # source://rubocop//lib/rubocop/options.rb#264 def handle_deprecated_option(old_option, new_option); end # Finds the option in `args` starting with -- and converts it to a symbol, @@ -58857,7 +59753,7 @@ class RuboCop::Options # # @api private # - # source://rubocop//lib/rubocop/options.rb#297 + # source://rubocop//lib/rubocop/options.rb#298 def long_opt_symbol(args); end # Sets a value in the @options hash, based on the given long option and its @@ -58865,17 +59761,22 @@ class RuboCop::Options # # @api private # - # source://rubocop//lib/rubocop/options.rb#286 + # source://rubocop//lib/rubocop/options.rb#287 def option(opts, *args); end # @api private # - # source://rubocop//lib/rubocop/options.rb#268 + # source://rubocop//lib/rubocop/options.rb#303 + def plugin_feature(file); end + + # @api private + # + # source://rubocop//lib/rubocop/options.rb#269 def rainbow; end # @api private # - # source://rubocop//lib/rubocop/options.rb#302 + # source://rubocop//lib/rubocop/options.rb#309 def require_feature(file); end # Creates a section of options in order to separate them visually when @@ -58883,7 +59784,7 @@ class RuboCop::Options # # @api private # - # source://rubocop//lib/rubocop/options.rb#278 + # source://rubocop//lib/rubocop/options.rb#279 def section(opts, heading, &_block); end end @@ -58906,125 +59807,125 @@ RuboCop::Options::E_STDIN_NO_PATH = T.let(T.unsafe(nil), String) # # @api private # -# source://rubocop//lib/rubocop/options.rb#498 +# source://rubocop//lib/rubocop/options.rb#512 module RuboCop::OptionsHelp; end # @api private # -# source://rubocop//lib/rubocop/options.rb#500 +# source://rubocop//lib/rubocop/options.rb#514 RuboCop::OptionsHelp::FORMATTER_OPTION_LIST = T.let(T.unsafe(nil), Array) # @api private # -# source://rubocop//lib/rubocop/options.rb#499 +# source://rubocop//lib/rubocop/options.rb#513 RuboCop::OptionsHelp::MAX_EXCL = T.let(T.unsafe(nil), String) # @api private # -# source://rubocop//lib/rubocop/options.rb#502 +# source://rubocop//lib/rubocop/options.rb#516 RuboCop::OptionsHelp::TEXT = T.let(T.unsafe(nil), Hash) # Validates option arguments and the options' compatibility with each other. # # @api private # -# source://rubocop//lib/rubocop/options.rb#312 +# source://rubocop//lib/rubocop/options.rb#327 class RuboCop::OptionsValidator # @api private # @return [OptionsValidator] a new instance of OptionsValidator # - # source://rubocop//lib/rubocop/options.rb#350 + # source://rubocop//lib/rubocop/options.rb#365 def initialize(options); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/options.rb#472 + # source://rubocop//lib/rubocop/options.rb#486 def boolean_or_empty_cache?; end # @api private # - # source://rubocop//lib/rubocop/options.rb#442 + # source://rubocop//lib/rubocop/options.rb#456 def disable_parallel_when_invalid_option_combo; end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/options.rb#468 + # source://rubocop//lib/rubocop/options.rb#482 def except_syntax?; end # @api private # - # source://rubocop//lib/rubocop/options.rb#476 + # source://rubocop//lib/rubocop/options.rb#490 def incompatible_options; end # @api private # - # source://rubocop//lib/rubocop/options.rb#455 + # source://rubocop//lib/rubocop/options.rb#469 def invalid_arguments_for_parallel; end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/options.rb#463 + # source://rubocop//lib/rubocop/options.rb#477 def only_includes_redundant_disable?; end # @api private # - # source://rubocop//lib/rubocop/options.rb#382 + # source://rubocop//lib/rubocop/options.rb#397 def validate_auto_gen_config; end # @api private # @raise [OptionArgumentError] # - # source://rubocop//lib/rubocop/options.rb#428 + # source://rubocop//lib/rubocop/options.rb#442 def validate_autocorrect; end # @api private # @raise [OptionArgumentError] # - # source://rubocop//lib/rubocop/options.rb#488 + # source://rubocop//lib/rubocop/options.rb#502 def validate_cache_enabled_for_cache_root; end # @api private # @raise [OptionArgumentError] # - # source://rubocop//lib/rubocop/options.rb#359 + # source://rubocop//lib/rubocop/options.rb#374 def validate_compatibility; end # @api private # - # source://rubocop//lib/rubocop/options.rb#354 + # source://rubocop//lib/rubocop/options.rb#369 def validate_cop_options; end # @api private # @raise [OptionArgumentError] # - # source://rubocop//lib/rubocop/options.rb#403 + # source://rubocop//lib/rubocop/options.rb#418 def validate_display_only_correctable_and_autocorrect; end # @api private # @raise [OptionArgumentError] # - # source://rubocop//lib/rubocop/options.rb#395 + # source://rubocop//lib/rubocop/options.rb#410 def validate_display_only_failed; end # @api private # @raise [OptionArgumentError] # - # source://rubocop//lib/rubocop/options.rb#412 + # source://rubocop//lib/rubocop/options.rb#427 def validate_display_only_failed_and_display_only_correctable; end # @api private # @raise [OptionParser::MissingArgument] # - # source://rubocop//lib/rubocop/options.rb#480 + # source://rubocop//lib/rubocop/options.rb#494 def validate_exclude_limit_option; end # @api private # @raise [OptionArgumentError] # - # source://rubocop//lib/rubocop/options.rb#421 + # source://rubocop//lib/rubocop/options.rb#436 def validate_lsp_and_editor_mode; end class << self @@ -59033,14 +59934,14 @@ class RuboCop::OptionsValidator # # @api private # - # source://rubocop//lib/rubocop/options.rb#319 + # source://rubocop//lib/rubocop/options.rb#334 def validate_cop_list(names); end private # @api private # - # source://rubocop//lib/rubocop/options.rb#336 + # source://rubocop//lib/rubocop/options.rb#351 def format_message_from(name, cop_names); end end end @@ -59053,35 +59954,38 @@ module RuboCop::PathUtil # Returns true for an absolute Unix or Windows path. # - # source://rubocop//lib/rubocop/path_util.rb#79 + # source://rubocop//lib/rubocop/path_util.rb#83 def absolute?(path); end # Returns true for a glob # - # source://rubocop//lib/rubocop/path_util.rb#84 + # source://rubocop//lib/rubocop/path_util.rb#88 def glob?(path); end - # source://rubocop//lib/rubocop/path_util.rb#114 + # source://rubocop//lib/rubocop/path_util.rb#118 def hidden_dir?(path); end - # source://rubocop//lib/rubocop/path_util.rb#97 + # source://rubocop//lib/rubocop/path_util.rb#101 def hidden_file?(path); end - # source://rubocop//lib/rubocop/path_util.rb#88 + # source://rubocop//lib/rubocop/path_util.rb#92 def hidden_file_in_not_hidden_dir?(pattern, path); end - # source://rubocop//lib/rubocop/path_util.rb#51 + # source://rubocop//lib/rubocop/path_util.rb#55 def match_path?(pattern, path); end # Loose check to reduce memory allocations # - # source://rubocop//lib/rubocop/path_util.rb#104 + # source://rubocop//lib/rubocop/path_util.rb#108 def maybe_hidden_file?(path); end # source://rubocop//lib/rubocop/path_util.rb#13 def relative_path(path, base_dir = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/path_util.rb#34 + # source://rubocop//lib/rubocop/path_util.rb#31 + def remote_file?(uri); end + + # source://rubocop//lib/rubocop/path_util.rb#38 def smart_path(path); end class << self @@ -59089,41 +59993,41 @@ module RuboCop::PathUtil # # @return [Boolean] # - # source://rubocop//lib/rubocop/path_util.rb#79 + # source://rubocop//lib/rubocop/path_util.rb#83 def absolute?(path); end # Returns true for a glob # # @return [Boolean] # - # source://rubocop//lib/rubocop/path_util.rb#84 + # source://rubocop//lib/rubocop/path_util.rb#88 def glob?(path); end # @return [Boolean] # - # source://rubocop//lib/rubocop/path_util.rb#114 + # source://rubocop//lib/rubocop/path_util.rb#118 def hidden_dir?(path); end # @return [Boolean] # - # source://rubocop//lib/rubocop/path_util.rb#97 + # source://rubocop//lib/rubocop/path_util.rb#101 def hidden_file?(path); end # @return [Boolean] # - # source://rubocop//lib/rubocop/path_util.rb#88 + # source://rubocop//lib/rubocop/path_util.rb#92 def hidden_file_in_not_hidden_dir?(pattern, path); end # @return [Boolean] # - # source://rubocop//lib/rubocop/path_util.rb#51 + # source://rubocop//lib/rubocop/path_util.rb#55 def match_path?(pattern, path); end # Loose check to reduce memory allocations # # @return [Boolean] # - # source://rubocop//lib/rubocop/path_util.rb#104 + # source://rubocop//lib/rubocop/path_util.rb#108 def maybe_hidden_file?(path); end # source://rubocop//lib/rubocop/path_util.rb#13 @@ -59141,15 +60045,20 @@ module RuboCop::PathUtil # source://rubocop//lib/rubocop/path_util.rb#7 def relative_paths_cache=(_arg0); end - # source://rubocop//lib/rubocop/path_util.rb#34 + # @return [Boolean] + # + # source://rubocop//lib/rubocop/path_util.rb#31 + def remote_file?(uri); end + + # source://rubocop//lib/rubocop/path_util.rb#38 def smart_path(path); end end end -# source://rubocop//lib/rubocop/path_util.rb#101 +# source://rubocop//lib/rubocop/path_util.rb#105 RuboCop::PathUtil::HIDDEN_FILE_PATTERN = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/path_util.rb#31 +# source://rubocop//lib/rubocop/path_util.rb#35 RuboCop::PathUtil::SMART_PATH_CACHE = T.let(T.unsafe(nil), Hash) # This module provides information on the platform that RuboCop is being run @@ -59165,6 +60074,196 @@ module RuboCop::Platform end end +# Provides a plugin for RuboCop extensions that conform to lint_roller. +# https://github.com/standardrb/lint_roller +# +# @api private +# +# source://rubocop//lib/rubocop/plugin/not_supported_error.rb#4 +module RuboCop::Plugin + class << self + # @api private + # + # source://rubocop//lib/rubocop/plugin.rb#37 + def integrate_plugins(rubocop_config, plugins); end + + # @api private + # @return [Boolean] + # + # source://rubocop//lib/rubocop/plugin.rb#22 + def plugin_capable?(feature_name); end + end +end + +# @api private +# +# source://rubocop//lib/rubocop/plugin.rb#11 +RuboCop::Plugin::BUILTIN_INTERNAL_PLUGINS = T.let(T.unsafe(nil), Hash) + +# A class for integrating plugin configurations into RuboCop. +# Handles configuration merging, validation, and compatibility for plugins. +# +# @api private +# +# source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#11 +class RuboCop::Plugin::ConfigurationIntegrator + class << self + # @api private + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#13 + def integrate_plugins_into_rubocop_config(rubocop_config, plugins); end + + private + + # @api private + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#44 + def combine_rubocop_configs(default_config, runner_context, plugins); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#27 + def create_context(rubocop_config); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#81 + def fake_out_rubocop_default_configuration(default_config); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#92 + def load_plugin_rubocop_config(plugin, runner_context); end + + # This is how we ensure "first-in wins": plugins can override AllCops settings that are + # set by RuboCop's default configuration, but once a plugin sets an AllCop setting, they + # have exclusive first-in-wins rights to that setting. + # + # The one exception to this are array fields, because we don't want to + # overwrite the AllCops defaults but rather munge the arrays (`existing | + # new`) to allow plugins to add to the array, for example Include and + # Exclude paths and patterns. + # + # @api private + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#118 + def merge_all_cop_settings(existing_all_cops, new_all_cops, already_configured_keys); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#67 + def merge_plugin_config_into_all_cops!(rubocop_config, plugin_config); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#71 + def merge_plugin_config_into_default_config!(default_config, plugin_config); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#137 + def resolver; end + + # @api private + # @raise [Plugin::NotSupportedError] + # + # source://rubocop//lib/rubocop/plugin/configuration_integrator.rb#37 + def validate_plugins!(plugins, runner_context); end + end +end + +# @api private +# +# source://rubocop//lib/rubocop/plugin.rb#18 +RuboCop::Plugin::INTERNAL_AFFAIRS_PLUGIN_NAME = T.let(T.unsafe(nil), String) + +# An exception raised when a plugin fails to load. +# +# @api private +# +# source://rubocop//lib/rubocop/plugin/load_error.rb#7 +class RuboCop::Plugin::LoadError < ::RuboCop::Error + # @api private + # @return [LoadError] a new instance of LoadError + # + # source://rubocop//lib/rubocop/plugin/load_error.rb#8 + def initialize(plugin_name); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/load_error.rb#14 + def message; end +end + +# A class for loading and resolving plugins. +# +# @api private +# +# source://rubocop//lib/rubocop/plugin/loader.rb#10 +class RuboCop::Plugin::Loader + class << self + # @api private + # + # source://rubocop//lib/rubocop/plugin/loader.rb#20 + def load(plugins); end + + private + + # @api private + # + # source://rubocop//lib/rubocop/plugin/loader.rb#70 + def constantize(plugin_name, plugin_config); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/loader.rb#61 + def constantize_plugin_from(plugin_name, plugin_config); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/loader.rb#90 + def constantize_plugin_from_gemspec_metadata(plugin_name); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/loader.rb#34 + def normalize(plugin_configs); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/loader.rb#86 + def require_plugin(require_path); end + end +end + +# @api private +# +# source://rubocop//lib/rubocop/plugin/loader.rb#12 +RuboCop::Plugin::Loader::DEFAULT_PLUGIN_CONFIG = T.let(T.unsafe(nil), Hash) + +# An exception raised when a plugin is not supported by the RuboCop engine. +# +# @api private +# +# source://rubocop//lib/rubocop/plugin/not_supported_error.rb#7 +class RuboCop::Plugin::NotSupportedError < ::RuboCop::Error + # @api private + # @return [NotSupportedError] a new instance of NotSupportedError + # + # source://rubocop//lib/rubocop/plugin/not_supported_error.rb#8 + def initialize(unsupported_plugins); end + + # @api private + # + # source://rubocop//lib/rubocop/plugin/not_supported_error.rb#14 + def message; end +end + +# @api private +# +# source://rubocop//lib/rubocop/plugin.rb#19 +RuboCop::Plugin::OBSOLETE_INTERNAL_AFFAIRS_PLUGIN_NAME = T.let(T.unsafe(nil), String) + # source://rubocop//lib/rubocop/ast_aliases.rb#6 RuboCop::ProcessedSource = RuboCop::AST::ProcessedSource @@ -60430,17 +61529,17 @@ module RuboCop::Version class << self # @api private # - # source://rubocop//lib/rubocop/version.rb#99 + # source://rubocop//lib/rubocop/version.rb#114 def config_for_pwd(env); end # @api private # - # source://rubocop//lib/rubocop/version.rb#129 + # source://rubocop//lib/rubocop/version.rb#144 def document_version; end # @api private # - # source://rubocop//lib/rubocop/version.rb#66 + # source://rubocop//lib/rubocop/version.rb#67 def extension_versions(env); end # Returns feature version in one of two ways: @@ -60450,7 +61549,7 @@ module RuboCop::Version # # @api private # - # source://rubocop//lib/rubocop/version.rb#113 + # source://rubocop//lib/rubocop/version.rb#128 def feature_version(feature); end # @api private @@ -60460,12 +61559,12 @@ module RuboCop::Version # @api private # - # source://rubocop//lib/rubocop/version.rb#134 + # source://rubocop//lib/rubocop/version.rb#149 def server_mode; end # @api private # - # source://rubocop//lib/rubocop/version.rb#90 + # source://rubocop//lib/rubocop/version.rb#105 def target_ruby_version(env); end # @api private diff --git a/Library/Homebrew/sorbet/rbi/gems/ruby-lsp@0.23.9.rbi b/Library/Homebrew/sorbet/rbi/gems/ruby-lsp@0.23.11.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/ruby-lsp@0.23.9.rbi rename to Library/Homebrew/sorbet/rbi/gems/ruby-lsp@0.23.11.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/spoom@1.5.3.rbi b/Library/Homebrew/sorbet/rbi/gems/spoom@1.5.4.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/spoom@1.5.3.rbi rename to Library/Homebrew/sorbet/rbi/gems/spoom@1.5.4.rbi index 639e76f135..214261eece 100644 --- a/Library/Homebrew/sorbet/rbi/gems/spoom@1.5.3.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/spoom@1.5.4.rbi @@ -1027,7 +1027,7 @@ class Spoom::Coverage::D3::ColorPalette < ::T::Struct prop :strong, ::String class << self - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -1367,7 +1367,7 @@ class Spoom::Coverage::Snapshot < ::T::Struct sig { params(obj: T::Hash[::String, T.untyped]).returns(::Spoom::Coverage::Snapshot) } def from_obj(obj); end - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -1503,7 +1503,7 @@ class Spoom::Deadcode::Definition < ::T::Struct def to_json(*args); end class << self - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -2391,7 +2391,7 @@ class Spoom::Deadcode::Send < ::T::Struct def each_arg_assoc(&block); end class << self - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -2411,7 +2411,7 @@ class Spoom::ExecResult < ::T::Struct def to_s; end class << self - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -2609,7 +2609,7 @@ class Spoom::FileTree::Node < ::T::Struct def path; end class << self - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -2675,7 +2675,7 @@ class Spoom::Git::Commit < ::T::Struct def timestamp; end class << self - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end # Parse a line formatted as `%h %at` into a `Commit` @@ -2787,7 +2787,7 @@ class Spoom::LSP::Diagnostic < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Diagnostic) } def from_json(json); end - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -2820,7 +2820,7 @@ class Spoom::LSP::DocumentSymbol < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::DocumentSymbol) } def from_json(json); end - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -2878,7 +2878,7 @@ class Spoom::LSP::Hover < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Hover) } def from_json(json); end - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -2903,7 +2903,7 @@ class Spoom::LSP::Location < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Location) } def from_json(json); end - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -2966,7 +2966,7 @@ class Spoom::LSP::Position < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Position) } def from_json(json); end - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -3004,7 +3004,7 @@ class Spoom::LSP::Range < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Range) } def from_json(json); end - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -3070,7 +3070,7 @@ class Spoom::LSP::SignatureHelp < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::SignatureHelp) } def from_json(json); end - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end end end @@ -3496,7 +3496,7 @@ class Spoom::Model::Reference < ::T::Struct sig { params(name: ::String, location: ::Spoom::Location).returns(::Spoom::Model::Reference) } def constant(name, location); end - # source://sorbet-runtime/0.5.11787/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11835/lib/types/struct.rb#13 def inherited(s); end # source://spoom//lib/spoom/model/reference.rb#29 @@ -4348,36 +4348,36 @@ end # From https://github.com/Shopify/ruby-lsp/blob/9154bfc6ef/lib/ruby_lsp/document.rb#L127 # -# source://spoom//lib/spoom/sorbet/sigs.rb#145 +# source://spoom//lib/spoom/sorbet/sigs.rb#147 class Spoom::Sorbet::Sigs::Scanner - # source://spoom//lib/spoom/sorbet/sigs.rb#151 + # source://spoom//lib/spoom/sorbet/sigs.rb#153 sig { params(source: ::String).void } def initialize(source); end # Finds the character index inside the source string for a given line and column # - # source://spoom//lib/spoom/sorbet/sigs.rb#159 + # source://spoom//lib/spoom/sorbet/sigs.rb#161 sig { params(line: ::Integer, character: ::Integer).returns(::Integer) } def find_char_position(line, character); end end -# source://spoom//lib/spoom/sorbet/sigs.rb#148 +# source://spoom//lib/spoom/sorbet/sigs.rb#150 Spoom::Sorbet::Sigs::Scanner::LINE_BREAK = T.let(T.unsafe(nil), Integer) -# source://spoom//lib/spoom/sorbet/sigs.rb#83 +# source://spoom//lib/spoom/sorbet/sigs.rb#85 class Spoom::Sorbet::Sigs::SigTranslator class << self - # source://spoom//lib/spoom/sorbet/sigs.rb#88 + # source://spoom//lib/spoom/sorbet/sigs.rb#90 sig { params(sig: ::RBI::Sig, node: T.any(::RBI::Attr, ::RBI::Method)).returns(::String) } def translate(sig, node); end private - # source://spoom//lib/spoom/sorbet/sigs.rb#135 + # source://spoom//lib/spoom/sorbet/sigs.rb#137 sig { params(sig: ::RBI::Sig, node: ::RBI::Attr).returns(::String) } def translate_attr_sig(sig, node); end - # source://spoom//lib/spoom/sorbet/sigs.rb#100 + # source://spoom//lib/spoom/sorbet/sigs.rb#102 sig { params(sig: ::RBI::Sig, node: ::RBI::Method).returns(::String) } def translate_method_sig(sig, node); end end diff --git a/Library/Homebrew/sorbet/rbi/gems/tapioca@0.16.9.rbi b/Library/Homebrew/sorbet/rbi/gems/tapioca@0.16.11.rbi similarity index 97% rename from Library/Homebrew/sorbet/rbi/gems/tapioca@0.16.9.rbi rename to Library/Homebrew/sorbet/rbi/gems/tapioca@0.16.11.rbi index d954af6f16..e9be793d70 100644 --- a/Library/Homebrew/sorbet/rbi/gems/tapioca@0.16.9.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/tapioca@0.16.11.rbi @@ -1,4 +1,4 @@ -# typed: true +# typed: false # DO NOT EDIT MANUALLY # This is an autogenerated file for types exported from the `tapioca` gem. @@ -218,7 +218,7 @@ class RBI::TypedParam < ::T::Struct const :type, ::String class << self - # source://sorbet-runtime/0.5.11796/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11845/lib/types/struct.rb#13 def inherited(s); end end end @@ -262,6 +262,25 @@ module T::Generic::TypeStoragePatch def type_template(variance = T.unsafe(nil), &bounds_proc); end end +# source://tapioca//lib/tapioca/runtime/trackers/required_ancestor.rb#54 +module T::Helpers + # source://tapioca//lib/tapioca/runtime/trackers/required_ancestor.rb#56 + def requires_ancestor(&block); end +end + +class T::InexactStruct + include ::T::Props + include ::T::Props::Plugin + include ::T::Props::Optional + include ::T::Props::PrettyPrintable + include ::T::Props::Serializable + include ::T::Props::WeakConstructor + include ::T::Props::Constructor + extend ::T::Props::ClassMethods + extend ::T::Props::Plugin::ClassMethods + extend ::T::Props::Serializable::ClassMethods +end + # source://tapioca//lib/tapioca/sorbet_ext/proc_bind_patch.rb#28 module T::Private::Methods class << self @@ -330,7 +349,16 @@ module T::Private::Methods::ProcBindPatch def finalize_proc(decl); end end -class T::Types::Proc < ::T::Types::Base; end +module T::Private::Retry; end +module T::Private::Retry::RETRY; end + +class T::Types::Proc < ::T::Types::Base + # source://tapioca//lib/tapioca/sorbet_ext/proc_bind_patch.rb#7 + def initialize(arg_types, returns, bind = T.unsafe(nil)); end + + # source://tapioca//lib/tapioca/sorbet_ext/proc_bind_patch.rb#15 + def name; end +end # source://tapioca//lib/tapioca/sorbet_ext/proc_bind_patch.rb#6 module T::Types::ProcBindPatch @@ -453,24 +481,24 @@ class Tapioca::Cli < ::Thor include ::Tapioca::ConfigHelper include ::Tapioca::EnvHelper - # source://tapioca//lib/tapioca/cli.rb#377 + # source://tapioca//lib/tapioca/cli.rb#372 def __print_version; end - # source://tapioca//lib/tapioca/cli.rb#359 + # source://tapioca//lib/tapioca/cli.rb#354 def annotations; end - # source://tapioca//lib/tapioca/cli.rb#331 + # source://tapioca//lib/tapioca/cli.rb#326 def check_shims; end # source://tapioca//lib/tapioca/cli.rb#46 def configure; end - # source://tapioca//lib/tapioca/cli.rb#151 + # source://tapioca//lib/tapioca/cli.rb#146 def dsl(*constant_or_paths); end # @raise [MalformattedArgumentError] # - # source://tapioca//lib/tapioca/cli.rb#274 + # source://tapioca//lib/tapioca/cli.rb#269 def gem(*gems); end # source://tapioca//lib/tapioca/cli.rb#27 @@ -484,11 +512,19 @@ class Tapioca::Cli < ::Thor private - # source://tapioca//lib/tapioca/cli.rb#391 + # source://tapioca//lib/tapioca/cli.rb#399 def print_init_next_steps; end class << self # source://tapioca//lib/tapioca/cli.rb#383 + def addon_mode; end + + # source://tapioca//lib/tapioca/cli.rb#386 + sig { void } + def addon_mode!; end + + # source://tapioca//lib/tapioca/cli.rb#391 + sig { returns(T::Boolean) } def exit_on_failure?; end end end @@ -556,11 +592,11 @@ class Tapioca::Commands::AbstractDsl < ::Tapioca::Commands::CommandWithoutTracke sig { returns(T::Array[::String]) } def all_requested_constants; end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#306 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#313 sig { params(cause: ::Symbol, files: T::Array[::String]).returns(::String) } def build_error_for_files(cause, files); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#230 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#237 sig do params( constant_name: ::String, @@ -571,15 +607,15 @@ class Tapioca::Commands::AbstractDsl < ::Tapioca::Commands::CommandWithoutTracke end def compile_dsl_rbi(constant_name, rbi, outpath: T.unsafe(nil), quiet: T.unsafe(nil)); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#165 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#172 sig { params(constant_names: T::Array[::String], ignore_missing: T::Boolean).returns(T::Array[::Module]) } def constantize(constant_names, ignore_missing: T.unsafe(nil)); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#190 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#197 sig { params(compiler_names: T::Array[::String]).returns(T::Array[T.class_of(Tapioca::Dsl::Compiler)]) } def constantize_compilers(compiler_names); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#366 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#373 sig { returns(T::Array[::String]) } def constants_from_requested_paths; end @@ -587,15 +623,15 @@ class Tapioca::Commands::AbstractDsl < ::Tapioca::Commands::CommandWithoutTracke sig { returns(::Tapioca::Dsl::Pipeline) } def create_pipeline; end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#269 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#276 sig { params(constant_name: ::String).returns(::Pathname) } def dsl_rbi_filename(constant_name); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#151 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#158 sig { params(requested_constants: T::Array[::String], path: ::Pathname).returns(T::Set[::Pathname]) } def existing_rbi_filenames(requested_constants, path: T.unsafe(nil)); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#361 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#368 sig { params(constant: ::String).returns(::String) } def generate_command_for(constant); end @@ -607,7 +643,7 @@ class Tapioca::Commands::AbstractDsl < ::Tapioca::Commands::CommandWithoutTracke sig { void } def load_application; end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#248 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#255 sig { params(dir: ::Pathname).void } def perform_dsl_verification(dir); end @@ -615,31 +651,31 @@ class Tapioca::Commands::AbstractDsl < ::Tapioca::Commands::CommandWithoutTracke sig { returns(::Tapioca::Dsl::Pipeline) } def pipeline; end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#257 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#264 sig { params(files: T::Set[::Pathname]).void } def purge_stale_dsl_rbi_files(files); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#356 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#363 sig { params(constant: ::String).returns(::String) } def rbi_filename_for(constant); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#337 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#344 sig { params(path: ::Pathname).returns(T::Array[::Pathname]) } def rbi_files_in(path); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#315 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#322 sig { params(diff: T::Hash[::String, ::Symbol], command: ::Symbol).void } def report_diff_and_exit_if_out_of_date(diff, command); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#210 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#217 sig { params(name: ::String).returns(T.nilable(T.class_of(Tapioca::Dsl::Compiler))) } def resolve(name); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#344 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#351 sig { params(class_name: ::String).returns(::String) } def underscore(class_name); end - # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#274 + # source://tapioca//lib/tapioca/commands/abstract_dsl.rb#281 sig { params(tmp_dir: ::Pathname).returns(T::Hash[::String, ::Symbol]) } def verify_dsl_rbi(tmp_dir:); end end @@ -1143,7 +1179,7 @@ class Tapioca::ConfigHelper::ConfigError < ::T::Struct const :message_parts, T::Array[::Tapioca::ConfigHelper::ConfigErrorMessagePart] class << self - # source://sorbet-runtime/0.5.11796/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11845/lib/types/struct.rb#13 def inherited(s); end end end @@ -1154,7 +1190,7 @@ class Tapioca::ConfigHelper::ConfigErrorMessagePart < ::T::Struct const :colors, T::Array[::Symbol] class << self - # source://sorbet-runtime/0.5.11796/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11845/lib/types/struct.rb#13 def inherited(s); end end end @@ -1349,15 +1385,15 @@ class Tapioca::Dsl::Pipeline sig { returns(T::Enumerable[T.class_of(Tapioca::Dsl::Compiler)]) } def active_compilers; end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#105 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#110 sig { params(error: ::String).void } def add_error(error); end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#110 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#115 sig { params(compiler_name: ::String).returns(T::Boolean) } def compiler_enabled?(compiler_name); end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#119 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#124 sig { returns(T::Array[T.class_of(Tapioca::Dsl::Compiler)]) } def compilers; end @@ -1392,15 +1428,15 @@ class Tapioca::Dsl::Pipeline private - # source://tapioca//lib/tapioca/dsl/pipeline.rb#227 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#231 sig { void } def abort_if_pending_migrations!; end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#172 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#177 sig { params(constants: T::Set[::Module]).returns(T::Set[::Module]) } def filter_anonymous_and_reloaded_constants(constants); end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#136 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#141 sig do params( requested_compilers: T::Array[T.class_of(Tapioca::Dsl::Compiler)], @@ -1409,7 +1445,7 @@ class Tapioca::Dsl::Pipeline end def gather_active_compilers(requested_compilers, excluded_compilers); end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#150 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#155 sig do params( requested_constants: T::Array[::Module], @@ -1419,12 +1455,12 @@ class Tapioca::Dsl::Pipeline end def gather_constants(requested_constants, requested_paths, skipped_constants); end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#201 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#206 sig { params(constant: ::Module).returns(T.nilable(::RBI::File)) } def rbi_for_constant(constant); end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#220 - sig { params(error: ::String).returns(T.noreturn) } + # source://tapioca//lib/tapioca/dsl/pipeline.rb#225 + sig { params(error: ::String).void } def report_error(error); end end @@ -1858,7 +1894,7 @@ class Tapioca::Gem::Listeners::Subconstants < ::Tapioca::Gem::Listeners::Base private - # source://tapioca//lib/tapioca/gem/listeners/subconstants.rb#36 + # source://tapioca//lib/tapioca/gem/listeners/subconstants.rb#35 sig { override.params(event: ::Tapioca::Gem::NodeAdded).returns(T::Boolean) } def ignore?(event); end @@ -2228,7 +2264,7 @@ class Tapioca::GemInfo < ::T::Struct sig { params(spec: ::Bundler::LazySpecification).returns(::Tapioca::GemInfo) } def from_spec(spec); end - # source://sorbet-runtime/0.5.11796/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11845/lib/types/struct.rb#13 def inherited(s); end end end diff --git a/Library/Homebrew/sorbet/tapioca/compilers/attrables.rb b/Library/Homebrew/sorbet/tapioca/compilers/attrables.rb deleted file mode 100644 index a1ae0740f7..0000000000 --- a/Library/Homebrew/sorbet/tapioca/compilers/attrables.rb +++ /dev/null @@ -1,53 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -require_relative "../../../global" -require "sorbet/tapioca/utils" -require "debrew" - -module Tapioca - module Compilers - class Attrables < Tapioca::Dsl::Compiler - ATTRABLE_FILENAME = "attrable.rb" - ConstantType = type_member { { fixed: Module } } - - sig { override.returns(T::Enumerable[Module]) } - def self.gather_constants = Homebrew::Tapioca::Utils.named_objects_with_module(Attrable) - - sig { override.void } - def decorate - root.create_path(constant) do |klass| - Homebrew::Tapioca::Utils.methods_from_file(constant, ATTRABLE_FILENAME) - .each { |method| compile_attrable_method(klass, method) } - Homebrew::Tapioca::Utils.methods_from_file(constant, ATTRABLE_FILENAME, class_methods: true) - .each { |method| compile_attrable_method(klass, method, class_method: true) } - end - end - - private - - sig { params(klass: RBI::Scope, method: T.any(Method, UnboundMethod), class_method: T::Boolean).void } - def compile_attrable_method(klass, method, class_method: false) - case method.arity - when -1 - # attr_rw - klass.create_method( - method.name.to_s, - parameters: [create_opt_param("arg", type: "T.untyped", default: "nil")], - return_type: "T.untyped", - class_method:, - ) - when 0 - # attr_predicate - klass.create_method( - method.name.to_s, - return_type: "T::Boolean", - class_method:, - ) - else - raise "Unsupported arity for method #{method.name} - did `Attrable` change?" - end - end - end - end -end diff --git a/Library/Homebrew/sorbet/tapioca/compilers/delegators.rb b/Library/Homebrew/sorbet/tapioca/compilers/delegators.rb index 681d7fcc3d..14d1c359e8 100644 --- a/Library/Homebrew/sorbet/tapioca/compilers/delegators.rb +++ b/Library/Homebrew/sorbet/tapioca/compilers/delegators.rb @@ -7,7 +7,7 @@ require "cask/url" module Tapioca module Compilers # A compiler for subclasses of Delegator. - # To add a new delegator: require it above add add it to the DELEGATIONS hash below. + # To add a new delegator: require it above and add it to the DELEGATIONS hash below. class Delegators < Tapioca::Dsl::Compiler # Mapping of delegator classes to the classes they delegate to (as defined in `__getobj__`). DELEGATIONS = T.let({ diff --git a/Library/Homebrew/sorbet/tapioca/compilers/forwardables.rb b/Library/Homebrew/sorbet/tapioca/compilers/forwardables.rb index 6898beef6e..f0185cb522 100644 --- a/Library/Homebrew/sorbet/tapioca/compilers/forwardables.rb +++ b/Library/Homebrew/sorbet/tapioca/compilers/forwardables.rb @@ -12,6 +12,13 @@ module Tapioca ARRAY_METHODS = T.let(["to_a", "to_ary"].freeze, T::Array[String]) HASH_METHODS = T.let(["to_h", "to_hash"].freeze, T::Array[String]) STRING_METHODS = T.let(["to_s", "to_str", "to_json"].freeze, T::Array[String]) + # Use this to override the default return type of a forwarded method: + RETURN_TYPE_OVERRIDES = T.let({ + "::Cask::Cask" => { + "on_system_block_min_os" => "T.nilable(MacOSVersion)", + "url" => "T.nilable(::Cask::URL)", + }, + }.freeze, T::Hash[String, T::Hash[String, String]]) ConstantType = type_member { { fixed: Module } } @@ -38,7 +45,7 @@ module Tapioca sig { params(klass: RBI::Scope, method: T.any(Method, UnboundMethod), class_method: T::Boolean).void } def compile_forwardable_method(klass, method, class_method: false) name = method.name.to_s - return_type = return_type(name) + return_type = return_type(klass.to_s, name) klass.create_method( name, parameters: [ @@ -50,16 +57,13 @@ module Tapioca ) end - sig { params(name: String).returns(String) } - def return_type(name) - if name.end_with?("?") - "T::Boolean" - elsif ARRAY_METHODS.include?(name) - "Array" - elsif HASH_METHODS.include?(name) - "Hash" - elsif STRING_METHODS.include?(name) - "String" + sig { params(klass: String, name: String).returns(String) } + def return_type(klass, name) + if (override = RETURN_TYPE_OVERRIDES.dig(klass, name)) then override + elsif name.end_with?("?") then "T::Boolean" + elsif ARRAY_METHODS.include?(name) then "Array" + elsif HASH_METHODS.include?(name) then "Hash" + elsif STRING_METHODS.include?(name) then "String" else "T.untyped" end diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index e25271138b..8d9d99f366 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -85,21 +85,15 @@ module Homebrew run_shellcheck(shell_files, output_type, fix:) end - shfmt_result = if files.present? && shell_files.empty? - true - else - run_shfmt(shell_files, fix:) - end + shfmt_result = files.present? && shell_files.empty? + shfmt_result ||= run_shfmt(shell_files, fix:) has_actionlint_workflow = actionlint_files.any? do |path| path.to_s.end_with?("/.github/workflows/actionlint.yml") end odebug "actionlint workflow detected. Skipping actionlint checks." if has_actionlint_workflow - actionlint_result = if files.present? && (has_actionlint_workflow || actionlint_files.empty?) - true - else - run_actionlint(actionlint_files) - end + actionlint_result = files.present? && (has_actionlint_workflow || actionlint_files.empty?) + actionlint_result ||= run_actionlint(actionlint_files) if output_type == :json Offenses.new(rubocop_result + shellcheck_result) diff --git a/Library/Homebrew/system_command.rb b/Library/Homebrew/system_command.rb index 94601fb4da..737eea4322 100644 --- a/Library/Homebrew/system_command.rb +++ b/Library/Homebrew/system_command.rb @@ -1,7 +1,6 @@ # typed: true # rubocop:todo Sorbet/StrictSigil # frozen_string_literal: true -require "attrable" require "plist" require "shellwords" require "uri" @@ -34,7 +33,6 @@ class SystemCommand end include Context - extend Attrable def self.run(executable, **options) new(executable, **options).run! @@ -154,7 +152,17 @@ class SystemCommand attr_reader :executable, :args, :input, :chdir, :env - attr_predicate :sudo?, :sudo_as_root?, :must_succeed?, :reset_uid? + sig { returns(T::Boolean) } + def must_succeed? = @must_succeed + + sig { returns(T::Boolean) } + def reset_uid? = @reset_uid + + sig { returns(T::Boolean) } + def sudo? = @sudo + + sig { returns(T::Boolean) } + def sudo_as_root? = @sudo_as_root sig { returns(T::Boolean) } def debug? diff --git a/Library/Homebrew/test/bottle_specification_spec.rb b/Library/Homebrew/test/bottle_specification_spec.rb index cb2c82fd7d..51eed26c67 100644 --- a/Library/Homebrew/test/bottle_specification_spec.rb +++ b/Library/Homebrew/test/bottle_specification_spec.rb @@ -52,11 +52,13 @@ RSpec.describe BottleSpecification do end end - %w[root_url rebuild].each do |method| - specify "##{method}" do - object = Object.new - bottle_spec.public_send(method, object) - expect(bottle_spec.public_send(method)).to eq(object) - end + specify "#rebuild" do + bottle_spec.rebuild(1337) + expect(bottle_spec.rebuild).to eq(1337) + end + + specify "#root_url" do + bottle_spec.root_url("https://example.com") + expect(bottle_spec.root_url).to eq("https://example.com") end end diff --git a/Library/Homebrew/test/cask/artifact/bashcompletion_spec.rb b/Library/Homebrew/test/cask/artifact/bashcompletion_spec.rb new file mode 100644 index 0000000000..3bdfec62f4 --- /dev/null +++ b/Library/Homebrew/test/cask/artifact/bashcompletion_spec.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +RSpec.describe Cask::Artifact::BashCompletion, :cask do + let(:cask) { Cask::CaskLoader.load(cask_token) } + + context "with install" do + let(:install_phase) do + lambda do + cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact| + artifact.install_phase(command: NeverSudoSystemCommand, force: false) + end + end + end + + let(:source_path) { cask.staged_path.join("test.bash") } + let(:target_path) { cask.config.bash_completion.join("test") } + let(:full_source_path) { cask.staged_path.join("test.bash-completion") } + let(:full_target_path) { cask.config.bash_completion.join("test") } + + before do + InstallHelper.install_without_artifacts(cask) + end + + context "with completion" do + let(:cask_token) { "with-shellcompletion" } + + it "links the completion to the proper directory" do + install_phase.call + + expect(File).to be_identical target_path, source_path + end + end + + context "with long completion" do + let(:cask_token) { "with-shellcompletion-long" } + + it "links the completion to the proper directory" do + install_phase.call + + expect(File).to be_identical full_target_path, full_source_path + end + end + end +end diff --git a/Library/Homebrew/test/cask/artifact/fishlcompletion_spec.rb b/Library/Homebrew/test/cask/artifact/fishlcompletion_spec.rb new file mode 100644 index 0000000000..f5e166ff45 --- /dev/null +++ b/Library/Homebrew/test/cask/artifact/fishlcompletion_spec.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +RSpec.describe Cask::Artifact::FishCompletion, :cask do + let(:cask) { Cask::CaskLoader.load(cask_token) } + + context "with install" do + let(:install_phase) do + lambda do + cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact| + artifact.install_phase(command: NeverSudoSystemCommand, force: false) + end + end + end + + let(:source_path) { cask.staged_path.join("test.fish") } + let(:target_path) { cask.config.fish_completion.join("test.fish") } + let(:full_source_path) { cask.staged_path.join("test.fish-completion") } + let(:full_target_path) { cask.config.fish_completion.join("test.fish") } + + before do + InstallHelper.install_without_artifacts(cask) + end + + context "with completion" do + let(:cask_token) { "with-shellcompletion" } + + it "links the completion to the proper directory" do + install_phase.call + + expect(File).to be_identical target_path, source_path + end + end + + context "with long completion" do + let(:cask_token) { "with-shellcompletion-long" } + + it "links the completion to the proper directory" do + install_phase.call + + expect(File).to be_identical full_target_path, full_source_path + end + end + end +end diff --git a/Library/Homebrew/test/cask/artifact/zshcompletion_spec.rb b/Library/Homebrew/test/cask/artifact/zshcompletion_spec.rb new file mode 100644 index 0000000000..8a46f84f5e --- /dev/null +++ b/Library/Homebrew/test/cask/artifact/zshcompletion_spec.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +RSpec.describe Cask::Artifact::ZshCompletion, :cask do + let(:cask) { Cask::CaskLoader.load(cask_token) } + + context "with install" do + let(:install_phase) do + lambda do + cask.artifacts.select { |a| a.is_a?(described_class) }.each do |artifact| + artifact.install_phase(command: NeverSudoSystemCommand, force: false) + end + end + end + + let(:source_path) { cask.staged_path.join("_test") } + let(:target_path) { cask.config.zsh_completion.join("_test") } + let(:full_source_path) { cask.staged_path.join("test.zsh-completion") } + let(:full_target_path) { cask.config.zsh_completion.join("_test") } + + before do + InstallHelper.install_without_artifacts(cask) + end + + context "with completion" do + let(:cask_token) { "with-shellcompletion" } + + it "links the completion to the proper directory" do + install_phase.call + + expect(File).to be_identical target_path, source_path + end + end + + context "with long completion" do + let(:cask_token) { "with-shellcompletion-long" } + + it "links the completion to the proper directory" do + install_phase.call + + expect(File).to be_identical full_target_path, full_source_path + end + end + end +end diff --git a/Library/Homebrew/test/caveats_spec.rb b/Library/Homebrew/test/caveats_spec.rb index c9231e2615..7871177928 100644 --- a/Library/Homebrew/test/caveats_spec.rb +++ b/Library/Homebrew/test/caveats_spec.rb @@ -248,6 +248,7 @@ RSpec.describe Caveats do let(:bash_completion_dir) { path/"etc/bash_completion.d" } let(:fish_vendor_completions) { path/"share/fish/vendor_completions.d" } let(:zsh_site_functions) { path/"share/zsh/site-functions" } + let(:pwsh_completion_dir) { path/"share/pwsh/completions" } before do # don't try to load/fetch gcc/glibc @@ -274,6 +275,12 @@ RSpec.describe Caveats do FileUtils.touch zsh_site_functions/f.name expect(caveats).to include(HOMEBREW_PREFIX/"share/zsh/site-functions") end + + it "includes where pwsh completions have been installed to" do + pwsh_completion_dir.mkpath + FileUtils.touch pwsh_completion_dir/f.name + expect(caveats).to include(HOMEBREW_PREFIX/"share/pwsh/completions") + end end end end diff --git a/Library/Homebrew/test/dependencies_helpers_spec.rb b/Library/Homebrew/test/dependencies_helpers_spec.rb index bae4998fe1..75dc834bd4 100644 --- a/Library/Homebrew/test/dependencies_helpers_spec.rb +++ b/Library/Homebrew/test/dependencies_helpers_spec.rb @@ -35,7 +35,7 @@ RSpec.describe DependenciesHelpers do :any_version_installed?, ] - dependents = described_class.dependents([foo, foo_cask, bar, bar_cask]) + dependents = Class.new.extend(described_class).dependents([foo, foo_cask, bar, bar_cask]) dependents.each do |dependent| methods.each do |method| diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index da58f08b6b..9d404f4b20 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -549,6 +549,7 @@ RSpec.describe Formula do expect(f.homepage).to eq("https://brew.sh") expect(f.version).to eq(Version.new("0.1")) expect(f).to be_stable + expect(f.build).to be_a(BuildOptions) expect(f.stable.version).to eq(Version.new("0.1")) expect(f.head.version).to eq(Version.new("HEAD")) end diff --git a/Library/Homebrew/test/language/node/shebang_spec.rb b/Library/Homebrew/test/language/node/shebang_spec.rb index 4c282eab3d..6744434824 100644 --- a/Library/Homebrew/test/language/node/shebang_spec.rb +++ b/Library/Homebrew/test/language/node/shebang_spec.rb @@ -46,7 +46,6 @@ RSpec.describe Language::Node::Shebang do describe "#detected_node_shebang" do it "can be used to replace Node shebangs" do - allow(Formulary).to receive(:factory) allow(Formulary).to receive(:factory).with(f[:node18].name).and_return(f[:node18]) Utils::Shebang.rewrite_shebang described_class.detected_node_shebang(f[:versioned_node_dep]), file.path diff --git a/Library/Homebrew/test/language/perl/shebang_spec.rb b/Library/Homebrew/test/language/perl/shebang_spec.rb index c08de4321d..6677ae74f6 100644 --- a/Library/Homebrew/test/language/perl/shebang_spec.rb +++ b/Library/Homebrew/test/language/perl/shebang_spec.rb @@ -45,7 +45,6 @@ RSpec.describe Language::Perl::Shebang do describe "#detected_perl_shebang" do it "can be used to replace Perl shebangs when depends_on \"perl\" is used" do - allow(Formulary).to receive(:factory) allow(Formulary).to receive(:factory).with(f[:perl].name).and_return(f[:perl]) Utils::Shebang.rewrite_shebang described_class.detected_perl_shebang(f[:depends_on]), file.path @@ -58,7 +57,6 @@ RSpec.describe Language::Perl::Shebang do end it "can be used to replace Perl shebangs when uses_from_macos \"perl\" is used" do - allow(Formulary).to receive(:factory) allow(Formulary).to receive(:factory).with(f[:perl].name).and_return(f[:perl]) Utils::Shebang.rewrite_shebang described_class.detected_perl_shebang(f[:uses_from_macos]), file.path diff --git a/Library/Homebrew/test/language/python/shebang_spec.rb b/Library/Homebrew/test/language/python/shebang_spec.rb index b6d3d22d97..c823702cef 100644 --- a/Library/Homebrew/test/language/python/shebang_spec.rb +++ b/Library/Homebrew/test/language/python/shebang_spec.rb @@ -46,7 +46,6 @@ RSpec.describe Language::Python::Shebang do describe "#detected_python_shebang" do it "can be used to replace Python shebangs" do - allow(Formulary).to receive(:factory) allow(Formulary).to receive(:factory).with(f[:python311].name).and_return(f[:python311]) Utils::Shebang.rewrite_shebang( described_class.detected_python_shebang(f[:versioned_python_dep], use_python_from_path: false), file.path diff --git a/Library/Homebrew/test/livecheck/livecheck_spec.rb b/Library/Homebrew/test/livecheck/livecheck_spec.rb index c7ba95dac8..eab430f208 100644 --- a/Library/Homebrew/test/livecheck/livecheck_spec.rb +++ b/Library/Homebrew/test/livecheck/livecheck_spec.rb @@ -76,6 +76,32 @@ RSpec.describe Homebrew::Livecheck do RUBY end + describe "::livecheck_strategy_names" do + context "when provided with a strategy class" do + it "returns demodulized class name" do + # We run this twice with the same argument to exercise the caching logic + expect(livecheck.send(:livecheck_strategy_names, Homebrew::Livecheck::Strategy::PageMatch)).to eq("PageMatch") + expect(livecheck.send(:livecheck_strategy_names, Homebrew::Livecheck::Strategy::PageMatch)).to eq("PageMatch") + end + end + end + + describe "::livecheck_find_versions_parameters" do + context "when provided with a strategy class" do + it "returns demodulized class name" do + page_match_parameters = T::Utils.signature_for_method( + Homebrew::Livecheck::Strategy::PageMatch.method(:find_versions), + ).parameters.map(&:second) + + # We run this twice with the same argument to exercise the caching logic + expect(livecheck.send(:livecheck_find_versions_parameters, Homebrew::Livecheck::Strategy::PageMatch)) + .to eq(page_match_parameters) + expect(livecheck.send(:livecheck_find_versions_parameters, Homebrew::Livecheck::Strategy::PageMatch)) + .to eq(page_match_parameters) + end + end + end + describe "::resolve_livecheck_reference" do context "when a formula/cask has a `livecheck` block without formula/cask methods" do it "returns [nil, []]" do diff --git a/Library/Homebrew/test/livecheck/options_spec.rb b/Library/Homebrew/test/livecheck/options_spec.rb new file mode 100644 index 0000000000..468deb6f4e --- /dev/null +++ b/Library/Homebrew/test/livecheck/options_spec.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +require "livecheck/options" + +RSpec.describe Homebrew::Livecheck::Options do + subject(:options) { described_class } + + let(:post_hash) do + { + empty: "", + boolean: "true", + number: "1", + string: "a + b = c", + } + end + let(:args) do + { + homebrew_curl: true, + post_form: post_hash, + post_json: post_hash, + } + end + let(:other_args) do + { + post_form: { something: "else" }, + } + end + let(:merged_hash) { args.merge(other_args) } + + let(:base_options) { options.new(**args) } + let(:other_options) { options.new(**other_args) } + let(:merged_options) { options.new(**merged_hash) } + + describe "#url_options" do + it "returns a Hash of the options that are provided as arguments to the `url` DSL method" do + expect(options.new.url_options).to eq({ + homebrew_curl: nil, + post_form: nil, + post_json: nil, + }) + end + end + + describe "#to_h" do + it "returns a Hash of all instance variables" do + # `T::Struct.serialize` omits `nil` values + expect(options.new.to_h).to eq({}) + + expect(options.new(**args).to_h).to eq(args) + end + end + + describe "#to_hash" do + it "returns a Hash of all instance variables, using String keys" do + # `T::Struct.serialize` omits `nil` values + expect(options.new.to_hash).to eq({}) + + expect(options.new(**args).to_hash).to eq(args.transform_keys(&:to_s)) + end + end + + describe "#merge" do + it "returns an Options object with merged values" do + expect(options.new(**args).merge(other_args)) + .to eq(options.new(**merged_hash)) + expect(options.new(**args).merge(options.new(**other_args))) + .to eq(options.new(**merged_hash)) + expect(options.new(**args).merge(args)) + .to eq(options.new(**args)) + expect(options.new(**args).merge({})) + .to eq(options.new(**args)) + end + end + + describe "#merge!" do + it "merges values from `other` into `self` and returns `self`" do + o1 = options.new(**args) + expect(o1.merge!(other_options)).to eq(merged_options) + expect(o1).to eq(merged_options) + + o2 = options.new(**args) + expect(o2.merge!(other_args)).to eq(merged_options) + expect(o2).to eq(merged_options) + + o3 = options.new(**args) + expect(o3.merge!(base_options)).to eq(base_options) + expect(o3).to eq(base_options) + + o4 = options.new(**args) + expect(o4.merge!(args)).to eq(base_options) + expect(o4).to eq(base_options) + + o5 = options.new(**args) + expect(o5.merge!(options.new)).to eq(base_options) + expect(o5).to eq(base_options) + + o6 = options.new(**args) + expect(o6.merge!({})).to eq(base_options) + expect(o6).to eq(base_options) + end + + it "skips over hash values without a corresponding Options value" do + o1 = options.new(**args) + expect(o1.merge!({ nonexistent: true })).to eq(base_options) + expect(o1).to eq(base_options) + end + end + + describe "#==" do + it "returns true if all instance variables are the same" do + obj_with_args1 = options.new(**args) + obj_with_args2 = options.new(**args) + expect(obj_with_args1 == obj_with_args2).to be true + + default_obj1 = options.new + default_obj2 = options.new + expect(default_obj1 == default_obj2).to be true + end + + it "returns false if any instance variables differ" do + expect(options.new == options.new(**args)).to be false + end + + it "returns false if other object is not the same class" do + expect(options.new == :other).to be false + end + end + + describe "#empty?" do + it "returns true if object has only default values" do + expect(options.new.empty?).to be true + end + + it "returns false if object has any non-default values" do + expect(options.new(**args).empty?).to be false + end + end + + describe "#present?" do + it "returns false if object has only default values" do + expect(options.new.present?).to be false + end + + it "returns true if object has any non-default values" do + expect(options.new(**args).present?).to be true + end + end +end diff --git a/Library/Homebrew/test/livecheck/strategy_spec.rb b/Library/Homebrew/test/livecheck/strategy_spec.rb index ddb3bde2f5..4ef416c331 100644 --- a/Library/Homebrew/test/livecheck/strategy_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy_spec.rb @@ -9,14 +9,6 @@ RSpec.describe Homebrew::Livecheck::Strategy do let(:redirection_url) { "https://brew.sh/redirection" } let(:post_hash) do - { - "empty" => "", - "boolean" => "true", - "number" => "1", - "string" => "a + b = c", - } - end - let(:post_hash_symbol_keys) do { empty: "", boolean: "true", @@ -154,7 +146,6 @@ RSpec.describe Homebrew::Livecheck::Strategy do describe "::post_args" do it "returns an array including `--data` and an encoded form data string" do expect(strategy.post_args(post_form: post_hash)).to eq(["--data", form_string]) - expect(strategy.post_args(post_form: post_hash_symbol_keys)).to eq(["--data", form_string]) # If both `post_form` and `post_json` are present, only `post_form` will # be used. @@ -163,7 +154,6 @@ RSpec.describe Homebrew::Livecheck::Strategy do it "returns an array including `--json` and a JSON string" do expect(strategy.post_args(post_json: post_hash)).to eq(["--json", json_string]) - expect(strategy.post_args(post_json: post_hash_symbol_keys)).to eq(["--json", json_string]) end it "returns an empty array if `post_form` value is blank" do @@ -191,8 +181,12 @@ RSpec.describe Homebrew::Livecheck::Strategy do it "handles `post_form` `url` options" do allow(strategy).to receive(:curl_headers).and_return({ responses:, body: }) - expect(strategy.page_headers(url, url_options: { post_form: post_hash })) - .to eq([responses.first[:headers]]) + expect( + strategy.page_headers( + url, + options: Homebrew::Livecheck::Options.new(post_form: post_hash), + ), + ).to eq([responses.first[:headers]]) end it "returns an empty array if `curl_headers` only raises an `ErrorDuringExecution` error" do @@ -217,14 +211,24 @@ RSpec.describe Homebrew::Livecheck::Strategy do allow_any_instance_of(Utils::Curl).to receive(:curl_version).and_return(curl_version) allow(strategy).to receive(:curl_output).and_return([response_text[:ok], nil, success_status]) - expect(strategy.page_content(url, url_options: { post_form: post_hash })).to eq({ content: body }) + expect( + strategy.page_content( + url, + options: Homebrew::Livecheck::Options.new(post_form: post_hash), + ), + ).to eq({ content: body }) end it "handles `post_json` `url` option" do allow_any_instance_of(Utils::Curl).to receive(:curl_version).and_return(curl_version) allow(strategy).to receive(:curl_output).and_return([response_text[:ok], nil, success_status]) - expect(strategy.page_content(url, url_options: { post_json: post_hash })).to eq({ content: body }) + expect( + strategy.page_content( + url, + options: Homebrew::Livecheck::Options.new(post_json: post_hash), + ), + ).to eq({ content: body }) end it "returns error `messages` from `stderr` in the return hash on failure when `stderr` is not `nil`" do diff --git a/Library/Homebrew/test/livecheck_spec.rb b/Library/Homebrew/test/livecheck_spec.rb index d213d227d6..ba5bde56e0 100644 --- a/Library/Homebrew/test/livecheck_spec.rb +++ b/Library/Homebrew/test/livecheck_spec.rb @@ -29,10 +29,10 @@ RSpec.describe Livecheck do let(:post_hash) do { - "empty" => "", - "boolean" => "true", - "number" => "1", - "string" => "a + b = c", + empty: "", + boolean: "true", + number: "1", + string: "a + b = c", } end @@ -156,10 +156,17 @@ RSpec.describe Livecheck do expect(livecheck_c.url).to eq(:url) end - it "sets `url_options` when provided" do - post_args = { post_form: post_hash } - livecheck_f.url(url_string, **post_args) - expect(livecheck_f.url_options).to eq(post_args) + it "sets `url` options when provided" do + # This test makes sure that we can set multiple options at once and + # options from subsequent `url` calls are merged with existing values + # (i.e. existing values aren't reset to `nil`). [We only call `url` once + # in a `livecheck` block but this should technically work due to how it's + # implemented.] + livecheck_f.url(url_string, homebrew_curl: true, post_form: post_hash) + livecheck_f.url(url_string, post_json: post_hash) + expect(livecheck_f.options.homebrew_curl).to be(true) + expect(livecheck_f.options.post_form).to eq(post_hash) + expect(livecheck_f.options.post_json).to eq(post_hash) end it "raises an ArgumentError if the argument isn't a valid Symbol" do @@ -179,15 +186,15 @@ RSpec.describe Livecheck do it "returns a Hash of all instance variables" do expect(livecheck_f.to_hash).to eq( { - "cask" => nil, - "formula" => nil, - "regex" => nil, - "skip" => false, - "skip_msg" => nil, - "strategy" => nil, - "throttle" => nil, - "url" => nil, - "url_options" => nil, + "options" => Homebrew::Livecheck::Options.new.to_hash, + "cask" => nil, + "formula" => nil, + "regex" => nil, + "skip" => false, + "skip_msg" => nil, + "strategy" => nil, + "throttle" => nil, + "url" => nil, }, ) end diff --git a/Library/Homebrew/test/rubocops/text/assert_statements_spec.rb b/Library/Homebrew/test/rubocops/text/assert_statements_spec.rb index 3444a0f525..240e1ff1d9 100644 --- a/Library/Homebrew/test/rubocops/text/assert_statements_spec.rb +++ b/Library/Homebrew/test/rubocops/text/assert_statements_spec.rb @@ -23,7 +23,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::AssertStatements do desc "foo" url 'https://brew.sh/foo-1.0.tgz' assert File.exist? "default.ini" - ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `assert_predicate , :exist?` instead of `assert File.exist? "default.ini"` + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `assert_path_exists ` instead of `assert File.exist? "default.ini"` end RUBY end @@ -34,7 +34,7 @@ RSpec.describe RuboCop::Cop::FormulaAudit::AssertStatements do desc "foo" url 'https://brew.sh/foo-1.0.tgz' assert !File.exist?("default.ini") - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `refute_predicate , :exist?` instead of `assert !File.exist?("default.ini")` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `refute_path_exists ` instead of `assert !File.exist?("default.ini")` end RUBY end diff --git a/Library/Homebrew/test/support/fixtures/cask/AppWithShellCompletion.zip b/Library/Homebrew/test/support/fixtures/cask/AppWithShellCompletion.zip new file mode 100644 index 0000000000..bd3496ae41 Binary files /dev/null and b/Library/Homebrew/test/support/fixtures/cask/AppWithShellCompletion.zip differ diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-shellcompletion-long.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-shellcompletion-long.rb new file mode 100644 index 0000000000..8a0e80ad30 --- /dev/null +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-shellcompletion-long.rb @@ -0,0 +1,11 @@ +cask "with-shellcompletion-long" do + version "1.2.3" + sha256 "957978d9b30adfda8e1f914ba8c8019e016545c8f7e16c6ab0234d189fac8146" + + url "file://#{TEST_FIXTURE_DIR}/cask/AppWithShellCompletion.zip" + homepage "https://brew.sh/with-autodetected-manpage-section" + + bash_completion "test.bash-completion" + fish_completion "test.fish-completion" + zsh_completion "test.zsh-completion" +end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-shellcompletion.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-shellcompletion.rb new file mode 100644 index 0000000000..54f518dd4c --- /dev/null +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-shellcompletion.rb @@ -0,0 +1,11 @@ +cask "with-shellcompletion" do + version "1.2.3" + sha256 "957978d9b30adfda8e1f914ba8c8019e016545c8f7e16c6ab0234d189fac8146" + + url "file://#{TEST_FIXTURE_DIR}/cask/AppWithShellCompletion.zip" + homepage "https://brew.sh/with-autodetected-manpage-section" + + bash_completion "test.bash" + fish_completion "test.fish" + zsh_completion "_test" +end diff --git a/Library/Homebrew/test/support/fixtures/cask/everything.json b/Library/Homebrew/test/support/fixtures/cask/everything.json index 9bc4c6af19..b247e82a05 100644 --- a/Library/Homebrew/test/support/fixtures/cask/everything.json +++ b/Library/Homebrew/test/support/fixtures/cask/everything.json @@ -76,7 +76,12 @@ "depends_on": { "cask": [ "something" - ] + ], + "macos": { + ">=": [ + "10.11" + ] + } }, "conflicts_with": { "formula": [ diff --git a/Library/Homebrew/test/utils/shell_spec.rb b/Library/Homebrew/test/utils/shell_spec.rb index 16bb3670a3..3855f08131 100644 --- a/Library/Homebrew/test/utils/shell_spec.rb +++ b/Library/Homebrew/test/utils/shell_spec.rb @@ -35,6 +35,11 @@ RSpec.describe Utils::Shell do ENV["SHELL"] = "/bin/ksh" expect(described_class.profile).to eq("~/.kshrc") end + + it "returns ~/.config/powershell/Microsoft.PowerShell_profile.ps1 for PowerShell" do + ENV["SHELL"] = "/usr/bin/pwsh" + expect(described_class.profile).to eq("~/.config/powershell/Microsoft.PowerShell_profile.ps1") + end end describe "::from_path" do diff --git a/Library/Homebrew/test/utils_spec.rb b/Library/Homebrew/test/utils_spec.rb index b8766fc9ac..466ef342d7 100644 --- a/Library/Homebrew/test/utils_spec.rb +++ b/Library/Homebrew/test/utils_spec.rb @@ -30,6 +30,10 @@ RSpec.describe Utils do expect(described_class.demodulize("")).to eq("") expect(described_class.demodulize("::")).to eq("") end + + it "raise an ArgumentError when passed nil" do + expect { described_class.demodulize(nil) }.to raise_error(ArgumentError) + end end specify ".parse_author!" do diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 704162ead7..3c61fba3df 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -97,8 +97,11 @@ module Utils # See also #deconstantize. # @see https://github.com/rails/rails/blob/b0dd7c7/activesupport/lib/active_support/inflector/methods.rb#L230-L245 # `ActiveSupport::Inflector.demodulize` - sig { params(path: String).returns(String) } + # @raise [ArgumentError] if the provided path is nil + sig { params(path: T.nilable(String)).returns(String) } def self.demodulize(path) + raise ArgumentError, "No constant path provided" if path.nil? + if (i = path.rindex("::")) T.must(path[(i + 2)..]) else diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index fc38425a8f..54674b019f 100644 --- a/Library/Homebrew/utils/analytics.rb +++ b/Library/Homebrew/utils/analytics.rb @@ -71,9 +71,6 @@ module Utils def report_package_event(measurement, package_name:, tap_name:, on_request: false, options: "") return if not_this_run? || disabled? - # ensure on_request is a boolean - on_request = on_request ? true : false - # ensure options are removed (by `.compact` below) if empty options = nil if options.blank? @@ -137,9 +134,6 @@ module Utils return if not_this_run? || disabled? return if ENV["HOMEBREW_TEST_BOT_ANALYTICS"].blank? - # ensure passed is a boolean - passed = passed ? true : false - # Tags must have low cardinality. tags = { passed:, diff --git a/Library/Homebrew/utils/gems.rbi b/Library/Homebrew/utils/gems.rbi deleted file mode 100644 index 746bceef1d..0000000000 --- a/Library/Homebrew/utils/gems.rbi +++ /dev/null @@ -1,27 +0,0 @@ -# typed: strict - -module Homebrew - sig { returns(String) } - def ruby_bindir; end - - sig { returns(String) } - def gem_user_bindir; end - - sig { params(message: String).void } - def ohai_if_defined(message); end - - sig { params(message: String).returns(T.noreturn) } - def odie_if_defined(message); end - - sig { params(name: String, version: T.nilable(String), executable: String, setup_gem_environment: T::Boolean).void } - def install_gem_setup_path!(name, version: nil, executable: name, setup_gem_environment: true); end - - sig { params(executable: String).returns(T.nilable(String)) } - def find_in_path(executable); end - - sig { void } - def install_bundler!; end - - sig { params(only_warn_on_failure: T::Boolean, setup_path: T::Boolean, groups: T::Array[String]).void } - def install_bundler_gems!(only_warn_on_failure: false, setup_path: false, groups: []); end -end diff --git a/Library/Homebrew/utils/pypi.rb b/Library/Homebrew/utils/pypi.rb index d8920b3d75..9005162454 100644 --- a/Library/Homebrew/utils/pypi.rb +++ b/Library/Homebrew/utils/pypi.rb @@ -340,11 +340,8 @@ module PyPI show_info = !print_only && !silent ohai "Retrieving PyPI dependencies for \"#{input_packages.join(" ")}\"..." if show_info - print_stderr = if verbose && show_info - true - else - false - end + print_stderr = verbose && show_info + print_stderr ||= false found_packages = pip_report(input_packages, python_name:, print_stderr:) # Resolve the dependency tree of excluded packages to prune the above diff --git a/Library/Homebrew/utils/shell.rb b/Library/Homebrew/utils/shell.rb index eb429ab7a6..1e88d881dd 100644 --- a/Library/Homebrew/utils/shell.rb +++ b/Library/Homebrew/utils/shell.rb @@ -17,7 +17,7 @@ module Utils shell_name = File.basename(path) # handle possible version suffix like `zsh-5.2` shell_name.sub!(/-.*\z/m, "") - shell_name.to_sym if %w[bash csh fish ksh mksh rc sh tcsh zsh].include?(shell_name) + shell_name.to_sym if %w[bash csh fish ksh mksh pwsh rc sh tcsh zsh].include?(shell_name) end sig { params(default: String).returns(String) } @@ -60,6 +60,9 @@ module Utils when :bash bash_profile = "#{Dir.home}/.bash_profile" return bash_profile if File.exist? bash_profile + when :pwsh + pwsh_profile = "#{Dir.home}/.config/powershell/Microsoft.PowerShell_profile.ps1" + return pwsh_profile if File.exist? pwsh_profile when :rc rc_profile = "#{Dir.home}/.rcrc" return rc_profile if File.exist? rc_profile @@ -78,6 +81,8 @@ module Utils case preferred when :bash, :ksh, :sh, :zsh, nil "echo 'export #{variable}=#{sh_quote(value)}' >> #{profile}" + when :pwsh + "$env:#{variable}='#{value}' >> #{profile}" when :rc "echo '#{variable}=(#{sh_quote(value)})' >> #{profile}" when :csh, :tcsh @@ -92,6 +97,8 @@ module Utils case preferred when :bash, :ksh, :mksh, :sh, :zsh, nil "echo 'export PATH=\"#{sh_quote(path)}:$PATH\"' >> #{profile}" + when :pwsh + "$env:PATH = '#{path}' + \":${env:PATH}\" >> #{profile}" when :rc "echo 'path=(#{sh_quote(path)} $path)' >> #{profile}" when :csh, :tcsh @@ -108,6 +115,7 @@ module Utils fish: "~/.config/fish/config.fish", ksh: "~/.kshrc", mksh: "~/.kshrc", + pwsh: "~/.config/powershell/Microsoft.PowerShell_profile.ps1", rc: "~/.rcrc", sh: "~/.profile", tcsh: "~/.tcshrc", diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 5de4adde5a..810c594e4f 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -36,12 +36,87 @@ else end $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-6.0.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.7/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ast-2.4.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/base64-0.2.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/benchmark-0.4.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/bigdecimal-3.1.9") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bigdecimal-3.1.9/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.5.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/coderay-1.1.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/diff-lcs-1.6.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/docile-1.4.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/elftools-1.3.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/erubi-1.13.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/hana-1.3.7/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/json-2.10.1") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json-2.10.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/regexp_parser-2.10.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simpleidn-0.2.3/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json_schemer-2.4.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rexml-3.4.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/kramdown-2.5.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/language_server-protocol-3.17.0.4/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/lint_roller-1.1.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/logger-1.6.6/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/method_source-1.1.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.25.4/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/netrc-0.11.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel-1.26.3/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel_tests-5.0.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/racc-1.8.1") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/racc-1.8.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parser-3.3.7.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/patchelf-1.5.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/plist-3.7.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/prism-1.3.0") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/prism-1.3.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/pry-0.15.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/pycall-1.5.2") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/pycall-1.5.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11888/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.2.4/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/rbs-3.8.1") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.8.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/redcarpet-3.6.1") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/redcarpet-3.6.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-support-3.13.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-core-3.13.3/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-expectations-3.13.3/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-mocks-3.13.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-3.13.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-github-3.0.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-retry-0.6.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-sorbet-1.9.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec_junit_formatter-0.6.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.38.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.13.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-emoji-4.0.4/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-3.1.4/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.73.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-md-2.0.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.24.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-3.5.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.8.9/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.23.11/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-4.1.0/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11812/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/ruby-prof-1.7.1") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-prof-1.7.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-html-0.13.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov_json_formatter-0.1.4/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-0.22.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-cobertura-2.1.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.5.11888-universal-darwin/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.11888/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.11888/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.3.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.5.4/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/stackprof-0.2.27") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/stackprof-0.2.27/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.37/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.9.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.16.11/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/vernier-1.5.0") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/vernier-1.5.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.5.0/lib") diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/sorbet-runtime.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/sorbet-runtime.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/sorbet-runtime.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/sorbet-runtime.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/_types.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/_types.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/_types.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/_types.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/abstract_utils.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/abstract_utils.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/abstract_utils.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/abstract_utils.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/boolean.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/boolean.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/boolean.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/boolean.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/compatibility_patches.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/compatibility_patches.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/compatibility_patches.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/compatibility_patches.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/configuration.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/configuration.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/configuration.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/configuration.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/enum.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/enum.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/enum.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/enum.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/generic.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/generic.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/generic.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/generic.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/helpers.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/helpers.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/helpers.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/helpers.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/non_forcing_constants.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/non_forcing_constants.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/non_forcing_constants.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/non_forcing_constants.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/abstract/data.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/abstract/data.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/abstract/data.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/abstract/data.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/abstract/declare.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/abstract/declare.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/abstract/declare.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/abstract/declare.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/abstract/hooks.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/abstract/hooks.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/abstract/hooks.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/abstract/hooks.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/abstract/validate.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/abstract/validate.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/abstract/validate.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/abstract/validate.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/caller_utils.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/caller_utils.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/caller_utils.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/caller_utils.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/casts.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/casts.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/casts.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/casts.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/class_utils.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/class_utils.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/class_utils.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/class_utils.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/decl_state.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/decl_state.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/decl_state.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/decl_state.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/final.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/final.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/final.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/final.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/_methods.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/_methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/call_validation.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/call_validation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/call_validation.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/call_validation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/call_validation_2_6.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/call_validation_2_6.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/call_validation_2_6.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/call_validation_2_6.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/call_validation_2_7.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/call_validation_2_7.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/call_validation_2_7.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/call_validation_2_7.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/decl_builder.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/decl_builder.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/decl_builder.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/decl_builder.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/modes.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/modes.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/modes.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/modes.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/signature.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/signature.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/signature.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/signature.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/signature_validation.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/signature_validation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/methods/signature_validation.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/methods/signature_validation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/mixins/mixins.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/mixins/mixins.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/mixins/mixins.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/mixins/mixins.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/retry.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/retry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/retry.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/retry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/runtime_levels.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/runtime_levels.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/runtime_levels.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/runtime_levels.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/sealed.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/sealed.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/sealed.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/sealed.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/not_typed.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/not_typed.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/not_typed.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/not_typed.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/simple_pair_union.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/simple_pair_union.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/simple_pair_union.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/simple_pair_union.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/string_holder.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/string_holder.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/string_holder.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/string_holder.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/type_alias.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/type_alias.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/type_alias.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/type_alias.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/void.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/void.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/private/types/void.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/private/types/void.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/_props.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/_props.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/_props.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/_props.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/constructor.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/constructor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/constructor.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/constructor.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/custom_type.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/custom_type.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/custom_type.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/custom_type.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/decorator.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/decorator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/decorator.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/decorator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/errors.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/errors.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/errors.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/errors.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/generated_code_validation.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/generated_code_validation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/generated_code_validation.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/generated_code_validation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/has_lazily_specialized_methods.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/has_lazily_specialized_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/has_lazily_specialized_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/has_lazily_specialized_methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/optional.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/optional.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/optional.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/optional.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/plugin.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/plugin.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/plugin.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/plugin.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/pretty_printable.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/pretty_printable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/pretty_printable.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/pretty_printable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/apply_default.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/apply_default.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/apply_default.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/apply_default.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/deserializer_generator.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/deserializer_generator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/deserializer_generator.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/deserializer_generator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/parser.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/parser.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/parser.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/parser.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/serde_transform.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/serde_transform.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/serde_transform.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/serde_transform.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/serializer_generator.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/serializer_generator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/serializer_generator.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/serializer_generator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/setter_factory.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/setter_factory.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/private/setter_factory.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/private/setter_factory.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/serializable.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/serializable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/serializable.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/serializable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/type_validation.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/type_validation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/type_validation.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/type_validation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/utils.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/utils.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/utils.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/utils.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/weak_constructor.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/weak_constructor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/props/weak_constructor.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/props/weak_constructor.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/sig.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/sig.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/sig.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/sig.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/struct.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/struct.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/struct.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/struct.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/anything.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/anything.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/anything.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/anything.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/attached_class.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/attached_class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/attached_class.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/attached_class.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/base.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/base.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/base.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/base.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/class_of.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/class_of.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/class_of.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/class_of.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/enum.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/enum.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/enum.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/enum.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/fixed_array.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/fixed_array.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/fixed_array.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/fixed_array.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/fixed_hash.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/fixed_hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/fixed_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/fixed_hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/intersection.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/intersection.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/intersection.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/intersection.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/noreturn.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/noreturn.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/noreturn.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/noreturn.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/proc.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/proc.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/proc.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/proc.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/self_type.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/self_type.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/self_type.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/self_type.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/simple.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/simple.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/simple.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/simple.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/t_enum.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/t_enum.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/t_enum.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/t_enum.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/type_member.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/type_member.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/type_member.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/type_member.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/type_parameter.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/type_parameter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/type_parameter.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/type_parameter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/type_template.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/type_template.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/type_template.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/type_template.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/type_variable.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/type_variable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/type_variable.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/type_variable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_array.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_array.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_array.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_array.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_class.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_class.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_class.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_enumerable.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_enumerable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_enumerable.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_enumerable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_enumerator.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_enumerator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_enumerator.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_enumerator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_enumerator_chain.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_enumerator_chain.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_enumerator_chain.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_enumerator_chain.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_enumerator_lazy.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_enumerator_lazy.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_enumerator_lazy.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_enumerator_lazy.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_hash.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_range.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_range.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_range.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_set.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_set.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/typed_set.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/typed_set.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/union.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/union.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/union.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/union.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/untyped.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/untyped.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/types/untyped.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/types/untyped.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/utils.rb b/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/utils.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11812/lib/types/utils.rb rename to Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11888/lib/types/utils.rb diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 067acba83f..acf6d440de 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -766,15 +766,15 @@ class Version ) end + # Represents the absence of a version. + # + # NOTE: Constructor needs to called with an arbitrary non-empty version which is then set to `nil`. + NULL = T.let(Version.new("NULL").tap { |v| v.instance_variable_set(:@version, nil) }.freeze, Version) + private sig { params(first: Integer, second: Integer).returns(Integer) } def max(first, second) (first > second) ? first : second end - - # Represents the absence of a version. - # - # NOTE: Constructor needs to called with an arbitrary non-empty version which is then set to `nil`. - NULL = T.let(Version.new("NULL").tap { |v| v.instance_variable_set(:@version, nil) }.freeze, Version) end diff --git a/README.md b/README.md index a9306affc5..ccd8e8db30 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,6 @@ Secure password storage and syncing is provided by [1Password for Teams](https:/ [![DNSimple](https://cdn.dnsimple.com/assets/resolving-with-us/logo-light.png)](https://dnsimple.com/resolving/homebrew#gh-light-mode-only) [![DNSimple](https://cdn.dnsimple.com/assets/resolving-with-us/logo-dark.png)](https://dnsimple.com/resolving/homebrew#gh-dark-mode-only) -Homebrew is generously supported by [GitHub](https://github.com/github), [Custom Ink](https://github.com/customink), [Randy Reddig](https://github.com/ydnar), [Codecademy](https://github.com/Codecademy), [MacPaw Inc.](https://github.com/MacPaw), [Workbrew](https://github.com/Workbrew) and many other users and organisations via [GitHub Sponsors](https://github.com/sponsors/Homebrew). +Homebrew is generously supported by [GitHub](https://github.com/github), [Custom Ink](https://github.com/customink), [Randy Reddig](https://github.com/ydnar), [Henok Mikre](https://github.com/henokmikre), [Codecademy](https://github.com/Codecademy), [MacPaw Inc.](https://github.com/MacPaw), [mikadelbert](https://github.com/mikadelbert), [Workbrew](https://github.com/Workbrew) and many other users and organisations via [GitHub Sponsors](https://github.com/sponsors/Homebrew). [![GitHub](https://github.com/github.png?size=64)](https://github.com/github) diff --git a/completions/bash/brew b/completions/bash/brew index 91c384f483..704a02b4a5 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -816,6 +816,7 @@ _brew_create() { --set-version --tap --verbose + --zig " return ;; diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 50b7da926f..1a00fe99aa 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -592,6 +592,7 @@ __fish_brew_complete_arg 'create' -l set-name -d 'Explicitly set the name of the __fish_brew_complete_arg 'create' -l set-version -d 'Explicitly set the version of the new formula or cask' __fish_brew_complete_arg 'create' -l tap -d 'Generate the new formula within the given tap, specified as user`/`repo' __fish_brew_complete_arg 'create' -l verbose -d 'Make some output more verbose' +__fish_brew_complete_arg 'create' -l zig -d 'Create a basic template for a Zig build' __fish_brew_complete_cmd 'debugger' 'Run the specified Homebrew command in debug mode' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 21582179ad..8213c5fb53 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -740,27 +740,28 @@ _brew_contributions() { _brew_create() { _arguments \ '(--cask)--HEAD[Indicate that URL points to the package'\''s repository rather than a file]' \ - '(--cmake --crystal --go --meson --node --perl --python --ruby --rust --cask)--autotools[Create a basic template for an Autotools-style build]' \ - '(--autotools --cmake --crystal --go --meson --node --perl --python --ruby --rust --HEAD --set-license)--cask[Create a basic template for a cask]' \ - '(--autotools --crystal --go --meson --node --perl --python --ruby --rust --cask)--cmake[Create a basic template for a CMake-style build]' \ - '(--autotools --cmake --go --meson --node --perl --python --ruby --rust --cask)--crystal[Create a basic template for a Crystal build]' \ + '(--cmake --crystal --go --meson --node --perl --python --ruby --rust --zig --cask)--autotools[Create a basic template for an Autotools-style build]' \ + '(--autotools --cmake --crystal --go --meson --node --perl --python --ruby --rust --zig --HEAD --set-license)--cask[Create a basic template for a cask]' \ + '(--autotools --crystal --go --meson --node --perl --python --ruby --rust --zig --cask)--cmake[Create a basic template for a CMake-style build]' \ + '(--autotools --cmake --go --meson --node --perl --python --ruby --rust --zig --cask)--crystal[Create a basic template for a Crystal build]' \ '--debug[Display any debugging information]' \ '--force[Ignore errors for disallowed formula names and names that shadow aliases]' \ - '(--autotools --cmake --crystal --meson --node --perl --python --ruby --rust --cask)--go[Create a basic template for a Go build]' \ + '(--autotools --cmake --crystal --meson --node --perl --python --ruby --rust --zig --cask)--go[Create a basic template for a Go build]' \ '--help[Show this message]' \ - '(--autotools --cmake --crystal --go --node --perl --python --ruby --rust --cask)--meson[Create a basic template for a Meson-style build]' \ + '(--autotools --cmake --crystal --go --node --perl --python --ruby --rust --zig --cask)--meson[Create a basic template for a Meson-style build]' \ '--no-fetch[Homebrew will not download URL to the cache and will thus not add its SHA-256 to the formula for you, nor will it check the GitHub API for GitHub projects (to fill out its description and homepage)]' \ - '(--autotools --cmake --crystal --go --meson --perl --python --ruby --rust --cask)--node[Create a basic template for a Node build]' \ - '(--autotools --cmake --crystal --go --meson --node --python --ruby --rust --cask)--perl[Create a basic template for a Perl build]' \ - '(--autotools --cmake --crystal --go --meson --node --perl --ruby --rust --cask)--python[Create a basic template for a Python build]' \ + '(--autotools --cmake --crystal --go --meson --perl --python --ruby --rust --zig --cask)--node[Create a basic template for a Node build]' \ + '(--autotools --cmake --crystal --go --meson --node --python --ruby --rust --zig --cask)--perl[Create a basic template for a Perl build]' \ + '(--autotools --cmake --crystal --go --meson --node --perl --ruby --rust --zig --cask)--python[Create a basic template for a Python build]' \ '--quiet[Make some output more quiet]' \ - '(--autotools --cmake --crystal --go --meson --node --perl --python --rust --cask)--ruby[Create a basic template for a Ruby build]' \ - '(--autotools --cmake --crystal --go --meson --node --perl --python --ruby --cask)--rust[Create a basic template for a Rust build]' \ + '(--autotools --cmake --crystal --go --meson --node --perl --python --rust --zig --cask)--ruby[Create a basic template for a Ruby build]' \ + '(--autotools --cmake --crystal --go --meson --node --perl --python --ruby --zig --cask)--rust[Create a basic template for a Rust build]' \ '(--cask)--set-license[Explicitly set the license of the new formula]' \ '--set-name[Explicitly set the name of the new formula or cask]' \ '--set-version[Explicitly set the version of the new formula or cask]' \ '--tap[Generate the new formula within the given tap, specified as user`/`repo]' \ - '--verbose[Make some output more verbose]' + '--verbose[Make some output more verbose]' \ + '(--autotools --cmake --crystal --go --meson --node --perl --python --ruby --rust --cask)--zig[Create a basic template for a Zig build]' } # brew debugger diff --git a/docs/Brew-Livecheck.md b/docs/Brew-Livecheck.md index 65cd546248..90ffcbe58c 100644 --- a/docs/Brew-Livecheck.md +++ b/docs/Brew-Livecheck.md @@ -119,8 +119,8 @@ Some checks require making a `POST` request and that can be accomplished by addi ```ruby livecheck do url "https://example.com/download.php", post_form: { - "Name" => "", - "E-mail" => "", + Name: "", + "E-mail": "", } regex(/href=.*?example[._-]v?(\d+(?:\.\d+)+)\.t/i) end diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 755fd6ba1b..7451e5312e 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -74,11 +74,11 @@ Homebrew will try to guess the formula’s name from its URL. If it fails to do ### Fill in the `homepage` -**We don’t accept formulae without a [`homepage`](https://rubydoc.brew.sh/Formula#homepage%3D-class_method)!** +**We don’t accept formulae without a [`homepage`](https://rubydoc.brew.sh/Formula#homepage-class_method)!** -An SSL/TLS (https) [`homepage`](https://rubydoc.brew.sh/Formula#homepage%3D-class_method) is preferred, if one is available. +An SSL/TLS (https) [`homepage`](https://rubydoc.brew.sh/Formula#homepage-class_method) is preferred, if one is available. -Try to summarise from the [`homepage`](https://rubydoc.brew.sh/Formula#homepage%3D-class_method) what the formula does in the [`desc`](https://rubydoc.brew.sh/Formula#desc%3D-class_method)ription. Note that the [`desc`](https://rubydoc.brew.sh/Formula#desc%3D-class_method)ription is automatically prepended with the formula name when printed. +Try to summarise from the [`homepage`](https://rubydoc.brew.sh/Formula#homepage-class_method) what the formula does in the [`desc`](https://rubydoc.brew.sh/Formula#desc-class_method)ription. Note that the [`desc`](https://rubydoc.brew.sh/Formula#desc-class_method)ription is automatically prepended with the formula name when printed. ### Fill in the `license` @@ -179,17 +179,17 @@ conflicts_with "blueduck", because: "yellowduck also ships a duck binary" In Homebrew we sometimes accept formulae updates that don’t include a version bump. These include resource updates, new patches or fixing a security issue with a formula. -Occasionally, these updates require a forced-recompile of the formula itself or its dependents to either ensure formulae continue to function as expected or to close a security issue. This forced-recompile is known as a [`revision`](https://rubydoc.brew.sh/Formula#revision%3D-class_method) and is inserted underneath the [`homepage`](https://rubydoc.brew.sh/Formula#homepage%3D-class_method)/[`url`](https://rubydoc.brew.sh/Formula#url-class_method)/[`sha256`](https://rubydoc.brew.sh/Formula#sha256%3D-class_method)/[`license`](https://rubydoc.brew.sh/Formula#license-class_method) block. +Occasionally, these updates require a forced-recompile of the formula itself or its dependents to either ensure formulae continue to function as expected or to close a security issue. This forced-recompile is known as a [`revision`](https://rubydoc.brew.sh/Formula#revision-class_method) and is inserted underneath the [`homepage`](https://rubydoc.brew.sh/Formula#homepage-class_method)/[`url`](https://rubydoc.brew.sh/Formula#url-class_method)/[`sha256`](https://rubydoc.brew.sh/Formula#sha256-class_method)/[`license`](https://rubydoc.brew.sh/Formula#license-class_method) block. -When a dependent of a formula fails to build against a new version of that dependency it must receive a [`revision`](https://rubydoc.brew.sh/Formula#revision%3D-class_method). An example of such failure is in [this issue report](https://github.com/Homebrew/legacy-homebrew/issues/31195) and [its fix](https://github.com/Homebrew/legacy-homebrew/pull/31207). +When a dependent of a formula fails to build against a new version of that dependency it must receive a [`revision`](https://rubydoc.brew.sh/Formula#revision-class_method). An example of such failure is in [this issue report](https://github.com/Homebrew/legacy-homebrew/issues/31195) and [its fix](https://github.com/Homebrew/legacy-homebrew/pull/31207). -[`revision`](https://rubydoc.brew.sh/Formula#revision%3D-class_method)s are also used for formulae that move from the system OpenSSL to the Homebrew-shipped OpenSSL without any other changes to that formula. This ensures users aren’t left exposed to the potential security issues of the outdated OpenSSL. An example of this can be seen in [this commit](https://github.com/Homebrew/homebrew-core/commit/0d4453a91923e6118983961e18d0609e9828a1a4). +[`revision`](https://rubydoc.brew.sh/Formula#revision-class_method)s are also used for formulae that move from the system OpenSSL to the Homebrew-shipped OpenSSL without any other changes to that formula. This ensures users aren’t left exposed to the potential security issues of the outdated OpenSSL. An example of this can be seen in [this commit](https://github.com/Homebrew/homebrew-core/commit/0d4453a91923e6118983961e18d0609e9828a1a4). ### Version scheme changes Sometimes formulae have version schemes that change such that a direct comparison between two versions no longer produces the correct result. For example, a project might be version `13` and then decide to become `1.0.0`. As `13` is translated to `13.0.0` by our versioning system by default this requires intervention. -When a version scheme of a formula fails to recognise a new version as newer it must receive a [`version_scheme`](https://rubydoc.brew.sh/Formula#version_scheme%3D-class_method). An example of this can be seen in [this pull request](https://github.com/Homebrew/homebrew-core/pull/4006). +When a version scheme of a formula fails to recognise a new version as newer it must receive a [`version_scheme`](https://rubydoc.brew.sh/Formula#version_scheme-class_method). An example of this can be seen in [this pull request](https://github.com/Homebrew/homebrew-core/pull/4006). ### Double-check for dependencies @@ -460,7 +460,7 @@ end ### Standard arguments -For any formula using certain well-known build systems, there will be arguments that should be passed during compilation so that the build conforms to Homebrew standards. These have been collected into a set of `std_*_args` methods. +For any formula using certain well-known build systems, there will be arguments that should be passed during compilation so that the build conforms to Homebrew standards. These have been collected into a set of `std_*_args` methods. Detailed information about each of those methods can be found in [Rubydoc](https://rubydoc.brew.sh/Formula). Most of these methods accept parameters to customize their output. For example, to set the install prefix to [**`libexec`**](#variables-for-directory-locations) for `configure` or `cmake`: @@ -517,6 +517,8 @@ The `std_*_args` methods, as well as the arguments they pass, are: "-o=#{output}" ``` +It also provides a convenient way to set `-ldflags` and `-gcflags`, see examples: [`babelfish`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/b/babelfish.rb) and [`wazero`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/w/wazero.rb) formulae. + #### `std_meson_args` ```ruby @@ -546,6 +548,19 @@ The `std_*_args` methods, as well as the arguments they pass, are: "--no-compile" ``` +#### `std_zig_args` + +```ruby +"--prefix" +prefix +"--release=#{release_mode}" +"-Doptimize=Release#{release_mode}" +"--summary" +"all" +``` + +`release_mode` is a symbol that accepts only `:fast`, `:safe`, and `:small` values (with `:fast` being default). + ### `bin.install "foo"` You’ll see stuff like this in some formulae. This moves the file `foo` into the formula’s `bin` directory (`/opt/homebrew/Cellar/pkg/0.1/bin`) and makes it executable (`chmod 0555 foo`). @@ -889,6 +904,7 @@ Generally we'd rather you were specific about which files or directories need to | **`bash_completion`** | `#{prefix}/etc/bash_completion.d` | `/opt/homebrew/Cellar/foo/0.1/etc/bash_completion.d` | | **`zsh_completion`** | `#{prefix}/share/zsh/site-functions` | `/opt/homebrew/Cellar/foo/0.1/share/zsh/site-functions` | | **`fish_completion`** | `#{prefix}/share/fish/vendor_completions.d` | `/opt/homebrew/Cellar/foo/0.1/share/fish/vendor_completions.d` | +| **`pwsh_completion`** | `#{prefix}/share/pwsh/completions` | `/opt/homebrew/Cellar/foo/0.1/share/pwsh/completions` | | **`etc`** | `#{HOMEBREW_PREFIX}/etc` | `/opt/homebrew/etc` | | **`pkgetc`** | `#{HOMEBREW_PREFIX}/etc/#{name}` | `/opt/homebrew/etc/foo` | | **`var`** | `#{HOMEBREW_PREFIX}/var` | `/opt/homebrew/var` | @@ -1233,7 +1249,7 @@ See our [Deprecating, Disabling and Removing Formulae](Deprecating-Disabling-and ## Updating formulae -When a new version of the software is released, use `brew bump-formula-pr` to automatically update the [`url`](https://rubydoc.brew.sh/Formula#url-class_method) and [`sha256`](https://rubydoc.brew.sh/Formula#sha256%3D-class_method), remove any [`revision`](https://rubydoc.brew.sh/Formula#revision%3D-class_method) lines, and submit a pull request. See our [How to Open a Homebrew Pull Request](How-To-Open-a-Homebrew-Pull-Request.md) documentation for more information. +When a new version of the software is released, use `brew bump-formula-pr` to automatically update the [`url`](https://rubydoc.brew.sh/Formula#url-class_method) and [`sha256`](https://rubydoc.brew.sh/Formula#sha256-class_method), remove any [`revision`](https://rubydoc.brew.sh/Formula#revision-class_method) lines, and submit a pull request. See our [How to Open a Homebrew Pull Request](How-To-Open-a-Homebrew-Pull-Request.md) documentation for more information. ## Troubleshooting for new formulae diff --git a/docs/Homebrew-Governance.md b/docs/Homebrew-Governance.md index 24df3d4796..4ef558aba1 100644 --- a/docs/Homebrew-Governance.md +++ b/docs/Homebrew-Governance.md @@ -64,7 +64,7 @@ last_review_date: "1970-01-01" 1. The financial administration of Homebrew, organisation of the AGM, enforcement of the code of conduct and removal of members are performed by the PLC. The PLC will represent Homebrew in all dealings with Open Collective. -1. The PLC consists of five members, one of whom is the Project Leader. The other committee members are elected by Homebrew members in a [Meek Single Transferable Vote](https://en.wikipedia.org/wiki/Counting_single_transferable_votes#Meek) election using the Droop quota. Each PLC member will serve a term of two years or until the member's successor is elected. The maximum number of consecutive terms a (non-PL) PLC member can serve is two, even if this means they have no successor. Any sudden vacancy in the PLC will be filled by the usual procedure for electing PLC members at the next general meeting, typically the next AGM. +1. The PLC consists of five members, one of whom is the Project Leader. The other committee members are elected by Homebrew members in a [Meek Single Transferable Vote](https://en.wikipedia.org/wiki/Counting_single_transferable_votes#Meek's_method) election using the Droop quota. Each PLC member will serve a term of two years or until the member's successor is elected. The maximum number of consecutive terms a (non-PL) PLC member can serve is two, even if this means they have no successor. Any sudden vacancy in the PLC will be filled by the usual procedure for electing PLC members at the next general meeting, typically the next AGM. 1. When a PLC seat is up for election or is vacant, any member may become a candidate for the PLC by providing a brief statement in the `#members` channel in Homebrew's Slack expressing relevant experience and intentions if elected no later than three weeks before the AGM. The PLC will maintain the candidate list until ballots are sent out one week before the AGM, during which time members should cast their votes. Candidates should deliver remarks in writing or verbally before or during the AGM but votes already cast are not changeable. The current PLC should vote on and publish a statement recommending their preferred candidates within the three-week period between the candidate deadline and the AGM. diff --git a/docs/Installation.md b/docs/Installation.md index 959585a118..cf90ebed01 100644 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -93,6 +93,26 @@ Make sure you avoid installing into: Create a Homebrew installation wherever you extract the tarball. Whichever `brew` command is called is where the packages will be installed. You can use this as you see fit, e.g. to have a system set of libs in the default prefix and tweaked formulae for development in `~/homebrew`. +## Post-installation steps + +When you install Homebrew, it prints some directions for updating your shell's config. +If you don't follow those directions, Homebrew will not work. + +You need to update your shell's config file (which file exactly depends on your shell, for example `~/.bashrc` or `~/.zshrc`) to include this: + +```sh +eval "/bin/brew shellenv)" +``` + +Replace `` with the directory where Homebrew is installed on your system. +You can find Homebrew's default install location [in this FAQ entry](https://docs.brew.sh/FAQ#why-should-i-install-homebrew-in-the-default-location). + +For more insight, re-run the installer or inspect [the installer's source](https://github.com/Homebrew/install/blob/deacfa6a6e62e5f4002baf9e1fac7a96e9aa5d41/install.sh#L1072-L1088) +to see how the installer constructs the path it recommends. + +See [Tips N' Tricks > Loading Homebrew from the same dotfiles on different operating systems](Tips-N'-Tricks.md#loading-homebrew-from-the-same-dotfiles-on-different-operating-systems) +for another way to handle this across multiple operating systems. + ## Uninstallation Uninstallation is documented in the [FAQ](FAQ.md#how-do-i-uninstall-homebrew). diff --git a/docs/Manpage.md b/docs/Manpage.md index e799be7bf4..0ab8fa1a26 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -2154,6 +2154,10 @@ see: : Create a basic template for a Rust build. +`--zig` + +: Create a basic template for a Zig build. + `--no-fetch` : Homebrew will not download *`URL`* to the cache and will thus not add its @@ -3293,6 +3297,10 @@ flags which will help with finding keg-only dependencies like `openssl`, : `install` runs `brew upgrade` on outdated dependencies, even if `$HOMEBREW_BUNDLE_NO_UPGRADE` is set. +`--install` + +: Run `install` before continuing to other operations e.g. `exec`. + `-f`, `--force` : `install` runs with `--force`/`--overwrite`. `dump` overwrites an existing @@ -4279,6 +4287,11 @@ command execution e.g. `$(cat file)`. : If set, pass `--greedy` to all cask upgrade commands. +`HOMEBREW_UPGRADE_GREEDY_CASKS` + +: A space-separated list of casks. Homebrew will act as if `--greedy` was passed + when upgrading any cask on this list. + `HOMEBREW_VERBOSE` : If set, always assume `--verbose` when running commands. diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index 91ada47368..125966f99b 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -74,3 +74,15 @@ if test -d (brew --prefix)"/share/fish/vendor_completions.d" set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d end ``` + +## Configuring Completions in `pwsh` + +To make Homebrew's completions available in `pwsh` (PowerShell), you must source the definitions as part of your shell's startup. Add the following to your `$PROFILE`, for example: `~/.config/powershell/Microsoft.PowerShell_profile.ps1`: + +```pwsh +if ((Get-Command brew) -and (Test-Path ($completions = "$(brew --prefix)/share/pwsh/completions"))) { + foreach ($f in Get-ChildItem -Path $completions -File) { + . $f + } +} +``` diff --git a/docs/Tips-N'-Tricks.md b/docs/Tips-N'-Tricks.md index 85dde92c86..ea2ce64612 100644 --- a/docs/Tips-N'-Tricks.md +++ b/docs/Tips-N'-Tricks.md @@ -140,3 +140,14 @@ export HOMEBREW_ARTIFACT_DOMAIN=https://artifacts.example.com/artifactory/homebr export HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK=1 export HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN="$(printf 'anonymous:' | base64)" ``` + +## Loading Homebrew from the same dotfiles on different operating systems + +Some users may want to use the same shell initialization files on macOS and Linux. +Use this to detect the likely Homebrew installation directory and load Homebrew when it's found. +You may need to adapt this to your particular shell or other particulars of your environment. + +```sh +command -v brew || export PATH="/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/bin" +command -v brew && eval "$(brew shellenv)" +``` diff --git a/docs/governance/2021-agm-minutes.md b/docs/governance/2021-agm-minutes.md index 249767e8e3..6d2ca643e6 100644 --- a/docs/governance/2021-agm-minutes.md +++ b/docs/governance/2021-agm-minutes.md @@ -60,6 +60,6 @@ Voting by proxy is permitted, and proxy votes count towards the quorum for the e #### Project Leadership Committee (PLC) -The Homebrew Project Leadership Committee will be chosen by holding a [Meek Single Transferable Vote (STV)](https://en.wikipedia.org/wiki/Counting_single_transferable_votes#Meek) election. The quota (threshold) of votes for a candidate to be elected will be calculated using the [Droop quota](https://en.wikipedia.org/wiki/Droop_quota). +The Homebrew Project Leadership Committee will be chosen by holding a [Meek Single Transferable Vote (STV)](https://en.wikipedia.org/wiki/Counting_single_transferable_votes#Meek's_method) election. The quota (threshold) of votes for a candidate to be elected will be calculated using the [Droop quota](https://en.wikipedia.org/wiki/Droop_quota). Voting by proxy is permitted, and proxy votes count towards the quorum for the election. diff --git a/manpages/brew.1 b/manpages/brew.1 index d4567eb9ca..8b043c2961 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,5 +1,5 @@ .\" generated by kramdown -.TH "BREW" "1" "February 2025" "Homebrew" +.TH "BREW" "1" "March 2025" "Homebrew" .SH NAME brew \- The Missing Package Manager for macOS (or Linux) .SH "SYNOPSIS" @@ -1368,6 +1368,9 @@ Create a basic template for a Ruby build\. \fB\-\-rust\fP Create a basic template for a Rust build\. .TP +\fB\-\-zig\fP +Create a basic template for a Zig build\. +.TP \fB\-\-no\-fetch\fP Homebrew will not download \fIURL\fP to the cache and will thus not add its SHA\-256 to the formula for you, nor will it check the GitHub API for GitHub projects (to fill out its description and homepage)\. .TP @@ -2112,6 +2115,9 @@ Read the \fBBrewfile\fP from \fB$HOMEBREW_BUNDLE_FILE_GLOBAL\fP (if set), \fB${X \fB\-\-upgrade\fP \fBinstall\fP runs \fBbrew upgrade\fP on outdated dependencies, even if \fB$HOMEBREW_BUNDLE_NO_UPGRADE\fP is set\. .TP +\fB\-\-install\fP +Run \fBinstall\fP before continuing to other operations e\.g\. \fBexec\fP\&\. +.TP \fB\-f\fP, \fB\-\-force\fP \fBinstall\fP runs with \fB\-\-force\fP/\fB\-\-overwrite\fP\&\. \fBdump\fP overwrites an existing \fBBrewfile\fP\&\. \fBcleanup\fP actually performs its cleanup operations\. .TP @@ -2805,6 +2811,9 @@ If set, always use the latest stable tag (even if developer commands have been r \fBHOMEBREW_UPGRADE_GREEDY\fP If set, pass \fB\-\-greedy\fP to all cask upgrade commands\. .TP +\fBHOMEBREW_UPGRADE_GREEDY_CASKS\fP +A space\-separated list of casks\. Homebrew will act as if \fB\-\-greedy\fP was passed when upgrading any cask on this list\. +.TP \fBHOMEBREW_VERBOSE\fP If set, always assume \fB\-\-verbose\fP when running commands\. .TP diff --git a/package/scripts/postinstall b/package/scripts/postinstall index 4296700b90..dc83014913 100755 --- a/package/scripts/postinstall +++ b/package/scripts/postinstall @@ -29,9 +29,9 @@ export HOME="${homebrew_directory}" # reset Git repository cd "${homebrew_directory}" git config --global --add safe.directory "${homebrew_directory}" -git reset --hard -git checkout --force master -git branch | grep -v '\*' | xargs -n 1 git branch --delete --force || true +git checkout --force -B stable +git reset --hard "$(git tag --list --sort="-version:refname" | head -n1)" +git clean -f -d rm "${homebrew_directory}/.gitconfig" # move to /usr/local if on x86_64 @@ -44,8 +44,9 @@ then export HOME="/usr/local/Homebrew" git config --global --add safe.directory /usr/local/Homebrew + git -C /usr/local/Homebrew checkout --force -B stable git -C /usr/local/Homebrew reset --hard - git -C /usr/local/Homebrew checkout --force master + git -C /usr/local/Homebrew clean -f -d rm /usr/local/Homebrew/.gitconfig else mkdir -vp /usr/local/bin