/** Helper to report a warning. */ public void warning(LocationContext locationContext, String message, Object... params) { String prefix = String.format(DIAG_PREFIX, validatorName); diagReporter.reportWarning(locationContext, prefix + message, params); }
/** Helper to report a warning. */ public void warning(LocationContext locationContext, String message, Object... params) { String prefix = String.format(DIAG_PREFIX, validatorName); diagReporter.reportWarning(locationContext, prefix + message, params); }
public void warning(LocationContext locationContext, String message, Object... params) { String prefix = String.format(ASPECT_DIAG_PREFIX, aspectName); getDiagReporter().reportWarning(locationContext, prefix + message, params); }
public void warning(LocationContext locationContext, String message, Object... params) { String prefix = String.format(ASPECT_DIAG_PREFIX, aspectName); getDiagReporter().reportWarning(locationContext, prefix + message, params); }
/** Reports any unmatched rules. */ public void reportUnmatchedRules(String category) { for (Map.Entry<RuleWrapper<RuleType>, Set<String>> unmatched : unmatchedRules.entrySet()) { Set<String> selectors = unmatched.getValue(); selectors.remove("*"); // For rules which are not general default, report a warning. if (!selectors.isEmpty()) { String unmatchedSelectors = SELECTOR_JOINER.join(unmatched.getValue()); diagReporter.reportWarning( MessageLocationContext.create(unmatched.getKey().rule, SELECTOR_FIELD_NAME), "%s rule has selector(s) '%s' that do not match and are not " + "shadowed by other rules.", category, unmatchedSelectors); } } }
/** Reports any unmatched rules. */ public void reportUnmatchedRules(String category) { for (Map.Entry<RuleWrapper<RuleType>, Set<String>> unmatched : unmatchedRules.entrySet()) { Set<String> selectors = unmatched.getValue(); selectors.remove("*"); // For rules which are not general default, report a warning. if (!selectors.isEmpty()) { String unmatchedSelectors = SELECTOR_JOINER.join(unmatched.getValue()); diagReporter.reportWarning( MessageLocationContext.create(unmatched.getKey().rule, SELECTOR_FIELD_NAME), "%s rule has selector(s) '%s' that do not match and are not " + "shadowed by other rules.", category, unmatchedSelectors); } } }
/** * Given a comment string, remove the TODO and all characters found after the TODO. If the input * string has no TODO, then the original string is returned. If a TODO was found, then a warning * will be triggered telling the user that the TODO comment has been removed and to use internal * documentation comment tags to avoid non internal documentation from getting removed from the * generated documentation. */ private static String sanitizeTodos( DiagReporter diagReporter, LocationContext location, @Nullable String source, boolean reportWarning) { if (Strings.isNullOrEmpty(source)) { return source; } String[] sourceSplitByTodo = Pattern.compile("\\bTODO(\\(.*?\\))?:").split(source); if (sourceSplitByTodo.length > 1 && reportWarning) { diagReporter.reportWarning( location, "A TODO comment was found. All comments from this TODO to the end of the comment " + "block will be removed from the generated documentation. This TODO Comment " + "should be wrapped in internal comment tags, \"(--\" and \"--)\", to prevent " + "non-internal documentation after the TODO from being removed from the " + "generated documentation."); } String result = sourceSplitByTodo[0]; // Remove last newline. return result.endsWith("\n") ? result.substring(0, result.length() - 1) : result; }
/** * Given a comment string, remove the TODO and all characters found after the TODO. If the input * string has no TODO, then the original string is returned. If a TODO was found, then a warning * will be triggered telling the user that the TODO comment has been removed and to use internal * documentation comment tags to avoid non internal documentation from getting removed from the * generated documentation. */ private static String sanitizeTodos( DiagReporter diagReporter, LocationContext location, @Nullable String source, boolean reportWarning) { if (Strings.isNullOrEmpty(source)) { return source; } String[] sourceSplitByTodo = Pattern.compile("\\bTODO(\\(.*?\\))?:").split(source); if (sourceSplitByTodo.length > 1 && reportWarning) { diagReporter.reportWarning( location, "A TODO comment was found. All comments from this TODO to the end of the comment " + "block will be removed from the generated documentation. This TODO Comment " + "should be wrapped in internal comment tags, \"(--\" and \"--)\", to prevent " + "non-internal documentation after the TODO from being removed from the " + "generated documentation."); } String result = sourceSplitByTodo[0]; // Remove last newline. return result.endsWith("\n") ? result.substring(0, result.length() - 1) : result; }
/** Logs a lint warning. */ protected void warning(LocationContext locationContext, String message, Object... params) { String prefix = String.format(DIAG_PREFIX, aspect.getAspectName(), ruleName); aspect.getDiagReporter().reportWarning(locationContext, prefix + message, params); }
/** Logs a lint warning. */ protected void warning(LocationContext locationContext, String message, Object... params) { String prefix = String.format(DIAG_PREFIX, aspect.getAspectName(), ruleName); aspect.getDiagReporter().reportWarning(locationContext, prefix + message, params); }
private void validateRequirement(LocationContext location, String requirement) { if (requirement.equals(BILLING_REQUIREMENT) || requirement.startsWith(TOS_REQUIREMENT_PREFIX)) { return; } String message = LintRule.formatLintWarning( "Unsupported usage requirement: %s", UNSUPPORTED_REQUIREMENT_RULE, getAspectName(), requirement); getDiagReporter().reportWarning(location, message); }
private void validateRequirement(LocationContext location, String requirement) { if (requirement.equals(BILLING_REQUIREMENT) || requirement.startsWith(TOS_REQUIREMENT_PREFIX)) { return; } String message = LintRule.formatLintWarning( "Unsupported usage requirement: %s", UNSUPPORTED_REQUIREMENT_RULE, getAspectName(), requirement); getDiagReporter().reportWarning(location, message); }
diagReporter.reportWarning( location, "Enabling feature %s had no effect because the feature was already enabled.", diagReporter.reportWarning( location, "Disabling feature %s had no effect because the feature was already disabled.",
diagReporter.reportWarning( location, "Enabling feature %s had no effect because the feature was already enabled.", diagReporter.reportWarning( location, "Disabling feature %s had no effect because the feature was already disabled.",
private void warning(String rule, LocationContext location, String message, Object... params) { String fullMessage = LintRule.formatLintWarning(message, rule, configAspect.getAspectName(), params); configAspect.getDiagReporter().reportWarning(location, fullMessage); } }
private void warning(String rule, LocationContext location, String message, Object... params) { String fullMessage = LintRule.formatLintWarning(message, rule, configAspect.getAspectName(), params); configAspect.getDiagReporter().reportWarning(location, fullMessage); } }
@Override public void startMerging() { if (!Strings.isNullOrEmpty(environment)) { if (!SUPPORTED_ENVS.contains(environment)) { error( getModel().getLocation(), "Control environment '%s' is not one of the supported environments: %s", environment, SUPPORTED_ENVS); } } else { String message = LintRule.formatLintWarning( "Service %s does not have control environment configured.", NO_CONTROL_ENV, NAME, getModel().getServiceConfig().getName()); getDiagReporter().reportWarning(ResolvedLocation.create(getModel().getLocation()), message); } }
@Override public void startMerging() { if (!Strings.isNullOrEmpty(environment)) { if (!SUPPORTED_ENVS.contains(environment)) { error( getModel().getLocation(), "Control environment '%s' is not one of the supported environments: %s", environment, SUPPORTED_ENVS); } } else { String message = LintRule.formatLintWarning( "Service %s does not have control environment configured.", NO_CONTROL_ENV, NAME, getModel().getServiceConfig().getName()); getDiagReporter().reportWarning(ResolvedLocation.create(getModel().getLocation()), message); } }
.getModel() .getDiagReporter() .reportWarning( ResolvedLocation.create(element.getLocation()), "message '%s' is recursive and will not be inlined.",
.getModel() .getDiagReporter() .reportWarning( ResolvedLocation.create(element.getLocation()), "message '%s' is recursive and will not be inlined.",