<commit_before>/*jslint node: true */

module.exports = function () {
    'use strict';

    var express = require('express'),
        basicAuth = require('basic-auth-connect'),
        request = require('request'),
        bodyParser = require('body-parser'),
        HTTP_BASIC_USER = process.env.HTTP_BASIC_USER,
        HTTP_BASIC_PASS = process.env.HTTP_BASIC_PASS,
        BITBUCKET_USERNAME = process.env.BITBUCKET_USERNAME,
        BITBUCKET_API_KEY = process.env.BITBUCKET_API_KEY,
        app = express();

    function postBitbucketCommitStatus(build, postStatusCallback) {
        var bitbucket_state = 'FAILED',
            bitbucket_url = 'https://' + BITBUCKET_USERNAME + ':' + BITBUCKET_API_KEY + '@api.bitbucket.org/2.0/repositories/' + build.project_name + '/commit/' + build.commit_id + '/statuses/build';

        switch (build.status) {
        case 'success':
            bitbucket_state = 'SUCCESSFUL';
            break;
        case 'testing':
            bitbucket_state = 'INPROGRESS';
            break;
        }

        request({
            url: bitbucket_url,
            method: 'POST',
            json: {
                state: bitbucket_state,<commit_msg>Prevents builds in a 'waiting' state from being marked as failed on Bitbucket.<commit_after>/*jslint node: true */

module.exports = function () {
    'use strict';

    var express = require('express'),
        basicAuth = require('basic-auth-connect'),
        request = require('request'),
        bodyParser = require('body-parser'),
        HTTP_BASIC_USER = process.env.HTTP_BASIC_USER,
        HTTP_BASIC_PASS = process.env.HTTP_BASIC_PASS,
        BITBUCKET_USERNAME = process.env.BITBUCKET_USERNAME,
        BITBUCKET_API_KEY = process.env.BITBUCKET_API_KEY,
        app = express();

    function postBitbucketCommitStatus(build, postStatusCallback) {
        var bitbucket_state = 'FAILED',
            bitbucket_url = 'https://' + BITBUCKET_USERNAME + ':' + BITBUCKET_API_KEY + '@api.bitbucket.org/2.0/repositories/' + build.project_name + '/commit/' + build.commit_id + '/statuses/build';

        switch (build.status) {
        case 'waiting':
            console.info('Codeship has indicated that the build is waiting to take place. Bitbucket will not be updated until the build is in progress.');
            return postStatusCallback(null);
        case 'success':
            bitbucket_state = 'SUCCESSFUL';
            break;
        case 'testing':
            bitbucket_state = 'INPROGRESS';
            break;
        }

        request({
            url: bitbucket_url,
            method: 'POST',
            json: {
                state: bitbucket_state,
{'fraction_non_alphanumeric': 0.11185933408155631, 'fraction_numerical': 0.0014964459408903852, 'mean_word_length': 2.3635220125786165, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1380648', 'n_tokens_mistral': 778, 'n_tokens_neox': 775, 'n_words': 159}