<commit_before>// Dependencies
var allowUnsafeNewFunction = require('loophole').allowUnsafeNewFunction
var standard = allowUnsafeNewFunction(function () {
  return require('standard')
})
// var semistandard = require('semistandard')
// var happiness = require('happiness')
var fs = require('fs')
var pkgConfig = require('pkg-config')

function getStyleThroughDevDeps (filePath) {
  // This will get the devDependencies
  // from the nearest package.json
  var options = { cwd: filePath, root: 'devDependencies', cache: false }
  var devDeps = pkgConfig(null, options)

  // Check if there are linters defined in
  // package.json devDependencies
  if (devDeps && (devDeps.standard || devDeps.semistandard || devDeps.happiness)) {
    // standard style
    if (devDeps.standard) {
      return standard
    }

    // happiness style
    if (devDeps.happiness) {
      return happiness
    }

    // semistandard style
    return semistandard
  }

  // no style
  return {}
}

module.exports = function selectStyle (config, filePath) {
  // see if setting 'checkStyleDevDependencies' is true
  // if true get style from the package.json
  if (config.checkStyleDevDependencies) {
    return getStyleThroughDevDeps(filePath)
  }

  // fallback to style select value to decide which style
  // we should use
  var linter
  if (config.style === 'standard') {
    linter = standard
  } else if (config.style === 'happiness') {
    linter = happiness
  } else {
    linter = semistandard
  }<commit_msg>fix deps of select-style<commit_after>// Dependencies
var allowUnsafeNewFunction = require('loophole').allowUnsafeNewFunction
var standard = allowUnsafeNewFunction(function () {
  return require('standard')
})
var semistandard = allowUnsafeNewFunction(function () {
  return require('semistandard')
})
var happiness = allowUnsafeNewFunction(function () {
  return require('happiness')
})
var fs = require('fs')
var pkgConfig = require('pkg-config')

function getStyleThroughDevDeps (filePath) {
  // This will get the devDependencies
  // from the nearest package.json
  var options = { cwd: filePath, root: 'devDependencies', cache: false }
  var devDeps = pkgConfig(null, options)

  // Check if there are linters defined in
  // package.json devDependencies
  if (devDeps && (devDeps.standard || devDeps.semistandard || devDeps.happiness)) {
    // standard style
    if (devDeps.standard) {
      return standard
    }

    // happiness style
    if (devDeps.happiness) {
      return happiness
    }

    // semistandard style
    return semistandard
  }

  // no style
  return {
    cmd: 'no-style'
  }
}

module.exports = function selectStyle (config, filePath) {
  // see if setting 'checkStyleDevDependencies' is true
  // if true get style from the package.json
  if (config.checkStyleDevDependencies) {
    return getStyleThroughDevDeps(filePath)
  }

  // fallback to style select value to decide which style
  // we should use
  var linter
  if (config.style === 'standard') {
    linter = standard
  } else if (config.style === 'happiness') {
    linter = happiness
  } else {
    linter = semistandard
  }
{'fraction_non_alphanumeric': 0.10622593068035943, 'fraction_numerical': 0.0, 'mean_word_length': 3.472022955523673, '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': '1846910', 'n_tokens_mistral': 965, 'n_tokens_neox': 925, 'n_words': 267}