<commit_before>flatiron = require 'flatiron'
connect  = require 'connect'
https    = require 'https'
fs       = require "fs"
yaml     = require "js-yaml"
eco      = require 'eco'

# Helper object for GitHub Issues.
Issues =

    # Make HTTPS GET to GitHub API v3.
    get: (path, type, callback) ->
        options =
            host:   "api.github.com"
            method: "GET"
            path:   path
            headers:
                'User-Agent': 'Scrum Burndown (1)'

        if Issues.config.api_token
            options.headers.Authorization = 'token '+Issues.config.api_token

        https.request(options, (response) ->
            if response.statusCode is 200
                json = ""
                response.on "data", (chunk) -> json += chunk
                
                response.on "end", -> callback JSON.parse(json), type
        ).end()<commit_msg>throw on request error will improve in the future<commit_after>flatiron = require 'flatiron'
connect  = require 'connect'
https    = require 'https'
fs       = require "fs"
yaml     = require "js-yaml"
eco      = require 'eco'

# Helper object for GitHub Issues.
Issues =

    # Make HTTPS GET to GitHub API v3.
    get: (path, type, callback) ->
        options =
            host:   "api.github.com"
            method: "GET"
            path:   path
            headers:
                'User-Agent': 'Scrum Burndown (1)'

        if Issues.config.api_token
            options.headers.Authorization = 'token '+Issues.config.api_token

        https.request(options, (response) ->
            if response.statusCode is 200
                json = ""
                response.on "data", (chunk) -> json += chunk
                
                response.on "end", -> callback JSON.parse(json), type
            else
                throw response.statusCode
        ).end()
{'fraction_non_alphanumeric': 0.10631408526713437, 'fraction_numerical': 0.005396654074473826, 'mean_word_length': 1.6523605150214593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1108610', 'n_tokens_mistral': 534, 'n_tokens_neox': 502, 'n_words': 150}