FarmBot/Farmbot-Web-App

View on GitHub

Showing 610 of 1,573 total issues

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

export function FarmwareInputs(props: FarmwareInputsProps) {
  const {
    farmwareName, currentStep, farmwareInstalled, defaultConfigs, updateStep
  } = props;

Severity: Major
Found in frontend/sequences/step_tiles/tile_execute_script_support.tsx - About 3 hrs to fix

    Function render has 86 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 PlantPanel has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function PlantPanel(props: PlantPanelProps) {
        const {
          info, updatePlant, dispatch, inSavedGarden, timeSettings
        } = props;
        const { slug, plantedAt, daysOld, uuid, plantStatus } = info;
      Severity: Major
      Found in frontend/plants/plant_panel.tsx - About 3 hrs to fix

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

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

            const LayerToggles = (props: GardenMapLegendProps) => {
              const { toggle, getConfigValue, dispatch } = props;
              const subMenuProps = { dispatch, getConfigValue };
              return <div className="toggle-buttons">
                <LayerToggle
            Severity: Major
            Found in frontend/farm_designer/map/legend/garden_map_legend.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

                  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 VariableForm has a Cognitive Complexity of 23 (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 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 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 WizardStepContainer has 81 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

                      File util.ts has 301 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 render has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          render() {
                            return <Highlight className={"section"}
                              settingName={DeviceSetting.changeOwnership}>
                              <ExpandableHeader
                                expanded={this.state.open}
                        Severity: Major
                        Found in frontend/settings/transfer_ownership/change_ownership_form.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 GardenLocationRow has 79 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

                              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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language