<commit_before>/**
 * Concat and flattens non-null values.
 * Ex: concat(1, undefined, 2, [3, 4]) = [1, 2, 3, 4]
 *
 * @param   {...any}
 * @returns {any[]}
 */
function concat() {
  const args = Array.from(arguments).filter(e => e != null);
  const baseArray = Array.isArray(args[0]) ? args[0] : [args[0]];
  return Array.prototype.concat.apply(baseArray, args.slice(1));
}

/**
 * Remove the stack trace from the message.
 *
 * @param   {string} message
 * @returns {string}
 */
const cleanStackTrace = (message) => message.replace(/^\s*at\s.*:\d+:\d+[\s)]*\n/gm, '');

/**
 * Replace the error message.
 *
 * @param   {string} message
 * @returns {string}
 */
const cleanMessage = (message) => message.replace(/^Module build failed.*:\s/, "Module build failed: Module failed because of a stylelint error.\n");

/**
 * Whether the error is from the stylelint plugin.
 *
 * @param   {Object} error
 * @returns {boolean}
 */
const isStylelintError = (error) => error.originalStack.some(stackframe => stackframe.fileName && stackframe.fileName.indexOf('stylelint-webpack-plugin') > 0);

/**
 * Return the error message.
 *
 * @param   {Object} error
 * @returns {*[]}
 */
const displayError = (error) => [error.message, ''];

/**
 *
 * @param   {Object} error
 * @returns {Object}
 */
const transform = (error) => {
  if (isStylelintError(error)) {
    error = Object.assign({}, error, {
      message: cleanStackTrace(cleanMessage(error.message) + '\n'),
      name: 'Lint error',
      type: 'stylelint-error',
    });

    error.webpackError = error.message;
  }

  return error;
};

/**
 *<commit_msg>Changed stylelint plugin name<commit_after>/**
 * Concat and flattens non-null values.
 * Ex: concat(1, undefined, 2, [3, 4]) = [1, 2, 3, 4]
 *
 * @param   {...any}
 * @returns {any[]}
 */
function concat() {
  const args = Array.from(arguments).filter(e => e != null);
  const baseArray = Array.isArray(args[0]) ? args[0] : [args[0]];
  return Array.prototype.concat.apply(baseArray, args.slice(1));
}

/**
 * Remove the stack trace from the message.
 *
 * @param   {string} message
 * @returns {string}
 */
const cleanStackTrace = (message) => message.replace(/^\s*at\s.*:\d+:\d+[\s)]*\n/gm, '');

/**
 * Replace the error message.
 *
 * @param   {string} message
 * @returns {string}
 */
const cleanMessage = (message) => message.replace(/^Module build failed.*:\s/, "Module build failed: Module failed because of a stylelint error.\n");

/**
 * Whether the error is from the stylelint plugin.
 *
 * @param   {Object} error
 * @returns {boolean}
 */
const isStylelintError = (error) => error.originalStack.some(stackframe => stackframe.fileName && stackframe.fileName.indexOf('stylelint-ext-webpack-plugin') > 0);

/**
 * Return the error message.
 *
 * @param   {Object} error
 * @returns {*[]}
 */
const displayError = (error) => [error.message, ''];

/**
 *
 * @param   {Object} error
 * @returns {Object}
 */
const transform = (error) => {
  if (isStylelintError(error)) {
    error = Object.assign({}, error, {
      message: cleanStackTrace(cleanMessage(error.message) + '\n'),
      name: 'Lint error',
      type: 'stylelint-error',
    });

    error.webpackError = error.message;
  }

  return error;
};

/**
 *
{'fraction_non_alphanumeric': 0.19052044609665428, 'fraction_numerical': 0.0080545229244114, 'mean_word_length': 3.503486750348675, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '7352356', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1062, 'n_words': 269}