FarmBot/Farmbot-Web-App

View on GitHub
frontend/farm_designer/map/garden_map.tsx

Summary

Maintainability
F
4 days
Test Coverage

File garden_map.tsx has 688 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from "react";
import { BooleanSetting } from "../../session_keys";
import { closePlantInfo, unselectPlant } from "./actions";
import {
  MapTransformProps, TaggedPlant, Mode, AxisNumberProperty,
Severity: Major
Found in frontend/farm_designer/map/garden_map.tsx - About 1 day to fix

    GardenMap has 59 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class GardenMap extends
      React.Component<GardenMapProps, Partial<GardenMapState>> {
      state: Partial<GardenMapState> = {};
      constructor(props: GardenMapProps) {
        super(props);
    Severity: Major
    Found in frontend/farm_designer/map/garden_map.tsx - About 1 day to fix

      Function render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          return <div className={"drop-area"} {...this.mapDropAreaProps()}>
            <ErrorBoundary>
              <svg id={"map-background-svg"}>
                <this.MapBackground />
      Severity: Minor
      Found in frontend/farm_designer/map/garden_map.tsx - About 1 hr to fix

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

              case Mode.createWeed:
                resizePoint({
                  gardenCoords: this.getGardenCoordinates(e),
                  drawnPoint: this.props.designer.drawnWeed,
                  dispatch: this.props.dispatch,
        Severity: Major
        Found in frontend/farm_designer/map/garden_map.tsx and 1 other location - About 2 hrs to fix
        frontend/farm_designer/map/garden_map.tsx on lines 351..359

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

        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

              case Mode.createPoint:
                resizePoint({
                  gardenCoords: this.getGardenCoordinates(e),
                  drawnPoint: this.props.designer.drawnPoint,
                  dispatch: this.props.dispatch,
        Severity: Major
        Found in frontend/farm_designer/map/garden_map.tsx and 1 other location - About 2 hrs to fix
        frontend/farm_designer/map/garden_map.tsx on lines 360..368

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

        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

              case Mode.editGroup:
                startNewSelectionBox({
                  gardenCoords: this.getGardenCoordinates(e),
                  setMapState: this.setMapState,
                  dispatch: this.props.dispatch,
        Severity: Major
        Found in frontend/farm_designer/map/garden_map.tsx and 1 other location - About 1 hr to fix
        frontend/farm_designer/map/garden_map.tsx on lines 216..223

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

        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

              case Mode.editGroup:
                startNewSelectionBox({
                  gardenCoords: this.getGardenCoordinates(e),
                  setMapState: this.setMapState,
                  dispatch: this.props.dispatch,
        Severity: Major
        Found in frontend/farm_designer/map/garden_map.tsx and 1 other location - About 1 hr to fix
        frontend/farm_designer/map/garden_map.tsx on lines 169..176

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

        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

              case Mode.createPoint:
                startNewPoint({
                  gardenCoords: this.getGardenCoordinates(e),
                  dispatch: this.props.dispatch,
                  setMapState: this.setMapState,
        Severity: Major
        Found in frontend/farm_designer/map/garden_map.tsx and 1 other location - About 1 hr to fix
        frontend/farm_designer/map/garden_map.tsx on lines 185..192

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

        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

              case Mode.createWeed:
                startNewPoint({
                  gardenCoords: this.getGardenCoordinates(e),
                  dispatch: this.props.dispatch,
                  setMapState: this.setMapState,
        Severity: Major
        Found in frontend/farm_designer/map/garden_map.tsx and 1 other location - About 1 hr to fix
        frontend/farm_designer/map/garden_map.tsx on lines 177..184

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

        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

            hoveredSensorReading={this.props.sensorReadings.filter(reading =>
              reading.uuid == this.props.designer.hoveredSensorReading)[0]}
        Severity: Major
        Found in frontend/farm_designer/map/garden_map.tsx and 2 other locations - About 50 mins to fix
        frontend/farm_designer/map/garden_map.tsx on lines 664..665
        frontend/farm_designer/map/garden_map.tsx on lines 666..667

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

        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

            hoveredPoint={this.props.allPoints.filter(point =>
              point.uuid == this.props.designer.hoveredPoint)[0]}
        Severity: Major
        Found in frontend/farm_designer/map/garden_map.tsx and 2 other locations - About 50 mins to fix
        frontend/farm_designer/map/garden_map.tsx on lines 662..663
        frontend/farm_designer/map/garden_map.tsx on lines 664..665

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

        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

            hoveredImage={this.props.latestImages.filter(image =>
              image.uuid == this.props.designer.hoveredImage)[0]}
        Severity: Major
        Found in frontend/farm_designer/map/garden_map.tsx and 2 other locations - About 50 mins to fix
        frontend/farm_designer/map/garden_map.tsx on lines 662..663
        frontend/farm_designer/map/garden_map.tsx on lines 666..667

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

        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

                startNewSelectionBox({
                  gardenCoords: this.getGardenCoordinates(e),
                  setMapState: this.setMapState,
                  dispatch: this.props.dispatch,
                  plantActions: true,
        Severity: Minor
        Found in frontend/farm_designer/map/garden_map.tsx and 1 other location - About 40 mins to fix
        frontend/farm_designer/map/garden_map.tsx on lines 242..247

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

        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

                startNewSelectionBox({
                  gardenCoords: this.getGardenCoordinates(e),
                  setMapState: this.setMapState,
                  dispatch: this.props.dispatch,
                  plantActions: true,
        Severity: Minor
        Found in frontend/farm_designer/map/garden_map.tsx and 1 other location - About 40 mins to fix
        frontend/farm_designer/map/garden_map.tsx on lines 209..214

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

        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