<commit_before>Path = require 'path'
{CompositeDisposable, Emitter} = require 'atom'
Panel = require './panel'
PanelView = require './panel-view'
EditorLinter = require './editor-linter'

class Linter

  constructor: ->
    @View = new (require './panel-old')(this)
    @ViewPanel = atom.workspace.addBottomPanel item: @View.Root, visible: false
    @StatusBar = null
    @MessagesProject = new Map
    @ActiveEditor = atom.workspace.getActiveTextEditor()

    @LintOnFly = true
    @Emitter = new Emitter
    @Subscriptions = new CompositeDisposable
    @EditorLinters = new Map # An object of Editor <--> Linter
    @Linters = [] # I </3 coffee-script
    @Subscriptions.add atom.views.addViewProvider
      modelConstructor: Panel
      viewConstructor: PanelView
    @Panel = new Panel this
    @Panel.registerView atom.views.getView @Panel
    @Subscriptions.add atom.workspace.onDidChangeActivePaneItem (Editor) =>
      @ActiveEditor = Editor
      ActiveLinter = @getActiveEditorLinter()
      return unless ActiveLinter
      ActiveLinter.lint false
    @Subscriptions.add atom.workspace.observeTextEditors (Editor) =>
      CurrentEditorLinter = new EditorLinter @, Editor
      @EditorLinters.set Editor, CurrentEditorLinter
      @Emitter.emit 'linters-observe', CurrentEditorLinter
      Editor.onDidDestroy =>
        CurrentEditorLinter.destroy()
        @EditorLinters.delete CurrentEditorLinter

  getActiveEditorLinter: ->
    return null unless @ActiveEditor
    return @EditorLinters.get @ActiveEditor<commit_msg>:new: Register ViewProvider using the new API<commit_after>Path = require 'path'
{CompositeDisposable, Emitter} = require 'atom'
Panel = require './panel'
PanelView = require './panel-view'
EditorLinter = require './editor-linter'

class Linter

  constructor: ->
    @View = new (require './linter-view')(this)
#    @ViewPanel = atom.workspace.addBottomPanel item: @View.Root, visible: false
    @StatusBar = null
    @MessagesProject = new Map
    @ActiveEditor = atom.workspace.getActiveTextEditor()

    @LintOnFly = true
    @Emitter = new Emitter
    @Subscriptions = new CompositeDisposable
    @EditorLinters = new Map # An object of Editor <--> Linter
    @Linters = [] # I </3 coffee-script
    @Subscriptions.add atom.views.addViewProvider Panel, (Model)->
      ( new PanelView() ).registerModel(Model)
    @Panel = new Panel this
    @PanelView = atom.views.getView @Panel
    @Subscriptions.add atom.workspace.onDidChangeActivePaneItem (Editor) =>
      @ActiveEditor = Editor
      ActiveLinter = @getActiveEditorLinter()
      return unless ActiveLinter
      ActiveLinter.lint false
    @Subscriptions.add atom.workspace.observeTextEditors (Editor) =>
      CurrentEditorLinter = new EditorLinter @, Editor
      @EditorLinters.set Editor, CurrentEditorLinter
      @Emitter.emit 'linters-observe', CurrentEditorLinter
      Editor.onDidDestroy =>
        CurrentEditorLinter.destroy()
        @EditorLinters.delete CurrentEditorLinter

  getActiveEditorLinter: ->
    return null unless @ActiveEditor
    return @EditorLinters.get @ActiveEditor
{'fraction_non_alphanumeric': 0.09854604200323101, 'fraction_numerical': 0.0006462035541195477, 'mean_word_length': 3.6838124054462935, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 16, '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': '4693412', 'n_tokens_mistral': 891, 'n_tokens_neox': 878, 'n_words': 218}