File: require-strict-typing

package info (click to toggle)
ruby-pdf-reader 2.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,512 kB
  • sloc: ruby: 11,959; sh: 46; makefile: 11
file content (23 lines) | stat: -rwxr-xr-x 712 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env ruby

sha_that_introduced_sorbet = 'feb9203'

raw_files_added = `git diff --numstat --diff-filter=A #{sha_that_introduced_sorbet} HEAD -- lib/`

just_files_added = raw_files_added.split("\n").map { |line|
  line.split(/\s+/).last
}

files_added_without_strict_typing = just_files_added.reject { |path|
  File.read(path).include?("typed: strict")
}

if files_added_without_strict_typing.any?
  $stderr.puts "The following source files added since #{sha_that_introduced_sorbet} need 'typed: strict' added:'"
  files_added_without_strict_typing.each do |path|
    $stderr.puts "- #{path}"
  end
  exit 1
else
  puts "All source files added since #{sha_that_introduced_sorbet} have strict typing"
end