Lambda-School-Labs/signlingo-fe

View on GitHub

Showing 74 of 74 total issues

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

function render(
  ui,
  {
    initialState = reducerInitialState,
    store = createStore(reducer, initialState),
Severity: Major
Found in src/utils/appTestUtils.js and 1 other location - About 3 hrs to fix
src/utils/loginTestUtils.js on lines 10..22

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

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 render(
  ui,
  {
    initialState = reducerInitialState,
    store = createStore(reducer, initialState),
Severity: Major
Found in src/utils/loginTestUtils.js and 1 other location - About 3 hrs to fix
src/utils/appTestUtils.js on lines 10..22

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

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

const FlashcardWrapper = (props) => {
  let history = useHistory();
  const { id } = useParams();
  const [flashcardData, setFlashcardData] = useState([]);
  const [flipped, setFlipped] = useState([]);
Severity: Major
Found in src/components/Flashcards/FlashcardWrapper.js - About 2 hrs to fix

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

        } else if (d.completed_flashcards) {
          flashcard = (
            <>
              <Link to={`/flashcard/${d.level_id}`}>
                <img
    Severity: Major
    Found in src/components/Dashboard/DashboardCard.js and 1 other location - About 2 hrs to fix
    src/components/Dashboard/DashboardCard.js on lines 76..115

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

    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 (
          props.userLevels[levelMinusOne].completed_exercises &&
          props.userLevels[levelMinusOne].completed_flashcards &&
          props.userLevels[levelMinusOne].completed_quiz &&
          d.completed_flashcards === null
    Severity: Major
    Found in src/components/Dashboard/DashboardCard.js and 1 other location - About 2 hrs to fix
    src/components/Dashboard/DashboardCard.js on lines 93..115

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

    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

    File ExerciseCard.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useState } from "react";
    import { useParams, useHistory } from "react-router-dom";
    import { connect } from "react-redux";
    const purl = process.env.PUBLIC_URL;
    
    
    Severity: Minor
    Found in src/components/Exercises/ExerciseCard.js - About 2 hrs to fix

      Function Quiz has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      const Quiz = (props) => {
        const [data, setData] = useState(["dummy", "data"]);
        const [videoOn, setVideoOn] = useState(false);
        const [currentIndex, setCurrentIndex] = useState(0);
        const [enableButton, setEnableButton] = useState(false);
      Severity: Minor
      Found in src/components/Quiz/Quiz.js - About 2 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

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

        it("renders Account Component", () => {
          const history = createMemoryHistory();
          render(
            <Router history={history}>
              <Account />
      Severity: Major
      Found in src/__tests__/Account.test.js and 1 other location - About 2 hrs to fix
      src/__tests__/LandingPage.test.js on lines 43..53

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

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

                <section>
                  <div>
                    <img
                      src={
                        process.env.PUBLIC_URL + "/images/icons/medalIconSmall.png"
      Severity: Major
      Found in src/components/Home/LandingPage.js and 3 other locations - About 2 hrs to fix
      src/components/Home/LandingPage.js on lines 66..79
      src/components/Home/LandingPage.js on lines 81..90
      src/components/Home/LandingPage.js on lines 92..104

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

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

                <section>
                  <div>
                    <img
                      src={process.env.PUBLIC_URL + "/images/icons/recIconSmall.png"}
                      alt="rec icon"
      Severity: Major
      Found in src/components/Home/LandingPage.js and 3 other locations - About 2 hrs to fix
      src/components/Home/LandingPage.js on lines 50..64
      src/components/Home/LandingPage.js on lines 66..79
      src/components/Home/LandingPage.js on lines 81..90

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

      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

      test("Title of Landing Page renders", () => {
        const history = createMemoryHistory();
        render(
          <Router history={history}>
            <LandingPage />
      Severity: Major
      Found in src/__tests__/LandingPage.test.js and 1 other location - About 2 hrs to fix
      src/__tests__/Account.test.js on lines 31..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 83.

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

                <section>
                  <div>
                    <img
                      src={
                        process.env.PUBLIC_URL + "/images/icons/personIconSmall.png"
      Severity: Major
      Found in src/components/Home/LandingPage.js and 3 other locations - About 2 hrs to fix
      src/components/Home/LandingPage.js on lines 50..64
      src/components/Home/LandingPage.js on lines 81..90
      src/components/Home/LandingPage.js on lines 92..104

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

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

                <section>
                  <div>
                    <img
                      src={process.env.PUBLIC_URL + "/images/icons/examIconSmall.png"}
                      alt="exam icon"
      Severity: Major
      Found in src/components/Home/LandingPage.js and 3 other locations - About 2 hrs to fix
      src/components/Home/LandingPage.js on lines 50..64
      src/components/Home/LandingPage.js on lines 66..79
      src/components/Home/LandingPage.js on lines 92..104

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

      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

      it('submits correct values', () => {
        const { container } = render(<Login />)
      
        const email = container.querySelector('AccountTextFields[name="email"]')
      //   const password = container.querySelector('AccountTextFields[name="password"]')
      Severity: Major
      Found in src/__tests__/Login.test.js and 1 other location - About 2 hrs to fix
      src/__tests__/Signup.test.js on lines 25..59

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

      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

      it('submits correct values', () => {
        const { container } = render(<Signup />)
      
        const email = container.querySelector('AccountTextFields[name="email"]')
      //   const password = container.querySelector('AccountTextFields[name="password"]')
      Severity: Major
      Found in src/__tests__/Signup.test.js and 1 other location - About 2 hrs to fix
      src/__tests__/Login.test.js on lines 25..59

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

      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 FlashcardWrapper has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      const FlashcardWrapper = (props) => {
        let history = useHistory();
        const { id } = useParams();
        const [flashcardData, setFlashcardData] = useState([]);
        const [flipped, setFlipped] = useState([]);
      Severity: Minor
      Found in src/components/Flashcards/FlashcardWrapper.js - About 2 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

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

      test("Logout button appears on screen", () => {
        const { getByText } = render(<Dashboard />);
        const logout = getByText(/logout/i);
      
        expect(logout).toBeInTheDocument();
      Severity: Major
      Found in src/__tests__/Dashboard.test.js and 2 other locations - About 2 hrs to fix
      src/__tests__/DashboardCard.test.js on lines 12..18
      src/__tests__/Quiz.test.js on lines 14..20

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

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

      test("A - E appears on dashboard", () => {
        const { getByText } = render(<DashboardCard />);
        const aToE = getByText(/a - e/i);
      
        expect(aToE).toBeInTheDocument();
      Severity: Major
      Found in src/__tests__/DashboardCard.test.js and 2 other locations - About 2 hrs to fix
      src/__tests__/Dashboard.test.js on lines 12..18
      src/__tests__/Quiz.test.js on lines 14..20

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

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

      test("Sign A text appears on screen", () => {
        const { getByText } = render(<Quiz />);
        const signA = getByText(/sign/i);
      
        expect(signA).toBeInTheDocument();
      Severity: Major
      Found in src/__tests__/Quiz.test.js and 2 other locations - About 2 hrs to fix
      src/__tests__/Dashboard.test.js on lines 12..18
      src/__tests__/DashboardCard.test.js on lines 12..18

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

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

      const ExerciseWrapper = (props) => {
        const { id } = useParams();
        let history = useHistory();
        const [flashcardData, setFlashcardData] = useState([]);
        let exerciseData = [];
      Severity: Major
      Found in src/components/Exercises/ExerciseWrapper.js - About 2 hrs to fix
        Severity
        Category
        Status
        Source
        Language