lib/packwerk/run_context.rb in packwerk-2.1.1 vs lib/packwerk/run_context.rb in packwerk-2.2.0
- old
+ new
@@ -36,11 +36,11 @@
end
sig do
params(
root_path: String,
- load_paths: T::Array[String],
+ load_paths: T::Hash[String, Module],
inflector: T.class_of(ActiveSupport::Inflector),
cache_directory: Pathname,
config_path: T.nilable(String),
package_paths: T.nilable(T.any(T::Array[String], String)),
custom_associations: AssociationInspector::CustomAssociations,
@@ -77,16 +77,18 @@
)
end
sig { params(absolute_file: String).returns(T::Array[Packwerk::Offense]) }
def process_file(absolute_file:)
- unresolved_references_and_offenses = file_processor.call(absolute_file)
- references_and_offenses = ReferenceExtractor.get_fully_qualified_references_and_offenses_from(
- unresolved_references_and_offenses,
+ processed_file = file_processor.call(absolute_file)
+
+ references = ReferenceExtractor.get_fully_qualified_references_from(
+ processed_file.unresolved_references,
context_provider
)
reference_checker = ReferenceChecking::ReferenceChecker.new(@checkers)
- references_and_offenses.flat_map { |reference| reference_checker.call(reference) }
+
+ processed_file.offenses + references.flat_map { |reference| reference_checker.call(reference) }
end
private
sig { returns(FileProcessor) }