<commit_before>import * as React from 'react';
import {reduxForm, Field} from 'redux-form';

class ContactForm extends React.Component {

    _handleSubmitHandler = (formData) => this._onFormSubmit(formData);

    render() {
        const {handleSubmit, reset} = this.props;

        return (
            <form onSubmit={handleSubmit(this._handleSubmitHandler)}>
                <div className="form-group">
                    <Field
                        component={this._renderInputField}
                        label="Name"
                        name="name"
                        placeholder=""
                        type="text"
                    />
                </div>
                <div className="form-group">
                    <Field
                        component={this._renderInputField}
                        label="Email"
                        name="email"
                        placeholder="<EMAIL>"
                        type="email"
                    />
                    <small
                        className="form-text text-muted"
                        id="emailHelp"
                    >
                        {'We\'ll never share your email with anyone else.'}
                    </small>
                </div>
                <div className="form-group">
                    <Field
                        label={'Example select'}
                        name="exampleSelect1"
                        component={this._renderSelect}
                    />
                </div>
                <div className="form-group">
                    <Field
                        component={this._renderTextArea}
                        label="Message"
                        name="message"
                        placeholder=""
                    />
                </div>
                <fieldset className="form-group">
                    <legend>{'Code Quality'}</legend>

                    <Field
                        component={this._renderRadio}
                        label="This code is awesome!"
                        name="codeQualityRadio"
                        option="1"
                        checked={true}
                    />
                    <Field
                        component={this._renderRadio}
                        label="This code is ok."
                        name="codeQualityRadio"
                        option="2"
                    />
                    <Field
                        component={this._renderRadio}
                        label="This code is bad."
                        name="codeQualityRadio"
                        option="3"
                        disabled={true}
                    />
                </fieldset>
                <div className="form-check">
                    <Field
                        component={this._renderCheckbox}
                        label="Did you star my repo?"
                        name="starred"
                        type="checkbox"
                    />
                </div>
                <button
                    type="submit"
                    className="btn btn-primary"
                >
                    {'Submit'}
                </button>
                <button
                    type="submit"
                    className="btn btn-primary"
                    onClick={reset}
                >
                    {'Reset'}
                </button>
            </form>
        );
    }

    _onFormSubmit(formData) {
        console.info(formData);

        window.alert(JSON.stringify(formData, null, 2)); // eslint-disable-line no-alert
    }

    _renderInputField(field) {
        const {meta: {touched, error}} = field;
        const className = `small text-danger ${touched && error ? '' : 'd-none'}`;

        return (
            <div>
                <label htmlFor={field.input.name}>
                    {field.label} <span className={className}>{error}</span>
                </label>
                <input<commit_msg>Rename submit method name and change to use bind.<commit_after>import * as React from 'react';
import {reduxForm, Field} from 'redux-form';

class ContactForm extends React.Component {

    _onSubmitHandler = this._onSubmit.bind(this);

    render() {
        const {handleSubmit, reset} = this.props;

        return (
            <form onSubmit={handleSubmit(this._onSubmitHandler)}>
                <div className="form-group">
                    <Field
                        component={this._renderInputField}
                        label="Name"
                        name="name"
                        placeholder=""
                        type="text"
                    />
                </div>
                <div className="form-group">
                    <Field
                        component={this._renderInputField}
                        label="Email"
                        name="email"
                        placeholder="<EMAIL>"
                        type="email"
                    />
                    <small
                        className="form-text text-muted"
                        id="emailHelp"
                    >
                        {'We\'ll never share your email with anyone else.'}
                    </small>
                </div>
                <div className="form-group">
                    <Field
                        label={'Example select'}
                        name="exampleSelect1"
                        component={this._renderSelect}
                    />
                </div>
                <div className="form-group">
                    <Field
                        component={this._renderTextArea}
                        label="Message"
                        name="message"
                        placeholder=""
                    />
                </div>
                <fieldset className="form-group">
                    <legend>{'Code Quality'}</legend>

                    <Field
                        component={this._renderRadio}
                        label="This code is awesome!"
                        name="codeQualityRadio"
                        option="1"
                        checked={true}
                    />
                    <Field
                        component={this._renderRadio}
                        label="This code is ok."
                        name="codeQualityRadio"
                        option="2"
                    />
                    <Field
                        component={this._renderRadio}
                        label="This code is bad."
                        name="codeQualityRadio"
                        option="3"
                        disabled={true}
                    />
                </fieldset>
                <div className="form-check">
                    <Field
                        component={this._renderCheckbox}
                        label="Did you star my repo?"
                        name="starred"
                        type="checkbox"
                    />
                </div>
                <button
                    type="submit"
                    className="btn btn-primary"
                >
                    {'Submit'}
                </button>
                <button
                    type="submit"
                    className="btn btn-primary"
                    onClick={reset}
                >
                    {'Reset'}
                </button>
            </form>
        );
    }

    _onSubmit(formData) {
        console.info(formData);

        window.alert(JSON.stringify(formData, null, 2)); // eslint-disable-line no-alert
    }

    _renderInputField(field) {
        const {meta: {touched, error}} = field;
        const className = `small text-danger ${touched && error ? '' : 'd-none'}`;

        return (
            <div>
                <label htmlFor={field.input.name}>
                    {field.label} <span className={className}>{error}</span>
                </label>
                <input
{'fraction_non_alphanumeric': 0.09579064313047772, 'fraction_numerical': 0.0012344155042587335, 'mean_word_length': 0.845978582820688, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 76, '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': '1765239', 'n_tokens_mistral': 1808, 'n_tokens_neox': 1603, 'n_words': 322}