<commit_before>require('cute-stack')();
require('..');
/* global lazyAss */
var foo = 'foo', bar = 'bar';
lazyAss(false, 'this fails, foo =', foo, 'bar =', bar);
<commit_msg>cute-stack plugin with printing offending line<commit_after>var cute = require('cute-stack');


function myPlugin(frame) {
  var exists = require('fs').existsSync;
  var read = require('fs').readFileSync;

  function getLine(filename, line) {
    var source = read(filename, 'utf-8').split('\n');
    return source[line - 1];
  }
  function isRelative(frame) {
    var startsWithDot = /^\./;
    return frame.file &&
      startsWithDot.test(frame.file) &&
      typeof frame.line === 'number' &&
      exists(frame.file);
  }
  if (isRelative(frame)) {
    console.log('relative frame');
    console.log(frame);
    var line = getLine(frame.file, frame.line);
    if (line) {
      frame.name = line.trim() + '\n  in ' + frame.id();
    }
    return cute.ui.default(frame);
  } else {
    return cute.ui.default(frame);
  }
}

cute.ui.myPlugin = myPlugin;

cute('myPlugin');

require('..');
/* global lazyAss */
function bad(foo, bar) {
  lazyAss(false, 'this fails, foo =', foo, 'bar =', bar);
}
bad('foo', 'bar');

{'fraction_non_alphanumeric': 0.19143576826196473, 'fraction_numerical': 0.0016792611251049538, 'mean_word_length': 3.4312267657992566, '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': '4686714', 'n_tokens_mistral': 411, 'n_tokens_neox': 409, 'n_words': 92}