FarmBot/Farmbot-Web-App

View on GitHub
frontend/farm_designer/map/legend/garden_map_legend.tsx

Summary

Maintainability
D
2 days
Test Coverage

Function LayerToggles has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const LayerToggles = (props: GardenMapLegendProps) => {
  const { toggle, getConfigValue, dispatch } = props;
  const subMenuProps = { dispatch, getConfigValue };
  const threeDGarden = !!props.getConfigValue(BooleanSetting.three_d_garden);
  return <div className="toggle-buttons">
Severity: Major
Found in frontend/farm_designer/map/legend/garden_map_legend.tsx - About 3 hrs to fix

    File garden_map_legend.tsx has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from "react";
    import { LayerToggle } from "../legend/layer_toggle";
    import { GardenMapLegendProps } from "../interfaces";
    import { atMaxZoom, atMinZoom } from "../zoom";
    import {
    Severity: Minor
    Found in frontend/farm_designer/map/legend/garden_map_legend.tsx - About 2 hrs to fix

      Function GardenMapLegend has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function GardenMapLegend(props: GardenMapLegendProps) {
        const { getConfigValue } = props;
        const menuClass = props.legendMenuOpen ? "active" : "";
        const [zDisplayOpen, setZDisplayOpen] = React.useState(false);
        return <div className={`garden-map-legend ${menuClass} ${props.className}`}>
      Severity: Minor
      Found in frontend/farm_designer/map/legend/garden_map_legend.tsx - About 1 hr to fix

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

            <LayerToggle
              settingName={BooleanSetting.show_farmbot}
              value={props.showFarmbot}
              label={DeviceSetting.showFarmbot}
              onClick={toggle(BooleanSetting.show_farmbot)}
        Severity: Major
        Found in frontend/farm_designer/map/legend/garden_map_legend.tsx and 2 other locations - About 2 hrs to fix
        frontend/farm_designer/map/legend/garden_map_legend.tsx on lines 121..127
        frontend/farm_designer/map/legend/garden_map_legend.tsx on lines 138..144

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

            <LayerToggle
              settingName={BooleanSetting.show_weeds}
              value={props.showWeeds}
              label={DeviceSetting.showWeeds}
              onClick={toggle(BooleanSetting.show_weeds)}
        Severity: Major
        Found in frontend/farm_designer/map/legend/garden_map_legend.tsx and 2 other locations - About 2 hrs to fix
        frontend/farm_designer/map/legend/garden_map_legend.tsx on lines 121..127
        frontend/farm_designer/map/legend/garden_map_legend.tsx on lines 150..156

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

            <LayerToggle
              settingName={BooleanSetting.show_plants}
              value={props.showPlants}
              label={DeviceSetting.showPlants}
              onClick={toggle(BooleanSetting.show_plants)}
        Severity: Major
        Found in frontend/farm_designer/map/legend/garden_map_legend.tsx and 2 other locations - About 2 hrs to fix
        frontend/farm_designer/map/legend/garden_map_legend.tsx on lines 138..144
        frontend/farm_designer/map/legend/garden_map_legend.tsx on lines 150..156

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

            {props.hasSensorReadings &&
              <LayerToggle
                settingName={BooleanSetting.show_moisture_interpolation_map}
                value={props.showMoistureInterpolationMap}
                label={DeviceSetting.showMoisture}
        Severity: Major
        Found in frontend/farm_designer/map/legend/garden_map_legend.tsx and 1 other location - About 1 hr to fix
        frontend/farm_designer/map/legend/garden_map_legend.tsx on lines 189..194

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

        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

            {props.hasSensorReadings &&
              <LayerToggle
                settingName={BooleanSetting.show_sensor_readings}
                value={props.showSensorReadings}
                label={DeviceSetting.showReadings}
        Severity: Major
        Found in frontend/farm_designer/map/legend/garden_map_legend.tsx and 1 other location - About 1 hr to fix
        frontend/farm_designer/map/legend/garden_map_legend.tsx on lines 195..200

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

        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

              {zDisplayOpen &&
                <ZDisplay
                  allPoints={props.allPoints}
                  firmwareConfig={props.firmwareConfig}
                  sourceFbosConfig={props.sourceFbosConfig}
        Severity: Major
        Found in frontend/farm_designer/map/legend/garden_map_legend.tsx and 1 other location - About 1 hr to fix
        frontend/wizard/step.tsx on lines 97..103

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

        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