<commit_before>"use strict";

var
  fs = require('fs');

/**
 * Helper class containing some util functions
 */
class Helper {

  /**
   * Helper function to get the number of retries from the path of the report file of the scenario.
   * @param path The path of the report file for the given scenario
   * @returns {Number} Returns the retry count for the scenario
   */
  static getRetryCountFromPath(path) {
    return parseInt(path.replace('.json', '').substr(path.length - 6))
  }

  /**
   * Create the folder structure for the provided path
   * @param completePath The complete path of the file (can be just the folder structure as well)
   */
  static createFolderStructure(completePath) {
    var path = '';
    completePath.split('/').map(function (folder) {
      if (folder == '.') {
        path += folder + '/';
      } else if (folder.indexOf('.') == -1) {
        path += folder + '/';
        try {
          if (!fs.existsSync(path)) {
            fs.mkdirSync(path);
          }
        } catch (ex) {
          console.error("There was an exception during the creation of the '" + path + "' folder: " + ex);
        }
      }
    });
  };

  /**
   * Based on the report returns true if the scenario had undefined step(s), or returns false otherwise
   * @param pathToReport The path to the report file to examine
   * @returns {boolean} True if there were undefined steps, false otherwise
   */
  static hadUndefinedStep(pathToReport) {
    var actualReport = JSON.parse(fs.readFileSync(pathToReport, 'utf8'))[0],
      hasUndefinedStep = false;

    if (actualReport && actualReport.elements && actualReport.elements[0]) {
      actualReport.elements[0].steps.map(function (step) {
        hasUndefinedStep = (step.result.status == 'undefined') ? true : hasUndefinedStep;
      });<commit_msg>Fix OS based path issue<commit_after>"use strict";

var
  fs = require('fs'),
  pathHelper = require('path'),
  pathSeparator = pathHelper.sep;

/**
 * Helper class containing some util functions
 */
class Helper {

  /**
   * Helper function to get the number of retries from the path of the report file of the scenario.
   * @param path The path of the report file for the given scenario
   * @returns {Number} Returns the retry count for the scenario
   */
  static getRetryCountFromPath(path) {
    return parseInt(path.replace('.json', '').substr(path.length - 6))
  }

  /**
   * Create the folder structure for the provided path
   * @param completePath The complete path of the file (can be just the folder structure as well)
   */
  static createFolderStructure(completePath) {
    var path = '';
    completePath.split(pathSeparator).map(function (folder) {
      if (folder == '.') {
        path += folder + pathSeparator;
      } else if (folder.indexOf('.') == -1) {
        path += folder + pathSeparator;
        try {
          if (!fs.existsSync(path)) {
            fs.mkdirSync(path);
          }
        } catch (ex) {
          console.error("There was an exception during the creation of the '" + path + "' folder: " + ex);
        }
      }
    });
  };

  /**
   * Based on the report returns true if the scenario had undefined step(s), or returns false otherwise
   * @param pathToReport The path to the report file to examine
   * @returns {boolean} True if there were undefined steps, false otherwise
   */
  static hadUndefinedStep(pathToReport) {
    var actualReport = JSON.parse(fs.readFileSync(pathToReport, 'utf8'))[0],
      hasUndefinedStep = false;

    if (actualReport && actualReport.elements && actualReport.elements[0]) {
      actualReport.elements[0].steps.map(function (step) {
        hasUndefinedStep = (step.result.status == 'undefined') ? true : hasUndefinedStep;
      });
{'fraction_non_alphanumeric': 0.1187800963081862, 'fraction_numerical': 0.0032102728731942215, 'mean_word_length': 2.850669412976313, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1059230', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1041, 'n_words': 352}