<commit_before>'use babel'

import {Emitter, CompositeDisposable} from 'atom'

export class IndieRegistry {
  constructor() {
    this.subscriptions = new CompositeDisposable()
    this.emitter = new Emitter()

    this.subscriptions.add(this.emitter)
  }

  register() {

  }
  unregister() {

  }

  dispose() {
    this.subscriptions.dispose()
  }
}<commit_msg>:new: Implement basics of indie registry<commit_after>'use babel'

import {Emitter, CompositeDisposable} from 'atom'
import Validate from './validate'
import {Indie} from './indie'

export class IndieRegistry {
  constructor() {
    this.subscriptions = new CompositeDisposable()
    this.emitter = new Emitter()

    this.indieLinters = new Set()
    this.subscriptions.add(this.emitter)
  }

  register(linter) {
    Validate.linter(linter, true)
    const indieLinter = new Indie(linter)

    this.subscriptions.add(indieLinter)
    this.indieLinters.add(indieLinter)

    indieLinter.onDidDestroy(() => {
      this.indieLinters.delete(indieLinter)
    })

    return indieLinter
  }
  unregister(indieLinter) {
    if (this.indieLinters.has(indieLinter)) {
      indieLinter.dispose()
    }
  }

  dispose() {
    this.subscriptions.dispose()
  }
}
{'fraction_non_alphanumeric': 0.11914543960558752, 'fraction_numerical': 0.0, 'mean_word_length': 3.5789473684210527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4401064', 'n_tokens_mistral': 430, 'n_tokens_neox': 408, 'n_words': 75}