CodeTheChangeUBC/sasc

View on GitHub
client/src/Containers/Sms/index.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function render has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render() {
        if (this.props.auth === "counsellor") {
            return (
                <div className="Sms">
                    <h2>SMS Settings</h2>
Severity: Minor
Found in client/src/Containers/Sms/index.js - About 2 hrs to fix

    Identical blocks of code found in 8 locations. Consider refactoring.
    Open

        handleOnChange(event) {
            const target = event.target;
            const value = target.value;
            const name = target.name;
    
    
    Severity: Major
    Found in client/src/Containers/Sms/index.js and 7 other locations - About 1 hr to fix
    client/src/Containers/Account/index.js on lines 43..51
    client/src/Containers/Login/index.js on lines 28..36
    client/src/Containers/LoginCounsellor/index.js on lines 27..35
    client/src/Containers/PasswordChange/index.js on lines 33..41
    client/src/Containers/PreChatSurvey/index.js on lines 30..38
    client/src/Containers/Register/index.js on lines 47..55
    client/src/Containers/RegisterCounsellor/index.js on lines 61..69

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 59.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            var fields = {
                email: email.trim(),
                twilioPhoneNumber: twilioPhoneNumber.trim(),
                accountSid: accountSid.trim(),
                authToken: authToken.trim()
    Severity: Major
    Found in client/src/Containers/Sms/index.js and 1 other location - About 1 hr to fix
    client/src/Containers/PreChatSurvey/index.js on lines 58..63

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 6 locations. Consider refactoring.
    Open

        renderAlert() {
            if (this.props.errorMessage) {
                return <div className="error">{this.props.errorMessage}</div>;
            }
        }
    Severity: Major
    Found in client/src/Containers/Sms/index.js and 5 other locations - About 50 mins to fix
    client/src/Containers/Login/index.js on lines 46..50
    client/src/Containers/LoginCounsellor/index.js on lines 49..53
    client/src/Containers/PreChatSurvey/index.js on lines 74..78
    client/src/Containers/Register/index.js on lines 128..132
    client/src/Containers/RegisterCounsellor/index.js on lines 29..33

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if (!email || !twilioPhoneNumber || !accountSid || !authToken) {
                this.props.renderSMSError("You must not leave any field blank.");
                return false;
            }
    Severity: Minor
    Found in client/src/Containers/Sms/index.js and 1 other location - About 35 mins to fix
    client/src/Containers/PreChatSurvey/index.js on lines 43..46

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                            <Form
                                twilioEmail
                                twilioPhoneNumber
                                accountSid
                                authToken
    Severity: Minor
    Found in client/src/Containers/Sms/index.js and 1 other location - About 35 mins to fix
    client/src/Containers/PreChatSurvey/index.js on lines 85..93

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status