<commit_before>var fs = require('fs'),
	path = require('path'),
	findup = require('findup'),
	stripJSONComments = require('strip-json-comments');

var configSources = ['package.json', '.rtlcssrc', '.rtlcss.json'];

function loadConfig(dir) {

	for(var x=0;x<configSources.length;x++){
		var found, source = configSources[x];
		
		try 
		{
			found = findup.sync(dir,source);			
		}
		catch(e) {
			continue;
		}
		
		if(found){
			var configFilePath = path.normalize(path.join(found, source));
			config = JSON.parse(
						stripJSONComments(
							fs.readFileSync(configFilePath,'utf-8')
						)
					 );
			
		  	if(source == 'package.json'){
				config = config.rtlcssConfig;
			}
			
			if(config)
				return config;
		}
	}
}

function override(to,from){
	if(to && from){
		for(var p in from){
			if(typeof to[p] === 'object'){
				override(to[p], from[p]);
			}else {
				to[p] = from[p];
			}
		}
	}
}

exports.load = function(configFilePath, cwd, overrides){
	 
	 if(configFilePath){<commit_msg>Append config file path to error msg<commit_after>var fs = require('fs'),
	path = require('path'),
	findup = require('findup'),
	stripJSONComments = require('strip-json-comments');

var configSources = ['package.json', '.rtlcssrc', '.rtlcss.json'];

function loadConfig(dir) {

	for(var x=0;x<configSources.length;x++){
		var found, source = configSources[x];
		
		try 
		{
			found = findup.sync(dir,source);			
		}
		catch(e) {
			continue;
		}
		
		if(found){
			var configFilePath = path.normalize(path.join(found, source));
			try
			{
				config = JSON.parse(
						stripJSONComments(
							fs.readFileSync(configFilePath,'utf-8')
						)
					 );
			}catch(e){
				throw new Error(e + ' ' + configFilePath);
			}
			
		  	if(source == 'package.json'){
				config = config.rtlcssConfig;
			}
			
			if(config)
				return config;
		}
	}
}

function override(to,from){
	if(to && from){
		for(var p in from){
			if(typeof to[p] === 'object'){
				override(to[p], from[p]);
			}else {
				to[p] = from[p];
			}
		}
	}
}

module.exports.load = function(configFilePath, cwd, overrides){
	 
	 if(configFilePath){
{'fraction_non_alphanumeric': 0.16926713947990543, 'fraction_numerical': 0.0018912529550827422, 'mean_word_length': 3.124756335282651, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6470542', 'n_tokens_mistral': 933, 'n_tokens_neox': 746, 'n_words': 139}