Shopify / packwerk

Good things come in small packages.
MIT License
1.54k stars 111 forks source link

Add option to exclude paths from strict mode #365

Closed athieriot closed 11 months ago

athieriot commented 1 year ago

What are you trying to accomplish?

Open the possibility to activate strict mode whilst being softer on specific paths.

At Doctolib we are in the process of pushing for isolated Engines (Privacy and Dependency) but we would like to take care of violations coming from test files at a later time (In the meantime, we are still interested in tracking them)

What approach did you choose and why?

This PRs will complement the exclude global property with a exclude_from_strict and allow to specify an array of path that will not trigger packwerk check.

For example, this configuration will continue to track test violations in the todo files, but will also trigger strict mode on all the other paths:

exclude_from_strict:
- test/**/*
- engines/test/**/*

There are a few levels where this property could go:

As in my mind it was a similar scope than the existing exclude feature, it made sense to have it globally. I hesitated quite a bit with the "per Engine" approach, but I don't think this should fall down at the Checker level.

What should reviewers focus on?

It would be the first time I am proposing a change on Packwerk so it might not be as idiomatic as it should be.

Type of Change

Additional Release Notes

Include any notes here to include in the release description. For example, if you selected "breaking change" above, leave notes on how users can transition to this version.

If no additional notes are necessary, delete this section or leave it unchanged.

Checklist