in src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/BlockedKeywordValidator.java [193:218]
public ImmutableList<CommentValidationFailure> validateComments(
CommentValidationContext ctx, ImmutableList<CommentForValidation> comments) {
try {
NameKey projectNameKey = Project.nameKey(ctx.getProject());
PluginConfig cfg = cfgFactory.getFromProjectConfigWithInheritance(projectNameKey, pluginName);
if (isActive(cfg)
&& validatorConfig.isEnabled(
null,
projectNameKey,
"",
KEY_CHECK_COMMENT_BLOCKED_KEYWORD,
ImmutableListMultimap.of())) {
ImmutableMap<String, Pattern> blockedKeywordPatterns =
patternCache.getAll(
Arrays.asList(cfg.getStringList(KEY_CHECK_BLOCKED_KEYWORD_PATTERN)));
return comments.stream()
.map(comment -> validateComment(blockedKeywordPatterns, comment))
.filter(Optional::isPresent)
.map(Optional::get)
.collect(ImmutableList.toImmutableList());
}
} catch (NoSuchProjectException | ExecutionException e) {
throw new IllegalStateException("Exception validating comments in uploadvalidator", e);
}
return ImmutableList.of();
}