<commit_before>


function raiseMetadata(obj, checks) {
	'use strict';

	Object.keys(dqre.constants.raisedMetadata).forEach(function (key) {
		var collection = dqre.constants.raisedMetadata[key];
		var highestIndex = checks.reduce(function (prev, current) {
		  var prevIndex = typeof prev === 'object' ? collection.indexOf(prev[key]) : prev;
		  var currentIndex = collection.indexOf(current[key]);
		  return currentIndex > prevIndex ? currentIndex : prevIndex;
		}, -1);
		if (collection[highestIndex]) {
			obj[key] = collection[highestIndex];
		}
	});

}

/**
 * Calculates the result (PASS or FAIL) of a Node (node-level) or an entire Rule (page-level)
 * @private
 * @param  {Array} checks  Array of checks to calculate the result of
 * @return {String}        Either "PASS" or "FAIL"
 */
function calculateCheckResult(failingChecks) {
	'use strict';
	var isFailing = failingChecks.any.length || failingChecks.all.length || failingChecks.none.length;

	return isFailing ? dqre.constants.result.FAIL : dqre.constants.result.PASS;
}
<commit_msg>`prev` will never be an object<commit_after>


function raiseMetadata(obj, checks) {
	'use strict';

	Object.keys(dqre.constants.raisedMetadata).forEach(function (key) {
		var collection = dqre.constants.raisedMetadata[key];
		var highestIndex = checks.reduce(function (prevIndex, current) {
		  var currentIndex = collection.indexOf(current[key]);
		  return currentIndex > prevIndex ? currentIndex : prevIndex;
		}, -1);
		if (collection[highestIndex]) {
			obj[key] = collection[highestIndex];
		}
	});

}

/**
 * Calculates the result (PASS or FAIL) of a Node (node-level) or an entire Rule (page-level)
 * @private
 * @param  {Array} checks  Array of checks to calculate the result of
 * @return {String}        Either "PASS" or "FAIL"
 */
function calculateCheckResult(failingChecks) {
	'use strict';
	var isFailing = failingChecks.any.length || failingChecks.all.length || failingChecks.none.length;

	return isFailing ? dqre.constants.result.FAIL : dqre.constants.result.PASS;
}

{'fraction_non_alphanumeric': 0.12665684830633284, 'fraction_numerical': 0.0009818360333824251, 'mean_word_length': 4.478494623655914, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5190657', 'n_tokens_mistral': 671, 'n_tokens_neox': 631, 'n_words': 162}