Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not wrap single active recipe & remove activateAll() #4349

Merged
merged 6 commits into from
Jul 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,27 @@ public Recipe activateRecipes(Iterable<String> activeRecipes) {
}
}
if (!recipesNotFound.isEmpty()) {
@SuppressWarnings("deprecation")
List<String> suggestions = recipesNotFound.stream()
.map(r -> recipesByName.keySet().stream()
.min(comparingInt(a -> StringUtils.getLevenshteinDistance(a, r)))
.orElse(r))
.collect(toList());
String message = String.format("Recipes not found: %s\nDid you mean: %s",
String message = String.format("Recipe(s) not found: %s\nDid you mean: %s",
String.join(", ", recipesNotFound),
String.join(", ", suggestions));
throw new RecipeException(message);
}
if (activatedRecipes.size() == 1) {
return activatedRecipes.get(0);
}
return new CompositeRecipe(activatedRecipes);
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
}

public Recipe activateRecipes(String... activeRecipes) {
return activateRecipes(Arrays.asList(activeRecipes));
}

//TODO: Nothing uses this and in most cases it would be a bad idea anyway, should consider removing
public Recipe activateAll() {
return new CompositeRecipe(listRecipes());
}

/**
* @return A list of validations of style names that could be activated.
*/
Expand Down
Loading