Merge pull request #13989 from issyl0/sorbet-rbi-is-in-maintenance

This commit is contained in:
Issy Long 2022-10-12 08:48:45 +01:00 committed by GitHub
commit 8684f953f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 29 additions and 52 deletions

View File

@ -34,6 +34,7 @@ gem "warning", require: false
group :sorbet, optional: true do
gem "parlour", require: false
gem "sorbet-static-and-runtime", require: false
gem "spoom", require: false
gem "tapioca", require: false
end

View File

@ -236,6 +236,7 @@ DEPENDENCIES
simplecov-cobertura
sorbet-runtime
sorbet-static-and-runtime
spoom
tapioca
warning

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "cask/artifact/moved"

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "cask/artifact/relocated"

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "plist"

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "cask/artifact/moved"

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "cask/artifact/relocated"

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "language/python"

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "formula"

View File

@ -68,38 +68,11 @@ module Homebrew
safe_system "bundle", "exec", "tapioca", "gem", *tapioca_args
safe_system "bundle", "exec", "parlour"
safe_system "bundle", "exec", "srb", "rbi", "hidden-definitions"
safe_system "bundle", "exec", "srb", "rbi", "todo"
safe_system "bundle", "exec", "tapioca", "todo"
if args.suggest_typed?
result = system_command(
"bundle",
args: ["exec", "--", "srb", "tc", "--suggest-typed", "--typed=strict",
"--isolate-error-code=7022"],
print_stderr: false,
)
allowed_changes = {
"false" => ["true", "strict"],
"true" => ["strict"],
}
# Workaround for `srb tc rbi suggest-typed`, which currently fails get to a converging state.
result.stderr.scan(/^(.*\.rb):\d+:\s+You could add `#\s*typed:\s*(.*?)`/).each do |path, new_level|
path = Pathname(path)
next unless path.file?
contents = path.read
next unless (match = contents.match(/\A\s*#\s*typed:\s*([^\s]+)/))
existing_level = match[1]
next unless allowed_changes.fetch(existing_level, []).include?(new_level)
puts "#{path}: #{existing_level} -> #{new_level}"
path.atomic_write contents.sub(/\A(\s*#\s*typed:\s*)(?:[^\s]+)/, "\\1#{new_level}")
end
ohai "Bumping Sorbet `typed` sigils..."
safe_system "bundle", "exec", "spoom", "bump"
end
return

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "cli/parser"

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "extend/os/linux/args" if OS.linux?

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
module Homebrew

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
module Homebrew

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "extend/os/linux/parser" if OS.linux?

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
# List of formulae that had a revision in linuxbrew-core

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "open3"

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "forwardable"

View File

@ -1,7 +1,9 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# srb rbi todo
# DO NOT EDIT MANUALLY
# This is an autogenerated file for unresolved constants.
# Please instead update this file by running `bin/tapioca todo`.
# typed: false
# typed: strong
module ::StackProf; end
module T::InterfaceWrapper::Helpers; end
module T::Private::Abstract::Hooks; end

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
module UnpackStrategy

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "fcntl"

View File

@ -1,5 +1,5 @@
#!/usr/bin/env ruby
# typed: false
# typed: true
# frozen_string_literal: true
require_relative "../standalone"

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
# from https://github.com/lsegal/yard/issues/484#issuecomment-442586899