---------------------------------------- Public ---------------------------------------- 
Validate given path
@param {string} validationPath
@param {Object} userOptions
@param {Function} done
172551
function nodeW3CValidator (validationPath, userOptions, done) {
	const spinner = ora(`${pkg.name} - processing ...`).start();
	let options = getOptions(userOptions);
	let execPath = [vnuCmd].concat(getArgvFromObject(options), fileset.sync(validationPath));

	// console.log(execPath.join(' '));
	exec(execPath.join(' '), function (err, stdout, stderr) {
		let output = stdout;

		if (err === null) {
			spinner.succeed(`${pkg.name} - no errors`);
		} else {
			output = stderr;
			if (options.outputAsHtml) {
				output = renderHtml(output);
			}
			spinner.fail(`${pkg.name} - found errors`);
		}

		done(err, output);
	});
}
648003
function validate(config, source) {

  if (typeof config.rules === 'object') {
    Object.keys(config.rules).forEach(function(id) {
      validateRuleOptions(id, config.rules[id], source);
    });
  }
}
1284697
public static void validateValues(Object actualValue, Object expectedValue, String pathExpression, TestContext context)
            throws ValidationException {
        try {
            if (actualValue != null) {
                Assert.isTrue(expectedValue != null,
                        ValidationUtils.buildValueMismatchErrorMessage(
                                "Values not equal for element '" + pathExpression + "'", null, actualValue));

                if (expectedValue instanceof Matcher) {
                    Assert.isTrue(((Matcher) expectedValue).matches(actualValue),
                            ValidationUtils.buildValueMismatchErrorMessage(
                                    "Values not matching for element '" + pathExpression + "'", expectedValue, actualValue));
                    return;
                }

                if (!(expectedValue instanceof String)) {
                    Object converted = TypeConversionUtils.convertIfNecessary(actualValue, expectedValue.getClass());

                    if (converted == null) {
                        throw new CitrusRuntimeException(String.format("Failed to convert value '%s' to required type '%s'", actualValue, expectedValue.getClass()));
                    }

                    if (converted instanceof List) {
                        Assert.isTrue(converted.toString().equals(expectedValue.toString()),
                                ValidationUtils.buildValueMismatchErrorMessage(
                                        "Values not equal for element '" + pathExpression + "'", expectedValue.toString(), converted.toString()));
                    } else if (converted instanceof String[]) {
                        String convertedDelimitedString = StringUtils.arrayToCommaDelimitedString((String[]) converted);
                        String expectedDelimitedString = StringUtils.arrayToCommaDelimitedString((String[]) expectedValue);

                        Assert.isTrue(convertedDelimitedString.equals(expectedDelimitedString),
                                ValidationUtils.buildValueMismatchErrorMessage(
                                        "Values not equal for element '" + pathExpression + "'", expectedDelimitedString, convertedDelimitedString));
                    } else if (converted instanceof byte[]) {
                        String convertedBase64 = Base64.encodeBase64String((byte[]) converted);
                        String expectedBase64 = Base64.encodeBase64String((byte[]) expectedValue);

                        Assert.isTrue(convertedBase64.equals(expectedBase64),
                                ValidationUtils.buildValueMismatchErrorMessage(
                                        "Values not equal for element '" + pathExpression + "'", expectedBase64, convertedBase64));
                    } else {
                        Assert.isTrue(converted.equals(expectedValue),
                                ValidationUtils.buildValueMismatchErrorMessage(
                                        "Values not equal for element '" + pathExpression + "'", expectedValue, converted));
                    }
                } else {
                    String expectedValueString = expectedValue.toString();
                    String actualValueString;
                    if (List.class.isAssignableFrom(actualValue.getClass())) {
                        actualValueString = StringUtils.arrayToCommaDelimitedString(((List)actualValue).toArray(new Object[((List)actualValue).size()]));
                        expectedValueString = expectedValueString.replaceAll("^\\[", "").replaceAll("\\]$", "").replaceAll(",\\s", ",");
                    } else {
                        actualValueString = actualValue.toString();
                    }

                    if (ValidationMatcherUtils.isValidationMatcherExpression(String.valueOf(expectedValueString))) {
                        ValidationMatcherUtils.resolveValidationMatcher(pathExpression,
                                actualValueString,
                                String.valueOf(expectedValueString),
                                context);
                    } else {
                        Assert.isTrue(actualValueString.equals(expectedValueString),
                                ValidationUtils.buildValueMismatchErrorMessage(
                                        "Values not equal for element '" + pathExpression + "'", expectedValueString, actualValueString));
                    }
                }
            } else if (expectedValue != null) {
                if (expectedValue instanceof Matcher) {
                    Assert.isTrue(((Matcher) expectedValue).matches(null),
                            ValidationUtils.buildValueMismatchErrorMessage(
                                    "Values not matching for element '" + pathExpression + "'", expectedValue, null));
                } else if (expectedValue instanceof String) {
                    String expectedValueString = expectedValue.toString();

                    if (ValidationMatcherUtils.isValidationMatcherExpression(expectedValueString)) {
                        ValidationMatcherUtils.resolveValidationMatcher(pathExpression,
                                null,
                                expectedValueString,
                                context);
                    } else {
                        Assert.isTrue(!StringUtils.hasText(expectedValueString),
                                ValidationUtils.buildValueMismatchErrorMessage(
                                        "Values not equal for element '" + pathExpression + "'", expectedValueString, null));
                    }
                } else {
                    throw new ValidationException("Validation failed: " + ValidationUtils.buildValueMismatchErrorMessage(
                            "Values not equal for element '" + pathExpression + "'", expectedValue, null));
                }
            }
        } catch (IllegalArgumentException | AssertionError e) {
            throw new ValidationException("Validation failed:", e);
        }
    }
516170
protected void validate(File directory, ValidationOptions option){
		if(!directory.exists()){
			this.errors.addError("directory <{}> does not exist in file system", directory.getAbsolutePath());
		}
		else if(!directory.isDirectory()){
			this.errors.addError("directory <{}> is not a directory", directory.getAbsolutePath());
		}
		else if(directory.isHidden()){
			this.errors.addError("directory <{}> is a hidden directory", directory.getAbsolutePath());
		}
		else{
			switch(option){
				case AS_SOURCE:
					if(!directory.canRead()){
						this.errors.addError("directory <{}> is not readable", directory.getAbsolutePath());
					}
					break;
				case AS_SOURCE_AND_TARGET:
					if(!directory.canRead()){
						this.errors.addError("directory <{}> is not readable", directory.getAbsolutePath());
					}
					if(!directory.canWrite()){
						this.errors.addError("directory <{}> is not writable", directory.getAbsolutePath());
					}
					break;
				case AS_TARGET:
					if(!directory.canWrite()){
						this.errors.addError("directory <{}> is not writable", directory.getAbsolutePath());
					}
					break;
			}
		}
	}
187127
async function validateOptions(options) {
  // Check that input glob was passed
  if (!options.paths.length) {
    throw new ValidationError('No paths specified')
  }

  // Check that output path was passed
  if (!options.outputDir) {
    throw new ValidationError('Please specify an output directory with -o or --output')
  }

  // Check that the existance of output path
  if (!await fsAsync.exists(options.outputDir)) {
    throw new ValidationError('Output directory doesn\'t exist')
  }

  // Check that output path is a directory
  const outStat = await fsAsync.stat(options.outputDir)
  if (!outStat.isDirectory()) {
    throw new ValidationError('Output path must be a directory')
  }

  // Check existance of CSS template (If set)
  if (options.cssTemplate && !await fsAsync.exists(options.cssTemplate)) {
    throw new ValidationError('CSS template not found')
  }

  // Check existance of HTML template (If set)
  if (options.htmlTemplate && !await fsAsync.exists(options.htmlTemplate)) {
    throw new ValidationError('HTML template not found')
  }

  // Validate codepoints file if passed
  if (options.codepoints) {
    if (!await fsAsync.exists(options.codepoints)) {
      throw new ValidationError(`Cannot find json file @ ${options.codepoints}!`)
    }

    const codepointsStat = await fsAsync.stat(options.codepoints)
    if (!codepointsStat.isFile() || path.extname(options.codepoints) !== '.json') {
      throw new ValidationError([
        'Codepoints file must be JSON',
        `${options.codepoints} is not a valid file.`
      ].join(' '))
    }
  }
}
1281169
function invalid(options) { // called in context
    //if (this instanceof FilterTree && !this.children.length) {
    //    throw new this.Error('Empty subexpression (no filters).');
    //}

    this.children.forEach(function(child) {
        if (child instanceof FilterLeaf) {
            child.invalid(options);
        } else if (child.children.length) {
            invalid.call(child, options);
        }
    });
}
73350
function validateOptions(opt) {
    if (opt) {
        if (opt.hasOwnProperty('dir')) {
            if (opt.dir.length < 1 || typeof opt.dir !== 'string') {
                throw new TypeError('dir value must be a valid string');
            }
            if (!isValidString(opt.dir)) {
                throw new TypeError('only underscore is allowed in dir name');
            }
            options.dir = opt.dir || options.dir;
        }


        if (opt.hasOwnProperty('file')) {
            if ((opt.file.length < 1 || typeof opt.file !== 'string')) {
                throw new TypeError('file value must be a valid string');
            }
            if (!isValidString(opt.file)) {
                throw new TypeError('only underscore is allowed in file name');
            }
            options.file = opt.file || options.file;
        }

        if (opt.hasOwnProperty('dateWise')) {
            if (typeof opt.dateWise !== 'boolean') {
                throw new TypeError('dateWise must be a boolean');
            }
            options.dateWise = opt.dateWise || options.dateWise;
        }
    }
    if (options.dateWise === true) {
        todayDate = todayDate.concat(new Date().getDate(), '_', monthsName[new Date().getMonth()], '_', new Date().getFullYear());
        if (options.file.indexOf('.log') === -1) {
            options.file = String().concat(options.file, '_', todayDate, '.log');
        } else {
            options.file = String().concat(options.file, '_', todayDate);
        }

    } else {
        if (options.file.indexOf('.log') === -1) {
            options.file = String().concat(options.file, '.log');
        } else {
            options.file = String().concat(options.file);
        }
    }
    return options;
}
1108172
function detectUserOptions () {
	let outputPath = program.output;
	let userOptions = {
		output: false
	};

	cliProps.forEach(prop => {
		let value = program[prop];

		if ((prop === 'stream' || prop === 'langdetect') && value) {
			return;
		}
		if (value !== undefined) {
			userOptions[prop] = value;
		}
	});
	if (typeof outputPath === 'string' && outputPath.length) {
		userOptions.output = outputPath;
	}
	return userOptions;
}
116512
function validateString(context, name, def, map) {
  var value = context[name]

  if (value == null) {
    value = def
  }

  value = String(value)

  if (!(value in map)) {
    raise(value, 'options.' + name)
  }

  context[name] = value
}
914810
@SuppressWarnings("unchecked")
	@Override
	protected void performValidation(String path, Object value, List<ValidationResult> results) {
		String name = path != null ? path : "value";
		value = ObjectReader.getValue(value);

		super.performValidation(path, value, results);

		if (value == null)
			return;

		if (value instanceof Map<?, ?>) {
			Map<Object, Object> map = (Map<Object, Object>) value;
			for (Object key : map.keySet()) {
				String elementPath = path == null || path.length() == 0 ? key.toString() : path + "." + key;

				performTypeValidation(elementPath, _keyType, key, results);
				performTypeValidation(elementPath, _valueType, map.get(key), results);
			}
		} else {
			results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_ISNOT_MAP",
					name + " type must be Map", "Map", value.getClass()));
		}
	}
576399
public void validate(String path, Schema schema, Object value, List<ValidationResult> results) {
		String name = path != null ? path : "value";
		List<String> found = new ArrayList<String>();

		for (String property : _properties) {
			Object propertyValue = ObjectReader.getProperty(value, property);
			if (propertyValue != null)
				found.add(property);
		}

		if (found.size() == 0) {
			results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_NULL",
					name + " must have at least one property from " + _properties, _properties, null));
		}
	}
1198867
function detectUserInput () {
	let validatePath = program.input;

	if (typeof validatePath !== 'string') {
		validatePath = process.cwd();
	} else {
		if (!(/^(http(s)?:)?\/\//i.test(validatePath))) {
			if (/^\//.test(validatePath)) {
				validatePath = path.resolve(validatePath);
			}
		}
	}
	return validatePath;
}
1277846
function validateSourcePath(sourcePath) {
    const materialPackageJSONPath = pathUtils.resolve(sourcePath, 'package.json');

    return fs.readFileAsync(materialPackageJSONPath, { encoding: 'UTF8' })
        .then(materialPackageJSONString => {
            const package = JSON.parse(materialPackageJSONString);
            if (package.name !== sourcePackageName) {
                throw new Error(`Source path ${sourcePath} does not appear to be a clone of https://github.com/callemall/material-ui`);
            }
            return sourcePath;
        });
}
646497
protected void performValidation(String path, Object value, List<ValidationResult> results) {
		String name = path != null ? path : "value";

		if (value == null) {
			// Check for required values
			if (_required)
				results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_IS_NULL",
						name + " cannot be null", "NOT NULL", null));
		} else {
			value = ObjectReader.getValue(value);

			// Check validation rules
			if (_rules != null) {
				for (IValidationRule rule : _rules)
					rule.validate(path, this, value, results);
			}
		}
	}
1310009
function validateRuleOptions(id, options, source) {
		var validateRule = validators.rules[id],
			message,
			severity,
			localOptions,
			schema = getRuleOptionsSchema(id),
			validSeverity = true;

		/* ORION no CQ for is-my-json-valid library
		 if (!validateRule && schema) {
			validateRule = schemaValidator(schema, {
				verbose: true
			});
			validators.rules[id] = validateRule;
		}*/

		// if it's not an array, it should be just a severity
		if (Array.isArray(options)) {
			localOptions = options.concat(); // clone
			severity = localOptions.shift();
		} else {
			severity = options;
			localOptions = [];
		}

		validSeverity = (
			severity === 0 || severity === 1 || severity === 2 ||
			(typeof severity === "string" && /^(?:off|warn|error)$/i.test(severity))
		);

		if (validateRule) {
			validateRule(localOptions);
		}

		if ((validateRule && validateRule.errors) || !validSeverity) {
			message = [
				source, ":\n",
				"\tConfiguration for rule \"", id, "\" is invalid:\n"
			];

			if (!validSeverity) {
				message.push(
					"\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '",
					util.inspect(severity).replace(/'/g, "\"").replace(/\n/g, ""),
					"').\n"
				);
			}

			if (validateRule && validateRule.errors) {
				validateRule.errors.forEach(function(error) {
					message.push(
						"\tValue \"", error.value, "\" ", error.message, ".\n"
					);
				});
			}

			throw new Error(message.join(""));
		}
	}
421357
public T validate(String path, Object controlValue) {
        if (JsonPathMessageValidationContext.isJsonPathExpression(path)) {
            getJsonPathValidationContext().getJsonPathExpressions().put(path, controlValue);
        } else {
            getXPathValidationContext().getXpathExpressions().put(path, controlValue);
        }

        return self;
    }
209547
function validateBoolean(context, name, def) {
  var value = context[name]

  if (value == null) {
    value = def
  }

  if (typeof value !== 'boolean') {
    raise(value, 'options.' + name)
  }

  context[name] = value
}