File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def self.data_accessor_name(key = default_data_accessor_name)
2525 sig { returns ( String ) }
2626 def self . default_data_accessor_name
2727 # e.g., MyNamespace::MyPlugin -> my_plugin
28- Utils . underscore ( Utils . demodulize ( name ) )
28+ Utils . underscore ( Utils . demodulize ( T . must ( name ) ) )
2929 end
3030
3131 sig { params ( base : T . untyped ) . void }
Original file line number Diff line number Diff line change @@ -40,14 +40,14 @@ def self.enable!
4040 end
4141 end
4242
43- sig { params ( attributes : T ::Hash [ T . untyped , T . untyped ] ) . returns ( CodeTeams ::Team ) }
43+ sig { params ( attributes : T ::Hash [ Symbol , T . untyped ] ) . returns ( CodeTeams ::Team ) }
4444 def self . create_code_team ( attributes )
4545 attributes = attributes . dup
4646 attributes [ :name ] ||= "Fake Team #{ SecureRandom . hex ( 4 ) } "
4747
4848 code_team = CodeTeams ::Team . new (
4949 config_yml : 'tmp/fake_config.yml' ,
50- raw_hash : T . cast ( Utils . deep_stringify_keys ( attributes ) , T :: Hash [ T . untyped , T . untyped ] )
50+ raw_hash : Utils . deep_stringify_keys ( attributes )
5151 )
5252
5353 code_teams << code_team
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+ #
3+ # typed: strict
4+
15module CodeTeams
26 module Utils
7+ extend T ::Sig
8+
39 module_function
410
11+ sig { params ( string : String ) . returns ( String ) }
512 def underscore ( string )
613 string . gsub ( '::' , '/' )
714 . gsub ( /([A-Z]+)([A-Z][a-z])/ , '\1_\2' )
@@ -10,10 +17,13 @@ def underscore(string)
1017 . downcase
1118 end
1219
20+ sig { params ( string : String ) . returns ( String ) }
1321 def demodulize ( string )
14- string . split ( '::' ) . last
22+ T . must ( string . split ( '::' ) . last )
1523 end
1624
25+ # Recursively converts symbol keys to strings. Top-level input should be a Hash.
26+ sig { params ( value : T . untyped ) . returns ( T . untyped ) }
1727 def deep_stringify_keys ( value )
1828 case value
1929 when Hash
You can’t perform that action at this time.
0 commit comments