lib/packwerk/cli.rb in packwerk-1.0.1 vs lib/packwerk/cli.rb in packwerk-1.0.2
- old
+ new
@@ -9,21 +9,25 @@
require "packwerk/formatters/progress_formatter"
require "packwerk/inflector"
require "packwerk/output_styles"
require "packwerk/run_context"
require "packwerk/updating_deprecated_references"
+require "packwerk/checking_deprecated_references"
module Packwerk
class Cli
extend T::Sig
def initialize(run_context: nil, configuration: nil, out: $stdout, err_out: $stderr, style: OutputStyles::Plain)
@out = out
@err_out = err_out
@style = style
@configuration = configuration || Configuration.from_path
- @run_context = run_context || Packwerk::RunContext.from_configuration(@configuration)
+ @run_context = run_context || Packwerk::RunContext.from_configuration(
+ @configuration,
+ reference_lister: ::Packwerk::CheckingDeprecatedReferences.new(@configuration.root_path),
+ )
@progress_formatter = Formatters::ProgressFormatter.new(@out, style: style)
end
sig { params(args: T::Array[String]).returns(T.noreturn) }
def run(args)
@@ -136,11 +140,11 @@
@progress_formatter.started(files)
all_offenses = T.let([], T.untyped)
execution_time = Benchmark.realtime do
all_offenses = files.flat_map do |path|
- @run_context.file_processor.call(path).tap { |offenses| mark_progress(offenses) }
+ @run_context.process_file(file: path).tap { |offenses| mark_progress(offenses) }
end
updating_deprecated_references.dump_deprecated_references_files
end
@@ -158,11 +162,11 @@
@progress_formatter.started(files)
all_offenses = T.let([], T.untyped)
execution_time = Benchmark.realtime do
files.each do |path|
- @run_context.file_processor.call(path).tap do |offenses|
+ @run_context.process_file(file: path).tap do |offenses|
mark_progress(offenses)
all_offenses.concat(offenses)
end
end
rescue Interrupt
@@ -198,10 +202,9 @@
" use `bin/packwerk validate` instead.") unless defined?(::Rails)
@progress_formatter.started_validation do
checker = Packwerk::ApplicationValidator.new(
config_file_path: @configuration.config_path,
- application_load_paths: @configuration.all_application_autoload_paths,
configuration: @configuration
)
result = checker.check_all
list_validation_errors(result)