<commit_before>$report = function(){
};

(function($report) {

  $report.levels = {
    INT_DEBUG   : 0,
    DEBUG       : 1,
    INFORMATION : 2,
    NOTE        : 3,
    SUCCESS     : 4,
    WARNING     : 5,
    ERROR       : 6,
    INTERNAL    : 7,
    FATAL       : 8
  };

  $report.report = function(){
    var report;
    return function(){
      return report || (report = $('#report'));
    };
  }();
  $report.tabs = function(){
    var tabs;
    return function(){
	return (tabs || (tabs = $report.report().tabs)).apply($report.report(), arguments);
    };
  }();

  $report.hijax = function(panel){ 
    $('a', panel).click(function() { 
      if (this.href == '') return true;
       /**makes children 'a' on panel load via ajax, hence hijax*/ 
       $(panel).load(this.href, null, function(){ 
         /**recursively apply the hijax to newly loaded panels*/ 
         hijax(panel);                   
       }); 
       /**prevents propagation of click to document*/ 
       return false; 
    });     
  };

  function testJSON(data) {
      var get = function(severity, attr) {
        var result = this.msgs.filter(function(a){return a.severity === severity})[0];
        if (attr === undefined) return result;
	if (result !== undefined && result.hasOwnProperty(attr)) return result[attr];
        return '';
      }
      var status = function() {
          var sorted = this.msgs.sort(function(a,b){return a.level<b.level});
          if (sorted[0].level>=$report.levels.ERROR) {
              return {status: 'FAIL', reason : '('+sorted[0].severity+') '+sorted[0].msg};
          }
          var success = this.get('SUCCESS');
          if (success === undefined) {
              return {status: 'FAIL', reason : 'No SUCCESS'};
	  }
          if (success.count > 1) {
              return {status: 'FAIL', reason : 'Too many SUCCESSes'};
	  }
	  return {status : 'PASS', reason : success.msg};
      };

    this.cols = function() {
      return [
	{ "sTitle": "log id" },
	{ "sTitle": "user" },
	{ "sTitle": "description" },
	{ "sTitle": "fatals" },
	{ "sTitle": "internals" },
	{ "sTitle": "errors" },
	{ "sTitle": "warnings" },
	{ "sTitle": "message" },
	{ "sTitle": "status" }
      ];
    };

    this.rows = function() {
	return data.map(function(log){
            var status = log.status();
            return [log.log.log_id, log.log.user, log.log.description, log.get('FATAL', 'count'), log.get('INTERNAL', 'count'), log.get('ERROR', 'count'), log.get('WARNING', 'count'), status.reason, status.status];
	});
    };
		       
      for (log in data) {
          data[log].get    = get;
          data[log].status = status;
     }
  };

  $report.renderTestJSON = function(data, type) {
    data = new testJSON($.parseJSON(data));
    var container = $('<div><table class="display"></table></div>');
    $('table', container).dataTable({
      "bJQueryUI": true,
      "bPaginate": false,
      "bFilter": false,
      "aaData" : data.rows(),
      "aoColumns": data.cols(),<commit_msg>popup first message<commit_after>$report = function(){
};

(function($report) {

  $report.levels = {
    INT_DEBUG   : 0,
    DEBUG       : 1,
    INFORMATION : 2,
    NOTE        : 3,
    SUCCESS     : 4,
    WARNING     : 5,
    ERROR       : 6,
    INTERNAL    : 7,
    FATAL       : 8
  };

  $report.report = function(){
    var report;
    return function(){
      return report || (report = $('#report'));
    };
  }();
  $report.tabs = function(){
    var tabs;
    return function(){
	return (tabs || (tabs = $report.report().tabs)).apply($report.report(), arguments);
    };
  }();

  $report.hijax = function(panel){ 
    $('a', panel).click(function() { 
      if (this.href == '') return true;
       /**makes children 'a' on panel load via ajax, hence hijax*/ 
       $(panel).load(this.href, null, function(){ 
         /**recursively apply the hijax to newly loaded panels*/ 
         hijax(panel);                   
       }); 
       /**prevents propagation of click to document*/ 
       return false; 
    });     
  };

  function testJSON(data) {
      var get = function(severity, attr) {
        var result = this.msgs.filter(function(a){return a.severity === severity})[0];
        if (attr === undefined) return result;
	if (result === undefined) return '';
        if (attr instanceof Function) {
          return attr(result);
	} else if (result.hasOwnProperty(attr)) {
          return result[attr];
        }
        return '';
      }
      var status = function() {
          var sorted = this.msgs.sort(function(a,b){return a.level<b.level});
          if (sorted[0].level>=$report.levels.ERROR) {
              return {status: 'FAIL', reason : '('+sorted[0].severity+') '+sorted[0].msg};
          }
          var success = this.get('SUCCESS');
          if (success === undefined) {
              return {status: 'FAIL', reason : 'No SUCCESS'};
	  }
          if (success.count > 1) {
              return {status: 'FAIL', reason : 'Too many SUCCESSes'};
	  }
	  return {status : 'PASS', reason : success.msg};
      };

    this.cols = function() {
      return [
	{ "sTitle": "log id" },
	{ "sTitle": "user" },
	{ "sTitle": "description" },
	{ "sTitle": "fatals" },
	{ "sTitle": "internals" },
	{ "sTitle": "errors" },
	{ "sTitle": "warnings" },
	{ "sTitle": "message" },
	{ "sTitle": "status" }
      ];
    };

    this.rows = function() {
        function popup(attr) {
            return '<abbr title="'+attr.msg.replace('"', '&quot;')+'">'+attr.count+'</abbr>';
	}
	return data.map(function(log){
            var status = log.status();
            return [log.log.log_id, log.log.user, log.log.description, log.get('FATAL', popup), log.get('INTERNAL', popup), log.get('ERROR', popup), log.get('WARNING', popup), status.reason, status.status];
	});
    };
		       
      for (log in data) {
          data[log].get    = get;
          data[log].status = status;
     }
  };

  $report.renderTestJSON = function(data, type) {
    data = new testJSON($.parseJSON(data));
    var container = $('<div><table class="display"></table></div>');
    $('table', container).dataTable({
      "bJQueryUI": true,
      "bPaginate": false,
      "bFilter": false,
      "aaData" : data.rows(),
      "aoColumns": data.cols(),
{'fraction_non_alphanumeric': 0.18431122448979592, 'fraction_numerical': 0.004464285714285714, 'mean_word_length': 2.2637877211238293, 'pattern_counts': {'":': 26, '<': 15, '<?xml version=': 0, '>': 17, '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': '5176964', 'n_tokens_mistral': 2068, 'n_tokens_neox': 1971, 'n_words': 454}