Examples of IValidationAdvisor


Examples of com.puppetlabs.geppetto.pp.dsl.validation.IValidationAdvisor

    catch(IllegalArgumentException iae) {
      // Can happen if there is something seriously wrong with the qualified name, should be caught by
      // validation - just ignore it here
      return;
    }
    IValidationAdvisor advisor = advisor();

    boolean mustExist = true;
    if(qualified && global) {
      // TODO: Possible future improvement when more global variables are known.
      // if reported as error now, almost all global variables would be flagged as errors.
      // Future enhancement could warn about those that are not found (resolved at runtime).
      mustExist = false;
    }

    // Record facts at resource and model levels about where variable was found
    recordCrossReference(qName, searchResult, existsAdjusted, existsOutside, mustExist, importedNames, o);

    if(mustExist) {
      if(!(existsAdjusted || existsOutside)) {
        // importedNames.addUnresolved(qName);

        // found nowhere
        if(qualified || advisor.unqualifiedVariables().isWarningOrError()) {
          StringBuilder message = new StringBuilder();
          if(disqualified)
            message.append("Reference to not yet initialized variable: ");
          else
            message.append(qualified
                ? "Unknown variable: '"
                : "Unqualified and Unknown variable: '");
          message.append(varName);
          message.append("'");

          String issue = disqualified
              ? IPPDiagnostics.ISSUE__UNINITIALIZED_VARIABLE
              : IPPDiagnostics.ISSUE__UNKNOWN_VARIABLE;
          if(disqualified || advisor.unqualifiedVariables() == ValidationPreference.ERROR)
            acceptor.acceptError(message.toString(), o, attr, issue);
          else
            acceptor.acceptWarning(message.toString(), o, attr, issue);
        }
      }
      else if(!existsAdjusted && existsOutside) {
        // found outside
        if(qualified || advisor.unqualifiedVariables().isWarningOrError())
          acceptor.acceptWarning(
            "Found outside current search path variable: '" + varName + "'", o, attr,
            IPPDiagnostics.ISSUE__NOT_ON_PATH);
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.