<commit_before>import Debug from 'debug'
import path, { sep } from 'path'
import mongoose from 'mongoose'
import Tokens from 'csrf'
import redis from 'redis'
import url from 'url'
import socketIO from 'socket.io'
import models from '../models'
const debug = Debug('crowi:crowi')

const pkg = require('../../package.json')
const events = require('../events')
const middlewares = require('../middlewares')
const controllers = require('../controllers')

type Model<T> = T extends (crowi: any) => infer R ? R : any
type Models<M = typeof models> = {
  [K in keyof M]: Model<M[K]>
}

class Crowi {
  version: string

  rootDir: string

  pluginDir: string

  publicDir: string

  libDir: string

  localeDir: string

  resourceDir: string

  viewsDir: string

  mailDir: string

  tmpDir: string

  cacheDir: string

  // FIXME after service/config typed
  config: any

  searcher: any = null

  mailer: any = {}

  lru: any = {}

  tokens: Tokens | null = null

  // FIXME: {} をアサインしないで済む方法を捜す
  models: Models = {} as any

  events: any = {}
  middlewares: any = {}
  controllers: any = {}

  env: typeof process.env

  node_env: string

  port: number

  redis: redis.RedisClient | null = null

  redisUrl: string | null

  redisOpts: any

  // TODO: @types モジュール入れたらやる
  sessionConfig: any

  io?: socketIO.Server

  // FIXME: util/slack に型付けたらやる
  slack: any

  constructor(rootdir: string, env: typeof process.env) {
    this.version = pkg.version

    this.rootDir = rootdir<commit_msg>Format<commit_after>import Debug from 'debug'
import path, { sep } from 'path'
import mongoose from 'mongoose'
import Tokens from 'csrf'
import redis from 'redis'
import url from 'url'
import socketIO from 'socket.io'
import models from '../models'
const debug = Debug('crowi:crowi')

const pkg = require('../../package.json')
const events = require('../events')
const middlewares = require('../middlewares')
const controllers = require('../controllers')

type Model<T> = T extends (crowi: any) => infer R ? R : any
type Models<M = typeof models> = {
  [K in keyof M]: Model<M[K]>
}

class Crowi {
  version: string

  rootDir: string

  pluginDir: string

  publicDir: string

  libDir: string

  localeDir: string

  resourceDir: string

  viewsDir: string

  mailDir: string

  tmpDir: string

  cacheDir: string

  // FIXME after service/config typed
  config: any

  searcher: any = null

  mailer: any = {}

  lru: any = {}

  tokens: Tokens | null = null

  // FIXME: {} をアサインしないで済む方法を捜す
  models: Models = {} as any

  events: any = {}

  middlewares: any = {}

  controllers: any = {}

  env: typeof process.env

  node_env: string

  port: number

  redis: redis.RedisClient | null = null

  redisUrl: string | null

  redisOpts: any

  // TODO: @types モジュール入れたらやる
  sessionConfig: any

  io?: socketIO.Server

  // FIXME: util/slack に型付けたらやる
  slack: any

  constructor(rootdir: string, env: typeof process.env) {
    this.version = pkg.version

    this.rootDir = rootdir
{'fraction_non_alphanumeric': 0.11915180074049142, 'fraction_numerical': 0.0, 'mean_word_length': 3.301013024602026, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '6393050', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1016, 'n_words': 313}