<commit_before>var ring = require("ring");
var sailfishBinderFactory = require("sailfish/binder");
var _ = require("underscore");

var addRunnerController = ring.create({

    constructor: function(app, sailfishCollector) {
        app.get('/add-runner', function(req, res) {

            sailfishCollector.collectInformation(function(err, viewParameters) {

                return res.render("addrepository", _.extend(viewParameters, {
                    view: "settings",
                    hasError: false
                }));

            });

        });

        app.post('/add-runner', function(req, res) {

            sailfishCollector.collectInformation(function(err, viewParameters) {

                //Trying to bind
                var binder = new sailfishBinderFactory(app);

                binder.bind(req.body.name, req.body.endpoint, function(err, result) {

                    if(err) {
                        return res.render("addrunner", _.extend(viewParameters, {
                            view: "settings",
                            name: req.body.name,
                            endpoint: req.body.endpoint,
                            error: err.message,
                            hasError: true
                        }));
                    } else {
                        res.redirect('/settings');
                    }

                });

            });

        });
    }

});

module.exports = function(app, sailfishCollector) {
    return new addRunnerController(app, sailfishCollector);
}<commit_msg>Update add_runner.js<commit_after>var ring = require("ring");
var sailfishBinderFactory = require("sailfish/binder");
var _ = require("underscore");

var addRunnerController = ring.create({

    constructor: function(app, sailfishCollector) {
        app.get('/add-runner', function(req, res) {

            sailfishCollector.collectInformation(function(err, viewParameters) {

                return res.render("addrunner", _.extend(viewParameters, {
                    view: "settings",
                    hasError: false
                }));

            });

        });

        app.post('/add-runner', function(req, res) {

            sailfishCollector.collectInformation(function(err, viewParameters) {

                //Trying to bind
                var binder = new sailfishBinderFactory(app);

                binder.bind(req.body.name, req.body.endpoint, function(err, result) {

                    if(err) {
                        return res.render("addrunner", _.extend(viewParameters, {
                            view: "settings",
                            name: req.body.name,
                            endpoint: req.body.endpoint,
                            error: err.message,
                            hasError: true
                        }));
                    } else {
                        res.redirect('/settings');
                    }

                });

            });

        });
    }

});

module.exports = function(app, sailfishCollector) {
    return new addRunnerController(app, sailfishCollector);
}

{'fraction_non_alphanumeric': 0.11143224149004496, 'fraction_numerical': 0.0, 'mean_word_length': 1.4297971918876755, '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': '5920890', 'n_tokens_mistral': 783, 'n_tokens_neox': 731, 'n_words': 131}