Class: Packwerk::Commands::UpdateTodoCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Packwerk::Commands::UpdateTodoCommand
- Defined in:
- lib/packwerk/commands/update_todo_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 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/packwerk/commands/update_todo_command.rb', line 13 def run if @files_for_processing.files_specified? out.puts(<<~MSG.squish) ⚠️ update-todo must be called without any file arguments. MSG return false end 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 return true end run_context = RunContext.from_configuration(configuration) offenses = [] #: Array[Offense] progress_formatter.started_inspection(@files_for_processing.files) do offenses = parse_run.find_offenses(run_context, on_interrupt: -> { progress_formatter.interrupted }) do progress_formatter.increment_progress end end offense_collection = OffenseCollection.new(configuration.root_path) offense_collection.add_offenses(offenses) offense_collection.persist_package_todo_files(run_context.package_set) unlisted_strict_mode_violations = offense_collection.unlisted_strict_mode_violations = [ offenses_formatter.show_offenses(offense_collection.errors + unlisted_strict_mode_violations), ] << if unlisted_strict_mode_violations.any? "⚠️ `package_todo.yml` has been updated, but unlisted strict mode violations were not added." else "✅ `package_todo.yml` has been updated." end out.puts(.select(&:present?).join("\n") + "\n") unlisted_strict_mode_violations.empty? && offense_collection.errors.empty? end |