Lambda-School-Labs/grants-fe

View on GitHub

Showing 36 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

        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

                      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

                              Function onboardingReducer has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

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

                                Function handleValidation has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const handleValidation = (e) => {
                                    // validation function handles all inputs where the only validation is that the string must be greater than 2
                                    const validator = (formValue) => {
                                      //persisting the event to ensure it makes it to validation
                                      e.persist();
                                Severity: Major
                                Found in src/components/WriterOnboardingForms/WriterProfileForm.js - About 3 hrs to fix

                                  Function WriterProfile has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const WriterProfile = (props) => {
                                    const dispatch = useDispatch();
                                    const classes = useStyles();
                                  
                                    //Redux
                                  Severity: Major
                                  Found in src/components/writer-profile/writerProfile.js - About 2 hrs to fix

                                    File WriterWorkCard.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    import React, { useState } from "react";
                                    import { useDispatch, useSelector } from "react-redux";
                                    import { useStyles } from "./WriterForm.styles";
                                    import Card from "@material-ui/core/Card";
                                    import CardContent from "@material-ui/core/CardContent";
                                    Severity: Minor
                                    Found in src/components/WriterOnboardingForms/WriterWorkCard.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language