Shopify/packwerk

[Bug Report] Stale violations on deleted files

gmcgibbon opened this issue · 1 comments

Description
Stale violations in deleted files aren't deleted.

To Reproduce
If you update a package TODO, delete the file that has the reference violation, and then run packwerk check, it will pass.

Expected Behaviour
It should fail, but packwerk doesn't inspect that file anymore and can't see that there are stale references in the TODO file.

Version Information

  • Packwerk: edge
  • Ruby v3.2.0

Additional Context
I think it might be useful to add CLI options to check and update that take deleted file violations into consideration. Right now, you have to do something like

unless Packwerk::Cli.new(style: Packwerk::OutputStyles::Coloured.new).execute_command(["check"])
  exit(1)
end

Packwerk::Cli.new(style: Packwerk::OutputStyles::Coloured.new).execute_command(["update-deprecations"])

unless %x(git status --porcelain).empty?
  puts <<~MESSAGE
    There were stale violations found, please run `packwerk update-deprecations`.
  MESSAGE
  exit(1)
end

which isn't ideal.

Guys, any plans to fix this issue?