@@ -16,7 +16,7 @@ class ArrowHead < T::Enum
1616 enums do
1717 DependencyTodo = new ( 'color=darkred style=dashed arrowhead=odiamond' )
1818 PrivacyTodo = new ( 'color=darkred style=dashed arrowhead=crow' )
19- ArchitectureTodo = new ( 'color=darkred style=dashed arrowhead=obox' )
19+ LayerTodo = new ( 'color=darkred style=dashed arrowhead=obox' )
2020 VisibilityTodo = new ( 'color=darkred style=dashed arrowhead=tee' )
2121 FolderVisibilityTodo = new ( 'color=darkred style=dashed arrowhead=odot' )
2222 ConfiguredDependency = new ( 'color=darkgreen' )
@@ -40,18 +40,18 @@ def self.package_graph!(args, raw_config, packages)
4040
4141 title = diagram_title ( args , options , max_todo_count )
4242
43- architecture_layers = ( raw_config [ 'architecture_layers ' ] || [ ] ) + [ "NotInLayer" ]
44- grouped_packages = architecture_layers . inject ( { } ) do |result , key |
43+ layers = ( raw_config [ 'layers ' ] || [ ] ) + [ "NotInLayer" ]
44+ grouped_packages = layers . inject ( { } ) do |result , key |
4545 result [ key ] = [ ]
4646 result
4747 end
4848
4949 all_packages . each do |package |
5050 key = package . config [ 'layer' ] || "NotInLayer"
51- if architecture_layers . include? ( key )
51+ if layers . include? ( key )
5252 grouped_packages [ key ] << package
5353 else
54- raise RuntimeError , "Package #{ package . name } has architecture layer key #{ key } . Known layers are only #{ architecture_layers . join ( ", " ) } "
54+ raise RuntimeError , "Package #{ package . name } has layer key #{ key } . Known layers are only #{ layers . join ( ", " ) } "
5555 end
5656 end
5757
@@ -64,7 +64,7 @@ def self.package_graph!(args, raw_config, packages)
6464 template . result ( binding )
6565 end
6666
67- private
67+ private
6868
6969 sig { params ( package : ParsePackwerk ::Package ) . returns ( T . nilable ( String ) ) }
7070 def self . code_owner ( package )
@@ -91,7 +91,7 @@ def self.diagram_title(args, options, max_todo_count)
9191
9292 focus_info = if options . focus_pack
9393 "Focus on #{ limited_sentence ( options . focus_pack ) } (Edge mode: #{ options . show_only_edges_to_focus_pack . serialize } )"
94- else
94+ else
9595 "All packs"
9696 end
9797
@@ -135,8 +135,8 @@ def self.limited_sentence(list)
135135 sig { params ( options : Options , all_package_names : T ::Array [ String ] ) . returns ( T . proc . params ( arg0 : String , arg1 : String ) . returns ( T ::Boolean ) ) }
136136 def self . show_edge_builder ( options , all_package_names )
137137 return lambda do |start_node , end_node |
138- all_package_names . include? ( start_node ) &&
139- all_package_names . include? ( end_node ) &&
138+ all_package_names . include? ( start_node ) &&
139+ all_package_names . include? ( end_node ) &&
140140 (
141141 case options . show_only_edges_to_focus_pack
142142 when FocusPackEdgeDirection ::All then
@@ -159,11 +159,11 @@ def self.node_color_builder
159159 return lambda do |text |
160160 return unless text
161161 hash_value = Digest ::SHA256 . hexdigest ( text . encode ( 'utf-8' ) )
162- color_code = hash_value [ 0 , 6 ]
163- r = color_code [ 0 , 2 ] . to_i ( 16 ) % 128 + 128
164- g = color_code [ 2 , 2 ] . to_i ( 16 ) % 128 + 128
165- b = color_code [ 4 , 2 ] . to_i ( 16 ) % 128 + 128
166- hex = "#%02X%02X%02X" % [ r , g , b ]
162+ color_code = T . must ( hash_value [ 0 , 6 ] )
163+ r = T . must ( color_code [ 0 , 2 ] ) . to_i ( 16 ) % 128 + 128
164+ g = T . must ( color_code [ 2 , 2 ] ) . to_i ( 16 ) % 128 + 128
165+ b = T . must ( color_code [ 4 , 2 ] ) . to_i ( 16 ) % 128 + 128
166+ "#%02X%02X%02X" % [ r , g , b ]
167167 end
168168 end
169169
@@ -224,7 +224,7 @@ def self.filtered(packages, options)
224224 res [ p . name ] = p
225225 res
226226 end
227-
227+
228228 result = T . let ( [ ] , T ::Array [ T . nilable ( String ) ] )
229229 result = packages . map { |pack | pack . name }
230230
@@ -244,7 +244,7 @@ def self.filtered(packages, options)
244244 when FocusPackEdgeDirection ::In then
245245 result += dependents + todos_in
246246 when FocusPackEdgeDirection ::Out then
247- result += dependencies + todos_out
247+ result += dependencies + todos_out
248248 when FocusPackEdgeDirection ::None then
249249 # nothing to do
250250 end
@@ -314,9 +314,9 @@ def self.remove_nested_packs(packages, options)
314314
315315 morphed_todos = T . must ( package . violations ) . map do |v |
316316 ParsePackwerk ::Violation . new (
317- type : v . type ,
318- to_package_name : nested_packages [ v . to_package_name ] || v . to_package_name ,
319- class_name : v . class_name ,
317+ type : v . type ,
318+ to_package_name : nested_packages [ v . to_package_name ] || v . to_package_name ,
319+ class_name : v . class_name ,
320320 files : v . files
321321 )
322322 end . reject { |v | v . to_package_name == package . name }
@@ -346,7 +346,7 @@ def self.match_packs?(pack, packs_name_with_wildcards)
346346 sig { params ( all_packages : T ::Array [ ParsePackwerk ::Package ] , focus_packs_names : T ::Array [ String ] ) . returns ( T ::Array [ String ] ) }
347347 def self . dependencies_of ( all_packages , focus_packs_names )
348348 focus_packs = all_packages . select { focus_packs_names . include? ( _1 . name ) }
349-
349+
350350 focus_packs . inject ( [ ] ) do |result , pack |
351351 result += pack . dependencies
352352 result
@@ -385,7 +385,7 @@ def self.package_based_todos_for(protection, package_name, rubocop_config, rubo
385385
386386 raise ArgumentError unless [ 'Packs/ClassMethodsAsPublicApis' , 'Packs/DocumentedPublicApis' , 'Packs/RootNamespaceIsPackName' , 'Packs/TypedPublicApis' ] . include? ( protection )
387387 return nil unless ( rubocop_config . dig ( protection ) &.dig ( 'Enabled' ) )
388-
388+
389389 ( rubocop_todo . dig ( protection ) &.dig ( 'Exclude' ) || [ ] ) . inject ( 0 ) do |result , todo |
390390 result += 1 if todo . start_with? ( "#{ package_name } /" )
391391 result
@@ -396,17 +396,17 @@ def self.package_based_todos_for(protection, package_name, rubocop_config, rubo
396396 def self . package_based_todos_text_maker
397397 -> ( package_name ) {
398398 [
399- 'Packs/ClassMethodsAsPublicApis' ,
400- 'Packs/DocumentedPublicApis' ,
401- 'Packs/RootNamespaceIsPackName' ,
399+ 'Packs/ClassMethodsAsPublicApis' ,
400+ 'Packs/DocumentedPublicApis' ,
401+ 'Packs/RootNamespaceIsPackName' ,
402402 'Packs/TypedPublicApis'
403403 ] . map do |protection |
404404 rubocop_config = File . exist? ( "#{ package_name } /.rubocop.yml" ) ? YAML . load_file ( "#{ package_name } /.rubocop.yml" ) : { }
405405 rubocop_todo = File . exist? ( ".rubocop_todo.yml" ) ? YAML . load_file ( ".rubocop_todo.yml" ) : { }
406406
407407 todo_value = package_based_todos_for ( protection , package_name , rubocop_config , rubocop_todo )
408408 abbreviation = T . must ( protection . split ( '/' ) [ 1 ] ) . chars [ 0 ]
409-
409+
410410 "#{ abbreviation } : #{ todo_value } " if todo_value
411411 end . compact . join ( ", " )
412412 }
0 commit comments