<commit_before>var assert = require('assert')

module.exports = function () {}

module.exports.prototype =
  { name: 'attributeSeparator'

  , configure: function (options) {

      assert(typeof options === 'string' && /^([ ]|[ ]?,[ ]?)$/.test(options)
        , this.name + ' option requires string value containing only commas or spaces')

      this._separator = options
      // this._errorMessage = isRequired ? 'Missing comma after attribute' : 'Comma after attribute'

    }

  , lint: function (file) {

      var attributeTokens = file.tokens.filter(function (token) {
          return token.type === 'attrs' && token.attrs
        })

      attributeTokens.forEach(function (token) {
        var attributeCount = token.attrs.length
          , lineNumber = token.line
          , line = file.lines[lineNumber - 1]
          , regex = new RegExp(/\((.+)\)/g)
          , match

        while ((match = regex.exec(line)) !== null) {
          var attributes = match[1].split(this._separator).filter(filterAttributes)

          if (attributes.length !== attributeCount) {
            file.errors.push({ message: this._errorMessage, filename: file.filename, line: lineNumber })
          }
        }
      }, this)

      function filterAttributes(attribute) {
        return attribute.lastIndexOf(',') !== attribute.length - 1
      }

    }
  }<commit_msg>> Adds missing error message<commit_after>var assert = require('assert')

module.exports = function () {}

module.exports.prototype =
  { name: 'attributeSeparator'

  , configure: function (options) {

      assert(typeof options === 'string' && /^([ ]|[ ]?,[ ]?)$/.test(options)
        , this.name + ' option requires string value containing only commas or spaces')

      this._separator = options

    }

  , lint: function (file) {

      var attributeTokens = file.tokens.filter(function (token) {
          return token.type === 'attrs' && token.attrs
        })

      attributeTokens.forEach(function (token) {
        var attributeCount = token.attrs.length
          , lineNumber = token.line
          , line = file.lines[lineNumber - 1]
          , regex = new RegExp(/\((.+)\)/g)
          , match

        while ((match = regex.exec(line)) !== null) {
          var attributes = match[1].split(this._separator).filter(filterAttributes)

          if (attributes.length !== attributeCount) {
            file.errors.push({ message: 'Attributes must be separated by "' + this._separator + '"'
              , filename: file.filename, line: lineNumber })
          }
        }
      }, this)

      function filterAttributes(attribute) {
        return attribute.lastIndexOf(',') !== attribute.length - 1
      }

    }
  }
{'fraction_non_alphanumeric': 0.14100666173205034, 'fraction_numerical': 0.0022205773501110288, 'mean_word_length': 2.4, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5979718', 'n_tokens_mistral': 753, 'n_tokens_neox': 723, 'n_words': 170}