<commit_before>// Generate dummy process data

var processesData = [];

var maxNumberOrProcesses = 10;
var countToCreateNew = 0;

var updateExistingProcesses = function() {
    for(var i=0; i< processesData.length; i++) {
        processesData[i].numberOfProcessedFiles++;
        processesData[i].percentageComplete += Math.floor((Math.random()*4)+1);
        processesData[i].percentageComplete =
            (processesData[i].percentageComplete > 100) ? 100: processesData[i].percentageComplete;
    }
}

var sampleTypesOfProcess = ['Testing', 'Refactoring', 'Implementing', 'Compressing', 'Hammering', 'Forking'];

var createNewProcess = function() {
    return {
        'typeOfProcess': 'Executing',
        'percentageComplete': Math.floor((Math.random() * 20) + 1),
        'state': 'executing',
        'numberOfProcessedFiles': Math.floor((Math.random() * 5) + 1),
        'title': 'process ' + Math.floor((Math.random() * 10000) + 1),
        'type': sampleTypesOfProcess[Math.floor((Math.random() * sampleTypesOfProcess.length))]
    };
};

var refreshRate = 500;

var startGeneratingData = function(length) {
    var self = this;
    this.timeout = setTimeout(function() {

        // Update existing processes
        updateExistingProcesses();

        // Create new process
        if(countToCreateNew++ > 10) {
            processesData.push(createNewProcess());
            countToCreateNew = 0;
        }

        // Remove excess processes
        if(processesData.length > maxNumberOrProcesses) {
            processesData = processesData.slice(maxNumberOrProcesses/2, maxNumberOrProcesses);
        }

        startGeneratingData(refreshRate);
    }, length );

};

startGeneratingData(0);

module.exports = processesData;<commit_msg>Bug fix: processesData.js was not correctly removing processes<commit_after>// Generate dummy process data

var processesData = [];

var maxNumberOrProcesses = 10;
var countToCreateNew = 0;

var updateExistingProcesses = function() {
    for(var i=0; i< processesData.length; i++) {
        processesData[i].numberOfProcessedFiles++;
        processesData[i].percentageComplete += Math.floor((Math.random()*4)+1);
        processesData[i].percentageComplete =
            (processesData[i].percentageComplete > 100) ? 100: processesData[i].percentageComplete;
    }
}

var sampleTypesOfProcess = ['Testing', 'Refactoring', 'Implementing', 'Compressing', 'Hammering', 'Forking'];

var createNewProcess = function() {
    return {
        'typeOfProcess': 'Executing',
        'percentageComplete': Math.floor((Math.random() * 20) + 1),
        'state': 'executing',
        'numberOfProcessedFiles': Math.floor((Math.random() * 5) + 1),
        'title': 'process ' + Math.floor((Math.random() * 10000) + 1),
        'type': sampleTypesOfProcess[Math.floor((Math.random() * sampleTypesOfProcess.length))]
    };
};

var refreshRate = 500;

var startGeneratingData = function(length) {
    var self = this;
    this.timeout = setTimeout(function() {

        // Update existing processes
        updateExistingProcesses();

        // Create new process
        if(countToCreateNew++ > 10) {
            processesData.push(createNewProcess());
            countToCreateNew = 0;
        }

        // Remove excess processes
        if(processesData.length > maxNumberOrProcesses) {
            processesData.splice(0, maxNumberOrProcesses/2);
        }

        startGeneratingData(refreshRate);
    }, length );

};

startGeneratingData(0);

module.exports = processesData;
{'fraction_non_alphanumeric': 0.1335412531896796, 'fraction_numerical': 0.017862205840657782, 'mean_word_length': 3.2660217654171704, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '4120182', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1018, 'n_words': 199}