<commit_before>'use strict';

let yargs = require('yargs'),
  urlValidator = require('valid-url'),
  util = require('util'),
  hasbin = require('hasbin'),
  packageInfo = require('../../package');

function validateInput(argv) {
  let url = argv._[0];
  if (!urlValidator.isWebUri(url)) {
    return util.format(
      "'%s' is not a valid url (e.g. http://www.browsertime.net)",
      url
    );
  }

  if (argv.chrome && argv.chrome.mobileEmulation) {
    const m = argv.chrome.mobileEmulation;
    if (!(m.deviceName || (m.height && m.width && m.pixelRatio))) {
      return 'chrome.mobileEmulation needs to specify deviceName OR height, width and pixelRatio';
    }
  }

  if (argv.video || argv.speedIndex) {
    if (!hasbin.all.sync(['ffmpeg'])) {
      return 'You need to have ffmpeg in your path to be able to record a video.';
    }
  }

  if (
    argv.connectivity.profile !== 'custom' &&
    (argv.connectivity.upstreamKbps ||
      argv.connectivity.downstreamKbps ||
      argv.connectivity.latency)
  ) {
    return 'You must pass --connectivity.profile "custom" for custom connectivity configs to take effect.';
  }

  if (
    argv.connectivity.profile === 'custom' &&
    (!argv.connectivity.upstreamKbps ||
      !argv.connectivity.downstreamKbps ||
      !argv.connectivity.latency)
  ) {
    return 'You must set downstreamKbps, upstreamKbps and latency when using --connectivity.profile "custom".';
  }

  if (
    argv.connectivity.profile !== 'native' &&
    argv.connectivity.engine === 'tc'
  ) {
    if (!hasbin.all.sync(['tc'])) {
      return 'You need to have tc in your path to be able to set the connectivity.';
    }
  }

  if (<commit_msg>you can set only latency now if you want<commit_after>'use strict';

let yargs = require('yargs'),
  urlValidator = require('valid-url'),
  util = require('util'),
  hasbin = require('hasbin'),
  packageInfo = require('../../package');

function validateInput(argv) {
  let url = argv._[0];
  if (!urlValidator.isWebUri(url)) {
    return util.format(
      "'%s' is not a valid url (e.g. http://www.browsertime.net)",
      url
    );
  }

  if (argv.chrome && argv.chrome.mobileEmulation) {
    const m = argv.chrome.mobileEmulation;
    if (!(m.deviceName || (m.height && m.width && m.pixelRatio))) {
      return 'chrome.mobileEmulation needs to specify deviceName OR height, width and pixelRatio';
    }
  }

  if (argv.video || argv.speedIndex) {
    if (!hasbin.all.sync(['ffmpeg'])) {
      return 'You need to have ffmpeg in your path to be able to record a video.';
    }
  }

  if (
    argv.connectivity.profile !== 'custom' &&
    (argv.connectivity.upstreamKbps ||
      argv.connectivity.downstreamKbps ||
      argv.connectivity.latency)
  ) {
    return 'You must pass --connectivity.profile "custom" for custom connectivity configs to take effect.';
  }

  if (
    argv.connectivity.profile !== 'native' &&
    argv.connectivity.engine === 'tc'
  ) {
    if (!hasbin.all.sync(['tc'])) {
      return 'You need to have tc in your path to be able to set the connectivity.';
    }
  }

  if (
{'fraction_non_alphanumeric': 0.14990266060999352, 'fraction_numerical': 0.0006489292667099286, 'mean_word_length': 2.972938144329897, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3468582', 'n_tokens_mistral': 1004, 'n_tokens_neox': 978, 'n_words': 260}