<commit_before>/**
 * Copyright (c) 2015-present, goreutils
 * All rights reserved.
 *
 * This source code is licensed under the MIT-style license found in the
 * LICENSE file in the root directory of this source tree.
 */

"use strict";

var _ = require("lodash"),
    path = require("path"),
    ecmaScriptTestFileExtensionsRegExp = require(path.resolve(__dirname, "..", "..", "pckg", "ecmaScriptTestFileExtensionsRegExp")),
    fs = require("fs"),
    karma = require("karma"),
    karmaWebpackConfig = require(path.resolve(__dirname, "..", "..", "webpack", "config", "karma")),
    mustache = require("mustache"),
    Promise = require("bluebird"),
    tmp = require("tmp");

function awaitPreprocessorCode(config, pckg) {
    return Promise.fromNode(function (cb) {
            fs.readFile(path.resolve(__dirname, "..", "..", "..", "karma", "preprocessor.js.mustache"), cb);
        })
        .then(function (preprocessorTemplateBuffer) {
            return preprocessorTemplateBuffer.toString();
        })
        .then(function (preprocessorTemplate) {
            return mustache.render(preprocessorTemplate, {
                "config": config,
                "ecmaScriptTestFileExtensionsRegExp": ecmaScriptTestFileExtensionsRegExp(pckg, ".karma")
            });
        });
}

module.exports = function (config, pckgPromise) {
    return function () {
        var cleanupCallback;

        return Promise.props({
                "pckg": pckgPromise,
                "tmpfile": Promise.fromNode(function (cb) {
                    tmp.file({
                        "postfix": ".js"
                    }, cb);
                })
            })
            .then(function (results) {
                return Promise.props(_.merge(results, {
                    "preprocessorCode": awaitPreprocessorCode(config, results.pckg),
                    "webpackConfig": karmaWebpackConfig({}, config, results.pckg)
                }));
            })
            .then(function (results) {
                cleanupCallback = results.tmpfile[2];

                return Promise.props(_.merge(results, {<commit_msg>Satisfy linter error (indentation)<commit_after>/**
 * Copyright (c) 2015-present, goreutils
 * All rights reserved.
 *
 * This source code is licensed under the MIT-style license found in the
 * LICENSE file in the root directory of this source tree.
 */

"use strict";

var _ = require("lodash"),
    path = require("path"),
    ecmaScriptTestFileExtensionsRegExp = require(path.resolve(__dirname, "..", "..", "pckg", "ecmaScriptTestFileExtensionsRegExp")),
    fs = require("fs"),
    karma = require("karma"),
    karmaWebpackConfig = require(path.resolve(__dirname, "..", "..", "webpack", "config", "karma")),
    mustache = require("mustache"),
    Promise = require("bluebird"),
    tmp = require("tmp");

function awaitPreprocessorCode(config, pckg) {
    return Promise.fromNode(function (cb) {
            fs.readFile(path.resolve(__dirname, "..", "..", "..", "karma", "preprocessor.js.mustache"), cb);
        })
        .then(function (preprocessorTemplateBuffer) {
            return preprocessorTemplateBuffer.toString();
        })
        .then(function (preprocessorTemplate) {
            return mustache.render(preprocessorTemplate, {
                "config": config,
                "ecmaScriptTestFileExtensionsRegExp": ecmaScriptTestFileExtensionsRegExp(pckg, ".karma")
            });
        });
}

module.exports = function (config, pckgPromise) {
    return function () {
        var cleanupCallback;

        return Promise.props({
            "pckg": pckgPromise,
            "tmpfile": Promise.fromNode(function (cb) {
                tmp.file({
                    "postfix": ".js"
                }, cb);
            })
        })
            .then(function (results) {
                return Promise.props(_.merge(results, {
                    "preprocessorCode": awaitPreprocessorCode(config, results.pckg),
                    "webpackConfig": karmaWebpackConfig({}, config, results.pckg)
                }));
            })
            .then(function (results) {
                cleanupCallback = results.tmpfile[2];

                return Promise.props(_.merge(results, {
{'fraction_non_alphanumeric': 0.1372131535367873, 'fraction_numerical': 0.0023657440264963333, 'mean_word_length': 2.2673879443585783, 'pattern_counts': {'":': 14, '<': 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': '1057248', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1118, 'n_words': 231}