in java/com/google/gerrit/plugins/codeowners/restapi/CheckCodeOwnerConfigFiles.java [200:234]
public static Optional<ConsistencyProblemInfo> createConsistencyProblemInfo(
CommitValidationMessage commitValidationMessage,
@Nullable ConsistencyProblemInfo.Status verbosity) {
switch (commitValidationMessage.getType()) {
case FATAL:
return Optional.of(
new ConsistencyProblemInfo(
ConsistencyProblemInfo.Status.FATAL, commitValidationMessage.getMessage()));
case ERROR:
if (ConsistencyProblemInfo.Status.FATAL.equals(verbosity)) {
// errors should not be reported
return Optional.empty();
}
return Optional.of(
new ConsistencyProblemInfo(
ConsistencyProblemInfo.Status.ERROR, commitValidationMessage.getMessage()));
case WARNING:
if (ConsistencyProblemInfo.Status.FATAL.equals(verbosity)
|| ConsistencyProblemInfo.Status.ERROR.equals(verbosity)) {
// warnings should not be reported
return Optional.empty();
}
return Optional.of(
new ConsistencyProblemInfo(
ConsistencyProblemInfo.Status.WARNING, commitValidationMessage.getMessage()));
case HINT:
case OTHER:
return Optional.empty();
}
throw new IllegalStateException(
String.format(
"unknown message type %s for message %s",
commitValidationMessage.getType(), commitValidationMessage.getMessage()));
}