<commit_before>"use babel"

import fs from "fs"
import path from "path"
import less from 'less'

LinterLess = {

  name: "Less",

  grammarScopes: ['source.css.less'],

  scope: 'file',

  lintOnFly: true,

  lint(textEditor) {

    return new Promise((resolve, reject) => {

      filePath = textEditor.getPath()
      if (!filePath) { return resolve([]) }

      text = textEditor.getText()

      lineOffset = 0
      variables = []

      if (this.config('ignoreUndefinedVariables')) {
        for (variable of (text.match(/@[a-zA-Z0-9_-]+/g) || [])) {
          lineOffset++
          text = `${variable}: 0;\n${text}`
        }
      }

      if (this.config('ignoreUndefinedGlobalVariables')) {
        for (line of (text.match(/(^|\n)\/\/\s*global:\s*@[a-zA-Z0-9_-]+/g) || [])) {
          variable = text.match(/@[a-zA-Z0-9_-]+/)
          lineOffset++
          text = `${variable}: 0;\n${text}`
        }
      }

      this.lessParse(text, filePath, (err) => {

        if (!err) { return resolve([]) }

        lineIdx = err.line - 1 - lineOffset
        line = textEditor.lineTextForBufferRow(lineIdx)
        if (line) { colEndIdx = line.length }

        resolve([{
          type: "Error",
          text: err.message,
          filePath: err.filename,
          range: [[lineIdx, err.column], [lineIdx, colEndIdx]]
        }])
      })
    })
  },

  lessParse(text, filePath, callback) {

    cwd = path.dirname(filePath)

    options = {
      verbose: false,
      silent: true,
      paths: [cwd, ...this.config('includePath')],
      filename: filePath,
      ieCompat: this.config('ieCompatibilityChecks'),
      strictUnits: this.config('strictUnits'),
      strictMath: this.config('strictMath')
    }

    less.render(text, options, (error, output) => callback(error))
  },

  config(key) {
    return atom.config.get(`linter-less.${key}`)
  }
}

export default LinterLess
<commit_msg>Fix missing variable declarations<commit_after>"use babel"

import fs from "fs"
import path from "path"
import less from 'less'

LinterLess = {

  name: "Less",

  grammarScopes: ['source.css.less'],

  scope: 'file',

  lintOnFly: true,

  lint(textEditor) {

    return new Promise((resolve, reject) => {

      const filePath = textEditor.getPath()
      if (!filePath) { return resolve([]) }

      let text = textEditor.getText()
      let lineOffset = 0

      if (this.config('ignoreUndefinedVariables')) {
        for (let variable of (text.match(/@[a-zA-Z0-9_-]+/g) || [])) {
          lineOffset++
          text = `${variable}: 0;\n${text}`
        }
      }

      if (this.config('ignoreUndefinedGlobalVariables')) {
        for (line of (text.match(/(^|\n)\/\/\s*global:\s*@[a-zA-Z0-9_-]+/g) || [])) {
          let variable = text.match(/@[a-zA-Z0-9_-]+/)
          lineOffset++
          text = `${variable}: 0;\n${text}`
        }
      }

      this.lessParse(text, filePath, (err) => {

        if (!err) { return resolve([]) }

        let colEndIdx = 0
        let lineIdx = err.line - 1 - lineOffset
        let line = textEditor.lineTextForBufferRow(lineIdx)

        if (line) { colEndIdx = line.length }

        resolve([{
          type: "Error",
          text: err.message,
          filePath: err.filename,
          range: [[lineIdx, err.column], [lineIdx, colEndIdx]]
        }])
      })
    })
  },

  lessParse(text, filePath, callback) {

    const cwd = path.dirname(filePath)
    const options = {
      verbose: false,
      silent: true,
      paths: [cwd, ...this.config('includePath')],
      filename: filePath,
      ieCompat: this.config('ieCompatibilityChecks'),
      strictUnits: this.config('strictUnits'),
      strictMath: this.config('strictMath')
    }

    less.render(text, options, (error, output) => callback(error))
  },

  config(key) {
    return atom.config.get(`linter-less.${key}`)
  }
}

export default LinterLess

{'fraction_non_alphanumeric': 0.16812339331619539, 'fraction_numerical': 0.005398457583547558, 'mean_word_length': 2.305862361937128, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7291031', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1261, 'n_words': 258}