<commit_before>var assert = require('assert');
var fs = require('fs');
var jshint = require('../packages/jshint/jshint').JSHINT;
var coverage = require('coveraje').coveraje;
var useServer = (process.argv[2] === 'server');

var tests = [];

var options = {
  asi: false,
  auto_indent: false,
  debug: false,
  indent: 2,
  indentpref: "spaces",
  immed: true,
  lastsemic: false,
  laxbreak: true,
  maxerr: 500,
  nonew: true,
  shadow: false,
  sub: false,
  supernew: false,
  trailing: true,
  white: true
};


function DSL(self, code, opts) {
  code = code || "var foo = 1";
  opts = opts || options;
  var result = jshint(code, opts);
  return self.fixMyJS(jshint.data(), code);
}

function reporter(done) {
  var runtime = done.runtime;
  var data = runtime.reportData();
  var cl = 0;
  var clt = 0;
  var vlt = 0;
  var vl = 0;
  var total = 0;

  vl = data.visited.length;
  cl += vl;

  if (vl > 0) {
    vlt = data.visited.filter(runtime.visit.isTested).length;
    clt += vlt;
  }

  vl = data.branches.length;
  cl += vl;

  if (vl > 0) {
    vlt = data.branches.filter(runtime.branch.isTested).length;
    clt += vlt;
  }

  total = (clt / cl * 100).toFixed(2);

  console.log('Coverage:', total + '%');

  process.exit(total < 90);
}

// Loop through each test and add a topic. Prepare for coveraje.
fs.readdirSync(__dirname + "/fixtures/broken/").forEach(function (test) {
  var opts;

  var file_n = __dirname + "/fixtures/broken/" + test;
  var file_y = __dirname + "/fixtures/ok/" + test;

  if (test === "autoindentspaces.js") {
    opts = { white: true, indent: 2, indentpref: "spaces", auto_indent: true };
  } else if (test === "autoindenttabs.js") {<commit_msg>Fixes bug, when using server don't exit<commit_after>var assert = require('assert');
var fs = require('fs');
var jshint = require('../packages/jshint/jshint').JSHINT;
var coverage = require('coveraje').coveraje;
var useServer = (process.argv[2] === 'server');

var tests = [];

var options = {
  asi: false,
  auto_indent: false,
  debug: false,
  indent: 2,
  indentpref: "spaces",
  immed: true,
  lastsemic: false,
  laxbreak: true,
  maxerr: 500,
  nonew: true,
  shadow: false,
  sub: false,
  supernew: false,
  trailing: true,
  white: true
};


function DSL(self, code, opts) {
  code = code || "var foo = 1";
  opts = opts || options;
  var result = jshint(code, opts);
  return self.fixMyJS(jshint.data(), code);
}

function reporter(done) {
  var runtime = done.runtime;
  var data = runtime.reportData();
  var cl = 0;
  var clt = 0;
  var vlt = 0;
  var vl = 0;
  var total = 0;

  vl = data.visited.length;
  cl += vl;

  if (vl > 0) {
    vlt = data.visited.filter(runtime.visit.isTested).length;
    clt += vlt;
  }

  vl = data.branches.length;
  cl += vl;

  if (vl > 0) {
    vlt = data.branches.filter(runtime.branch.isTested).length;
    clt += vlt;
  }

  total = (clt / cl * 100).toFixed(2);

  console.log('Coverage:', total + '%');

  if (!useServer) {
    process.exit(total < 90);
  }
}

// Loop through each test and add a topic. Prepare for coveraje.
fs.readdirSync(__dirname + "/fixtures/broken/").forEach(function (test) {
  var opts;

  var file_n = __dirname + "/fixtures/broken/" + test;
  var file_y = __dirname + "/fixtures/ok/" + test;

  if (test === "autoindentspaces.js") {
    opts = { white: true, indent: 2, indentpref: "spaces", auto_indent: true };
  } else if (test === "autoindenttabs.js") {
{'fraction_non_alphanumeric': 0.16559579439252337, 'fraction_numerical': 0.011682242990654205, 'mean_word_length': 3.2546583850931676, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1306801', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1264, 'n_words': 336}