<commit_before>$( document ).ready( function() { 
    $( '#register-form' ).submit(function() {
        var $username = $( '#username' ).val();  
        var $password = $( '#password' ).val();  
        var $passwordRepeat = $( '#password_repeat' ).val();  
        var $email = $( '#email' ).val();  
        if ( $username == '' ) {
            createError( '#register-form', 'Please type a username.' );
            return false;
        }
        if ( !$username.match( /^[a-zA-Z0-9_.]{3,16}$/ ) ) {
            createError( '#register-form', 'Usernames can only have numbers, letters, "." and "_"' );
            return false;
        }
        $.get(
            'user/view',
            {
                username: $username 
            },
            function( responseText ) {
                    createError( '#register-form', 'Username already exists' );
                    return false;
            },
            "html"
        );
        if ( $password == '' ) {
            createError( '#register-form', 'Please type a password.' );
            return false;
        }
        if ( $password.length < 7 ) {
            createError( '#register-form', 'Password should be at least 7 characters long' );
            return false;
        }
        if ( $passwordRepeat != $password ) {
            createError( '#register-form', 'Please repeat correctly your password' );
            return false;
        }
        if ( $email == '' ) {
            createError( '#register-form', 'Please type an email.' );
            return false;
        }
    }); 

    function createError( $form, $description ) {
        if ( $('.alert').length != 0 ) {
            $( '.alert' ).remove();
        }
        $( $form ).prepend( "<div class='alert alert-danger'>" + $description + "</div>" );
    }
});<commit_msg>corrections<commit_after>$( document ).ready( function() { 
    $( '#register-form' ).submit( function() {
        var username = $( '#username' ).val();  
        var password = $( '#password' ).val();  
        var passwordRepeat = $( '#password_repeat' ).val();  
        var email = $( '#email' ).val();  
        if ( username == '' ) {
            createError( '#register-form', 'Please type a username' );
            return false;
        }
        if ( !username.match( /^\s*[a-zA-Z0-9,\s._]+\s*$/ ) ) {
            createError( '#register-form', 'Usernames can only have numbers, letters, "." and "_"' );
            return false;
        }
        $.get(
            'user/view',
            {
                username: username 
            },
            function( responseText ) {
                createError( '#register-form', 'Username already exists' );
                return false;
            },
            "html"
        );
        if ( password == '' ) {
            createError( '#register-form', 'Please type a password' );
            return false;
        }
        if ( password.length < 7 ) {
            createError( '#register-form', 'Passwords do not match' );
            return false;
        }
        if ( passwordRepeat != password ) {
            createError( '#register-form', 'Please repeat correctly your password' );
            return false;
        }
        if ( email == '' ) {
            createError( '#register-form', 'Please type an email' );
            return false;
        }
    }); 

    function createError( form, description ) {
        $( '.alert' ).remove();
        $( form ).prepend( "<div class='alert alert-danger'>" + description + "</div>" );
    }
});
{'fraction_non_alphanumeric': 0.16336913510457884, 'fraction_numerical': 0.0031091011871113624, 'mean_word_length': 1.560781476121563, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5810042', 'n_tokens_mistral': 951, 'n_tokens_neox': 921, 'n_words': 240}