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

class Linter

  constructor: ->
    @View = new (require './view')(this)
    @ViewPanel = atom.workspace.addBottomPanel item: @View.root, visible: false
    @StatusBar = null
    @Messages = [] # A temp array to be used by views

    @LintOnFly = true
    @Emitter = new Emitter
    @Subscriptions = new CompositeDisposable
    @EditorLinters = {} # An object of Editor <--> Linter
    @Linters = [] # I </3 coffee-script
    @Subscriptions.add atom.workspace.onDidChangeActivePaneItem =>
      ActiveLinter = @getActiveEditorLinter()
      return unless ActiveLinter
      ActiveLinter.lint(false)
    @Subscriptions.add atom.workspace.observeTextEditors (Editor) =>
      CurrentEditorLinter = new EditorLinter @, Editor
      @EditorLinters[ Editor ] = CurrentEditorLinter
      @Emitter.emit 'linters-observe', CurrentEditorLinter
      Editor.onDidDestroy =>
        CurrentEditorLinter.destroy()
        delete @EditorLinters[ CurrentEditorLinter ]

  render: ->
    # Update `LeftTile` of `StatusBar`
    @View.updateLeftTile @Messages.length

    if not @Messages.length
      @ViewPanel.hide() if @ViewPanel.isVisible()
      @View.remove()
    else
      @View.update()
      @ViewPanel.show() unless @ViewPanel.isVisible()

  getActiveEditorLinter:->
    ActiveEditor = atom.workspace.getActiveTextEditor()
    return ActiveEditor unless ActiveEditor
    return @EditorLinters[ ActiveEditor ]

  getLinter:(Editor)->
    return @EditorLinters[ Editor ]

  observeLinters:(Callback)->
    Callback(Linter) for Linter of @EditorLinters
    @Emitter.on 'linters-observe', Callback

module.exports = Linter<commit_msg>:art: Make linter coffeelint compliant<commit_after>Path = require 'path'
{CompositeDisposable, Emitter} = require 'atom'
EditorLinter = require './editor-linter'

class Linter

  constructor: ->
    @View = new (require './view')(this)
    @ViewPanel = atom.workspace.addBottomPanel item: @View.root, visible: false
    @StatusBar = null
    @Messages = [] # A temp array to be used by views

    @LintOnFly = true
    @Emitter = new Emitter
    @Subscriptions = new CompositeDisposable
    @EditorLinters = {} # An object of Editor <--> Linter
    @Linters = [] # I </3 coffee-script
    @Subscriptions.add atom.workspace.onDidChangeActivePaneItem =>
      ActiveLinter = @getActiveEditorLinter()
      return unless ActiveLinter
      ActiveLinter.lint(false)
    @Subscriptions.add atom.workspace.observeTextEditors (Editor) =>
      CurrentEditorLinter = new EditorLinter @, Editor
      @EditorLinters[ Editor ] = CurrentEditorLinter
      @Emitter.emit 'linters-observe', CurrentEditorLinter
      Editor.onDidDestroy =>
        CurrentEditorLinter.destroy()
        delete @EditorLinters[ CurrentEditorLinter ]

  render: ->
    # Update `LeftTile` of `StatusBar`
    @View.updateLeftTile @Messages.length

    if not @Messages.length
      @ViewPanel.hide() if @ViewPanel.isVisible()
      @View.remove()
    else
      @View.update()
      @ViewPanel.show() unless @ViewPanel.isVisible()

  getActiveEditorLinter: ->
    ActiveEditor = atom.workspace.getActiveTextEditor()
    return ActiveEditor unless ActiveEditor
    return @EditorLinters[ ActiveEditor ]

  getLinter: (Editor) ->
    return @EditorLinters[ Editor ]

  observeLinters: (Callback) ->
    Callback(Linter) for Linter of @EditorLinters
    @Emitter.on 'linters-observe', Callback

module.exports = Linter
{'fraction_non_alphanumeric': 0.10582908885116016, 'fraction_numerical': 0.0005659309564233164, 'mean_word_length': 3.5554123711340204, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, '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': '63981', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1038, 'n_words': 249}