<commit_before>const path = require("path");
const os = require("os");
const config = require("config");
const fs = require("fs-extra");

const settingsPath = path.join(os.homedir(), config.get("cachePath"), config.get("settingsFileName"));
const defaultSettings = require(__dirname+"/settings.json");

if (fs.existsSync(settingsPath)) {
    // Settings File Exists

    try {
        settings = require(settingsPath);

        for (key in defaultSettings) {
            if (settings[key] == undefined) {
                // Key not found in Settings File. Use Default Value.

                settings[key] = defaultSettings[key];
            }
        }
    } catch (err) {
        // Error Reading Settings File. Use Default Value.

        settings = defaultSettings;
    }
} else {
    // Settings File Does Not Exists. Use Default Value.

    settings = defaultSettings;
}

function get(key) {
    return defaultSettings[key];
}

function set(key, value) {
    settings[key] = value;

    fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 4));
}

module.exports.get = get;
module.exports.set = set;<commit_msg>Fixed settings fetch issue : always should not fetch default settings<commit_after>const path = require("path");
const os = require("os");
const config = require("config");
const fs = require("fs-extra");

const settingsPath = path.join(os.homedir(), config.get("cachePath"), config.get("settingsFileName"));
const defaultSettings = require(__dirname+"/settings.json");

if (fs.existsSync(settingsPath)) {
    // Settings File Exists

    try {
        settings = require(settingsPath);

        for (key in defaultSettings) {
            if (settings[key] == undefined) {
                // Key not found in Settings File. Use Default Value.

                settings[key] = defaultSettings[key];
            }
        }
    } catch (err) {
        // Error Reading Settings File. Use Default Value.

        settings = defaultSettings;
    }
} else {
    // Settings File Does Not Exists. Use Default Value.

    settings = defaultSettings;
}

function get(key) {
    return settings[key];
}

function set(key, value) {
    settings[key] = value;

    fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 4));
}

module.exports.get = get;
module.exports.set = set;
{'fraction_non_alphanumeric': 0.12733594089526293, 'fraction_numerical': 0.000869187309865276, 'mean_word_length': 2.9083191850594226, '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': '1527394', 'n_tokens_mistral': 644, 'n_tokens_neox': 624, 'n_words': 178}