Skip to content

Commit

Permalink
Fix package_todo update comment
Browse files Browse the repository at this point in the history
The update-todo subcommand with arguments has been deprecated and is no
longer supported.
  • Loading branch information
gmcgibbon committed Mar 6, 2023
1 parent 5fdf6c7 commit 128d5fc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/packwerk/package_todo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def dump
#
# You can regenerate this file using the following command:
#
# bin/packwerk update-todo #{@package.name}
# bin/packwerk update-todo
MESSAGE
File.open(@filepath, "w") do |f|
f.write(message)
Expand Down
26 changes: 26 additions & 0 deletions test/unit/packwerk/package_todo_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,32 @@ class PackageTodoTest < Minitest::Test
end
end

test "#dump dumps package TODO comment" do
Tempfile.create("test_file.yml") do |file|
package_todo = PackageTodo.new(destination_package, file.path)
first_package = Package.new(name: "some_package", config: {})
first_package_reference = build_reference(
destination_package: first_package,
constant_name: "::Checkout::Wallet",
path: "some/violated/path.rb"
)

package_todo.add_entries(first_package_reference,
ReferenceChecking::Checkers::DependencyChecker::VIOLATION_TYPE)
package_todo.dump

assert_equal(<<~YAML, file.readlines.first(7).join)
# This file contains a list of dependencies that are not part of the long term plan for buyers.
# We should generally work to reduce this list, but not at the expense of actually getting work done.
#
# You can regenerate this file using the following command:
#
# bin/packwerk update-todo
---
YAML
end
end

test "#dump deletes the package TODO if there are no entries" do
file = Tempfile.new("empty_package_todo.yml")
package_todo = PackageTodo.new(destination_package, T.must(file.path))
Expand Down

0 comments on commit 128d5fc

Please sign in to comment.