<commit_before>import Promise from 'bluebird';
import _ from 'lodash';
import fs from 'fs';
import path from 'path';

let log = require('logfilename')('plugins');

export default function Plugins(app){

  let plugins = {};

  function requirePluginDir(pluginPath, name){
    log.debug(`requirePluginDir: ${pluginPath}, name: ${name}`);
    fs.readdirSync(pluginPath)
      .filter( file => file.slice(-9) === 'Plugin.js')
      .forEach(file => {
        plugins[name] = require(path.join(pluginPath, file))(app);
      });
  }

  function createPlugin(dirname) {
      fs.readdirSync(__dirname)
        .filter(file => fs.lstatSync(path.join(dirname, file)).isDirectory())
        .forEach(file => requirePluginDir(path.join(dirname, file), file));
  }

  createPlugin(__dirname);

  async function action(ops){
    await Promise.each(_.values(plugins), obj => obj[ops](app));
  }

  return {<commit_msg>add the possibilty to black list a plugin<commit_after>import Promise from 'bluebird';
import _ from 'lodash';
import fs from 'fs';
import path from 'path';

let log = require('logfilename')('plugins');

const blackList = [
  'fidor',
  //'ticket'
];

export default function Plugins(app){

  let plugins = {};

  function requirePluginDir(pluginPath, name){
    log.debug(`requirePluginDir: ${pluginPath}, name: ${name}`);
    fs.readdirSync(pluginPath)
      .filter( file => file.slice(-9) === 'Plugin.js')
      .forEach(file => {
        plugins[name] = require(path.join(pluginPath, file))(app);
      });
  }

  function createPlugin(dirname) {
      fs.readdirSync(__dirname)
        .filter(file => fs.lstatSync(path.join(dirname, file)).isDirectory())
        .filter(file => !_.includes(file, blackList))
        .forEach(file => requirePluginDir(path.join(dirname, file), file));
  }

  createPlugin(__dirname);

  async function action(ops){
    await Promise.each(_.values(plugins), obj => obj[ops](app));
  }

  return {
{'fraction_non_alphanumeric': 0.16237113402061856, 'fraction_numerical': 0.0010309278350515464, 'mean_word_length': 3.9263959390862944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '5871644', 'n_tokens_mistral': 607, 'n_tokens_neox': 594, 'n_words': 132}