<commit_before>'use strict';

const path = require('path');
const chalk = require('chalk');
const logSymbols = require('log-symbols');
const plur = require('plur');
const stringWidth = require('string-width');
const ansiEscapes = require('ansi-escapes');

module.exports = results => {
  const lines = [];
  let errorCount = 0;
  let warningsCount = 0;
  let maxLineWidth = 0;
  let maxColumnWidth = 0;
  let maxMessageWidth = 0;
  let showLineNumbers = false;

  results
    .sort((a, b) => a.warnings.length - b.warnings.length)
    .forEach(result => {
      const warnings = result.warnings;

      if (warnings.length === 0) {
        return;
      }

      if (lines.length !== 0) {
        lines.push({type: 'separator'});
      }

      const filePath = result.source;

      lines.push({
        type: 'header',
        filePath,
        relativeFilePath: path.relative('.', filePath),
        firstLineCol: warnings[0].line + ':' + warnings[0].column
      });

      warnings
        .sort((a, b) => {
          if (a.severity === b.severity) {
            if (a.line === b.line) {
              return a.column < b.column ? -1 : 1;
            }
            return a.line < b.line ? -1 : 1;
          } else if (a.severity === 2 && b.severity !== 2) {
            return 1;
          }
          return -1;
        })
        .forEach(x => {
          let message = x.text;

          // Remove rule ID from message
          message = message.replace(/\s\(.+\)$/g, '');

          // Stylize inline code blocks
          message = message.replace(/\B`(.*?)`\B|\B'(.*?)'\B/g, (m, p1, p2) => chalk.bold(p1 || p2));

          const line = String(x.line || 0);
          const column = String(x.column || 0);
          const lineWidth = stringWidth(line);
          const columnWidth = stringWidth(column);
          const messageWidth = stringWidth(message);
          let severity = 'warning';
          if (x.severity === 2 || x.severity === 'error') {
            severity = 'error';
            errorCount++;<commit_msg>Fix styling of inline code blocks.<commit_after>'use strict';

const path = require('path');
const chalk = require('chalk');
const logSymbols = require('log-symbols');
const plur = require('plur');
const stringWidth = require('string-width');
const ansiEscapes = require('ansi-escapes');

module.exports = results => {
  const lines = [];
  let errorCount = 0;
  let warningsCount = 0;
  let maxLineWidth = 0;
  let maxColumnWidth = 0;
  let maxMessageWidth = 0;
  let showLineNumbers = false;

  results
    .sort((a, b) => a.warnings.length - b.warnings.length)
    .forEach(result => {
      const warnings = result.warnings;

      if (warnings.length === 0) {
        return;
      }

      if (lines.length !== 0) {
        lines.push({type: 'separator'});
      }

      const filePath = result.source;

      lines.push({
        type: 'header',
        filePath,
        relativeFilePath: path.relative('.', filePath),
        firstLineCol: warnings[0].line + ':' + warnings[0].column
      });

      warnings
        .sort((a, b) => {
          if (a.severity === b.severity) {
            if (a.line === b.line) {
              return a.column < b.column ? -1 : 1;
            }
            return a.line < b.line ? -1 : 1;
          } else if (a.severity === 2 && b.severity !== 2) {
            return 1;
          }
          return -1;
        })
        .forEach(x => {
          let message = x.text;

          // Remove rule ID from message
          message = message.replace(/\s\(.+\)$/g, '');

          // Stylize inline code blocks
          message = message.replace(/\B"(.*?)"\B|\B'(.*?)'\B/g, (m, p1, p2) => chalk.bold(p1 || p2));

          const line = String(x.line || 0);
          const column = String(x.column || 0);
          const lineWidth = stringWidth(line);
          const columnWidth = stringWidth(column);
          const messageWidth = stringWidth(message);
          let severity = 'warning';
          if (x.severity === 2 || x.severity === 'error') {
            severity = 'error';
            errorCount++;
{'fraction_non_alphanumeric': 0.16010755316548522, 'fraction_numerical': 0.011733072598386702, 'mean_word_length': 1.9249463902787705, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '1099075', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1232, 'n_words': 308}