Skip to content

Conversation

@DavidVujic
Copy link
Owner

@DavidVujic DavidVujic commented Aug 6, 2025

Description

Adding features to the poly check command: report any unused bricks in projects.

When running the poly check command, with the --strict flag and a component that is not used by any of the bricks in the project:

🔎 Is <the_brick> needed in <the_project>?

As of this version, the poly check command 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:

from the_top_namespace import the_unused_component  # noqa  We want this to be included for reasons x, y, z.

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

@DavidVujic DavidVujic changed the title feat(check): collect unused bricks in a project feat(poly check): report unused bricks in projects Aug 6, 2025
@DavidVujic DavidVujic marked this pull request as ready for review August 6, 2025 16:58
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 6, 2025

@DavidVujic DavidVujic merged commit a195509 into main Aug 7, 2025
4 checks passed
@DavidVujic DavidVujic deleted the report-unused-bricks branch August 7, 2025 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants