FarmBot/Farmbot-Web-App

View on GitHub
frontend/messages/cards.tsx

Summary

Maintainability
F
4 days
Test Coverage

File cards.tsx has 436 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from "react";
import { t } from "../i18next_wrapper";
import {
  AlertCardProps, AlertCardTemplateProps, FirmwareMissingProps,
  SeedDataMissingProps, SeedDataMissingState, TourNotTakenProps,
Severity: Minor
Found in frontend/messages/cards.tsx - About 6 hrs to fix

    Function AlertCard has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const AlertCard = (props: AlertCardProps) => {
      const { alert, timeSettings, findApiAlertById, dispatch } = props;
      const commonProps = { alert, timeSettings, findApiAlertById, dispatch };
      switch (alert.problem_tag) {
        case "farmbot_os.firmware.missing":
    Severity: Minor
    Found in frontend/messages/cards.tsx - About 1 hr to fix

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

        <AlertCardTemplate
          alert={props.alert}
          className={"tour-not-taken-alert"}
          title={t("Take a guided tour")}
          message={t(Content.TAKE_A_TOUR)}
      Severity: Major
      Found in frontend/messages/cards.tsx and 3 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 359..375
      frontend/messages/cards.tsx on lines 378..402
      frontend/messages/cards.tsx on lines 405..432

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

      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

        <AlertCardTemplate
          alert={props.alert}
          className={"documentation-unread-alert"}
          title={t("Learn more about the app")}
          message={t(Content.READ_THE_DOCS)}
      Severity: Major
      Found in frontend/messages/cards.tsx and 3 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 342..356
      frontend/messages/cards.tsx on lines 359..375
      frontend/messages/cards.tsx on lines 405..432

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

      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

        <AlertCardTemplate
          alert={props.alert}
          className={"demo-account-alert"}
          title={t("You're currently using a demo account")}
          message={t(Content.DEMO_ACCOUNT)}
      Severity: Major
      Found in frontend/messages/cards.tsx and 3 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 342..356
      frontend/messages/cards.tsx on lines 359..375
      frontend/messages/cards.tsx on lines 378..402

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

      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

        <AlertCardTemplate
          alert={props.alert}
          className={"user-not-welcomed-alert"}
          title={t("Welcome to the FarmBot Web App")}
          message={t(Content.WELCOME)}
      Severity: Major
      Found in frontend/messages/cards.tsx and 3 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 342..356
      frontend/messages/cards.tsx on lines 378..402
      frontend/messages/cards.tsx on lines 405..432

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

      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

          <thead>
            <tr>
              <th>{t("FarmBot Version")}</th>
              <th>{t("Electronics Board")}</th>
              <th>{t("Firmware Name")}</th>
      Severity: Major
      Found in frontend/messages/cards.tsx and 1 other location - About 2 hrs to fix
      frontend/os_download/content.tsx on lines 104..110

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

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

            <tr>
              <td>{"Genesis v1.2"}</td>
              <td>{"RAMPS"}</td>
              <td><code>{FIRMWARE_CHOICES_DDI["arduino"].label}</code></td>
            </tr>
      Severity: Major
      Found in frontend/messages/cards.tsx and 7 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 167..171
      frontend/messages/cards.tsx on lines 172..176
      frontend/messages/cards.tsx on lines 177..181
      frontend/messages/cards.tsx on lines 182..186
      frontend/messages/cards.tsx on lines 187..191
      frontend/messages/cards.tsx on lines 202..206
      frontend/messages/cards.tsx on lines 207..211

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

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

            <tr>
              <td>{"Genesis v1.4"}</td>
              <td>{"Farmduino"}</td>
              <td><code>{FIRMWARE_CHOICES_DDI["farmduino_k14"].label}</code></td>
            </tr>
      Severity: Major
      Found in frontend/messages/cards.tsx and 7 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 167..171
      frontend/messages/cards.tsx on lines 172..176
      frontend/messages/cards.tsx on lines 177..181
      frontend/messages/cards.tsx on lines 187..191
      frontend/messages/cards.tsx on lines 192..196
      frontend/messages/cards.tsx on lines 202..206
      frontend/messages/cards.tsx on lines 207..211

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

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

            <tr>
              <td>{"Genesis v1.3"}</td>
              <td>{"Farmduino"}</td>
              <td><code>{FIRMWARE_CHOICES_DDI["farmduino"].label}</code></td>
            </tr>
      Severity: Major
      Found in frontend/messages/cards.tsx and 7 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 167..171
      frontend/messages/cards.tsx on lines 172..176
      frontend/messages/cards.tsx on lines 177..181
      frontend/messages/cards.tsx on lines 182..186
      frontend/messages/cards.tsx on lines 192..196
      frontend/messages/cards.tsx on lines 202..206
      frontend/messages/cards.tsx on lines 207..211

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

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

            <tr>
              <td>{"Genesis v1.7"}</td>
              <td>{"Farmduino"}</td>
              <td><code>{FIRMWARE_CHOICES_DDI["farmduino_k17"].label}</code></td>
            </tr>
      Severity: Major
      Found in frontend/messages/cards.tsx and 7 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 172..176
      frontend/messages/cards.tsx on lines 177..181
      frontend/messages/cards.tsx on lines 182..186
      frontend/messages/cards.tsx on lines 187..191
      frontend/messages/cards.tsx on lines 192..196
      frontend/messages/cards.tsx on lines 202..206
      frontend/messages/cards.tsx on lines 207..211

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

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

            <tr>
              <td>{"Genesis v1.6"}</td>
              <td>{"Farmduino"}</td>
              <td><code>{FIRMWARE_CHOICES_DDI["farmduino_k16"].label}</code></td>
            </tr>
      Severity: Major
      Found in frontend/messages/cards.tsx and 7 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 167..171
      frontend/messages/cards.tsx on lines 177..181
      frontend/messages/cards.tsx on lines 182..186
      frontend/messages/cards.tsx on lines 187..191
      frontend/messages/cards.tsx on lines 192..196
      frontend/messages/cards.tsx on lines 202..206
      frontend/messages/cards.tsx on lines 207..211

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

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

            <tr>
              <td>{"Genesis v1.5"}</td>
              <td>{"Farmduino"}</td>
              <td><code>{FIRMWARE_CHOICES_DDI["farmduino_k15"].label}</code></td>
            </tr>
      Severity: Major
      Found in frontend/messages/cards.tsx and 7 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 167..171
      frontend/messages/cards.tsx on lines 172..176
      frontend/messages/cards.tsx on lines 182..186
      frontend/messages/cards.tsx on lines 187..191
      frontend/messages/cards.tsx on lines 192..196
      frontend/messages/cards.tsx on lines 202..206
      frontend/messages/cards.tsx on lines 207..211

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

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

            <tr>
              <td>{"Express v1.1"}</td>
              <td>{"Farmduino"}</td>
              <td><code>{FIRMWARE_CHOICES_DDI["express_k11"].label}</code></td>
            </tr>
      Severity: Major
      Found in frontend/messages/cards.tsx and 7 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 167..171
      frontend/messages/cards.tsx on lines 172..176
      frontend/messages/cards.tsx on lines 177..181
      frontend/messages/cards.tsx on lines 182..186
      frontend/messages/cards.tsx on lines 187..191
      frontend/messages/cards.tsx on lines 192..196
      frontend/messages/cards.tsx on lines 207..211

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

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

            <tr>
              <td>{"Express v1.0"}</td>
              <td>{"Farmduino"}</td>
              <td><code>{FIRMWARE_CHOICES_DDI["express_k10"].label}</code></td>
            </tr>
      Severity: Major
      Found in frontend/messages/cards.tsx and 7 other locations - About 2 hrs to fix
      frontend/messages/cards.tsx on lines 167..171
      frontend/messages/cards.tsx on lines 172..176
      frontend/messages/cards.tsx on lines 177..181
      frontend/messages/cards.tsx on lines 182..186
      frontend/messages/cards.tsx on lines 187..191
      frontend/messages/cards.tsx on lines 192..196
      frontend/messages/cards.tsx on lines 202..206

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

      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

      There are no issues that match your filters.

      Category
      Status