<commit_before>const Promise = require("es6-promise").Promise;
const {exec} = require('child_process');

class CommitInfo {

    static git() {
        return new Promise((resolve, reject) => {
            let command = this.getCommand();
            exec(command, (err, stdout, stderr) => {
                if (err) {
                    err.stderr = stderr;
                    return reject(err);
                }
                let commitInfo = JSON.parse(stdout);
                commitInfo.refs = this.fixGitRefs(commitInfo.refs);
                return resolve(commitInfo);
            })
        });
    }

    static fixGitRefs(rawString) {
        let refs = rawString;
        refs = refs.trim();
        refs = refs.replace("(", "");
        refs = refs.replace(")", "");
        return refs.split(", ");
    }

    static getCommand() {
        let platform = process.platform;
        let format = JSON.stringify({
            "shortRevision": "%h",
            "revision": "%H",
            "date": "%cr",
            "subject": "%f",
            "author": "%an",
            "authorEmail": "%ae",
            "refs": "%d"
        });

        if (platform === 'win32') {
            format = format.replace(/"/g, "\"\"\"");
            return `git log -1 --no-color --decorate=short --pretty=format:${format} HEAD`;
        }
        
        return `git log -1 --no-color --decorate=short --pretty=format:'${format}' HEAD`;
    }
}

module.exports = CommitInfo;<commit_msg>Fixed formatting issues<commit_after>const Promise = require("es6-promise").Promise;
const {exec} = require('child_process');

class CommitInfo {

    static git() {
        return new Promise((resolve, reject) => {
            let command = this.getCommand();
            exec(command, (err, stdout, stderr) => {
                if (err) {
                    err.stderr = stderr;
                    return reject(err);
                }
                let commitInfo = JSON.parse(stdout);
                commitInfo.refs = this.fixGitRefs(commitInfo.refs);
                return resolve(commitInfo);
            })
        });
    }

    static fixGitRefs(rawString) {
        let refs = rawString;
        refs = refs.trim();
        refs = refs.replace("(", "");
        refs = refs.replace(")", "");
        return refs.split(", ");
    }

    static getCommand() {
        let platform = process.platform;
        let format = JSON.stringify({
            "shortRevision": "%h",
            "revision": "%H",
            "date": "%cr",
            "subject": "%f",
            "author": "%an",
            "authorEmail": "%ae",
            "refs": "%d"
        });

        if (platform === 'win32') {
            format = format.replace(/"/g, "\"\"\"");
            return `git log -1 --no-color --decorate=short --pretty=format:${format} HEAD`;
        }
        return `git log -1 --no-color --decorate=short --pretty=format:'${format}' HEAD`;
    }
}

module.exports = CommitInfo;
{'fraction_non_alphanumeric': 0.1628140703517588, 'fraction_numerical': 0.0033500837520938024, 'mean_word_length': 1.619298245614035, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 7, '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': '3904153', 'n_tokens_mistral': 876, 'n_tokens_neox': 831, 'n_words': 185}