1+ # frozen_string_literal: true
12# typed: strict
23
34require 'sorbet-runtime'
1920module PackStats
2021 extend T ::Sig
2122
22- ROOT_PACKAGE_NAME = T . let ( 'root' . freeze , String )
23+ ROOT_PACKAGE_NAME = T . let ( 'root' , String )
2324
2425 DEFAULT_COMPONENTIZED_SOURCE_CODE_LOCATIONS = T . let (
2526 [
2627 Pathname . new ( 'components' ) ,
27- Pathname . new ( 'gems' ) ,
28+ Pathname . new ( 'gems' )
2829 ] . freeze , T ::Array [ Pathname ]
2930 )
3031
@@ -47,17 +48,17 @@ def self.report_to_datadog!(
4748 app_name :,
4849 source_code_pathnames :,
4950 componentized_source_code_locations : DEFAULT_COMPONENTIZED_SOURCE_CODE_LOCATIONS ,
50- report_time : Time . now , # rubocop:disable Rails/TimeZone
51+ report_time : Time . now ,
5152 verbose : false ,
5253 packaged_source_code_locations : [ ] ,
5354 max_enforcements_tag_value : false
5455 )
5556
56- all_metrics = self . get_metrics (
57- source_code_pathnames : source_code_pathnames ,
58- componentized_source_code_locations : componentized_source_code_locations ,
59- app_name : app_name ,
60- max_enforcements_tag_value : max_enforcements_tag_value ,
57+ all_metrics = get_metrics (
58+ source_code_pathnames :,
59+ componentized_source_code_locations :,
60+ app_name :,
61+ max_enforcements_tag_value :
6162 )
6263
6364 # This helps us debug what metrics are being sent
@@ -68,8 +69,8 @@ def self.report_to_datadog!(
6869 end
6970
7071 Private ::DatadogReporter . report! (
71- datadog_client : datadog_client ,
72- report_time : report_time ,
72+ datadog_client :,
73+ report_time :,
7374 metrics : all_metrics
7475 )
7576 end
@@ -100,17 +101,17 @@ def self.get_metrics(
100101
101102 Private ::DatadogReporter . get_metrics (
102103 source_code_files : source_code_files (
103- source_code_pathnames : source_code_pathnames ,
104- componentized_source_code_locations : componentized_source_code_locations ,
104+ source_code_pathnames :,
105+ componentized_source_code_locations :
105106 ) ,
106- app_name : app_name
107+ app_name :
107108 )
108109 end
109110
110111 sig do
111112 params (
112113 source_code_pathnames : T ::Array [ Pathname ] ,
113- componentized_source_code_locations : T ::Array [ Pathname ] ,
114+ componentized_source_code_locations : T ::Array [ Pathname ]
114115 ) . returns ( T ::Array [ Private ::SourceCodeFile ] )
115116 end
116117 def self . source_code_files (
@@ -119,7 +120,9 @@ def self.source_code_files(
119120 )
120121
121122 # Sorbet has the wrong signatures for `Pathname#find`, whoops!
122- componentized_file_set = Set . new ( componentized_source_code_locations . select ( &:exist? ) . flat_map { |pathname | T . unsafe ( pathname ) . find . to_a } )
123+ componentized_file_set = Set . new ( componentized_source_code_locations . select ( &:exist? ) . flat_map do |pathname |
124+ T . unsafe ( pathname ) . find . to_a
125+ end )
123126
124127 packaged_file_set = Packs . all . flat_map do |pack |
125128 pack . relative_path . find . to_a
@@ -132,7 +135,7 @@ def self.source_code_files(
132135 packaged_file = packaged_file_set . include? ( pathname )
133136
134137 Private ::SourceCodeFile . new (
135- pathname : pathname ,
138+ pathname :,
136139 team_owner : CodeOwnership . for_file ( pathname . to_s ) ,
137140 is_componentized_file : componentized_file ,
138141 is_packaged_file : packaged_file
0 commit comments