FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

Function HomeButton has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

export const HomeButton = (props: HomeButtonProps) => {
  const { doFindHome, homeDirection, locked, arduinoBusy, botOnline } = props;
  const icon = doFindHome ? "fa-search" : "fa-arrow-right";
  const style = doFindHome ? {} : { transform: `rotate(${homeDirection}deg)` };
  const disabledAxes = disabledAxisMap(props.firmwareSettings);
Severity: Minor
Found in frontend/controls/move/home_button.tsx - About 4 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

Class AbstractExpress has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

    class AbstractExpress < AbstractGenesis
      def settings_device_name
        device.update!(name: Names::EXPRESS)
      end

Severity: Minor
Found in app/mutations/devices/seeders/abstract_express.rb - About 4 hrs to fix

    Class AbstractGenesis has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class AbstractGenesis < AbstractSeeder
          def peripherals_vacuum
            add_peripheral(9, ToolNames::VACUUM)
          end
    
    
    Severity: Minor
    Found in app/mutations/devices/seeders/abstract_genesis.rb - About 4 hrs to fix

      Function PrivateOverlay has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const PrivateOverlay = (props: OverlayProps) => {
        const bedMin = props.config.bedWallThickness * 2;
        const { config, setConfig } = props;
        const [paramAdd, setParamAdd] = React.useState(false);
        const common = { ...props, paramAdd };
      Severity: Major
      Found in frontend/three_d_garden/config_overlays.tsx - About 4 hrs to fix

        Function Data has 102 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Data = (props: DataProps) => {
          const { curve, setHovered, showHoverEffect, dragging } = props;
          const { normX, normY, yZero, yMax } = props.plotTools;
          const { data, type } = curve.body;
          const fullWidth = X_MAX / maxDay(data);
        Severity: Major
        Found in frontend/curves/chart.tsx - About 4 hrs to fix

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

            render() {
              const { dispatch, designer } = this.props;
              const { cropSearchResults, cropSearchInProgress } = designer;
              const { crop, result, basePath, backgroundURL } =
                getCropHeaderProps({ cropSearchResults });
          Severity: Major
          Found in frontend/plants/crop_info.tsx - About 4 hrs to fix

            File config_overlays.tsx has 336 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from "react";
            import { Config, modifyConfig } from "./config";
            import { setUrlParam } from "./zoom_beacons_constants";
            import { ExternalUrl } from "../external_urls";
            
            
            Severity: Minor
            Found in frontend/three_d_garden/config_overlays.tsx - About 4 hrs to fix

              Function createOrUpdateTranslationFile has 101 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                export function createOrUpdateTranslationFile(
                  langInput: string | undefined = "en",
                  metricsOnly?: boolean,
                ): SummaryData | undefined {
                  const lang = langInput.slice(0, 2);
              Severity: Major
              Found in public/app-resources/languages/_helper.ts - About 4 hrs to fix

                File edit_plant_status.tsx has 332 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React from "react";
                import {
                  FBSelect, DropDownItem, ColorPicker, BlurableInput, NULL_CHOICE,
                } from "../ui";
                import { PlantOptions } from "../farm_designer/interfaces";
                Severity: Minor
                Found in frontend/plants/edit_plant_status.tsx - About 4 hrs to fix

                  Function ProfileSvg has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const ProfileSvg = (props: ProfileSvgProps) => {
                    const { expanded, mapTransformProps, tools, position, getConfigValue } = props;
                    const lineAxis = props.designer.profileAxis;
                    const selectionWidth = props.designer.profileWidth;
                    const profileAxis = lineAxis == "x" ? "y" : "x";
                  Severity: Major
                  Found in frontend/farm_designer/map/profile/content.tsx - About 3 hrs to fix

                    Function determineDropdown has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      (node: VariableNode, resources: ResourceIndex, uuid?: UUID): DropDownItem => {
                        if (node.kind === "parameter_declaration") {
                          return {
                            label: t("Externally defined"),
                            value: "?"
                    Severity: Major
                    Found in frontend/resources/sequence_meta.ts - About 3 hrs to fix

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

                        render() {
                          const finalBack = () => {
                            if (this.state.version != Version["v1.6"]) { return "version"; }
                            if (this.state.pi) { return "pi"; }
                            return "run";
                      Severity: Major
                      Found in frontend/os_download/content.tsx - About 3 hrs to fix

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

                        const LayerToggles = (props: GardenMapLegendProps) => {
                          const { toggle, getConfigValue, dispatch } = props;
                          const subMenuProps = { dispatch, getConfigValue };
                          const threeDGarden = !!props.getConfigValue(BooleanSetting.three_d_garden);
                          return <div className="toggle-buttons">
                        Severity: Major
                        Found in frontend/farm_designer/map/legend/garden_map_legend.tsx - About 3 hrs to fix

                          File create_points.tsx has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React from "react";
                          import { connect } from "react-redux";
                          import { Everything, ResourceColor } from "../interfaces";
                          import { initSave } from "../api/crud";
                          import { Row, BlurableInput, ColorPicker } from "../ui";
                          Severity: Minor
                          Found in frontend/points/create_points.tsx - About 3 hrs to fix

                            Function mapStateToProps has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function mapStateToProps(props: Everything): FarmDesignerProps {
                              const plants = getPlants(props.resources);
                              const findPlant = plantFinder(plants);
                            
                              const { selectedPoints } = props.resources.consumers.farm_designer;
                            Severity: Major
                            Found in frontend/farm_designer/state_to_props.ts - About 3 hrs to fix

                              File crud.ts has 314 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import {
                                TaggedResource,
                                SpecialStatus,
                                ResourceName,
                                TaggedSequence,
                              Severity: Minor
                              Found in frontend/api/crud.ts - About 3 hrs to fix

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

                                  render() {
                                    return <div className={"add-sensor-reading-menu grid"}>
                                      <div className="row grid-2-col">
                                        <SensorSelection
                                          selectedSensor={this.state.sensor}
                                Severity: Major
                                Found in frontend/sensors/sensor_readings/add_reading.tsx - About 3 hrs to fix

                                  Function Desk has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const Desk = (props: DeskProps) => {
                                    const { config } = props;
                                    const zGround = -config.bedZOffset - config.bedHeight;
                                    const deskWoodTexture = useTexture(ASSETS.textures.wood + "?=desk");
                                    deskWoodTexture.wrapS = RepeatWrapping;
                                  Severity: Major
                                  Found in frontend/three_d_garden/desk.tsx - About 3 hrs to fix

                                    Function PlantPanel has 87 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 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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language