Suggest alternatives when active recipes are not found #4169
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.
What's changed?
When active recipe(s) not found, provide a helpful
Did you mean: ...
of closest match.What's your motivation?
Misconfigurations are common and hard to spot, as seen in supporting OSS and even colleagues.
In particular when generated Refaster recipes are used, folks might fail to add the
Recipe
orRecipes
suffix.By providing the nearest match as a suggestion folks have an easier way to troubleshoot this themselves.
Anything in particular you'd like reviewers to focus on?
Environment#activateRecipes(Iterable<String> activeRecipes)
to be rare enough to be ok with the streams use there. Outside perhaps tests I'd expect that to be called once per recipe run. Calling that out for review.getLevenshteinDistance
we use here. Didn't want to add a new dependency just for that, but in theory it's deprecated. In practice we're unlikely to move to a new major version any time soon.Have you considered any alternatives or workarounds?
We could use a different method of providing alternatives.
Any additional context
This came up twice today; once in OSS and once internally; combined time savings would already have paid this off today.