CodeTheChangeUBC/sasc

View on GitHub

Showing 160 of 160 total issues

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

    renderLinkChatUserConnected() {
        if (this.props.connected && this.props.auth === "user") {
            return [
                <li className="nav-item" key={1}>
                    <Link to="/chat">Chat</Link>
Severity: Major
Found in client/src/Components/Header/index.js and 1 other location - About 2 hrs to fix
client/src/Containers/Header/index.js on lines 56..64

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

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

function mapStateToProps(state) {
    return {
        auth: state.auth.auth,
        user: state.user.user,
        counsellor: state.counsellor.counsellor,
Severity: Major
Found in client/src/Containers/PasswordChange/index.js and 1 other location - About 2 hrs to fix
client/src/Containers/Account/index.js on lines 264..272

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

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

function mapStateToProps(state) {
    return {
        auth: state.auth.auth,
        user: state.user.user,
        counsellor: state.counsellor.counsellor,
Severity: Major
Found in client/src/Containers/Account/index.js and 1 other location - About 2 hrs to fix
client/src/Containers/PasswordChange/index.js on lines 143..151

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

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

        } else if (this.props.auth === "counsellor") {
            validated = this.validateForm(this.props.renderCounsellorError);
            if (validated) {
                this.props.changeCounsellorPassword({
                    ID: this.props.counsellor.ID,
Severity: Major
Found in client/src/Containers/PasswordChange/index.js and 1 other location - About 2 hrs to fix
client/src/Containers/PasswordChange/index.js on lines 79..97

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

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 (this.props.auth === "user") {
            validated = this.validateForm(this.props.renderUserError);
            if (validated) {
                this.props.changeUserPassword({
                    ID: this.props.user.ID,
Severity: Major
Found in client/src/Containers/PasswordChange/index.js and 1 other location - About 2 hrs to fix
client/src/Containers/PasswordChange/index.js on lines 88..97

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

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

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

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

    function mapDispatchToProps(dispatch) {
        return bindActionCreators(
            {
                getUser: userActions.getUser,
                updateUser: userActions.updateUser,
    Severity: Major
    Found in client/src/Containers/Account/index.js and 1 other location - About 1 hr to fix
    client/src/Containers/Logout/index.js on lines 45..57

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

    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

    function mapDispatchToProps(dispatch) {
        return bindActionCreators(
            {
                signout: authActions.signout,
                removeUser: userActions.removeUser,
    Severity: Major
    Found in client/src/Containers/Logout/index.js and 1 other location - About 1 hr to fix
    client/src/Containers/Account/index.js on lines 274..286

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

    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 (this.props.auth === "counsellor") {
                    this.props.socket.emit("chat message", {
                        user: this.props.counsellor.firstName,
                        message: this.state.input,
                        room: this.props.room.roomID
    Severity: Major
    Found in client/src/Components/Chat/ChatInput.js and 1 other location - About 1 hr to fix
    client/src/Components/Chat/ChatInput.js on lines 33..39

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

    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

                } else {
                    this.props.socket.emit("chat message", {
                        user: this.props.user.nickname,
                        message: this.state.input,
                        room: this.props.room.roomID
    Severity: Major
    Found in client/src/Components/Chat/ChatInput.js and 1 other location - About 1 hr to fix
    client/src/Components/Chat/ChatInput.js on lines 27..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 71.

    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

    Function validateForm has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        validateForm(fields, renderError) {
            const { password, passwordConfirm } = this.state;
    
            if (password !== passwordConfirm) {
                renderError("Passwords must match.");
    Severity: Minor
    Found in client/src/Containers/Account/index.js - About 1 hr to fix

      Function default has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function(state = initialState.user, action) {
          switch (action.type) {
          case SUBMIT_SURVEY:
              return {
                  ...state,
      Severity: Minor
      Found in client/src/Redux/Reducers/userReducer.js - About 1 hr to fix

        Function handleOnSubmit has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            handleOnSubmit(ev) {
                ev.preventDefault();
                var ID;
                var fields;
                var validated = false;
        Severity: Minor
        Found in client/src/Containers/Account/index.js - About 1 hr to fix

          Function server has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.server = function(database, databaseMode) {
            // DB setup
            database.connect(databaseMode, function(err) {
              if (err) {
                console.log('Unable to connect to MySQL.');
          Severity: Minor
          Found in server.js - About 1 hr to fix

            Function default has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function(state = initialState.counsellor, action) {
                switch (action.type) {
                case ADD_COUNSELLOR:
                    return {
                        ...state,
            Severity: Minor
            Found in client/src/Redux/Reducers/counsellorReducer.js - About 1 hr to fix

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

              Logout.propTypes = {
                  removeUser: PropTypes.func,
                  removeCounsellor: PropTypes.func,
                  signout: PropTypes.func,
                  disconnectFromChat: PropTypes.func,
              Severity: Major
              Found in client/src/Containers/Logout/index.js and 1 other location - About 1 hr to fix
              client/src/Containers/PreChatSurvey/index.js on lines 106..113

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

              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

              PreChatSurvey.propTypes = {
                  dispatch: PropTypes.func,
                  history: PropTypes.object,
                  submitSurvey: PropTypes.func,
                  errorMessage: PropTypes.string,
              Severity: Major
              Found in client/src/Containers/PreChatSurvey/index.js and 1 other location - About 1 hr to fix
              client/src/Containers/Logout/index.js on lines 59..66

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

              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

              Function abstractSignup has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              async function abstractSignup(user, requiredCredentials, role, res, model) {
                  var error = false;
                  var missingCredentials = [];
              
                  Object.keys(requiredCredentials).forEach(function (property) {
              Severity: Minor
              Found in server/controllers/authentication.js - About 1 hr to fix

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

                    handleOnSubmit(ev) {
                        ev.preventDefault();
                
                        const { history } = this.props;
                
                
                Severity: Major
                Found in client/src/Containers/LoginCounsellor/index.js and 1 other location - About 1 hr to fix
                client/src/Containers/Login/index.js on lines 38..44

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

                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

                    handleOnSubmit(ev) {
                        ev.preventDefault();
                
                        const { history } = this.props;
                
                
                Severity: Major
                Found in client/src/Containers/Login/index.js and 1 other location - About 1 hr to fix
                client/src/Containers/LoginCounsellor/index.js on lines 37..47

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

                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

                Severity
                Category
                Status
                Source
                Language