FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

Function GardenWeed has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const GardenWeed = (props: GardenWeedProps) => {
  const [iconHovered, setIconHovered] = React.useState(false);

  const iconHover = (action: "start" | "end") => () => {
    const startHover = action === "start";
Severity: Major
Found in frontend/farm_designer/map/layers/weeds/garden_weed.tsx - About 3 hrs to fix

    Function Grid has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const Grid = (props: GridProps) => {
      const { mapTransformProps, zoomLvl } = props;
      const gridSize = getMapSize(mapTransformProps);
      const origin = transformXY(0, 0, mapTransformProps);
      const arrowEnd = transformXY(20, 20, mapTransformProps);
    Severity: Major
    Found in frontend/farm_designer/map/background/grid.tsx - About 3 hrs to fix

      Function Lab has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const Lab = (props: LabProps) => {
        const { config } = props;
        const groundZ = -config.bedZOffset - config.bedHeight;
      
        const shelfWoodTexture = useTexture(ASSETS.textures.wood + "?=shelf");
      Severity: Major
      Found in frontend/three_d_garden/lab.tsx - About 3 hrs to fix

        Function PhotoFilterSettings has 75 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const PhotoFilterSettings = (props: PhotoFilterSettingsProps) => {
          const { dispatch, flags } = props;
          const {
            alwaysHighlightImage, hideUnShownImages,
            showCalibrationImages, showDetectionImages, showHeightImages,
        Severity: Major
        Found in frontend/photos/photo_filter_settings/index.tsx - About 3 hrs to fix

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

          function ItemListWrapper(props: ItemListWrapperProps) {
            const { chosenXY } = props;
            const items = sortBy(groupItemsByLocation(props.items, chosenXY), "distance");
            const [expanded, setExpanded] = React.useState(false);
            if (items.length < 1) {
          Severity: Major
          Found in frontend/farm_designer/location_info.tsx - About 2 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

              File point_inventory.tsx has 290 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from "react";
              import { connect } from "react-redux";
              import { PointInventoryItem } from "./point_inventory_item";
              import { Everything, PointsPanelState } from "../interfaces";
              import { Panel } from "../farm_designer/panel_header";
              Severity: Minor
              Found in frontend/points/point_inventory.tsx - About 2 hrs to fix

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

                  render() {
                    const commonProps = {
                      hoveredMetric: this.state.hoveredMetric,
                      hoveredTime: this.state.hoveredTime,
                      onHover: this.hoverMetric,
                Severity: Major
                Found in frontend/devices/connectivity/fbos_metric_history_table.tsx - About 2 hrs to fix

                  Method if_topic_is_safe has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def if_topic_is_safe
                        if farmbot_demo?
                          a, b, c = (routing_key_param || "").split(".")
                  
                          if !(permission_param == "read")
                  Severity: Minor
                  Found in app/controllers/api/rmq_utils_controller.rb - 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 CameraViewArea has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const CameraViewArea = (props: CameraViewAreaProps) => {
                    const { cameraCalibrationData, mapTransformProps, cropPhotos } = props;
                    const { xySwap } = mapTransformProps;
                    const { x, y } = props.position;
                    const { center, scale, rotation } = props.cameraCalibrationData;
                  Severity: Major
                  Found in frontend/farm_designer/map/layers/farmbot/bot_figure.tsx - About 2 hrs to fix

                    Function ToolSlotPoint has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const ToolSlotPoint = (props: TSPProps) => {
                      const { tool, toolSlot } = props.slot;
                      const {
                        id, x, y, pullout_direction, gantry_mounted
                      } = toolSlot.body;
                    Severity: Major
                    Found in frontend/farm_designer/map/layers/tool_slots/tool_slot_point.tsx - About 2 hrs to fix

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

                      export const emptyState = (): AppState => {
                        return {
                          settingsSearchTerm: "",
                          settingsPanelState: {
                            farmbot_settings: false,
                      Severity: Major
                      Found in frontend/reducer.ts - About 2 hrs to fix

                        Class RmqUtilsController has 25 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                          class RmqUtilsController < Api::AbstractController
                            class BrokerConnectionLimiter
                              attr_reader :cache
                        
                              CACHE_KEY_TPL = "mqtt_limiter:%s"
                        Severity: Minor
                        Found in app/controllers/api/rmq_utils_controller.rb - About 2 hrs to fix

                          File reducer.ts has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import {
                            DesignerState,
                            CropLiveSearchResult,
                            DrawnPointPayl,
                            DrawnWeedPayl,
                          Severity: Minor
                          Found in frontend/farm_designer/reducer.ts - About 2 hrs to fix

                            Function render has 70 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

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

                                render() {
                                  const { urlTourSlug, urlTourStepSlug } = this.tourState;
                              
                                  this.updateStateAndUrl();
                              
                              
                              Severity: Major
                              Found in frontend/help/tours/index.tsx - About 2 hrs to fix

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

                                import React from "react";
                                import { NavBarProps, NavBarState } from "./interfaces";
                                import { EStopButton } from "./e_stop_btn";
                                import { Popover } from "../ui";
                                import { useNavigate } from "react-router-dom";
                                Severity: Minor
                                Found in frontend/nav/index.tsx - About 2 hrs to fix

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

                                    render() {
                                      const simple = !!this.wdEnvGet(this.namespace("easy_calibration"));
                                      const commonProps = {
                                        wdEnvGet: this.wdEnvGet,
                                        onChange: this.props.onChange,
                                  Severity: Major
                                  Found in frontend/photos/camera_calibration/config.tsx - About 2 hrs to fix

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

                                      render() {
                                        /** Return filtered sensor readings for the specified period.
                                         * Must be in render() so that state updates. */
                                        const readingsForPeriod =
                                          filterSensorReadings(this.props.sensorReadings, this.state);
                                    Severity: Major
                                    Found in frontend/sensors/sensor_readings/sensor_readings.tsx - About 2 hrs to fix

                                      Function VariableForm has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        (props: VariableFormProps) => {
                                          const { sequenceUuid, resources, bodyVariables, variable, variableType,
                                            allowedVariableNodes, hideGroups, removeVariable, onChange } = props;
                                          const { celeryNode, dropdown, vector, isDefault } = maybeUseStepData({
                                            resources, bodyVariables, variable, uuid: sequenceUuid
                                      Severity: Minor
                                      Found in frontend/sequences/locals_list/variable_form.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language