FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

Function Packaging has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Packaging = (props: PackagingProps) => {
  const { config } = props;
  const isXL = config.sizePreset == "Genesis XL";
  const mainCartonLength = 1060;
  const mainCartonWidth = 420;
Severity: Major
Found in frontend/three_d_garden/packaging.tsx - About 3 hrs to fix

    Method plants has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

          def plants(product_line)
            spinach_row_count = product_line.include?("xl") ? 28 : 13
            spinach_col_count = product_line.include?("xl") ? 4 : 2
            (0..(spinach_row_count - 1)).map do |i|
              (0..(spinach_col_count - 1)).map do |j|
    Severity: Minor
    Found in app/mutations/devices/seeders/demo_account_seeder.rb - About 3 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 setPinBinding has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    export const setPinBinding = (props: SetPinBindingProps) =>
      // eslint-disable-next-line complexity
      (ddi: DropDownItem): boolean => {
        const { binding, dispatch, resources, pinNumber } = props;
        const bindingUuid = binding?.uuid;
    Severity: Minor
    Found in frontend/settings/pin_bindings/actions.ts - About 3 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 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const { beginDate, beginTime, endDate, endTime } = this.state;
        return <div className={"image-filter-menu"}>
          <table>
            <thead>
    Severity: Major
    Found in frontend/photos/photo_filter_settings/image_filter_menu.tsx - About 3 hrs to fix

      Function WizardStepContainer has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const WizardStepContainer = (props: WizardStepContainerProps) => {
        const { step } = props;
        const setSuccess = props.setStepSuccess(step.slug);
        const requirementsMet =
          every(step.prerequisites?.map(prerequisite =>
      Severity: Major
      Found in frontend/wizard/step.tsx - About 3 hrs to fix

        Function UTMProfile has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const UTMProfile = (props: ProfileUtmProps) => {
          const { x, y } = props.botPosition;
          const inProfile = !isUndefined(x) && !isUndefined(y) &&
            withinProfileRange({
              axis: props.profileAxis == "x" ? "y" : "x",
        Severity: Major
        Found in frontend/farm_designer/map/profile/tools.tsx - About 3 hrs to fix

          Class Device has 28 methods (exceeds 20 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 3 hrs to fix

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

              render() {
                const goText = (axes: string) => `${t("GO")} (${axes.split("").join(", ")})`;
                const current = this.props.currentBotLocation;
                const target = this.props.locationCoordinate;
                const { arduinoBusy, botOnline, dispatch, defaultAxes } = this.props;
            Severity: Major
            Found in frontend/farm_designer/move_to.tsx - About 3 hrs to fix

              File util.ts has 305 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { BotOriginQuadrant } from "../interfaces";
              import { McuParams, Xyz } from "farmbot";
              import { StepsPerMm } from "../../devices/interfaces";
              import {
                CheckedAxisLength, AxisNumberProperty, BotSize, MapTransformProps, Mode,
              Severity: Minor
              Found in frontend/farm_designer/map/util.ts - About 3 hrs to fix

                Function ErrorHandling has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function ErrorHandling(props: ErrorHandlingProps) {
                
                  const { error_handling } = props.settingsPanelState;
                  const {
                    dispatch, sourceFwConfig, arduinoBusy, firmwareHardware, showAdvanced,
                Severity: Major
                Found in frontend/settings/hardware_settings/error_handling.tsx - About 3 hrs to fix

                  Function RawEditPoint has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const RawEditPoint = (props: EditPointProps) => {
                    const getPoint = () => {
                      const stringyID = Path.getSlug(Path.points());
                      if (stringyID) {
                        return props.findPoint(parseInt(stringyID));
                  Severity: Major
                  Found in frontend/points/point_info.tsx - About 3 hrs to fix

                    Function textAnchorPosition has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const textAnchorPosition = (
                      pulloutDirection: ToolPulloutDirection,
                      quadrant: BotOriginQuadrant,
                      xySwap: boolean,
                      gantryMounted: boolean,
                    Severity: Minor
                    Found in frontend/farm_designer/map/layers/tool_slots/tool_label.tsx - About 3 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 generateTransformStyle has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const generateTransformStyle = (props: GenerateTransformStyleProps) => {
                      const { zoomLvl, mapTransformProps } = props;
                      const { quadrant, xySwap } = mapTransformProps;
                    
                      /** Determine if an axis is displayed vertically on the page. */
                    Severity: Minor
                    Found in frontend/farm_designer/map/background/grid_labels.tsx - About 3 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 81 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render() {
                        const wDEnvGet = (key: WDENVKey) => envGet(key, this.props.wDEnv);
                        const { syncStatus, botToMqttStatus } = this.props;
                        const botOnline = isBotOnline(syncStatus, botToMqttStatus);
                        const camDisabled = cameraBtnProps(this.props.env, botOnline);
                    Severity: Major
                    Found in frontend/photos/weed_detector/index.tsx - About 3 hrs to fix

                      Function ParameterManagement has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function ParameterManagement(props: ParameterManagementProps) {
                        const {
                          dispatch, onReset, botOnline, arduinoBusy, firmwareHardware,
                          getConfigValue, showAdvanced,
                        } = props;
                      Severity: Major
                      Found in frontend/settings/hardware_settings/parameter_management.tsx - About 3 hrs to fix

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

                          render() {
                            const { curve, setHovered } = this;
                            const { dispatch } = this.props;
                            const { hovered } = this.state;
                            const curvesPath = Path.curves();
                        Severity: Major
                        Found in frontend/curves/edit_curve.tsx - About 3 hrs to fix

                          Function ZoomBeacons has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const ZoomBeacons = (props: ZoomBeaconsProps) => {
                            const [hoveredFocus, setHoveredFocus] = React.useState("");
                            const { activeFocus, setActiveFocus } = props;
                            const gardenBedDiv =
                              // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
                          Severity: Major
                          Found in frontend/three_d_garden/zoom_beacons.tsx - About 3 hrs to fix

                            File _helper.ts has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /**
                             *
                             * Web App translation file helper
                             *   This script gathers translatable phrases from the web app and adds them
                             *   to translation files. It also organizes and sorts existing translation
                            Severity: Minor
                            Found in public/app-resources/languages/_helper.ts - About 3 hrs to fix

                              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 GardenLocationRow has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const GardenLocationRow = (props: GardenLocationRowProps) => {
                                  const { dispatch, device } = props;
                                  const latitudeKey: keyof DeviceAccountSettings = "lat";
                                  const latitude = device.body[latitudeKey];
                                  const longitudeKey: keyof DeviceAccountSettings = "lng";
                                Severity: Major
                                Found in frontend/settings/fbos_settings/garden_location_row.tsx - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language