<commit_before>function processFiles(reportPathName, ignoreFile, tag) {
    var xml2js = require('xml2js'),
        fs = require('fs'),
        path = require('path'),
        q = require('q'),
        reportsFilePath = path.join(process.cwd(), reportPathName),
        mostRecentDirectory,
        mostRecentDirectoryStats,
        failedTests = [];
        tag = tag ? '_'+ tag : tag;

        // STEP 1 - READ THROUGH THE DIRECTORIES AND DETERMINE THE MOST RECENT DIRECTORY
        var directories = fs.readdirSync(reportsFilePath);

        // Determines the most recent directory inside jasmine-reports
        for (var i = 0; i < directories.length; i++) {
            var file = directories[i];
            const fullFilePath = path.join(reportsFilePath, file),
                  fileStats = fs.statSync(fullFilePath);
            if (fileStats.isFile() || file === ignoreFile || (tag && file.indexOf(tag) !== (file.length - tag.length))) {
                //ignoring;
            } else if (!mostRecentDirectory) {
                mostRecentDirectory = fullFilePath;
                mostRecentDirectoryStats = fileStats;
            } else if (fileStats.birthtime.getTime() > mostRecentDirectoryStats.birthtime.getTime() ) {
                mostRecentDirectory = fullFilePath;
                mostRecentDirectoryStats = fileStats;
            }
        }

        if (!mostRecentDirectory) {
            console.log("no recent protractor runs found");
            throw "no recent protractor runs found";
        }

        // STEP 2 - READ AND PARSE THROUGH ALL THE FILES WITHIN THE MOST RECENT DIRECTORY
        var mostRecentFiles = fs.readdirSync(mostRecentDirectory);

        var fullFilePaths = [];
        for (var i = 0; i < mostRecentFiles.length; i++) {
            fullFilePaths.push(path.join(mostRecentDirectory, mostRecentFiles[i]));
        }
        return readXmlFiles(fullFilePaths);

        function readXmlFiles(fullFilePaths) {
            fullFilePaths.map(function(fullFilePath) {
                    readXmlFile(fullFilePath);
                });
            return failedTests;
        }

        function readXmlFile(fullFilePath) {
            var fileContents = fs.readFileSync(fullFilePath);

            return parseXmlFileContents(fileContents);
        }

        function parseXmlFileContents(fileContents) {

            xml2js.parseString(fileContents, function(err, result) {
                if (err) {
                    console.log("Failed to parse xml file contents");
                    throw "Failed to parse xml file contents";
                }

                var testSuiteArray = result.testsuites.testsuite;
                if (testSuiteArray) {
                    for (var i = 0; i < testSuiteArray.length; i++) {
                        var testCaseArray = testSuiteArray[i].testcase;
                        if (testCaseArray) {
                            for ( var j = 0; j < testCaseArray.length; j++) {
                                var testCase = testCaseArray[j];
                                if (testCase.failure) {
                                    failedTests.push({
                                        classname: testCase.$.classname.trim().toLowerCase(),
                                        name: testCase.$.name.trim().toLowerCase()
                                    });
                                }
                            }
                        }
                    }
                }
            });
        }
};

module.exports = processFiles;<commit_msg>fix bug with spec identity<commit_after>function processFiles(reportPathName, ignoreFile, tag) {
    var xml2js = require('xml2js'),
        fs = require('fs'),
        path = require('path'),
        q = require('q'),
        reportsFilePath = path.join(process.cwd(), reportPathName),
        mostRecentDirectory,
        mostRecentDirectoryStats,
        failedTests = [];
        tag = tag ? '_'+ tag : tag;

        // STEP 1 - READ THROUGH THE DIRECTORIES AND DETERMINE THE MOST RECENT DIRECTORY
        var directories = fs.readdirSync(reportsFilePath);

        // Determines the most recent directory inside jasmine-reports
        for (var i = 0; i < directories.length; i++) {
            var file = directories[i];
            const fullFilePath = path.join(reportsFilePath, file),
                  fileStats = fs.statSync(fullFilePath);
            if (fileStats.isFile() || file === ignoreFile || (tag && file.indexOf(tag) !== (file.length - tag.length))) {
                //ignoring;
            } else if (!mostRecentDirectory) {
                mostRecentDirectory = fullFilePath;
                mostRecentDirectoryStats = fileStats;
            } else if (fileStats.birthtime.getTime() > mostRecentDirectoryStats.birthtime.getTime() ) {
                mostRecentDirectory = fullFilePath;
                mostRecentDirectoryStats = fileStats;
            }
        }

        if (!mostRecentDirectory) {
            console.log("no recent protractor runs found");
            throw "no recent protractor runs found";
        }

        // STEP 2 - READ AND PARSE THROUGH ALL THE FILES WITHIN THE MOST RECENT DIRECTORY
        var mostRecentFiles = fs.readdirSync(mostRecentDirectory);

        var fullFilePaths = [];
        for (var i = 0; i < mostRecentFiles.length; i++) {
            fullFilePaths.push(path.join(mostRecentDirectory, mostRecentFiles[i]));
        }
        return readXmlFiles(fullFilePaths);

        function readXmlFiles(fullFilePaths) {
            fullFilePaths.map(function(fullFilePath) {
                    readXmlFile(fullFilePath);
                });
            return failedTests;
        }

        function readXmlFile(fullFilePath) {
            var fileContents = fs.readFileSync(fullFilePath);

            return parseXmlFileContents(fileContents);
        }

        function parseXmlFileContents(fileContents) {

            xml2js.parseString(fileContents, function(err, result) {
                if (err) {
                    console.log("Failed to parse xml file contents");
                    throw "Failed to parse xml file contents";
                }

                var testSuiteArray = result.testsuites.testsuite;
                if (testSuiteArray) {
                    for (var i = 0; i < testSuiteArray.length; i++) {
                        var testCaseArray = testSuiteArray[i].testcase;
                        if (testCaseArray) {
                            for ( var j = 0; j < testCaseArray.length; j++) {
                                var testCase = testCaseArray[j];
                                if (testCase.failure) {
                                    failedTests.push({
                                        classname: testCase.$.classname.trim().toLowerCase().replace(' .','  '),
                                        name: testCase.$.name.trim().toLowerCase()
                                    });
                                }
                            }
                        }
                    }
                }
            });
        }
};

module.exports = processFiles;
{'fraction_non_alphanumeric': 0.09452666852834404, 'fraction_numerical': 0.002513264451270595, 'mean_word_length': 1.5221830985915492, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '216021', 'n_tokens_mistral': 1822, 'n_tokens_neox': 1683, 'n_words': 397}