Lambda-School-Labs/grants-fe

View on GitHub

Showing 74 of 74 total issues

Function WriterProfileForm has 369 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function WriterProfileForm() {
  const history = useHistory();
  const dispatch = useDispatch();
  const classes = useStyles();
  const userId = useSelector((state) => state.login.user.id);
Severity: Major
Found in src/components/WriterOnboardingForms/WriterProfileForm.js - About 1 day to fix

    Function ApplicantProfileForm has 236 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function ApplicantProfileForm() {
      const history = useHistory();
      const dispatch = useDispatch();
      const classes = useStyles();
      const userId = useSelector((state) => state.login.user.id);
    Severity: Major
    Found in src/components/ApplicantOnboardingForm/ApplicantProfileForm.js - About 1 day to fix

      Function EditProfile has 208 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const EditProfile = (props) => {
        const classes = useStyles();
        const userType = props.userType;
      
        if (userType === "writer") {
      Severity: Major
      Found in src/components/EditProfileForms/EditProfileForms.js - About 1 day to fix

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

                  <div className="name-edit">
                    <h3 className={classes.editTitle}>Name:</h3>
                    <TextField
                      label="First Name"
                      className="first-name-input"
        Severity: Major
        Found in src/components/EditProfileForms/EditProfileForms.js and 1 other location - About 6 hrs to fix
        src/components/EditProfileForms/EditProfileForms.js on lines 133..152

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

        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

                  <div className="name-edit">
                    <h3 className={classes.editTitle}>Name:</h3>
                    <TextField
                      label="First Name"
                      className="first-name-input"
        Severity: Major
        Found in src/components/EditProfileForms/EditProfileForms.js and 1 other location - About 6 hrs to fix
        src/components/EditProfileForms/EditProfileForms.js on lines 31..50

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

        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 RegisterForm has 150 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function RegisterForm() {
          const dispatch = useDispatch();
          const classes = useStyles();
          const history = useHistory();
          const [isDisabled, setIsDisabled] = useState(true);
        Severity: Major
        Found in src/components/register/registerForm.js - About 6 hrs to fix

          Function LandingPage has 136 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function LandingPage() {
            const classes = useStyles();
            const dispatch = useDispatch();
            const token = localStorage.getItem("token");
            useEffect(() => {
          Severity: Major
          Found in src/components/landingPage/LandingPage.js - About 5 hrs to fix

            File WriterProfileForm.js has 391 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { useState } from "react";
            import { useHistory } from "react-router-dom";
            import { useDispatch, useSelector } from "react-redux";
            import { postWriterOboarding } from "../../store/actions/onboardingActions";
            import CssBaseline from "@material-ui/core/CssBaseline";
            Severity: Minor
            Found in src/components/WriterOnboardingForms/WriterProfileForm.js - About 5 hrs to fix

              Function grantsReducer has 123 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const grantsReducer = (state = initialState, action) => {
                switch (action.type) {
                  case GET_GRANTS_START:
                    return {
                      ...state,
              Severity: Major
              Found in src/store/reducers/grantsReducer.js - About 4 hrs to fix

                Function UpdateGrant has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function UpdateGrant() {
                  const dispatch = useDispatch();
                  const history = useHistory();
                  const classes = useStyles();
                  const applicant_id = useSelector(
                Severity: Major
                Found in src/components/applicant-profile/applicant-grants/UpdateGrant.js - About 4 hrs to fix

                  Function PrimarySearchAppBar has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function PrimarySearchAppBar() {
                    const classes = useStyles();
                    const history = useHistory();
                    const [anchorEl, setAnchorEl] = useState(null);
                    const [mobileMoreAnchorEl, setMobileMoreAnchorEl] = useState(null);
                  Severity: Major
                  Found in src/components/navbar/Navbar.js - About 4 hrs to fix

                    Function GrantsForm has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function GrantsForm() {
                      const classes = useStyles();
                      const history = useHistory();
                      const dispatch = useDispatch();
                      const profileId = useSelector((state) => state.profileInfo.profileDetails.id);
                    Severity: Major
                    Found in src/components/applicant-profile/applicant-grants/GrantsForm.js - About 4 hrs to fix

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

                        paper: {
                          marginTop: theme.spacing(3),
                          marginBottom: theme.spacing(3),
                          padding: theme.spacing(2),
                          [theme.breakpoints.up(600 + theme.spacing(3) * 2)]: {
                      Severity: Major
                      Found in src/components/WriterOnboardingForms/WriterForm.styles.js and 1 other location - About 4 hrs to fix
                      src/components/ApplicantOnboardingForm/ApplicantForm.styles.js on lines 27..36

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

                      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

                        paper: {
                          marginTop: theme.spacing(3),
                          marginBottom: theme.spacing(3),
                          padding: theme.spacing(2),
                          [theme.breakpoints.up(600 + theme.spacing(3) * 2)]: {
                      src/components/WriterOnboardingForms/WriterForm.styles.js on lines 31..40

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

                      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 GrantCard has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function GrantCard(props) {
                        const dispatch = useDispatch();
                        const grant = props.data;
                        const classes = useStyles();
                        const [expanded, setExpanded] = React.useState(false);
                      Severity: Major
                      Found in src/components/homepage/grantCards/GrantCard.jsx - About 3 hrs to fix

                        Function WriterProfileForm has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function WriterProfileForm() {
                          const history = useHistory();
                          const dispatch = useDispatch();
                          const classes = useStyles();
                          const userId = useSelector((state) => state.login.user.id);
                        Severity: Minor
                        Found in src/components/WriterOnboardingForms/WriterProfileForm.js - About 3 hrs to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function GrantCard has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function GrantCard(props) {
                          const dispatch = useDispatch();
                          const grant = props.data;
                        
                          const classes = useStyles();
                        Severity: Major
                        Found in src/components/grantsPage/grantCards/GrantCard.jsx - About 3 hrs to fix

                          Function ApplicantProfileForm has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export default function ApplicantProfileForm() {
                            const history = useHistory();
                            const dispatch = useDispatch();
                            const classes = useStyles();
                            const userId = useSelector((state) => state.login.user.id);
                          Severity: Minor
                          Found in src/components/ApplicantOnboardingForm/ApplicantProfileForm.js - About 3 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function getStepContent has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function getStepContent(step) {
                              switch (step) {
                                case 0:
                                  return (
                                    <WriterContactInfoForm
                          Severity: Major
                          Found in src/components/WriterOnboardingForms/WriterProfileForm.js - About 3 hrs to fix

                            Function Login has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const Login = () => {
                              const history = useHistory();
                              const dispatch = useDispatch();
                              const [user, setUser] = useState({
                                email: "",
                            Severity: Major
                            Found in src/components/login/loginForm.js - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language