{"size": 852, "ext": "js", "max_stars_repo_path": "testing/input/TestExtension/filterhook.js", "max_stars_repo_name": "fekblom/critic", "max_stars_repo_stars_event_min_datetime": "2015-01-05T12:48:10.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-08T00:12:23.000Z", "max_issues_repo_path": "testing/input/TestExtension/filterhook.js", "max_issues_repo_name": "fekblom/critic", "max_issues_repo_issues_event_min_datetime": "2015-02-28T12:10:26.000Z", "max_issues_repo_issues_event_max_datetime": "2020-11-18T17:45:16.000Z", "max_forks_repo_path": "testing/input/TestExtension/filterhook.js", "max_forks_repo_name": "fekblom/critic", "max_forks_repo_forks_event_min_datetime": "2015-05-02T15:15:10.000Z", "max_forks_repo_forks_event_max_datetime": "2020-06-15T19:20:37.000Z"}
{"max_stars_count": 216, "max_issues_count": 55, "max_forks_count": 34, "avg_line_length": 26.625, "max_line_length": 75, "alphanum_fraction": 0.5082159624}
/* -*- mode: js; indent-tabs-mode: nil -*- */

"use strict";

function filterhook(data, review, user, commits, files) {
  files.forEach(
    function (file) {
      if (file.path == "015-filterhook/include/explode")
        throw Error("Boom!");
    });

  var transaction = new critic.MailTransaction;

  transaction.add({
    to: critic.User.current,
    subject: "filterhook.js::filterhook()",
    review: review,
    body: format("data: %r\n" +
                 "review.id: %d\n" +
                 "user.name: %s\n" +
                 "commits: %r\n" +
                 "files: %r\n",
                 data,
                 review.id,
                 user.name,
                 commits.map(function (commit) { return commit.message; }),
                 files.map(function (file) { return file.path; }).sort())
  });

  transaction.finish();
}
