<commit_before>class LinterTern

  name: 'Tern'
  grammarScopes: ['source.js']
  scope: 'file'
  lintOnFly: true
  manager: null

  constructor: (manager) ->
    @manager = manager
    return unless @manager

  lint: (textEditor) ->
    return new Promise (resolve, reject) =>
      return resolve [] unless @manager.config.config.plugins.lint?.active
      return resolve [] unless @manager.server and @manager.config.config

      messages = []

      buffer = textEditor.getBuffer()
      URI = textEditor.getURI()
      text = textEditor.getText()
      @manager.client?.update(URI, text).then =>
        @manager.client.lint(URI, text).then (data) =>
          return resolve [] unless data.messages
          for message in data.messages
            positionFrom = buffer.positionForCharacterIndex(message.from)
            positionTo = buffer.positionForCharacterIndex(message.to)
            messages.push
              text: message.message,
              type: message.severity,
              filePath: buffer.file.path
              range: [
                [positionFrom.row, positionFrom.column],
                [positionTo.row, positionTo.column]
              ]
          return resolve messages
<commit_msg>check if config and project config is defined.<commit_after>class LinterTern

  name: 'Tern'
  grammarScopes: ['source.js']
  scope: 'file'
  lintOnFly: true
  manager: null

  constructor: (manager) ->
    @manager = manager
    return unless @manager

  lint: (textEditor) ->
    return new Promise (resolve, reject) =>
      return resolve [] unless @manager.config?.config?.plugins.lint?.active
      return resolve [] unless @manager.server

      messages = []

      buffer = textEditor.getBuffer()
      URI = textEditor.getURI()
      text = textEditor.getText()
      @manager.client?.update(URI, text).then =>
        @manager.client.lint(URI, text).then (data) =>
          return resolve [] unless data.messages
          for message in data.messages
            positionFrom = buffer.positionForCharacterIndex(message.from)
            positionTo = buffer.positionForCharacterIndex(message.to)
            messages.push
              text: message.message,
              type: message.severity,
              filePath: buffer.file.path
              range: [
                [positionFrom.row, positionFrom.column],
                [positionTo.row, positionTo.column]
              ]
          return resolve messages

{'fraction_non_alphanumeric': 0.10179153094462541, 'fraction_numerical': 0.0, 'mean_word_length': 2.2371541501976284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '3901523', 'n_tokens_mistral': 653, 'n_tokens_neox': 630, 'n_words': 155}