sorbet 0.4.4537 → 0.4.4538

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/require_everything.rb +32 -3
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '019969e65040602aef3172180f8995fbdc1badac'
4
- data.tar.gz: a964105f0f9b976270505ede585f49b56475d9e4
3
+ metadata.gz: 2ed2886670af759de0be9468f215a89f4c7b2765
4
+ data.tar.gz: d4cbe7f03463bd0392006895115e0bc4dd12bee1
5
5
  SHA512:
6
- metadata.gz: 74c6ae6ae02a22cc297dfd880aa1d68878719a3cf64128635d23e9b9dbfcd742c1a2346c23aed335a0e58debf683b2dcc5e988e10779767e5c8ae90685f3adf7
7
- data.tar.gz: aca49868a1fdc553213ec8174f8a89e81f05267a6bc3e84f3d0cecd75c226b62d898389552f3afcb4dd1adee45d8a481be99ab2cc6b56de2535e35afe178dcb9
6
+ metadata.gz: dbbc18e54949e11f6f66e54189264e2657181822753e31b3f853631c6248a8b6fa4c711b325f910a0d71af241ad83004b5480f87b8e017b74fe95747a7ed0af9
7
+ data.tar.gz: d994a399159a208e542daeadff4c9db4d9a273c5930ef600014c9e6ec93b2943e28c56b899af83d7883835f752dcfe3ea61db1a9983d2613a1ac9bdef6e726c2
@@ -43,7 +43,7 @@ class Sorbet::Private::RequireEverything
43
43
  excluded_paths = Set.new
44
44
  excluded_paths += excluded_rails_files if rails?
45
45
 
46
- abs_paths = Dir.glob("#{Dir.pwd}/**/*.rb")
46
+ abs_paths = rb_file_paths
47
47
  errors = []
48
48
  abs_paths.each_with_index do |abs_path, i|
49
49
  # Executable files are likely not meant to be required.
@@ -59,8 +59,6 @@ class Sorbet::Private::RequireEverything
59
59
  # generate it without using the whole rails ecosystem.
60
60
  next if /db\/schema.rb$/.match(abs_path)
61
61
 
62
- next if /^# +typed: +ignore$/.match(File.read(abs_path).scrub)
63
-
64
62
  begin
65
63
  my_require(abs_path, i+1, abs_paths.size)
66
64
  rescue LoadError, NoMethodError, SyntaxError
@@ -106,6 +104,37 @@ class Sorbet::Private::RequireEverything
106
104
 
107
105
  private
108
106
 
107
+ def self.rb_file_paths
108
+ srb = File.realpath("#{__dir__}/../bin/srb")
109
+ output = IO.popen([
110
+ srb,
111
+ "tc",
112
+ "-p",
113
+ "file-table-json",
114
+ "--stop-after=parser",
115
+ "--silence-dev-message",
116
+ "--no-error-count",
117
+ ]) {|io| io.read}
118
+ # This returns a hash with structure:
119
+ # { files:
120
+ # [
121
+ # {
122
+ # "strict": ["Ignore"|"False"|"True"|"Strict"|"Strong"|"Stdlib"],
123
+ # "path": "./path/to/file",
124
+ # ...
125
+ # }
126
+ # ...
127
+ # ]
128
+ # }
129
+ parsed = JSON.parse(output)
130
+ parsed['files']
131
+ .reject{|file| ["Ignore", "Stdlib"].include?(file["strict"])}
132
+ .map{|file| file["path"]}
133
+ .select{|path| File.file?(path)} # Some files have https:// paths. We ignore those here.
134
+ .select{|path| /.rb$/.match(path)}
135
+ .map{|path| File.expand_path(path)} # Requires absolute path
136
+ end
137
+
109
138
  def self.excluded_rails_files
110
139
  excluded_paths = Set.new
111
140
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4537
4
+ version: 0.4.4538
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.4537
19
+ version: 0.4.4538
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.4537
26
+ version: 0.4.4538
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement