Lambda-School-Labs/designhub-fe

View on GitHub

Showing 15 of 29 total issues

File ProjectFormBody.js has 340 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useState } from 'react';

import Privacy from './Privacy';

import DeleteProjectModal from './DeleteProjectModal';
Severity: Minor
Found in src/views/CreateProject/ProjectFormBody.js - About 4 hrs to fix

    Function LoginBar has 127 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    const LoginBar = () => {
      const { loginWithRedirect } = useAuth0();
      const startLight = localStorage.getItem('theme') === 'light';
      const [light, setLight] = useState(startLight);
      const [show, setShow] = useState(false);
    Severity: Major
    Found in src/common/Nav/LoginBar.js - About 4 hrs to fix

      Function ProjectFromBody has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

      const ProjectFromBody = ({
        isEditing,
        project,
        projectPhotos,
        userData,
      Severity: Minor
      Found in src/views/CreateProject/ProjectFormBody.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 OnboardingForm has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      const OnboardingForm = ({ history, isLoading }) => {
        const [loadingPage, setLoadingPage] = useState(false);
      
        // user data from auth0-spa
        const { logout, user } = useAuth0();
      Severity: Minor
      Found in src/views/Onboarding/OnboardingForm.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

      File ProfileTabs.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from 'react';
      import { Link } from 'react-router-dom';
      import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
      import moment from 'moment';
      import { v4 } from 'uuid';
      Severity: Minor
      Found in src/views/Profile/ProfileTabs.js - About 3 hrs to fix

        Function Profile has 99 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        export default function Profile(props, users) {
          // const { username, avatar} = useParams();
          const history = useHistory();
          const { id } = useParams();
          const { user } = useAuth0();
        Severity: Major
        Found in src/views/Profile/index.js - About 2 hrs to fix

          Function MultiImageUpload has 79 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          export function MultiImageUpload(props) {
            const { files, setFiles } = props;
            const {
              isDragActive,
              isDragReject,
          Severity: Major
          Found in src/views/CreateProject/MultiImageUpload.js - About 2 hrs to fix

            Function Heatmap has 75 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            const Heatmap = (props) => {
              const [today] = useState(new Date());
              const heatmapArr = [];
              const [days, setDays] = useState(-365);
              const { width } = useWindowDimensions();
            Severity: Major
            Found in src/views/Profile/Heatmap.js - About 2 hrs to fix

              Function App has 64 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              export default function App() {
                /*  USER STATE   */
              
                const { user, loading } = useAuth0();
                const history = useHistory();
              Severity: Major
              Found in src/App.js - About 1 hr to fix

                Function InviteModal has 61 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                const InviteModal = () => {
                  return (
                    <div className="modal--close">
                      <span className="modal--expand__background-overlay">
                        <div className="invite-modal">
                Severity: Major
                Found in src/views/CreateProject/InviteModal.js - About 1 hr to fix

                  Function ImageViewer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const ImageViewer = ({ projectImg, userData, projectData }) => {
                    const { isModal, toggleModal } = useModal();
                    const [activeImg, setActiveImg] = useState(null);
                    const changeImg = (imgObj) => {
                      if (activeImg === null || activeImg.id !== imgObj.id) {
                  Severity: Minor
                  Found in src/views/Project/ImageViewer/ImageViewer.js - About 1 hr 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 TopBar has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const TopBar = ({ searchData, getSearch }) => {
                    const { logout, user } = useAuth0();
                    const history = useHistory();
                  
                    const { data: activeUser } = useQuery(GET_USER_BY_ID_QUERY, {
                  Severity: Minor
                  Found in src/common/Nav/TopBar.js - About 1 hr 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 LoginBar has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const LoginBar = () => {
                    const { loginWithRedirect } = useAuth0();
                    const startLight = localStorage.getItem('theme') === 'light';
                    const [light, setLight] = useState(startLight);
                    const [show, setShow] = useState(false);
                  Severity: Minor
                  Found in src/common/Nav/LoginBar.js - About 1 hr 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 TempComment has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  export const TempComment = (props) => {
                    const [comment, setComment] = useState();
                  
                    const { c } = this.props;
                    const { top, left } = c;
                  Severity: Major
                  Found in src/views/Project/ImageViewer/TempComment.js - About 1 hr to fix

                    Function Step1 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const Step1 = ({
                      alert,
                      formUser,
                      onChange,
                      showPrev,
                    Severity: Minor
                    Found in src/views/Onboarding/Step1.js - About 55 mins 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

                    Severity
                    Category
                    Status
                    Source
                    Language