FarmBot/Farmbot-Web-App

View on GitHub

Showing 612 of 1,578 total issues

File abstract_seeder.rb has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Devices
  module Seeders
    class AbstractSeeder
      include Constants
      attr_reader :device
Severity: Minor
Found in app/mutations/devices/seeders/abstract_seeder.rb - 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

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

      import {
        DesignerState,
        CropLiveSearchResult,
        DrawnPointPayl,
        DrawnWeedPayl,
      Severity: Minor
      Found in frontend/farm_designer/reducer.ts - 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 render has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              const { point } = this;
              const { dispatch } = this.props;
              const pointsPath = Path.points();
              !point && Path.startsWith(pointsPath) && push(pointsPath);
          Severity: Major
          Found in frontend/points/point_info.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 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

                File other_settings.tsx has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React from "react";
                import { OtherSettingsProps, SettingDescriptionProps } from "./interfaces";
                import { Highlight } from "./maybe_highlight";
                import { DeviceSetting, Content, ToolTips } from "../constants";
                import { Header } from "./hardware_settings/header";
                Severity: Minor
                Found in frontend/settings/other_settings.tsx - About 2 hrs to fix

                  File point_inventory.tsx has 287 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 { DesignerNavTabs, Panel } from "../farm_designer/panel_header";
                  Severity: Minor
                  Found in frontend/points/point_inventory.tsx - About 2 hrs to fix

                    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 71 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 render has 71 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 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 index.tsx has 284 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 { Row, Col, Popover } from "../ui";
                              import { push } from "../history";
                              Severity: Minor
                              Found in frontend/nav/index.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 motors.tsx has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import React from "react";
                                  import { BooleanMCUInputGroup } from "./boolean_mcu_input_group";
                                  import { ToolTips, DeviceSetting } from "../../constants";
                                  import { settingToggle } from "../../devices/actions";
                                  import { NumericMCUInputGroup } from "./numeric_mcu_input_group";
                                  Severity: Minor
                                  Found in frontend/settings/hardware_settings/motors.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 a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        render() {
                                          const { imageWidth, imageHeight } = this.state;
                                          const { image, cameraCalibrationData, mapTransformProps, cropImage,
                                          } = this.props;
                                          const imageRotation = parse(cameraCalibrationData.rotation) ?? 0;
                                      Severity: Minor
                                      Found in frontend/farm_designer/map/layers/images/map_image.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