<commit_before>/**
 * Copyright (C) 2015 <NAME>
 * All rights reserved.
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */
package org.karivar.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Locale;
import java.util.Optional;
import java.util.ResourceBundle;

public class GitHook {
    private final Logger logger = LoggerFactory.getLogger(GitHook.class);
    private static GitHook githook;
    private ResourceBundle messages;
    private static CommitMessageManipulator manipulator;

    public static void main(String[] args) {
        githook = new GitHook();
        manipulator = new CommitMessageManipulator();
        githook.init(args);
    }

    public void init(String[] args) {

        loadI18nMessages(GitConfig.getLanguageSettings());
        printInitalText();

        if (args != null && args.length > 0) {
            manipulator.loadCommitMessage(args[0]);

            // Load JIRA project list

            // Load JIRA issue types and their accepted statuses.

            // Get options for
            //   1: override communication with JIRA altogether
            //   2: override (e.g force) commits
            boolean isJiraCommunicationOverridden = manipulator.isCommunicationOverridden();
            boolean isCommitOverridden = manipulator.isCommitOverridden();

            // Contact JIRA, fetch JIRA issue and check state and return populated issue

            // If state is OK, manipulate commit message.

            // Update the commit message file and allow commit


        } else {
            logger.error(messages.getString("error.githook.nocommitfile"));
        }
    }

    private void loadI18nMessages(Optional<String> languageSettings) {
        if (languageSettings.isPresent()) {
            messages = ResourceBundle.getBundle("messages", Locale.forLanguageTag(languageSettings.get()));
        } else messages = ResourceBundle.getBundle("messages");
    }

    private void printInitalText() {
        logger.info(messages.getString("startup.information") +  " 0.0.1");
    }
<commit_msg>started implementing connections to Jira<commit_after>/**
 * Copyright (C) 2015 <NAME>
 * All rights reserved.
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */
package org.karivar.utils;

import org.karivar.utils.domain.IssueKeyNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.ResourceBundle;

public class GitHook {
    private final Logger logger = LoggerFactory.getLogger(GitHook.class);
    private static GitHook githook;
    private ResourceBundle messages;
    private static CommitMessageManipulator manipulator;

    public static void main(String[] args) {
        githook = new GitHook();
        manipulator = new CommitMessageManipulator();
        githook.init(args);
    }

    public void init(String[] args) {

        loadI18nMessages(GitConfig.getLanguageSettings());
        printInitalText();

        if (args != null && args.length > 0) {
            manipulator.loadCommitMessage(args[0]);

            // Load JIRA project list
           Optional<String> jiraProjectKeys =  GitConfig.getJiraProjects();

            // Load JIRA issue types and their accepted statuses.

            // Get options for
            //   1: override communication with JIRA altogether
            //   2: override (e.g force) commits
            boolean isJiraCommunicationOverridden = manipulator.isCommunicationOverridden();
            boolean isCommitOverridden = manipulator.isCommitOverridden();

            if (!isJiraCommunicationOverridden && !isCommitOverridden) {
                logger.debug("Preparing to communicate with Jira");

                String jiraIssuekey = null;

                if (jiraProjectKeys.isPresent()) {
                    try {
                        jiraIssuekey = manipulator.getJiraIssueKeyFromCommitMessage(jiraProjectKeys.get());
                    } catch (IssueKeyNotFoundException e) {
                        e.printStackTrace();
                    }
                } else {
                    logger.debug("There are no project keys registered in git config");
                }

                if (jiraIssuekey != null) {
                    logger.debug("There is a jira issue key. Start contacting Jira to fetch the issue itself");
                }

            } else {
                logger.debug("Communication with Jira is overridden or commit is overridden");
            }

            // Contact JIRA, fetch JIRA issue and check state and return populated issue

            // If state is OK, manipulate commit message.

            // Update the commit message file and allow commit


        } else {
            logger.error(messages.getString("error.githook.nocommitfile"));
        }
    }

    private void loadI18nMessages(Optional<String> languageSettings) {
        if (languageSettings.isPresent()) {
            messages = ResourceBundle.getBundle("messages", Locale.forLanguageTag(languageSettings.get()));
        } else messages = ResourceBundle.getBundle("messages");
    }

    private void printInitalText() {
        logger.info(messages.getString("startup.information") +  " 0.0.1");
    }

{'fraction_non_alphanumeric': 0.08828928046989722, 'fraction_numerical': 0.006240822320117474, 'mean_word_length': 2.4163009404388713, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, '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': '7140708', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1379, 'n_words': 390}