<commit_before>var path = require('path')
var isAbsolute = require('path-is-absolute')
var eslint = require('eslint')

function resolvePackagesMain(cwd, packageFile) {
  var packageFilePath = path.join(cwd, packageFile)
  var packageJson = require(packageFilePath)
  return packageJson.main
}

function getConfigFile(specifiedFile) {
  //var specifiedFile = process.argv[2]
  if (specifiedFile) {
    // this is being called like: eslint-find-new-rules eslint-config-mgol
    if (isAbsolute(specifiedFile)) {
      return specifiedFile
    } else {
      return path.join(process.cwd(), specifiedFile)
    }
  } else {
    // this is not being called with an arg. Use the package.json `main`
    return resolvePackagesMain(process.cwd(), 'package.json')
  }
}

function getConfig(specifiedFile) {
  var configFile = getConfigFile(specifiedFile)
  var cliEngine = new eslint.CLIEngine({
    // ignore any config applicable depending on the location on the filesystem
    useEslintrc: false,
    // point to the particular config
    configFile: configFile, // eslint-disable-line object-shorthand
  })
  return cliEngine.getConfigForFile()
}

function mapPluginRuleNames(plugin) {
  return function mapPluginNames(rule) {
    return plugin + '/' + rule
  }
}

function getCurrentRules(conf) {
  var rules = Object.keys(conf.rules)
  return rules
}

function getPluginRules(conf) {
  var rules = []
  var plugins = conf.plugins
  if (plugins) {
    plugins.forEach(function normalizePluginRule(plugin) {
      var thisPluginsConfig = require('eslint-plugin-' + plugin)
      var thisPluginsRules = thisPluginsConfig.rules
      /* istanbul ignore next */
      if (typeof thisPluginsRules === 'object') {
        rules = rules.concat(Object.keys(thisPluginsRules).map(mapPluginRuleNames(plugin)))
      }
    })
  }
  return rules
}
<commit_msg>refactor(code): inlined two explicit functions<commit_after>var path = require('path')
var isAbsolute = require('path-is-absolute')
var eslint = require('eslint')

function getConfigFile(specifiedFile) {
  //var specifiedFile = process.argv[2]
  if (specifiedFile) {
    // this is being called like: eslint-find-new-rules eslint-config-mgol
    if (isAbsolute(specifiedFile)) {
      return specifiedFile
    } else {
      return path.join(process.cwd(), specifiedFile)
    }
  } else {
    // this is not being called with an arg. Use the package.json `main`
    return require(path.join(process.cwd(), 'package.json')).main
  }
}

function getConfig(specifiedFile) {
  var configFile = getConfigFile(specifiedFile)
  var cliEngine = new eslint.CLIEngine({
    // ignore any config applicable depending on the location on the filesystem
    useEslintrc: false,
    // point to the particular config
    configFile: configFile, // eslint-disable-line object-shorthand
  })
  return cliEngine.getConfigForFile()
}

function getCurrentRules(conf) {
  var rules = Object.keys(conf.rules)
  return rules
}

function getPluginRules(conf) {
  var rules = []
  var plugins = conf.plugins
  if (plugins) {
    plugins.forEach(function normalizePluginRule(plugin) {
      var thisPluginsConfig = require('eslint-plugin-' + plugin)
      var thisPluginsRules = thisPluginsConfig.rules
      /* istanbul ignore next */
      if (typeof thisPluginsRules === 'object') {
        rules = rules.concat(
          Object.keys(thisPluginsRules).map(function mapPluginNames(rule) {
            return plugin + '/' + rule
          })
        )
      }
    })
  }
  return rules
}

{'fraction_non_alphanumeric': 0.10692899914456801, 'fraction_numerical': 0.0005702879954376961, 'mean_word_length': 3.491677336747759, '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': '1913309', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1035, 'n_words': 261}