<commit_before>/* eslint max-params: [1, 5] */
const assert = require('assert');

/**
 * @mixin
 * @alias actions/fs
 */
const fs = module.exports;

/**
 * Read file from templates folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.read(this.templatePath(filepath))
 *
 * @param {String} filepath - absolute file path or relative to templates folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.readTemplate = function(filepath, ...args) {
  return this.fs.read(this.templatePath(filepath), ...args);
};

/**
 * Copy file from templates folder to destination folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.copy(this.templatePath(from), this.destinationPath(to))
 *
 * @param {String} from - absolute file path or relative to templates folder.
 * @param {String} to - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.copyTemplate = function(from, to, ...args) {
  return this.fs.copy(this.templatePath(from), this.destinationPath(to), ...args);
};

/**
 * Read file from destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.read(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.readDestination = function(filepath, ...args) {
  return this.fs.read(this.destinationPath(filepath), ...args);
};

/**
 * Read JSON file from destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.readJSON(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.readDestinationJSON = function(filepath, ...args) {
  return this.fs.readJSON(this.destinationPath(filepath), ...args);
};

/**
 * Write file to destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.write(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.writeDestination = function(filepath, ...args) {
  return this.fs.write(this.destinationPath(filepath), ...args);
};

/**
 * Write json file to destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.writeJSON(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.writeDestinationJSON = function(filepath, ...args) {
  return this.fs.writeJSON(this.destinationPath(filepath), ...args);
};

/**
 * Delete file from destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.delete(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.deleteDestination = function(filepath, ...args) {
  return this.fs.delete(this.destinationPath(filepath), ...args);
};

/**
 * Copy file from destination folder to another destination folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.copy(this.destinationPath(from), this.destinationPath(to)).
 *
 * @param {String} from - absolute file path or relative to destination folder.
 * @param {String} to - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.copyDestination = function(from, to, ...args) {
  return this.fs.copy(this.destinationPath(from), this.destinationPath(to), ...args);
};

/**
 * Move file from destination folder to another destination folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.move(this.destinationPath(from), this.destinationPath(to)).
 *
 * @param {String} from - absolute file path or relative to destination folder.
 * @param {String} to - absolute file path or relative to destination folder.
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.moveDestination = function(from, to, ...args) {
  return this.fs.move(this.destinationPath(from), this.destinationPath(to), ...args);
};

/**
 * Exists file on destination folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.exists(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.existsDestination = function(filepath, ...args) {
  return this.fs.exists(this.destinationPath(filepath), ...args);
};

/**
 * Copy a template from templates folder to the destination.
 *
 * @param  {String|Array} source - template file, absolute or relative to templatePath().
 * @param  {String|Array} [destination] - destination, absolute or relative to destinationPath().
 * @param {Object} [templateData] - ejs data
 * @param {Object} [templateOptions] - ejs options
 * @param {Object} [copyOptions] - mem-fs-editor copy options
 */
fs.renderTemplate = function(
  source,
  destination = source,
  templateData = this._templateData(),
  templateOptions,
  copyOptions
) {
  if (typeof templateData === 'string') {
    templateData = this._templateData(templateData);
  }

  source = Array.isArray(source) ? source : [source];
  const templatePath = this.templatePath(...source);
  destination = Array.isArray(destination) ? destination : [destination];
  const destinationPath = this.destinationPath(...destination);
<commit_msg>Allow renderTemplate to be called without any argument.<commit_after>/* eslint max-params: [1, 5] */
const assert = require('assert');

/**
 * @mixin
 * @alias actions/fs
 */
const fs = module.exports;

/**
 * Read file from templates folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.read(this.templatePath(filepath))
 *
 * @param {String} filepath - absolute file path or relative to templates folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.readTemplate = function(filepath, ...args) {
  return this.fs.read(this.templatePath(filepath), ...args);
};

/**
 * Copy file from templates folder to destination folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.copy(this.templatePath(from), this.destinationPath(to))
 *
 * @param {String} from - absolute file path or relative to templates folder.
 * @param {String} to - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.copyTemplate = function(from, to, ...args) {
  return this.fs.copy(this.templatePath(from), this.destinationPath(to), ...args);
};

/**
 * Read file from destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.read(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.readDestination = function(filepath, ...args) {
  return this.fs.read(this.destinationPath(filepath), ...args);
};

/**
 * Read JSON file from destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.readJSON(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.readDestinationJSON = function(filepath, ...args) {
  return this.fs.readJSON(this.destinationPath(filepath), ...args);
};

/**
 * Write file to destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.write(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.writeDestination = function(filepath, ...args) {
  return this.fs.write(this.destinationPath(filepath), ...args);
};

/**
 * Write json file to destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.writeJSON(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.writeDestinationJSON = function(filepath, ...args) {
  return this.fs.writeJSON(this.destinationPath(filepath), ...args);
};

/**
 * Delete file from destination folder
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.delete(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.deleteDestination = function(filepath, ...args) {
  return this.fs.delete(this.destinationPath(filepath), ...args);
};

/**
 * Copy file from destination folder to another destination folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.copy(this.destinationPath(from), this.destinationPath(to)).
 *
 * @param {String} from - absolute file path or relative to destination folder.
 * @param {String} to - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.copyDestination = function(from, to, ...args) {
  return this.fs.copy(this.destinationPath(from), this.destinationPath(to), ...args);
};

/**
 * Move file from destination folder to another destination folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.move(this.destinationPath(from), this.destinationPath(to)).
 *
 * @param {String} from - absolute file path or relative to destination folder.
 * @param {String} to - absolute file path or relative to destination folder.
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.moveDestination = function(from, to, ...args) {
  return this.fs.move(this.destinationPath(from), this.destinationPath(to), ...args);
};

/**
 * Exists file on destination folder.
 * mem-fs-editor method's shortcut, for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}.
 * Shortcut for this.fs.exists(this.destinationPath(filepath)).
 *
 * @param {String} filepath - absolute file path or relative to destination folder.
 * @param {...*} args - for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 * @returns {*} for more information see [mem-fs-editor]{@link https://github.com/SBoudrias/mem-fs-editor}
 */
fs.existsDestination = function(filepath, ...args) {
  return this.fs.exists(this.destinationPath(filepath), ...args);
};

/**
 * Copy a template from templates folder to the destination.
 *
 * @param  {String|Array} source - template file, absolute or relative to templatePath().
 * @param  {String|Array} [destination] - destination, absolute or relative to destinationPath().
 * @param {Object} [templateData] - ejs data
 * @param {Object} [templateOptions] - ejs options
 * @param {Object} [copyOptions] - mem-fs-editor copy options
 */
fs.renderTemplate = function(
  source = '',
  destination = source,
  templateData = this._templateData(),
  templateOptions,
  copyOptions
) {
  if (typeof templateData === 'string') {
    templateData = this._templateData(templateData);
  }

  source = Array.isArray(source) ? source : [source];
  const templatePath = this.templatePath(...source);
  destination = Array.isArray(destination) ? destination : [destination];
  const destinationPath = this.destinationPath(...destination);

{'fraction_non_alphanumeric': 0.15766966222497675, 'fraction_numerical': 0.0002479082739386427, 'mean_word_length': 4.244068898277543, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 58, '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': '609250', 'n_tokens_mistral': 4840, 'n_tokens_neox': 4815, 'n_words': 1255}