<commit_before>'use strict';

var fs = require('fs'),
    jshintPlugin = require('gulp-jshint'),
    cache = require('gulp-cache');

var jshintVersion = '0.2.4';

var task = {
    // Allow the original if needed.
    original: jshintPlugin,
    // Or, the cached version
    cached: function (opt) {
        var jshintOpts;

        if (typeof opt === 'string') {
            jshintOpts = fs.readFileSync(opt);
        } else {
            jshintOpts = JSON.stringify(opt);
        } 
        
        return cache.proxy('jshint', {
            task: jshintPlugin(opt),
            key: function (file) {
                return [file.contents.toString('utf8'), jshintVersion, jshintOpts].join('');
            },
            success: function (jshintedFile) {
                return jshintedFile.jshint.success;
            },
            value: function (jshintedFile) {
                var result = {
                    jshint: {
                        success: jshintedFile.jshint.success,
                        cached: true
                    }
                };
                return result;
            }
        });
    }
};

// Allow the fileCache to be modified externally
task.cached.fileCache = cache.fileCache;

module.exports = task;<commit_msg>Make sure we match the original API for reporter use<commit_after>'use strict';

var fs = require('fs'),
    jshintPlugin = require('gulp-jshint'),
    cache = require('gulp-cache');

var jshintVersion = '0.2.4';

// Add on to the original plugin
jshintPlugin.cached = function (opt) {
    var jshintOpts;

    if (typeof opt === 'string') {
        jshintOpts = fs.readFileSync(opt);
    } else {
        jshintOpts = JSON.stringify(opt);
    } 
    
    return cache.proxy('jshint', {
        task: jshintPlugin(opt),
        key: function (file) {
            return [file.contents.toString('utf8'), jshintVersion, jshintOpts].join('');
        },
        success: function (jshintedFile) {
            return jshintedFile.jshint.success;
        },
        value: function (jshintedFile) {
            var result = {
                jshint: {
                    success: jshintedFile.jshint.success,
                    cached: true
                }
            };
            return result;
        }
    });
};

// Allow the fileCache to be modified externally
jshintPlugin.cached.fileCache = cache.fileCache;

module.exports = jshintPlugin;
{'fraction_non_alphanumeric': 0.11516155758077878, 'fraction_numerical': 0.0033140016570008283, 'mean_word_length': 1.7257336343115124, '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': '689318', 'n_tokens_mistral': 711, 'n_tokens_neox': 698, 'n_words': 157}