Class: Docquet::CLI::RegenerateTodo

Inherits:
Base
  • Object
show all
Defined in:
lib/docquet/cli/regenerate_todo.rb

Instance Method Summary collapse

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/docquet/cli/regenerate_todo.rb', line 10

def call(**)
  unless rubocop_yml_exists?
    puts "Error: .rubocop.yml not found. Run 'docquet install-config' first."
    exit 1
  end

  before_hash = calculate_file_hash(".rubocop_todo.yml")
  command = build_command

  puts "Running: #{command}"
  if system(command)
    after_hash = calculate_file_hash(".rubocop_todo.yml")
    changed = before_hash != after_hash

    puts <<~MESSAGE
      ✓ Regenerated .rubocop_todo.yml
      #{changed ? "📝 TODO file was updated with changes" : "✅ TODO file unchanged (no new violations)"}
      Review the updated TODO file and continue fixing violations.
    MESSAGE
  else
    puts "Error: Failed to regenerate .rubocop_todo.yml"
    exit 1
  end
end