<commit_before>/*
 * grunt
 * https://github.com/cowboy/grunt
 *
 * Copyright (c) 2012 "Cowboy" <NAME>
 * Licensed under the MIT license.
 * http://benalman.com/about/license/
 */

var grunt = require('../grunt');

// The module to be exported.
var fail = module.exports = {};

// Error codes
// 1. Generic error.
// 2. Config file not found.
// 3. Generic task failed.
// 10. Uglify-JS error.
// 11. Banner generation error.
// 20. Init error.
// 90-99. Nodeunit/QUnit errors.

// DRY it up!
function writeln(e, mode) {
  grunt.log.muted = false;
  // Pretty colors.
  var tags = {
    warn: ['<'.red + 'WARN'.yellow + '>'.red, '</'.red + 'WARN'.yellow + '>'.red],
    fatal: ['<'.red + 'FATAL'.yellow + '>'.red, '</'.red + 'FATAL'.yellow + '>'.red]
  };
  var msg = String(e.message || e) + '\x07'; // Beep!
  if (mode === 'warn') {
    msg += ' ' + (grunt.option('force') ? 'Used --force, continuing.'.underline : 'Use --force to continue.');
  }
  grunt.log.writeln([tags[mode][0], msg.yellow, tags[mode][1]].join(' '));
}

// A fatal error occured. Abort immediately.
fail.fatal = function(e, errcode) {
  writeln(e, 'fatal');
  process.reallyExit(typeof errcode === 'number' ? errcode : 1);
};

// Keep track of error and warning counts.
fail.errorcount = 0;
fail.warncount = 0;

// Something (like the watch task) can override this to perform an alternate
// action to exiting on warn.
fail.warnAlternate = null;

// A warning ocurred. Abort immediately unless -f or --force was used.
fail.warn = function(e, errcode) {
  var message = typeof e === 'string' ? e : e.message;
  fail.warncount++;<commit_msg>Grunt no longer beeps on warn/fatal if --no-color is used. Fixes #119.<commit_after>/*
 * grunt
 * https://github.com/cowboy/grunt
 *
 * Copyright (c) 2012 "Cowboy" <NAME>
 * Licensed under the MIT license.
 * http://benalman.com/about/license/
 */

var grunt = require('../grunt');

// The module to be exported.
var fail = module.exports = {};

// Error codes
// 1. Generic error.
// 2. Config file not found.
// 3. Generic task failed.
// 10. Uglify-JS error.
// 11. Banner generation error.
// 20. Init error.
// 90-99. Nodeunit/QUnit errors.

// DRY it up!
function writeln(e, mode) {
  grunt.log.muted = false;
  // Pretty colors.
  var tags = {
    warn: ['<'.red + 'WARN'.yellow + '>'.red, '</'.red + 'WARN'.yellow + '>'.red],
    fatal: ['<'.red + 'FATAL'.yellow + '>'.red, '</'.red + 'FATAL'.yellow + '>'.red]
  };
  var msg = String(e.message || e);
  if (!grunt.option('no-color')) { msg += '\x07'; } // Beep!
  if (mode === 'warn') {
    msg += ' ' + (grunt.option('force') ? 'Used --force, continuing.'.underline : 'Use --force to continue.');
  }
  grunt.log.writeln([tags[mode][0], msg.yellow, tags[mode][1]].join(' '));
}

// A fatal error occured. Abort immediately.
fail.fatal = function(e, errcode) {
  writeln(e, 'fatal');
  process.reallyExit(typeof errcode === 'number' ? errcode : 1);
};

// Keep track of error and warning counts.
fail.errorcount = 0;
fail.warncount = 0;

// Something (like the watch task) can override this to perform an alternate
// action to exiting on warn.
fail.warnAlternate = null;

// A warning ocurred. Abort immediately unless -f or --force was used.
fail.warn = function(e, errcode) {
  var message = typeof e === 'string' ? e : e.message;
  fail.warncount++;
{'fraction_non_alphanumeric': 0.1948286229705352, 'fraction_numerical': 0.015333734215273603, 'mean_word_length': 2.974910394265233, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '4693403', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1161, 'n_words': 347}