Skip to content

Commit

Permalink
Turn off typechecking when called from exe
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcgibbon committed Jan 6, 2023
1 parent 589f784 commit f91af9e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions exe/packwerk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "disable_sorbet"
require "packwerk"

# Needs to be run in test environment in order to have test helper paths available in the autoload paths
Expand Down
30 changes: 30 additions & 0 deletions lib/disable_sorbet.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# typed: true
# frozen_string_literal: true

require "sorbet-runtime"

T::Configuration.default_checked_level = :never

T.singleton_class.prepend(
Module.new do
def cast(value, type, checked: true)
value
end

def let(value, type, checked: true)
value
end

def must(arg)
arg
end

def absurd(value)
value
end

def bind(value, type, checked: true)
value
end
end
)
1 change: 1 addition & 0 deletions lib/packwerk/spring_command.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# typed: strict
# frozen_string_literal: true

require "disable_sorbet"
require "spring/commands"

module Packwerk
Expand Down

0 comments on commit f91af9e

Please sign in to comment.