<commit_before>'use strict';

module.exports = function (grunt) {

    var path = require('path'),
        browsers = [
            {
                name: 'Chrome',
                DEFAULT_CMD: {
                    linux: ['google-chrome-canary'],
                    darwin: ['/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'],
                    win32: [
                        process.env.LOCALAPPDATA + '\\Google\\Chrome\\Application\\chrome.exe',
                        process.env.ProgramW6432 + '\\Google\\Chrome\\Application\\chrome.exe',
                        process.env.ProgramFiles + '\\Google\\Chrome\\Application\\chrome.exe'
                    ]
                },
                ENV_CMD: 'CHROME_BIN'
            },
            {
                name: 'ChromeCanary',
                DEFAULT_CMD: {
                    linux: ['google-chrome'],
                    darwin: ['/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'],
                    win32: [
                        process.env.LOCALAPPDATA + '\\Google\\Chrome SxS\\Application\\chrome.exe',
                        process.env.ProgramW6432 + '\\Google\\Chrome SxS\\Application\\chrome.exe',
                        process.env.ProgramFiles + '\\Google\\Chrome SxS\\Application\\chrome.exe'
                    ]
                },
                ENV_CMD: 'CHROME_CANARY_BIN'
            },
            {
                name: 'Firefox',
                DEFAULT_CMD: {
                    linux: ['firefox'],
                    darwin: ['/Applications/Firefox.app/Contents/MacOS/firefox-bin'],
                    win32: [
                        process.env.LOCALAPPDATA + '\\Mozilla Firefox\\firefox.exe',
                        process.env.ProgramW6432 + '\\Mozilla Firefox\\firefox.exe',
                        process.env.ProgramFiles + '\\Mozilla Firefox\\firefox.exe'
                    ]
                },
                ENV_CMD: 'FIREFOX_BIN'
            },
            {
                name: 'Safari',
                DEFAULT_CMD: {
                    darwin: ['/Applications/Safari.app/Contents/MacOS/Safari'],
                    win32: [
                        process.env.LOCALAPPDATA + '\\Safari\\Safari.exe',
                        process.env.ProgramW6432 + '\\Safari\\Safari.exe',
                        process.env.ProgramFiles + '\\Safari\\Safari.exe'
                    ]
                },
                ENV_CMD: 'SAFARI_BIN'
            },
            {
                name: 'IE',
                DEFAULT_CMD: {
                    win32: [
                        process.env.ProgramW6432 + '\\Internet Explorer\\iexplore.exe',
                        process.env.ProgramFiles + '\\Internet Explorer\\iexplore.exe'
                    ]
                },
                ENV_CMD: 'IE_BIN'
            }
        ];

    function getCoverageReport (folder) {
        var reports = grunt.file.expand(folder + '*/index.html');

        if (reports && reports.length > 0) {
            return reports[0];
        }

        return '';
    }

    function getInstalledBrowsers (browsers) {
        var result = [];

        browsers.forEach(function (browser) {
            var browserPaths = browser.DEFAULT_CMD[process.platform] || [],
                i, length = browserPaths.length;

            for (i = 0; i < length; i++) {
                if (grunt.file.exists(browserPaths[i]) || process.env[browser.ENV_CMD]) {
                    result.push(browser.name);

                    if (process.platform === 'win32' && !process.env[browser.ENV_CMD]) {
                        process.env[browser.ENV_CMD] = browserPaths[i];
                    }

                    return;
                }
            }
        });

        return result;
    }

    var availableBrowser = getInstalledBrowsers(browsers);

    // Project configuration.
    //noinspection JSUnresolvedFunction,JSUnresolvedVariable
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        conf: grunt.file.readJSON('config/app.conf.json').base,
        bbc: 'node_modules/baboon-client',
        banner: '/*!\n' +
            ' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
            '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
            ' *\n' +
            ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
            ' * Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
            ' */\n\n',
        // Before generating any new files, remove any previously-created files.
        clean: {<commit_msg>chore(Gruntfile): fix karma browser call<commit_after>'use strict';

module.exports = function (grunt) {

    var path = require('path'),
        browsers = [
            {
                name: 'Chrome',
                DEFAULT_CMD: {
                    linux: ['google-chrome'],
                    darwin: ['/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'],
                    win32: [
                        process.env.LOCALAPPDATA + '\\Google\\Chrome\\Application\\chrome.exe',
                        process.env.ProgramW6432 + '\\Google\\Chrome\\Application\\chrome.exe',
                        process.env.ProgramFiles + '\\Google\\Chrome\\Application\\chrome.exe'
                    ]
                },
                ENV_CMD: 'CHROME_BIN'
            },
            {
                name: 'ChromeCanary',
                DEFAULT_CMD: {
                    linux: ['google-chrome-canary'],
                    darwin: ['/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'],
                    win32: [
                        process.env.LOCALAPPDATA + '\\Google\\Chrome SxS\\Application\\chrome.exe',
                        process.env.ProgramW6432 + '\\Google\\Chrome SxS\\Application\\chrome.exe',
                        process.env.ProgramFiles + '\\Google\\Chrome SxS\\Application\\chrome.exe'
                    ]
                },
                ENV_CMD: 'CHROME_CANARY_BIN'
            },
            {
                name: 'Firefox',
                DEFAULT_CMD: {
                    linux: ['firefox'],
                    darwin: ['/Applications/Firefox.app/Contents/MacOS/firefox-bin'],
                    win32: [
                        process.env.LOCALAPPDATA + '\\Mozilla Firefox\\firefox.exe',
                        process.env.ProgramW6432 + '\\Mozilla Firefox\\firefox.exe',
                        process.env.ProgramFiles + '\\Mozilla Firefox\\firefox.exe'
                    ]
                },
                ENV_CMD: 'FIREFOX_BIN'
            },
            {
                name: 'Safari',
                DEFAULT_CMD: {
                    darwin: ['/Applications/Safari.app/Contents/MacOS/Safari'],
                    win32: [
                        process.env.LOCALAPPDATA + '\\Safari\\Safari.exe',
                        process.env.ProgramW6432 + '\\Safari\\Safari.exe',
                        process.env.ProgramFiles + '\\Safari\\Safari.exe'
                    ]
                },
                ENV_CMD: 'SAFARI_BIN'
            },
            {
                name: 'IE',
                DEFAULT_CMD: {
                    win32: [
                        process.env.ProgramW6432 + '\\Internet Explorer\\iexplore.exe',
                        process.env.ProgramFiles + '\\Internet Explorer\\iexplore.exe'
                    ]
                },
                ENV_CMD: 'IE_BIN'
            }
        ];

    function getCoverageReport (folder) {
        var reports = grunt.file.expand(folder + '*/index.html');

        if (reports && reports.length > 0) {
            return reports[0];
        }

        return '';
    }

    function getInstalledBrowsers (browsers) {
        var result = [];

        browsers.forEach(function (browser) {
            var browserPaths = browser.DEFAULT_CMD[process.platform] || [],
                i, length = browserPaths.length;

            for (i = 0; i < length; i++) {
                if (grunt.file.exists(browserPaths[i]) || process.env[browser.ENV_CMD] || process.env[browser.DEFAULT_CMD[process.platform]]) {
                    result.push(browser.name);

                    if (process.platform === 'win32' && !process.env[browser.ENV_CMD]) {
                        process.env[browser.ENV_CMD] = browserPaths[i];
                    }

                    return;
                }
            }
        });

        return result;
    }

    var availableBrowser = getInstalledBrowsers(browsers);

    // Project configuration.
    //noinspection JSUnresolvedFunction,JSUnresolvedVariable
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        conf: grunt.file.readJSON('config/app.conf.json').base,
        bbc: 'node_modules/baboon-client',
        banner: '/*!\n' +
            ' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
            '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
            ' *\n' +
            ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
            ' * Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
            ' */\n\n',
        // Before generating any new files, remove any previously-created files.
        clean: {
{'fraction_non_alphanumeric': 0.1363780526482715, 'fraction_numerical': 0.007400359446030236, 'mean_word_length': 1.2545281220209723, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '3352468', 'n_tokens_mistral': 2805, 'n_tokens_neox': 2517, 'n_words': 379}