-
Notifications
You must be signed in to change notification settings - Fork 121
Any way of warning when extraneous dependencies exist in a package.yml file? #208
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
All reactions
Replies: 2 comments
🤔 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.
All reactions
This is ... four months after the fact, but here's the script I use to find unneeded dependency declarations:
https://gist.github.com/bscofield/6a4a54deeab338517bf3a26edd9ee6b3
Quick summary: it makes a list of all declared dependencies across the system, then clears all dependency declarations and runs packwerk check. It then compares the violations that Packwerk finds with the list and outputs any declared dependencies that don't correspond to a violation.