CodeTheChangeUBC/sasc

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

Summary

Maintainability
A
3 hrs
Test Coverage

Consider simplifying this complex logical expression.
Open

        if (
            !username ||
            !nickname ||
            !age ||
            !gender ||
Severity: Major
Found in client/src/Containers/Register/index.js - About 1 hr 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/Register/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/RegisterCounsellor/index.js on lines 61..69
    client/src/Containers/Sms/index.js on lines 30..38

    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

    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/Register/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/RegisterCounsellor/index.js on lines 29..33
    client/src/Containers/Sms/index.js on lines 68..72

    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 4 locations. Consider refactoring.
    Open

    function mapDispatchToProps(dispatch) {
        return bindActionCreators(
            {
                signupUser: authActions.signupUser,
                addUser: userActions.addUser,
    Severity: Major
    Found in client/src/Containers/Register/index.js and 3 other locations - About 30 mins to fix
    client/src/Containers/Login/index.js on lines 90..99
    client/src/Containers/LoginCounsellor/index.js on lines 86..95
    client/src/Containers/PreChatSurvey/index.js on lines 115..124

    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 45.

    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