Lambda-School-Labs/designhub-fe

View on GitHub

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

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

          export function useWindowDimensions() {
            const [windowDimensions, setWindowDimensions] = useState(
              getWindowDimensions()
            );
          
          
          Severity: Major
          Found in src/views/Project/ImageViewer/useWindowDimensions.js and 1 other location - About 2 hrs to fix
          src/common/ImageViewer/useWindowDimensions.js on lines 11..26

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

          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

          export function useWindowDimensions() {
            const [windowDimensions, setWindowDimensions] = useState(
              getWindowDimensions()
            );
          
          
          Severity: Major
          Found in src/common/ImageViewer/useWindowDimensions.js and 1 other location - About 2 hrs to fix
          src/views/Project/ImageViewer/useWindowDimensions.js on lines 10..25

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

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

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

                  const setLightMode = () => {
                    toggleLightMode();
                    if (light) {
                      localStorage.setItem('theme', 'dark');
                    } else {
                Severity: Major
                Found in src/common/Nav/LoginBar.js and 1 other location - About 1 hr to fix
                src/common/Nav/TopBar.js on lines 50..58

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

                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

                  const setLightMode = () => {
                    toggleLightMode();
                    if (light) {
                      localStorage.setItem('theme', 'dark');
                    } else {
                Severity: Major
                Found in src/common/Nav/TopBar.js and 1 other location - About 1 hr to fix
                src/common/Nav/LoginBar.js on lines 33..41

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

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

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

                    const init = () => {
                      if (startLight) {
                        toggleLightMode();
                      }
                      document.addEventListener('mousedown', handleClick);
                  Severity: Major
                  Found in src/common/Nav/LoginBar.js and 1 other location - About 1 hr to fix
                  src/common/Nav/TopBar.js on lines 31..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 57.

                  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

                    const init = () => {
                      if (startLight) {
                        toggleLightMode();
                      }
                      document.addEventListener('mousedown', handleClick);
                  Severity: Major
                  Found in src/common/Nav/TopBar.js and 1 other location - About 1 hr to fix
                  src/common/Nav/LoginBar.js on lines 17..25

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

                  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 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
                    Severity
                    Category
                    Status
                    Source
                    Language