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(" \u26A0\uFE0F update-todo must be called without any file arguments.\n MSG\n\n return false\n end\n if @files_for_processing.files.empty?\n out.puts(<<~MSG.squish)\n No files found or given.\n Specify files or check the include and exclude glob in the config file.\n MSG\n\n return true\n end\n\n run_context = RunContext.from_configuration(configuration)\n offenses = T.let([], T::Array[Offense])\n progress_formatter.started_inspection(@files_for_processing.files) do\n offenses = parse_run.find_offenses(run_context, on_interrupt: -> { progress_formatter.interrupted }) do\n progress_formatter.increment_progress\n end\n end\n\n offense_collection = OffenseCollection.new(configuration.root_path)\n offense_collection.add_offenses(offenses)\n offense_collection.persist_package_todo_files(run_context.package_set)\n\n unlisted_strict_mode_violations = offense_collection.unlisted_strict_mode_violations\n\n messages = [\n offenses_formatter.show_offenses(offense_collection.errors + unlisted_strict_mode_violations),\n ]\n\n messages << if unlisted_strict_mode_violations.any?\n \"\u26A0\uFE0F `package_todo.yml` has been updated, but unlisted strict mode violations were not added.\"\n else\n \"\u2705 `package_todo.yml` has been updated.\"\n end\n\n out.puts(messages.select(&:present?).join(\"\\n\") + \"\\n\")\n\n unlisted_strict_mode_violations.empty? && offense_collection.errors.empty?\nend\n".squish)
|