FarmBot/Farmbot-Web-App

View on GitHub

Showing 612 of 1,578 total issues

File device.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Device < ApplicationRecord
  DEFAULT_MAX_CONFIGS = 300
  DEFAULT_MAX_IMAGES = 100
  DEFAULT_MAX_LOGS = 1000
  DEFAULT_MAX_TELEMETRY = 300
Severity: Minor
Found in app/models/device.rb - About 2 hrs to fix

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

      render() {
        const { chosenXY } = this;
        const allSoilHeightPoints = this.props.genericPoints.filter(soilHeightPoint);
        const getColorOverride = getSoilHeightColor(allSoilHeightPoints);
        const sensorReadings = this.props.sensorReadings
    Severity: Major
    Found in frontend/farm_designer/location_info.tsx - About 2 hrs to fix

      File index.tsx has 280 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from "react";
      import { connect } from "react-redux";
      import {
        DesignerPanel, DesignerPanelTop, DesignerPanelContent,
      } from "../farm_designer/designer_panel";
      Severity: Minor
      Found in frontend/tools/index.tsx - About 2 hrs to fix

        Function getWarningLinesContent has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          (props: GetWarningLinesContentProps): WarningLinesContent => {
            const { x, y } = props;
            const gantryHeight = props.sourceFbosConfig("gantry_height").value as number;
            const locationSoilHeight = getZAtLocation({
              x,
        Severity: Major
        Found in frontend/curves/chart.tsx - About 2 hrs to fix

          File component.tsx has 279 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from "react";
          import { StepWrapper } from "../../step_ui";
          import { Row, Col, ExpandableHeader } from "../../../ui";
          import { ToolTips } from "../../../constants";
          import { t } from "../../../i18next_wrapper";
          Severity: Minor
          Found in frontend/sequences/step_tiles/tile_computed_move/component.tsx - About 2 hrs to fix

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

              render() {
                const { dispatch, current, stepIndex, resources } = this.props;
                const commonStepProps = { dispatch, current, index: stepIndex };
                const click = () => {
                  scrollToBottom("sequenceDiv");
            Severity: Major
            Found in frontend/sequences/step_button_cluster.tsx - About 2 hrs to fix

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

                render() {
                  const {
                    cropSearchResults, cropSearchInProgress, dispatch, plant,
                  } = this.props;
                  const { plantUUID } = this.props.hoveredPlant;
              Severity: Major
              Found in frontend/plants/openfarm_search_results.tsx - About 2 hrs to fix

                File step_button_cluster.tsx has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React from "react";
                import { t } from "../i18next_wrapper";
                import { StepButton, stepClick } from "./step_buttons";
                import { equals, scrollToBottom } from "../util";
                import { Col } from "../ui";
                Severity: Minor
                Found in frontend/sequences/step_button_cluster.tsx - About 2 hrs to fix

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

                    render() {
                      const panelName = "designer-sequence-editor";
                      const { sequence } = this.props;
                      return <DesignerPanel panelName={panelName} panel={Panel.Sequences}>
                        <DesignerPanelHeader
                  Severity: Major
                  Found in frontend/sequences/panel/editor.tsx - About 2 hrs to fix

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

                      render() {
                        const {
                          weed, mapTransformProps, hovered, current, selected, animate,
                          radiusVisible, dispatch,
                        } = this.props;
                    Severity: Major
                    Found in frontend/farm_designer/map/layers/weeds/garden_weed.tsx - About 2 hrs to fix

                      File bot_figure.tsx has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React from "react";
                      import { AxisNumberProperty, MapTransformProps } from "../../interfaces";
                      import { getMapSize, transformXY } from "../../util";
                      import { BotPosition } from "../../../../devices/interfaces";
                      import { Color } from "../../../../ui";
                      Severity: Minor
                      Found in frontend/farm_designer/map/layers/farmbot/bot_figure.tsx - About 2 hrs to fix

                        Function emptyState has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const emptyState = (): RestResources => {
                          return {
                            consumers: {
                              sequences: sequenceState,
                              regimens: regimenState,
                        Severity: Major
                        Found in frontend/resources/reducer.ts - About 2 hrs to fix

                          Function render has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                            render() {
                              const point = this.props.tpp.body;
                              const color = point.meta.color || "green";
                              const { tpp, dispatch, hovered, colorOverride } = this.props;
                              const pointId = (point.id || "ERR_NO_POINT_ID").toString();
                          Severity: Minor
                          Found in frontend/points/point_inventory_item.tsx - About 2 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 render has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            render() {
                              const {
                                current, selected, dragging, plant, mapTransformProps,
                                activeDragXY, zoomLvl, animate, editing, hovered, hoveredSpread,
                              } = this.props;
                          Severity: Major
                          Found in frontend/farm_designer/map/layers/plants/garden_plant.tsx - About 2 hrs to fix

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

                              render() {
                                const { savedGarden } = this.props;
                                const gardensPath = Path.savedGardens();
                                const plantsPath = Path.plants();
                                !savedGarden && Path.startsWith(gardensPath) && push(plantsPath);
                            Severity: Major
                            Found in frontend/saved_gardens/garden_edit.tsx - About 2 hrs to fix

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

                                render() {
                                  const { curves } = this.props;
                                  const filteredCurves = curves
                                    .filter(p => p.body.name.toLowerCase()
                                      .includes(this.state.searchTerm.toLowerCase()));
                              Severity: Major
                              Found in frontend/curves/curves_inventory.tsx - About 2 hrs to fix

                                Function BotPositionRows has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const BotPositionRows = (props: BotPositionRowsProps) => {
                                  const { locationData, getConfigValue, arduinoBusy, locked } = props;
                                  const hardwareDisabled = disabledAxisMap(props.firmwareSettings);
                                  const commonAxisActionProps = {
                                    botOnline: props.botOnline,
                                Severity: Major
                                Found in frontend/controls/move/bot_position_rows.tsx - About 2 hrs to fix

                                  File move_to.tsx has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import React from "react";
                                  import { Row, Col, Popover } from "../ui";
                                  import { BotPosition } from "../devices/interfaces";
                                  import { move } from "../devices/actions";
                                  import { push } from "../history";
                                  Severity: Minor
                                  Found in frontend/farm_designer/move_to.tsx - About 2 hrs to fix

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

                                      render() {
                                        const { wdEnvGet } = this;
                                        const { syncStatus, botToMqttStatus } = this.props;
                                        const botOnline = isBotOnline(syncStatus, botToMqttStatus);
                                        const camDisabled = cameraBtnProps(this.props.env, botOnline);
                                    Severity: Major
                                    Found in frontend/photos/camera_calibration/index.tsx - About 2 hrs to fix

                                      Function LimitSwitches has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export function LimitSwitches(props: LimitSwitchesProps) {
                                      
                                        const { limit_switches } = props.settingsPanelState;
                                        const { dispatch, sourceFwConfig, arduinoBusy, firmwareHardware } = props;
                                      
                                      
                                      Severity: Major
                                      Found in frontend/settings/hardware_settings/limit_switches.tsx - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language