Shopify/packwerk

Any way of warning when extraneous dependencies exist in a package.yml file?

oskarpearson opened this issue · 1 comments

Description

Running packwerk check should ideally show a warning/error when a package.yml file includes items in the dependencies: block that are not actually dependencies in the code.

To Reproduce

Start with a codebase with multiple packages in it, and where packwerk check and packwerk validate are both passing as expected.

Modify one of the package's package.yml files (package_a) to add a dependency on a different package (package b). Ensure that you don't create any cyclic loops in this experiment. Don't make any ruby code changes - the intention is to just add an extraneous dependency to package_b

Run packwerk validate and packwerk check, and note that the output indicates that the configuration is valid.

Expected Behaviour

I'd expect a warning or error saying that there's an extraneous/unused dependency on package_b in package_a.

Screenshots

N/A

Version Information

  • Packwerk: v2.1.1
  • Ruby 2.7.4p191

Additional Context

As our developers change code, they sometimes inadvertently remove the code that previously triggered a dependency. Ideally, packwerk would let them know this, so that they can remove the obsolete line from the package.yml

🤔 Maybe it's because most of our packages are huge, but I've rarely seen this happen.

There's also the complication that packwerk so far doesn't have a concept of warnings, and I wouldn't want to make this an error.

That said, I understand how it could be useful.