feat(poly check): report unused bricks in projects #360
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Description
Adding features to the
poly checkcommand: report any unused bricks in projects.When running the
poly checkcommand, with the--strictflag and a component that is not used by any of the bricks in the project:As of this version, the
poly checkcommand will not exit with a fail code for this addition. At this point, it is information to the developer in case a brick was supposed to be removed.What if adding the unused component is intended?
Considering an extra flag to the command and/or configuration. But I lean on recommending users to add the component in a base, with a suitable "ignore lint" flag.
Example, a base brick defining a component not actually used in code, but still needed in a project:
I believe this will be more explicit and clear than a configuration (that can easily be forgotten when not needed or not relevant).
Motivation and Context
Idea from Discussion #357 🎉
How Has This Been Tested?
✅ CI
✅ Local run on the polylith source code itself, adding a unused brick to one of the projects in the workspace
✅ unit tests for the collect unused bricks function
Types of changes
Checklist: