<commit_before>import redis from 'redis';
import { Router } from 'express';
import nconf from '../config';
import request from 'request-promise';

const router = Router(); // eslint-disable-line new-cap

let client = redis.createClient('redis://' + nconf.get('REDIS_PORT_6379_TCP_ADDR') + ':6379');

router
  .route('/dockerbuilds')
    .post((req, res) => {
      // Publish the bots message to dockerbuilds
      client.publish('dockerbuilds', 'build for ' + req.body.repository.name + ' has finished',
        (err, response) => {
          res.send({ msg: "pushed to " + response + " subscribers" });
        });  
        // Required response for docker hub to mark the webhook as completed.
        const responseData = {
          "state":        "success",
          "description":  "SSE webhook response",
          "context":      "sse",
          "target_url":   "https://sse.rit.edu"
        };
        request.post({ url: req.body.callback_url, json: responseData })
        .then( () => console.log('Responsed') )
        .catch( err => console.error(err) );
    });

router
  .route('/:channel')
    .post((req, res) => {
      // Publish the bots message to dockerbuilds 
      client.publish(req.params.channel, JSON.stringify(req.body),
        (err, response) => {
          res.send('ok');
        });  
    });

export default router;<commit_msg>Linters happier<commit_after>import redis from 'redis';
import { Router } from 'express';
import nconf from '../config';
import request from 'request-promise';

const router = Router(); // eslint-disable-line new-cap
const client = redis.createClient('redis://' + nconf.get('REDIS_PORT_6379_TCP_ADDR') + ':6379');

router
  .route('/dockerbuilds')
  .post((req, res) => {
    // Publish the bots message to dockerbuilds
    client.publish('dockerbuilds', 'build for ' + req.body.repository.name + ' has finished', (err, response) => {
      res.send({
        msg: 'pushed to ' + response + ' subscribers'
      });
    });
    // Required response for docker hub to mark the webhook as completed.
    const responseData = {
      'state': 'success',
      'description': 'SSE webhook response',
      'context': 'sse',
      'target_url': 'https://sse.rit.edu'
    };
    request.post({
      url: req.body.callback_url,
      json: responseData
    })
    .then(() => console.log('Responsed'))
    .catch(err => console.error(err));
  });

router
  .route('/:channel')
  .post((req, res) => {
    // Publish the bots message to dockerbuilds
    client.publish(req.params.channel, JSON.stringify(req.body), (err, response) => {
      res.send({status: 'ok', count: response });
    });
  });

export
default router;
{'fraction_non_alphanumeric': 0.16436824450242266, 'fraction_numerical': 0.005963473723443906, 'mean_word_length': 2.7433751743375177, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '5582676', 'n_tokens_mistral': 851, 'n_tokens_neox': 829, 'n_words': 204}