FarmBot/Farmbot-Web-App

View on GitHub

Showing 612 of 1,578 total issues

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

  render() {
    const {
      stepSize, arduinoBusy, locked, getConfigValue, env, highlightHome,
      highlightAxis, highlightDirection, botPosition, botOnline, dispatch,
    } = this.props;
Severity: Major
Found in frontend/controls/move/jog_buttons.tsx - About 4 hrs to fix

    File model.tsx has 370 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable react/no-unknown-property */
    /* eslint-disable no-null/no-null */
    import React, { useRef } from "react";
    import * as THREE from "three";
    import {
    Severity: Minor
    Found in frontend/settings/pin_bindings/model.tsx - About 4 hrs to fix

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

        render() {
          const {
            legend_menu_open,
            show_plants,
            show_points,
      Severity: Major
      Found in frontend/farm_designer/index.tsx - About 4 hrs to fix

        File interfaces.ts has 353 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { OpenFarm } from "../open_farm/openfarm";
        import { DropDownItem } from "../ui";
        import {
          TaggedFarmEvent,
          TaggedSequence,
        Severity: Minor
        Found in frontend/farm_designer/interfaces.ts - About 4 hrs to fix

          Function EncodersOrStallDetection has 111 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

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

                  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 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 create_points.tsx has 328 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, Col, BlurableInput, ColorPicker } from "../ui";
                      Severity: Minor
                      Found in frontend/points/create_points.tsx - About 3 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

                          File edit_plant_status.tsx has 325 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 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 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 ParameterManagement has 93 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 93 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    render() {
                                      return <div className={"add-sensor-reading-menu"}>
                                        <SensorSelection
                                          selectedSensor={this.state.sensor}
                                          sensors={this.props.sensors}
                                  Severity: Major
                                  Found in frontend/sensors/sensor_readings/add_reading.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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language