Class: Packwerk::Commands::CheckCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Packwerk::Commands::CheckCommand
- Defined in:
- lib/packwerk/commands/check_command.rb
Instance Method Summary collapse
-
#run ⇒ Object
: -> bool.
Methods inherited from BaseCommand
Instance Method Details
#run ⇒ Object
: -> bool
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/packwerk/commands/check_command.rb', line 13 def run if @files_for_processing.files.empty? out.puts(<<~MSG.squish) No files found or given. Specify files or check the include and exclude glob in the config file. MSG true end all_offenses = [] #: Array[Offense] on_interrupt = -> { progress_formatter.interrupted } #: ^-> void progress_formatter.started_inspection(@files_for_processing.files) do all_offenses = parse_run.find_offenses(run_context, on_interrupt: on_interrupt) do |offenses| failed = offenses.any? { |offense| !offense_collection.listed?(offense) } progress_formatter.increment_progress(failed) end end offense_collection.add_offenses(all_offenses) unlisted_strict_mode_violations = offense_collection.unlisted_strict_mode_violations = [ offenses_formatter.show_offenses(offense_collection.outstanding_offenses), offenses_formatter.show_stale_violations(offense_collection, @files_for_processing.files), offenses_formatter.show_strict_mode_violations(unlisted_strict_mode_violations), ] out.puts(.select(&:present?).join("\n") + "\n") offense_collection.outstanding_offenses.empty? && !offense_collection.stale_violations?(@files_for_processing.files) && unlisted_strict_mode_violations.empty? end |