FarmBot/Farmbot-Web-App

View on GitHub
frontend/three_d_garden/config_overlays.tsx

Summary

Maintainability
D
2 days
Test Coverage

Function PrivateOverlay has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const PrivateOverlay = (props: OverlayProps) => {
  const bedMin = props.config.bedWallThickness * 2;
  const { config, setConfig } = props;
  const [paramAdd, setParamAdd] = React.useState(false);
  const common = { ...props, paramAdd };
Severity: Major
Found in frontend/three_d_garden/config_overlays.tsx - About 4 hrs to fix

    File config_overlays.tsx has 336 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from "react";
    import { Config, modifyConfig } from "./config";
    import { setUrlParam } from "./zoom_beacons_constants";
    import { ExternalUrl } from "../external_urls";
    
    
    Severity: Minor
    Found in frontend/three_d_garden/config_overlays.tsx - About 4 hrs to fix

      Function PublicOverlay has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const PublicOverlay = (props: OverlayProps) => {
        const { config, setConfig, toolTip, setToolTip } = props;
      
        const Section = (sectionProps: SectionProps) => {
          const { title, configKey, options } = sectionProps;
      Severity: Major
      Found in frontend/three_d_garden/config_overlays.tsx - About 2 hrs to fix

        Function PromoInfo has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const PromoInfo = (props: PromoInfoProps) => {
          const { isGenesis } = props;
          return <div className="promo-info">
            <h2 className="title">Explore our models</h2>
            {isGenesis
        Severity: Minor
        Found in frontend/three_d_garden/config_overlays.tsx - About 1 hr to fix

          Function Section has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const Section = (sectionProps: SectionProps) => {
              const { title, configKey, options } = sectionProps;
              return <div className={"setting-section"}>
                <div className="setting-title">{title}</div>
                <div className={"row"}>
          Severity: Minor
          Found in frontend/three_d_garden/config_overlays.tsx - About 1 hr to fix

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

                  onChange={e => {
                    const newValue = e.target.checked;
                    const update = { [configKey]: newValue };
                    setConfig(modifyConfig(config, update));
                    maybeAddParam(props.paramAdd, configKey, "" + newValue);
            Severity: Major
            Found in frontend/three_d_garden/config_overlays.tsx and 1 other location - About 1 hr to fix
            frontend/three_d_garden/config_overlays.tsx on lines 228..233

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

            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

              const change = (e: React.ChangeEvent<HTMLInputElement>) => {
                const newValue = e.target.value;
                const update = { [configKey]: newValue };
                setConfig(modifyConfig(config, update));
                maybeAddParam(props.paramAdd, configKey, "" + newValue);
            Severity: Major
            Found in frontend/three_d_garden/config_overlays.tsx and 1 other location - About 1 hr to fix
            frontend/three_d_garden/config_overlays.tsx on lines 210..215

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

            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

                  ? <div className="description">
                    <p className="short">
                      FarmBot Genesis is our flagship kit for prosumers and enthusiasts.
                    </p>
                    <p className="full">
            Severity: Major
            Found in frontend/three_d_garden/config_overlays.tsx and 2 other locations - About 55 mins to fix
            frontend/front_page/laptop_splash.tsx on lines 14..19
            frontend/three_d_garden/config_overlays.tsx on lines 126..138

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

            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

                  : <div className="description">
                    <p className="short">
                      Covering 400% the area, Genesis XL can grow enough veggies for a
                      family of four.
                    </p>
            Severity: Major
            Found in frontend/three_d_garden/config_overlays.tsx and 2 other locations - About 55 mins to fix
            frontend/front_page/laptop_splash.tsx on lines 14..19
            frontend/three_d_garden/config_overlays.tsx on lines 114..125

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

            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