<commit_before>var jshint = require('jshint').JSHINT;
var options = require("./options/lint-options.js");
var exclude = require("./options/lint-exclude.js");

module.exports.onFileContent = function (callback, config, fileObject) {
    var result;
    if (exclude.isExcluded(fileObject.path)) {
        fileObject.content = "\n\n" + fileObject.path
                + " excluded from jshint\n--------------------------------------------------------------------\n\n";
    } else {
        result = jshint(fileObject.content, options, {});

        fileObject.content = "\n\n" + fileObject.path
                + " jshint results\n=========================================\n\n";

        if (!result) {
            jshint.errors.forEach(function (result) {
                if (result) {
                    fileObject.content += '[E] line ' + result.line + ', col ' + result.character + ', ' + result.reason
                            + "\n";
                    if (!config.errors) {
                        config.errors = 1;
                    } else {
                        config.errors++;
                    }
                }
            });
        }
    }

    callback();
};

module.exports.onEnd = function (callback, config) {
    if (config.errors) {
        logger.logError("JShint found " + config.errors + " errors in the code! Please check "
                + Object.keys(config.packages)[0] + " for the complete logs");
        // disabled to continue with the build regardless of JSHint warnings:
        process.exit(1);
    } else {<commit_msg>Improving readability of JSHint visitor output<commit_after>var jshint = require('jshint').JSHINT;
var options = require("./options/lint-options.js");
var exclude = require("./options/lint-exclude.js");

module.exports.onFileContent = function (callback, config, fileObject) {
    var valid;
    if (exclude.isExcluded(fileObject.path)) {
        fileObject.content = "[SKIP] " + fileObject.path + " excluded from jshint\n";
    } else {
        valid = jshint(fileObject.content, options, {});

        if (valid) {
            fileObject.content = "[OK]   " + fileObject.path + "\n";
        } else {
            fileObject.content = "\n[FAIL] " + fileObject.path + "\n=========================================\n";
            jshint.errors.forEach(function (result) {
                if (result) {
                    fileObject.content += '  [E] line ' + result.line + ', col ' + result.character + ', '
                            + result.reason + "\n";
                    if (!config.errors) {
                        config.errors = 1;
                    } else {
                        config.errors++;
                    }
                }
            });
            fileObject.content += "\n";
        }
    }

    callback();
};

module.exports.onEnd = function (callback, config) {
    if (config.errors) {
        logger.logError("JShint found " + config.errors + " errors in the code! Please check "
                + Object.keys(config.packages)[0] + " for the complete logs");
        // disabled to continue with the build regardless of JSHint warnings:
        process.exit(1);
    } else {
{'fraction_non_alphanumeric': 0.176248821866164, 'fraction_numerical': 0.001885014137606032, 'mean_word_length': 1.6711409395973154, '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': '78333', 'n_tokens_mistral': 866, 'n_tokens_neox': 831, 'n_words': 183}