<commit_before>var config = require("./app-config");
var debug = require("./if-debug");
var fs = require("fs-extra");
var merge = require("js-object-merge");
module.exports = function(base) {
    this = config;
    var cFile = (base + "/" + ".idrinth.automatic-formatting.json").replace(
      "//",
      "/"
    );
    if(fs.existsSync(cFile)) {
        var content = fs.readFileSync(cFile).toString();
        debug("project "+base+" has own configuration: " + content);
        data = JSON.parse(content);
        if(data) {
            this.format = merge(
              this.format,
              data.format?data.format:{}
            );
            this.file = merge(
              this.file,
              data.file?data.file:{}
            );
            this.directory = merge(
              this.directory,
              data.directory?data.directory:{}
            );
        }
    } else {
        debug("project "+base+" has no own configuration");
    }
    return this;
};<commit_msg>cleaning up JSON instead of merging every allowed key on it's own<commit_after>var config = require("./app-config");
var debug = require("./if-debug");
var fs = require("fs-extra");
var merge = require("js-object-merge");
module.exports = function(base) {
    var cFile = (base + "/.idrinth.automatic-formatting.json").replace(
      "//",
      "/"
    );
    var data;
    if(fs.existsSync(cFile)) {
        var content = fs.readFileSync(cFile).toString();
        debug("project "+base+" has own configuration: " + content);
        data = JSON.parse(content);
        for(var key in data) {
            if(key !== 'format' && key !== 'file' && key !== 'directory') {
                delete data[key];
            }
        }
    } else {
        data = {};
        debug("project "+base+" has no own configuration");
    }
    this = merge(config,data);
    return this;
};
{'fraction_non_alphanumeric': 0.16347177848775293, 'fraction_numerical': 0.0, 'mean_word_length': 2.0064, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2808352', 'n_tokens_mistral': 546, 'n_tokens_neox': 540, 'n_words': 121}