<commit_before>import { DangerResults } from "../../dsl/DangerResults"
import { Violation } from "../../platforms/messaging/violation"
import * as v from "voca"

/**
 * Converts a set of violations into a HTML table
 *
 * @param {string} name User facing title of table
 * @param {string} emoji Emoji name to show next to each item
 * @param {Violation[]} violations for table
 * @returns {string} HTML
 */
function table(name: string, emoji: string, violations: Array<Violation>): string {
  if (violations.length === 0) { return "" }
  return `
<table>
  <thead>
    <tr>
      <th width="50"></th>
      <th width="100%" data-danger-table="true">${name}</th>
    </tr>
  </thead>
  <tbody>${violations.map((v: Violation) => { return `<tr>
      <td>:${emoji}:</td>
      <td>${v.message}</td>
    </tr>
  ` }).join("\n")}</tbody>
</table><commit_msg>Don't output table if no violations are specified<commit_after>import { DangerResults } from "../../dsl/DangerResults"
import { Violation } from "../../platforms/messaging/violation"
import * as v from "voca"

/**
 * Converts a set of violations into a HTML table
 *
 * @param {string} name User facing title of table
 * @param {string} emoji Emoji name to show next to each item
 * @param {Violation[]} violations for table
 * @returns {string} HTML
 */
function table(name: string, emoji: string, violations: Array<Violation>): string {
  if (violations.length === 0 || (violations.length === 1 && !violations[0].message)) { return "" }
  return `
<table>
  <thead>
    <tr>
      <th width="50"></th>
      <th width="100%" data-danger-table="true">${name}</th>
    </tr>
  </thead>
  <tbody>${violations.map((v: Violation) => { return `<tr>
      <td>:${emoji}:</td>
      <td>${v.message}</td>
    </tr>
  ` }).join("\n")}</tbody>
</table>
{'fraction_non_alphanumeric': 0.1930996104618809, 'fraction_numerical': 0.0077907623817473565, 'mean_word_length': 3.5175879396984926, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, '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': '1555241', 'n_tokens_mistral': 625, 'n_tokens_neox': 603, 'n_words': 171}