<commit_before>'use babel'

const NewLine = /\r?\n/

export class Message extends HTMLElement {
  initialize(message, includeLink = true) {
    this.message = message
    this.includeLink = includeLink
    this.status = false
    return this
  }
  updateVisibility(scope) {
    let status = true
    if (scope === 'Line')
      status = this.message.currentLine
    else if (scope === 'File')
      status = this.message.currentFile

    if (this.children.length && this.message.filePath) {
      const link = this.querySelector('.linter-message-link span')
      if (link) {
        if (scope === 'Project') {
          link.removeAttribute('hidden')
        } else {
          link.setAttribute('hidden', true)
        }
      }
    }

    this.status = status

    if (status) {
      this.removeAttribute('hidden')
    } else this.setAttribute('hidden', true)

    return this
  }
  attachedCallback() {
    if (!this.childNodes.length) {
      if (atom.config.get('linter.showProviderName') && this.message.linter) {
        this.appendChild(Message.getName(this.message))
      }
      this.appendChild(Message.getRibbon(this.message))
      this.appendChild(Message.getMessage(this.message, this.includeLink))
    }
  }
  static getLink(message) {
    const el = document.createElement('a')
    const pathEl = document.createElement('span')

    el.className = 'linter-message-link'<commit_msg>:art: Tweak updateVisibility a bit Make it efficient<commit_after>'use babel'

const NewLine = /\r?\n/

export class Message extends HTMLElement {
  initialize(message, includeLink = true) {
    this.message = message
    this.includeLink = includeLink
    this.visibility = false
    this.scope = 'Project'
    return this
  }
  updateVisibility(scope) {
    let visibility = scope === 'Line' ? this.message.currentFile : true
    if (scope === 'Line') {
      visibility = visibility && this.message.currentLine
    }
    if (this.scope !== scope) {
      const link = this.querySelector('.linter-message-link span')
      if (link) {
        if (scope === 'Project') {
          link.removeAttribute('hidden')
        } else link.setAttribute('hidden', true)
      }
      this.scope = scope
    }
    if (visibility !== this.visibility) {
      if (visibility) {
        this.removeAttribute('hidden')
      } else this.setAttribute('hidden', true)
      this.visibility = visibility
    }
    return this
  }
  attachedCallback() {
    if (!this.childNodes.length) {
      if (atom.config.get('linter.showProviderName') && this.message.linter) {
        this.appendChild(Message.getName(this.message))
      }
      this.appendChild(Message.getRibbon(this.message))
      this.appendChild(Message.getMessage(this.message, this.includeLink))
    }
  }
  static getLink(message) {
    const el = document.createElement('a')
    const pathEl = document.createElement('span')

    el.className = 'linter-message-link'
{'fraction_non_alphanumeric': 0.1291538198013018, 'fraction_numerical': 0.0, 'mean_word_length': 2.832020997375328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6782706', 'n_tokens_mistral': 850, 'n_tokens_neox': 848, 'n_words': 175}