<commit_before>BottomTab = require './views/bottom-tab'
BottomStatus = require './views/bottom-status'
Message = require './views/message'

class LinterViews
  constructor: (@linter) ->
    @_messages = []
    @_decorations = []
    @_showBubble = true

    @_bottomTabFile = new BottomTab()
    @_bottomTabProject = new BottomTab()
    @_panel = document.createElement 'div'
    @_bubble = null
    @_bottomStatus = new BottomStatus()

    @_bottomTabFile.initialize("Current File", =>
      @_changeTab('file')
    )
    @_bottomTabProject.initialize("Project", =>
      @_changeTab('project')
    )
    @_bottomStatus.initialize()
    @_panelWorkspace = atom.workspace.addBottomPanel item: @_panel, visible: false

    # Set default tab to File
    @_scope = 'file'
    @_bottomTabFile.active = true
    @_panel.id = 'linter-panel'

    # Bubble
    @linter.subscriptions.add atom.config.observe 'linter.showErrorInline', (showBubble) =>
      @_showBubble = showBubble

  # This message is called in editor-linter.coffee
  render: ->
    return @setPanelVisibility(false) unless @linter.activeEditor
    return @setPanelVisibility(false) unless @linter.activeEditor.getPath?()

    counts = {project: 0, file: 0}
    activeLinter = @linter.getActiveEditorLinter()
    messages = @._extractMessages(@linter.messagesProject, counts)
    messages = messages.concat(@._extractMessages(activeLinter.messages, counts)) if activeLinter
    @_messages = messages

    @_renderPanel()
    @_bottomTabFile.count = counts.file
    @_bottomTabProject.count = counts.project
    @_bottomStatus.count = counts.project

  # consumed in editor-linter, _renderPanel
  updateBubble: (point) ->
    @_removeBubble()
    return unless @_showBubble
    return unless @_messages.length
    point = point || @linter.activeEditor.getCursorBufferPosition()<commit_msg>:art: Simplify validation in LinterViews::render<commit_after>BottomTab = require './views/bottom-tab'
BottomStatus = require './views/bottom-status'
Message = require './views/message'

class LinterViews
  constructor: (@linter) ->
    @_messages = []
    @_decorations = []
    @_showBubble = true

    @_bottomTabFile = new BottomTab()
    @_bottomTabProject = new BottomTab()
    @_panel = document.createElement 'div'
    @_bubble = null
    @_bottomStatus = new BottomStatus()

    @_bottomTabFile.initialize("Current File", =>
      @_changeTab('file')
    )
    @_bottomTabProject.initialize("Project", =>
      @_changeTab('project')
    )
    @_bottomStatus.initialize()
    @_panelWorkspace = atom.workspace.addBottomPanel item: @_panel, visible: false

    # Set default tab to File
    @_scope = 'file'
    @_bottomTabFile.active = true
    @_panel.id = 'linter-panel'

    # Bubble
    @linter.subscriptions.add atom.config.observe 'linter.showErrorInline', (showBubble) =>
      @_showBubble = showBubble

  # This message is called in editor-linter.coffee
  render: ->
    return @setPanelVisibility(false) unless @linter.activeEditor?.getPath?()

    counts = {project: 0, file: 0}
    activeLinter = @linter.getActiveEditorLinter()
    messages = @._extractMessages(@linter.messagesProject, counts)
    messages = messages.concat(@._extractMessages(activeLinter.messages, counts)) if activeLinter
    @_messages = messages

    @_renderPanel()
    @_bottomTabFile.count = counts.file
    @_bottomTabProject.count = counts.project
    @_bottomStatus.count = counts.project

  # consumed in editor-linter, _renderPanel
  updateBubble: (point) ->
    @_removeBubble()
    return unless @_showBubble
    return unless @_messages.length
    point = point || @linter.activeEditor.getCursorBufferPosition()
{'fraction_non_alphanumeric': 0.11790393013100436, 'fraction_numerical': 0.001091703056768559, 'mean_word_length': 3.8350923482849604, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '6402216', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1107, 'n_words': 231}