<commit_before>// Requires
var Q = require('q');
var _ = require('underscore');
var path = require('path');
var watchr = require('watchr');

var batch = require('../utils').batch;


function init(logger, events, rootPath) {
    var d = Q.defer();

    // Normalize paths
    function normalize(fullPath) {
        return path.normalize(
            '/' + path.relative(rootPath, fullPath)
        );
    }

    logger.log('Starting Watch');
    // Construct
    watchr.watch({
        paths: [rootPath],

        // Following links causes issues with broken symlinks
        // crashing the whole watchr instance and thus codebox
        // so disabling link following for now
        followLinks: false,

        listeners: {
            log: function(logLevel) {
                /*
                events.emit('watch.log', {
                    level: logLevel,
                    args: _.toArray(arguments)
                });
                */
            },
            error: function(err) {
                events.emit('watch.error', err);
            },<commit_msg>Watchr quick fix waiting for bevry/watchr#59<commit_after>// Requires
var Q = require('q');
var _ = require('underscore');
var path = require('path');
var watchr = require('watchr');

var batch = require('../utils').batch;


function init(logger, events, rootPath) {
    var d = Q.defer();

    // Normalize paths
    function normalize(fullPath) {
        return path.normalize(
            '/' + path.relative(rootPath, fullPath)
        );
    }

    logger.log('Starting Watch');
    // Construct
    watchr.watch({
        paths: [rootPath],

        // Following links causes issues with broken symlinks
        // crashing the whole watchr instance and thus codebox
        // so disabling link following for now
        followLinks: false,

        listeners: {
            log: function(logLevel) {
                /*
                events.emit('watch.log', {
                    level: logLevel,
                    args: _.toArray(arguments)
                });
                */
            },
            error: function(err) {
                if(err) {
                    events.emit('watch.error', err);
                }
            },
{'fraction_non_alphanumeric': 0.12113055181695828, 'fraction_numerical': 0.0008972633467922835, 'mean_word_length': 1.599067599067599, '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': '4904550', 'n_tokens_mistral': 603, 'n_tokens_neox': 569, 'n_words': 150}