sorbet 0.5.5841
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/srb +150 -0
- data/bin/srb-rbi +237 -0
- data/lib/constant_cache.rb +226 -0
- data/lib/create-config.rb +37 -0
- data/lib/fetch-rbis.rb +129 -0
- data/lib/find-gem-rbis.rb +52 -0
- data/lib/gem-generator-tracepoint.rb +54 -0
- data/lib/gem-generator-tracepoint/tracepoint_serializer.rb +267 -0
- data/lib/gem-generator-tracepoint/tracer.rb +189 -0
- data/lib/gem_loader.rb +1249 -0
- data/lib/gem_loader.rbi +15 -0
- data/lib/hidden-definition-finder.rb +456 -0
- data/lib/real_stdlib.rb +84 -0
- data/lib/require_everything.rb +181 -0
- data/lib/serialize.rb +362 -0
- data/lib/status.rb +21 -0
- data/lib/step_interface.rb +11 -0
- data/lib/suggest-typed.rb +59 -0
- data/lib/t.rb +57 -0
- data/lib/todo-rbi.rb +48 -0
- metadata +133 -0
data/lib/status.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# typed: true
|
3
|
+
|
4
|
+
module Sorbet::Private::Status
|
5
|
+
def self.say(message, print_without_tty: true)
|
6
|
+
if STDOUT.isatty
|
7
|
+
# Carriage return to reset cursor, ANSI escape code to clear current line.
|
8
|
+
# (In case the new message is shorter than the old message.)
|
9
|
+
print "\r\033[K#{message}"
|
10
|
+
elsif print_without_tty
|
11
|
+
puts message
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.done
|
16
|
+
if STDOUT.isatty
|
17
|
+
# Clear the require_relative output when we're done requiring.
|
18
|
+
print "\r\033[K"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative './step_interface'
|
5
|
+
|
6
|
+
class Sorbet; end
|
7
|
+
module Sorbet::Private; end
|
8
|
+
class Sorbet::Private::SuggestTyped
|
9
|
+
include Sorbet::Private::StepInterface
|
10
|
+
|
11
|
+
def self.main
|
12
|
+
count = 0
|
13
|
+
while count < 100
|
14
|
+
count += 1
|
15
|
+
if suggest_typed
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
|
19
|
+
if count == 50
|
20
|
+
puts "Adding `typed:` sigils did not converge after 50 tries."
|
21
|
+
STDOUT.write("Would you like to continue anyway? [Y/n] ")
|
22
|
+
if STDIN.isatty && STDOUT.isatty
|
23
|
+
begin
|
24
|
+
input = STDIN.gets&.strip
|
25
|
+
if input.nil? || (input != '' && input != 'y' && input != 'Y')
|
26
|
+
return false
|
27
|
+
end
|
28
|
+
rescue Interrupt
|
29
|
+
return false
|
30
|
+
end
|
31
|
+
else
|
32
|
+
puts "Not running interactively, continuing."
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
puts "Adding `typed:` sigils did not converge after 100 tries."
|
38
|
+
false
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.suggest_typed
|
42
|
+
IO.popen(
|
43
|
+
[File.realpath("#{__dir__}/../bin/srb"), 'tc', '--suggest-typed', '--error-white-list=7022', '--typed=strict', '--silence-dev-message', '-a'],
|
44
|
+
err: [:child, :out],
|
45
|
+
) do |io|
|
46
|
+
out = io.read
|
47
|
+
return true if out == "No errors! Great job.\n"
|
48
|
+
end
|
49
|
+
false
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.output_file
|
53
|
+
nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
if $PROGRAM_NAME == __FILE__
|
58
|
+
Sorbet::Private::SuggestTyped.main
|
59
|
+
end
|
data/lib/t.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# typed: false
|
3
|
+
|
4
|
+
# This file contains runtime stubs to make `T::Sig::WithoutRuntime.sig` work in
|
5
|
+
# the runtime. We're using `T::Sig::WithoutRuntime.sig` in this gem because we
|
6
|
+
# don't want to have to depend on the sorbet-runtime gem.
|
7
|
+
|
8
|
+
# Note that in particular because sigs are lazily evaluated and
|
9
|
+
# `T::Sig::WithoutRuntime.sig` never forces the sig block, we don't actually
|
10
|
+
# need implementations for anything that can only go inside the sig block.
|
11
|
+
|
12
|
+
module T
|
13
|
+
module Sig
|
14
|
+
module WithoutRuntime
|
15
|
+
def self.sig(arg=nil, &blk); end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.any(type_a, type_b, *types); end
|
20
|
+
def self.nilable(type); end
|
21
|
+
def self.untyped; end
|
22
|
+
def self.noreturn; end
|
23
|
+
def self.all(type_a, type_b, *types); end
|
24
|
+
def self.enum(values); end
|
25
|
+
def self.proc; end
|
26
|
+
def self.self_type; end
|
27
|
+
def self.class_of(klass); end
|
28
|
+
def self.type_alias(type=nil, &blk); end
|
29
|
+
def self.type_parameter(name); end
|
30
|
+
|
31
|
+
def self.cast(value, type, checked: true); value; end
|
32
|
+
def self.let(value, type, checked: true); value; end
|
33
|
+
def self.assert_type!(value, type, checked: true); value; end
|
34
|
+
def self.unsafe(value); value; end
|
35
|
+
def self.must(arg, msg=nil); arg; end
|
36
|
+
def self.reveal_type(value); value; end
|
37
|
+
|
38
|
+
module Array
|
39
|
+
def self.[](type); end
|
40
|
+
end
|
41
|
+
|
42
|
+
module Hash
|
43
|
+
def self.[](keys, values); end
|
44
|
+
end
|
45
|
+
|
46
|
+
module Enumerable
|
47
|
+
def self.[](type); end
|
48
|
+
end
|
49
|
+
|
50
|
+
module Range
|
51
|
+
def self.[](type); end
|
52
|
+
end
|
53
|
+
|
54
|
+
module Set
|
55
|
+
def self.[](type); end
|
56
|
+
end
|
57
|
+
end
|
data/lib/todo-rbi.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
require_relative './serialize'
|
7
|
+
require_relative './step_interface'
|
8
|
+
|
9
|
+
class Sorbet::Private::TodoRBI
|
10
|
+
OUTPUT = 'sorbet/rbi/todo.rbi'
|
11
|
+
HEADER = Sorbet::Private::Serialize.header('strong', 'todo')
|
12
|
+
|
13
|
+
include Sorbet::Private::StepInterface
|
14
|
+
|
15
|
+
def self.main
|
16
|
+
File.delete(OUTPUT) if File.exist?(OUTPUT)
|
17
|
+
|
18
|
+
IO.popen(
|
19
|
+
[
|
20
|
+
File.realpath("#{__dir__}/../bin/srb"),
|
21
|
+
'tc',
|
22
|
+
'--print=missing-constants',
|
23
|
+
'--stdout-hup-hack',
|
24
|
+
'--silence-dev-message',
|
25
|
+
'--no-error-count',
|
26
|
+
],
|
27
|
+
err: '/dev/null',
|
28
|
+
) do |io|
|
29
|
+
missing_constants = io.read.split("\n")
|
30
|
+
|
31
|
+
output = String.new
|
32
|
+
output << HEADER
|
33
|
+
missing_constants.each do |const|
|
34
|
+
next if const.include?("<") || const.include?("class_of")
|
35
|
+
output << "module #{const.gsub('T.untyped::', '')}; end\n"
|
36
|
+
end
|
37
|
+
File.write(OUTPUT, output) if output != HEADER
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.output_file
|
42
|
+
OUTPUT
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
if $PROGRAM_NAME == __FILE__
|
47
|
+
Sorbet::Private::TodoRBI.main
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sorbet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.5841
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stripe
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sorbet-static
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.5.5841
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.5.5841
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.11'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.11'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mocha
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: The main entrypoint for using Sorbet
|
70
|
+
email: sorbet@stripe.com
|
71
|
+
executables:
|
72
|
+
- srb-rbi
|
73
|
+
- srb
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- bin/srb
|
78
|
+
- bin/srb-rbi
|
79
|
+
- lib/constant_cache.rb
|
80
|
+
- lib/create-config.rb
|
81
|
+
- lib/fetch-rbis.rb
|
82
|
+
- lib/find-gem-rbis.rb
|
83
|
+
- lib/gem-generator-tracepoint.rb
|
84
|
+
- lib/gem-generator-tracepoint/tracepoint_serializer.rb
|
85
|
+
- lib/gem-generator-tracepoint/tracer.rb
|
86
|
+
- lib/gem_loader.rb
|
87
|
+
- lib/gem_loader.rbi
|
88
|
+
- lib/hidden-definition-finder.rb
|
89
|
+
- lib/real_stdlib.rb
|
90
|
+
- lib/require_everything.rb
|
91
|
+
- lib/serialize.rb
|
92
|
+
- lib/status.rb
|
93
|
+
- lib/step_interface.rb
|
94
|
+
- lib/suggest-typed.rb
|
95
|
+
- lib/t.rb
|
96
|
+
- lib/todo-rbi.rb
|
97
|
+
homepage: https://sorbet.run
|
98
|
+
licenses:
|
99
|
+
- Apache-2.0
|
100
|
+
metadata:
|
101
|
+
source_code_uri: https://github.com/sorbet/sorbet
|
102
|
+
post_install_message: |2
|
103
|
+
|
104
|
+
Thanks for installing Sorbet! To use it in your project, first run:
|
105
|
+
|
106
|
+
bundle exec srb init
|
107
|
+
|
108
|
+
which will get your project ready to use with Sorbet.
|
109
|
+
After that whenever you want to typecheck your code, run:
|
110
|
+
|
111
|
+
bundle exec srb tc
|
112
|
+
|
113
|
+
For more docs see: https://sorbet.org/docs/adopting
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 2.3.0
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 2.5.2.3
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: A Typechecker for Ruby
|
133
|
+
test_files: []
|