<commit_before>'use strict';

const bunyan = require('bunyan');
const bodyParser = require('body-parser');
const express = require('express');
const fs = require('mz/fs');
const morgan = require('morgan');
const path = require('path');
const tremble = require('../');
const stream = require('stream');
const uuid = require('uuid');
const wrap = require('co-express');
const _ = require('lodash');

/**
 * @function trembleServer
 * Create a server instance
 * @param {Object} options          Options to send to the server
 * @param {string} options.dataDir  Directory where logs and history will be stored.
 * @param {string} options.command  Command to run in the project.
 * @param {string} options.pageTitle Page title for the web interface.
 * @return {Object} An Express app fully configured. Run listen() on it.
 */
var trembleServer = options => {
  const app = express();
  const testsLogFileName = path.join(options.dataDir, 'tests.log');
  const errorsLogFileName = path.join(options.dataDir, 'error.log');
  const historyLog = bunyan.createLogger({
    name: 'ci',
    streams: [{path: testsLogFileName}]
  });
  const internalLog = bunyan.createLogger({
    name: 'tremble-errors',
    streams: [{path: errorsLogFileName}]
  });

  app.set('views', path.join(__dirname, '/views'));
  app.set('view engine', 'jade');
  app.enable('trust proxy');

  // Global middlewares<commit_msg>fix template engine require<commit_after>'use strict';

const bunyan = require('bunyan');
const bodyParser = require('body-parser');
const express = require('express');
const fs = require('mz/fs');
const morgan = require('morgan');
const path = require('path');
const tremble = require('../');
const stream = require('stream');
const uuid = require('uuid');
const wrap = require('co-express');
const _ = require('lodash');

/**
 * @function trembleServer
 * Create a server instance
 * @param {Object} options          Options to send to the server
 * @param {string} options.dataDir  Directory where logs and history will be stored.
 * @param {string} options.command  Command to run in the project.
 * @param {string} options.pageTitle Page title for the web interface.
 * @return {Object} An Express app fully configured. Run listen() on it.
 */
var trembleServer = options => {
  const app = express();
  const testsLogFileName = path.join(options.dataDir, 'tests.log');
  const errorsLogFileName = path.join(options.dataDir, 'error.log');
  const historyLog = bunyan.createLogger({
    name: 'ci',
    streams: [{path: testsLogFileName}]
  });
  const internalLog = bunyan.createLogger({
    name: 'tremble-errors',
    streams: [{path: errorsLogFileName}]
  });

  app.set('views', path.join(__dirname, '/views'));
  app.set('view engine', 'jade');
  app.engine('jade', require('jade').__express);
  app.enable('trust proxy');

  // Global middlewares
{'fraction_non_alphanumeric': 0.15152578042792003, 'fraction_numerical': 0.0, 'mean_word_length': 4.5271317829457365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3776525', 'n_tokens_mistral': 833, 'n_tokens_neox': 822, 'n_words': 262}