<commit_before>// checks if the vulnerabilities are mitigated

const printChatText = require('../helpers/printChatText.js')

module.exports = function vulnVerification (cy) {
  let vulnArray = []
  let result = ''
  let mitigatedVulns = 0

  cy.elements().addClass('faded')

  // highlights vulnerability and mechanism nodes
  cy.nodes().map(node => {
    if (node.data().info.concept === 'vulnerability') {
      node.removeClass('faded')
      node.addClass('attention')
      vulnArray.push(node)
    }
    if (node.data().info.concept === 'mechanism') {
      node.removeClass('faded')
      node.addClass('protect')
    }
  })

  // checks if vulnerability node is connected to a mechanism node
  vulnArray.map(vuln => {
    const neighbor = vuln.neighborhood()
    neighbor.map(type => {
      if (type.data().hasOwnProperty('info') === true) {
        if (type.data().info.concept === 'mechanism') {
          result = `${result} • Vulnerability ${vuln.data()
            .id} mitigated by Mechanism ${type.data().id}\n`
          mitigatedVulns += 1
        }
      }
    })
  })

  result = `${result}\n • Vulnerabilities total: ${vulnArray.length}\n`
  result = `${result} • Mitigated total: ${mitigatedVulns}\n`
  printChatText(result)

  if (vulnArray.length <= mitigatedVulns) {
    printChatText('all vulnerabilities mitigated 🎉')
  }
}
<commit_msg>:memo: code documentation<commit_after>// checks if the vulnerabilities are mitigated

const printChatText = require('../helpers/printChatText.js')

module.exports = function vulnVerification (cy) {
  let vulnArray = []
  let result = ''
  let mitigatedVulns = 0

  cy.elements().addClass('faded')

  // highlights all vulnerability and mechanism nodes
  cy.nodes().map(node => {
    if (node.data().info.concept === 'vulnerability') {
      node.removeClass('faded')
      node.addClass('attention')
      vulnArray.push(node)
    }
    if (node.data().info.concept === 'mechanism') {
      node.removeClass('faded')
      node.addClass('protect')
    }
  })

  // checks if a vulnerability node is connected to a mechanism node
  vulnArray.map(vuln => {
    const neighbor = vuln.neighborhood()
    neighbor.map(type => {
      if (type.data().hasOwnProperty('info') === true) {
        if (type.data().info.concept === 'mechanism') {
          result = `${result} • Vulnerability ${vuln.data()
            .id} mitigated by Mechanism ${type.data().id}\n`
          mitigatedVulns += 1
        }
      }
    })
  })

  result = `${result}\n • Vulnerabilities total: ${vulnArray.length}\n`
  result = `${result} • Mitigated total: ${mitigatedVulns}\n`
  printChatText(result)

  if (vulnArray.length <= mitigatedVulns) {
    printChatText('all vulnerabilities mitigated 🎉')
  }
}

{'fraction_non_alphanumeric': 0.1552478134110787, 'fraction_numerical': 0.0014577259475218659, 'mean_word_length': 3.054652880354505, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1339870', 'n_tokens_mistral': 905, 'n_tokens_neox': 872, 'n_words': 188}