Lambda-School-Labs/signlingo-fe

View on GitHub

Showing 74 of 74 total issues

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

  if (d.completed_exercises && d.completed_quiz === null) {
    quiz = (
      <>
        <Link to={`/quiz/${d.level_id}`}>
          <img
Severity: Major
Found in src/components/Dashboard/DashboardCard.js and 1 other location - About 1 day to fix
src/components/Dashboard/DashboardCard.js on lines 118..162

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

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 (d.completed_flashcards && d.completed_exercises === null) {
    exercise = (
      <>
        <Link to={`/exercise/${d.level_id}`}>
          <img
Severity: Major
Found in src/components/Dashboard/DashboardCard.js and 1 other location - About 1 day to fix
src/components/Dashboard/DashboardCard.js on lines 164..208

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

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

const ExerciseCard = (props) => {
  let history = useHistory();
  let { id } = useParams(); //id of the level
  const [currentIndex, setCurrentIndex] = useState(0); //index of the question we're showing to the user at the moment
  const [lives, setLives] = useState(3); //amount of lives user have
Severity: Major
Found in src/components/Exercises/ExerciseCard.js - About 1 day to fix

    Function DashboardCard has 231 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const DashboardCard = (props) => {
      const purl = process.env.PUBLIC_URL;
      const alphabet = 5; // num levels pertaining to alphabet
      const d = props.levelData;
      let flashcard;
    Severity: Major
    Found in src/components/Dashboard/DashboardCard.js - About 1 day to fix

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

        return (
          <div className="quizDemo">
            <div className="quizDemoHead">
              <img
                onClick={backToDash}
      Severity: Major
      Found in src/components/Exercises/ExerciseFail.js and 1 other location - About 7 hrs to fix
      src/components/Exercises/ExerciseSuccess.js on lines 25..47

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

      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

        return (
          <div className="quizDemo">
            <div className="quizDemoHead">
              <img
                onClick={backToDash}
      Severity: Major
      Found in src/components/Exercises/ExerciseSuccess.js and 1 other location - About 7 hrs to fix
      src/components/Exercises/ExerciseFail.js on lines 10..32

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

      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 Quiz has 152 lines of code (exceeds 25 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: Major
      Found in src/components/Quiz/Quiz.js - About 6 hrs to fix

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

        it("clicking login button on Landing Page sends user to Login Tab of accounts", async () => {
          const history = createMemoryHistory();
          const { getByTestId } = render(
            <Router history={history}>
              <App />
        Severity: Major
        Found in src/__tests__/LandingPage.test.js and 1 other location - About 6 hrs to fix
        src/__tests__/LandingPage.test.js on lines 80..105

        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

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

        it("clicking backArrow Button on Account Page sends user to Landing Page", async () => {
          const history = createMemoryHistory();
          const { getByTestId } = render(
            <Router history={history}>
              <App />
        Severity: Major
        Found in src/__tests__/LandingPage.test.js and 1 other location - About 6 hrs to fix
        src/__tests__/LandingPage.test.js on lines 107..131

        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

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

                    <AccountTextFields
                      className={classes.inputText}
                      variant="outlined"
                      name="confirm"
                      type="password"
        Severity: Major
        Found in src/components/Signup.js and 1 other location - About 5 hrs to fix
        src/components/Signup.js on lines 171..189

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

        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

                    <AccountTextFields
                      className={classes.inputText}
                      variant="outlined"
                      name="password"
                      type="password"
        Severity: Major
        Found in src/components/Signup.js and 1 other location - About 5 hrs to fix
        src/components/Signup.js on lines 198..216

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

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

        const DashboardCard = (props) => {
          const purl = process.env.PUBLIC_URL;
          const alphabet = 5; // num levels pertaining to alphabet
          const d = props.levelData;
          let flashcard;
        Severity: Minor
        Found in src/components/Dashboard/DashboardCard.js - About 5 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 5 locations. Consider refactoring.
        Open

          it("renders the landing page from by clicking back button", async () => {
            const history = createMemoryHistory();
            const { getByTestId } = render(
              <Router history={history}>
                <App />
        Severity: Major
        Found in src/__tests__/Account.test.js and 4 other locations - About 5 hrs to fix
        src/__tests__/Account.test.js on lines 43..60
        src/__tests__/Account.test.js on lines 62..79
        src/__tests__/Account.test.js on lines 81..98
        src/__tests__/LandingPage.test.js on lines 57..77

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

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

          it("renders account component with signup tab open when clicking signup button on Landing Page", async () => {
            const history = createMemoryHistory();
            const { getByTestId } = render(
              <Router history={history}>
                <App />
        Severity: Major
        Found in src/__tests__/Account.test.js and 4 other locations - About 5 hrs to fix
        src/__tests__/Account.test.js on lines 62..79
        src/__tests__/Account.test.js on lines 81..98
        src/__tests__/Account.test.js on lines 100..117
        src/__tests__/LandingPage.test.js on lines 57..77

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

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

          it("renders the signup component when signup tab on the account route is clicked", async () => {
            const history = createMemoryHistory();
            const { getByTestId } = render(
              <Router history={history}>
                <App />
        Severity: Major
        Found in src/__tests__/Account.test.js and 4 other locations - About 5 hrs to fix
        src/__tests__/Account.test.js on lines 43..60
        src/__tests__/Account.test.js on lines 62..79
        src/__tests__/Account.test.js on lines 100..117
        src/__tests__/LandingPage.test.js on lines 57..77

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

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

        it("clicking signup button on Landing Page sends user to SignUp Tab of accounts", async () => {
          const history = createMemoryHistory();
          const { getByTestId } = render(
            <Router history={history}>
              <App />
        Severity: Major
        Found in src/__tests__/LandingPage.test.js and 4 other locations - About 5 hrs to fix
        src/__tests__/Account.test.js on lines 43..60
        src/__tests__/Account.test.js on lines 62..79
        src/__tests__/Account.test.js on lines 81..98
        src/__tests__/Account.test.js on lines 100..117

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

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

          it("renders login component when login tab is clicked", async () => {
            const history = createMemoryHistory();
            const { getByTestId } = render(
              <Router history={history}>
                <App />
        Severity: Major
        Found in src/__tests__/Account.test.js and 4 other locations - About 5 hrs to fix
        src/__tests__/Account.test.js on lines 43..60
        src/__tests__/Account.test.js on lines 81..98
        src/__tests__/Account.test.js on lines 100..117
        src/__tests__/LandingPage.test.js on lines 57..77

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

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

        const VideoAssessment = (props) => {
          let mediaRecorder;
          let constraintObj = {
            audio: false,
            video: {
        Severity: Major
        Found in src/components/Quiz/VideoAssessment.js - About 4 hrs to fix

          Function ExerciseCard has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

          const ExerciseCard = (props) => {
            let history = useHistory();
            let { id } = useParams(); //id of the level
            const [currentIndex, setCurrentIndex] = useState(0); //index of the question we're showing to the user at the moment
            const [lives, setLives] = useState(3); //amount of lives user have
          Severity: Minor
          Found in src/components/Exercises/ExerciseCard.js - About 4 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 LandingPage has 97 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const LandingPage = () => {
            let history = useHistory();
            const { authService } = useOktaAuth();
          
            const login = async () => {
          Severity: Major
          Found in src/components/Home/LandingPage.js - About 3 hrs to fix
            Severity
            Category
            Status
            Source
            Language