ApplicationValidator check #337
-
|
Hi all What do people think of changing ApplicationValidator so that there's a public API for retrieving the actual results, rather than a text-version-of-the-results-joined-with-slash-ns? Context:Our current project does contain package cycles. While this isn't ideal, we're trying to work towards something without cycles over time. Previously, I had a pretty hacky spec in our project which checked that our packwerk config was valid excluding the acyclic references check. It did this by instantiating ApplicationValidator and excluding that check. I see that ApplicationValidator has been marked as a private constant in recent versions of Packwerk in change e1da318 Additionally, the structure of validators has changed - so However, ideally I'd like to be able to get the results of Some ideas I can see working: Option 1:
The advantage of this is that it separates out the 'view' from the validation. This means that I could write more intelligent checkers ("We've noticed you've increased the number of cycles by 1 in this PR", and "Yay, you've reduced the number of cycles by 3 in this PR"). Option 2:
This way I can at least check everything other than app cycles in CI. Option 3:Input as to other options welcome! Thanks for your time! Oskar |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There are two things to distinguish here:
Actual dependencies can be cyclical, packwerk has no problem with that. Specified dependencies express a desired state. The desired state should never contain cycles. Packwerk enables teams to move from current state towards desired state via the package todo files which allow recording the difference between current and desired states. They are intended to be worked off (reduced) over time. Allowing cyclical dependencies in specified dependencies makes the difference between current and desired state less obvious, so I don't think it makes sense in packwerk and I can't see how manual workarounds would be very useful either. Maybe the docs don't explain this very well. Does this make sense to you? Could you specify a desired dependency graph in your package.yml files and use package todo files to capture the difference between that desired state and the current state? |
Beta Was this translation helpful? Give feedback.
There are two things to distinguish here:
Actual dependencies can be cyclical, packwerk has no problem with that.
When we decided to have packwerk reject cyclical specified dependencies, this was the reasoning:
Specified dependencies express a desired state. The desired state should never contain cycles. Packwerk enables teams to move from current state towards desired state via the package todo files which allow recording the difference between current and desired states. They are intended to be worked off (reduced) over time.
Allowing cyclical dependencies in specified depen…