public static String getDiagMessage(final Diag diag) { String message = diag.getMessage(); return message; }
/** * Adds a user-level suppression directive. The directive must be given in the form 'aspect-rule', * or 'aspect-*' to match any rule. Is used in comments such as '(== suppress_warning http-* ==)' * which will suppress all lint warnings generated by the http aspect. */ // TODO(user): See if we can avoid the type case. public boolean isDiagSuppressed(Diag diag, Location location) { if (location instanceof ProtoLocation) { if (isSuppressedWarning(diag, ((ProtoLocation) location).getElement())) { return true; } } else if (compilerGlobalSuppressionPattern.matcher(diag.getMessage()).matches()) { return true; } return false; }
/** * Adds a user-level suppression directive. The directive must be given in the form 'aspect-rule', * or 'aspect-*' to match any rule. Is used in comments such as '(== suppress_warning http-* ==)' * which will suppress all lint warnings generated by the http aspect. */ // TODO(user): See if we can avoid the type case. public boolean isDiagSuppressed(Diag diag, Location location) { if (location instanceof ProtoLocation) { if (isSuppressedWarning(diag, ((ProtoLocation) location).getElement())) { return true; } } else if (compilerGlobalSuppressionPattern.matcher(diag.getMessage()).matches()) { return true; } return false; }
@Override public void addDiag(Diag diag) { switch (diag.getKind()) { case ERROR: error(diag.getLocation(), diag.getMessage()); break; case WARNING: warning(diag.getLocation(), diag.getMessage()); break; } }
@Override public void addDiag(Diag diag) { switch (diag.getKind()) { case ERROR: error(diag.getLocation(), diag.getMessage()); break; case WARNING: warning(diag.getLocation(), diag.getMessage()); break; } }
@Override public String toString() { return String.format("%s: %s: %s", getKind().toString(), getLocation().getDisplayString(), getMessage()); } }
@Override public String toString() { return String.format("%s: %s: %s", getKind().toString(), getLocation().getDisplayString(), getMessage()); } }
while (current != null) { Pattern pattern = getPattern(current); if (pattern != null && pattern.matcher(diag.getMessage()).matches()) { return true;
while (current != null) { Pattern pattern = getPattern(current); if (pattern != null && pattern.matcher(diag.getMessage()).matches()) { return true;
/** * Accumulates errors and warning encountered during import. */ @Override public void addDiag(Diag diag) { Location loc = SimpleLocation.UNKNOWN; if (diag.getLocation() == SimpleLocation.UNKNOWN || diag.getLocation() == SimpleLocation.TOPLEVEL) { loc = swaggerFileLocation; } else { loc = new SimpleLocation( String.format("%s: %s", swaggerFileName, diag.getLocation().toString())); } diag = Diag.create(loc, diag.getMessage(), diag.getKind()); diags.add(diag); if (diag.getKind() == Diag.Kind.ERROR) { errorCount++; } }
/** * Accumulates errors and warning encountered during import. */ @Override public void addDiag(Diag diag) { Location loc = SimpleLocation.UNKNOWN; if (diag.getLocation() == SimpleLocation.UNKNOWN || diag.getLocation() == SimpleLocation.TOPLEVEL) { loc = swaggerFileLocation; } else { loc = new SimpleLocation( String.format("%s: %s", swaggerFileName, diag.getLocation().toString())); } diag = Diag.create(loc, diag.getMessage(), diag.getKind()); diags.add(diag); if (diag.getKind() == Diag.Kind.ERROR) { errorCount++; } }
String message = diagToPrint.getMessage(); for (Map.Entry<String, String> entry : diagPatternReplacements.entrySet()) { message = message.replaceAll(entry.getKey(), entry.getValue()); if (!message.equals(diagToPrint.getMessage())) { diagToPrint = Diag.create(diag.getLocation(), "%s", diag.getKind(), message);
assertThat(diagCollector.getDiags().get(0).getMessage()) .contains("archived_book from protofile clashes with a Resource"); assertThat(
++processedIndex; if (diag.getKind() != Diag.Kind.ERROR && !messagePattern.matcher(diag.getMessage()).matches()) { continue; final Diag diag = diags.get(i); if (diag.getKind() != Diag.Kind.ERROR && !messagePattern.matcher(diag.getMessage()).matches()) { continue;
.collect(Collectors.toList()); assertThat(warningDiags).isNotEmpty(); assertThat(warningDiags.get(0).getMessage()) .contains( "Resource[Set] entity archived_book from protofile clashes with a Resource[Set] of the same name from the GAPIC config. Using the GAPIC config entity.");
/** Produce a string for the diagnosis, with optional coloring. */ public static String diagToString(Diag diag, boolean colored) { Doc text; switch (diag.getKind()) { case ERROR: text = Doc.text("ERROR: "); if (colored) { text = Doc.color(AnsiColor.RED, text); } break; case WARNING: text = Doc.text("WARNING: "); if (colored) { text = Doc.color(AnsiColor.YELLOW, text); } break; default: text = Doc.text("HINT:"); break; } text = text.add(Doc.text(diag.getLocation().getDisplayString())) .add(Doc.text(": ")) .add(Doc.text(diag.getMessage())); return text.toString(); }
/** Produce a string for the diagnosis, with optional coloring. */ public static String diagToString(Diag diag, boolean colored) { Doc text; switch (diag.getKind()) { case ERROR: text = Doc.text("ERROR: "); if (colored) { text = Doc.color(AnsiColor.RED, text); } break; case WARNING: text = Doc.text("WARNING: "); if (colored) { text = Doc.color(AnsiColor.YELLOW, text); } break; default: text = Doc.text("HINT:"); break; } text = text.add(Doc.text(diag.getLocation().getDisplayString())) .add(Doc.text(": ")) .add(Doc.text(diag.getMessage())); return text.toString(); }