<commit_before>function compileFeature (feature, twig) {
  for (var k in feature) {
    if (typeof feature[k] === 'string' && feature[k].search('{') !== -1) {
      let template

      try {
        template = twig.twig({ data: feature[k], autoescape: true })
      } catch (err) {
        console.log('Error compiling twig template ' + this.id + '/' + k + ':', err)
        break
      }

      feature[k] = function (template, k, ob) {
        try {
          return template.render(ob)
        } catch (err) {
          console.log('Error rendering twig template ' + this.id + '/' + k + ': ', err)
        }

        return null
      }.bind(this, template, k)
    } else if (typeof feature[k] === 'object' && (['style'].indexOf(k) !== -1 || k.match(/^style:/))) {
      var templates = {}
      for (var k1 in feature[k]) {
        if (typeof feature[k][k1] === 'string' && feature[k][k1].search('{') !== -1) {
          templates[k1] = twig.twig({ data: feature[k][k1], autoescape: true })
        } else {
          templates[k1] = feature[k][k1]
        }
      }

      feature[k] = function (templates, ob) {
        var ret = {}
        for (var k1 in templates) {
          if (typeof templates[k1] === 'object' && templates[k1] !== null && 'render' in templates[k1]) {<commit_msg>Catch template compile errors and post them to the console<commit_after>function compileFeature (feature, twig) {
  for (var k in feature) {
    if (typeof feature[k] === 'string' && feature[k].search('{') !== -1) {
      let template

      try {
        template = twig.twig({ data: feature[k], autoescape: true })
      } catch (err) {
        console.log('Error compiling twig template ' + this.id + '/' + k + ':', err)
        break
      }

      feature[k] = function (template, k, ob) {
        try {
          return template.render(ob)
        } catch (err) {
          console.log('Error rendering twig template ' + this.id + '/' + k + ': ', err)
        }

        return null
      }.bind(this, template, k)
    } else if (typeof feature[k] === 'object' && (['style'].indexOf(k) !== -1 || k.match(/^style:/))) {
      var templates = {}
      for (var k1 in feature[k]) {
        if (typeof feature[k][k1] === 'string' && feature[k][k1].search('{') !== -1) {
          try {
            templates[k1] = twig.twig({ data: feature[k][k1], autoescape: true, rethrow: true })
          } catch (e) {
            console.error("Can't compile template:\n" + feature[k][k1] + "\n\n", e.message)
          }
        } else {
          templates[k1] = feature[k][k1]
        }
      }

      feature[k] = function (templates, ob) {
        var ret = {}
        for (var k1 in templates) {
          if (typeof templates[k1] === 'object' && templates[k1] !== null && 'render' in templates[k1]) {
{'fraction_non_alphanumeric': 0.1827956989247312, 'fraction_numerical': 0.01039426523297491, 'mean_word_length': 2.135955056179775, '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': '5592304', 'n_tokens_mistral': 905, 'n_tokens_neox': 885, 'n_words': 232}