FarmBot/Farmbot-Web-App

View on GitHub

Showing 610 of 1,573 total issues

File location_info.tsx has 463 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from "react";
import { Everything, MovementState, TimeSettings } from "../interfaces";
import { BotPosition, UserEnv } from "../devices/interfaces";
import { connect } from "react-redux";
import { getUrlQuery } from "../util";
Severity: Minor
Found in frontend/farm_designer/location_info.tsx - About 7 hrs to fix

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

      render() {
        const { H_LO, H_HI, S_LO, S_HI, V_LO, V_HI } = this.props;
        const cameraCalibrationEnv = this.props.namespace("H_LO").includes("CAMERA");
        const defaultHLow = this.getDefault(cameraCalibrationEnv ? "H_HI" : "H_LO");
        const defaultHHigh = this.getDefault(cameraCalibrationEnv ? "H_LO" : "H_HI");
    Severity: Major
    Found in frontend/photos/image_workspace/index.tsx - About 6 hrs to fix

      File actions.ts has 441 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import axios from "axios";
      import { success, warning, info, error } from "../toast/toast";
      import { getDevice } from "../device";
      import { Everything } from "../interfaces";
      import {
      Severity: Minor
      Found in frontend/devices/actions.ts - About 6 hrs to fix

        File crop_info.tsx has 437 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from "react";
        import { svgToUrl } from "../open_farm/icons";
        import {
          CropInfoProps, CropLiveSearchResult, DesignerState, OpenfarmSearch,
        } from "../farm_designer/interfaces";
        Severity: Minor
        Found in frontend/plants/crop_info.tsx - About 6 hrs to fix

          File cards.tsx has 436 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from "react";
          import { t } from "../i18next_wrapper";
          import {
            AlertCardProps, AlertCardTemplateProps, FirmwareMissingProps,
            SeedDataMissingProps, SeedDataMissingState, TourNotTakenProps,
          Severity: Minor
          Found in frontend/messages/cards.tsx - About 6 hrs to fix

            File chart.tsx has 422 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from "react";
            import { t } from "../i18next_wrapper";
            import { floor, isUndefined, range, round } from "lodash";
            import { Curve } from "farmbot/dist/resources/api_resources";
            import { Color, Popover } from "../ui";
            Severity: Minor
            Found in frontend/curves/chart.tsx - About 6 hrs to fix

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

                render() {
                  const { dispatch, sequence } = this.props;
                  const { viewSequenceCeleryScript, view } = this.state;
                  const variableData = this.props.resources.sequenceMetas[sequence.uuid] || {};
                  const declarations = betterCompact(Object.values(variableData)
              Severity: Major
              Found in frontend/sequences/sequence_editor_middle_active.tsx - About 6 hrs to fix

                Function VariableForm has 147 lines of code (exceeds 25 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: Major
                Found in frontend/sequences/locals_list/variable_form.tsx - About 5 hrs to fix

                  File map_image.tsx has 407 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React from "react";
                  import { TaggedImage } from "farmbot";
                  import { CameraCalibrationData, BotOriginQuadrant } from "../../../interfaces";
                  import { MapTransformProps } from "../../interfaces";
                  import { transformXY } from "../../util";
                  Severity: Minor
                  Found in frontend/farm_designer/map/layers/images/map_image.tsx - About 5 hrs to fix

                    Function AxisSettings has 144 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function AxisSettings(props: AxisSettingsProps) {
                    
                      const {
                        dispatch, bot, sourceFwConfig, firmwareConfig, botOnline,
                        firmwareHardware, showAdvanced,
                    Severity: Major
                    Found in frontend/settings/hardware_settings/axis_settings.tsx - About 5 hrs to fix

                      File content.tsx has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React from "react";
                      import { t } from "../i18next_wrapper";
                      import { Content, SetupWizardContent } from "../constants";
                      import { FilePath } from "../internal_urls";
                      
                      
                      Severity: Minor
                      Found in frontend/os_download/content.tsx - About 5 hrs to fix

                        Function WIZARD_STEPS has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const WIZARD_STEPS = (props: WizardStepDataProps): WizardSteps => {
                          const { firmwareHardware } = props;
                          const xySwap = !!props.getConfigValue?.(BooleanSetting.xy_swap);
                          const positiveMovementInstruction = (swap: boolean) =>
                            swap
                        Severity: Minor
                        Found in frontend/wizard/data.ts - About 5 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 variable_form.tsx has 395 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React from "react";
                        import { Row, Col, FBSelect, Color, BlurableInput, Help } from "../../ui";
                        import {
                          variableFormList, NO_VALUE_SELECTED_DDI, sortVariables, heading, sequences2Ddi,
                          LOCATION_PLACEHOLDER_DDI,
                        Severity: Minor
                        Found in frontend/sequences/locals_list/variable_form.tsx - About 5 hrs to fix

                          File edit_curve.tsx has 392 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React from "react";
                          import { t } from "../i18next_wrapper";
                          import { connect } from "react-redux";
                          import { push } from "../history";
                          import { SpecialStatus, TaggedCurve } from "farmbot";
                          Severity: Minor
                          Found in frontend/curves/edit_curve.tsx - About 5 hrs to fix

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

                              render() {
                                const { dispatch } = this.props;
                                const gridIds = compact(uniq(this.props.genericPoints
                                  .map(p => p.body.meta.gridId)));
                                const points = orderedPoints(this.props.genericPoints, this.state)
                            Severity: Major
                            Found in frontend/points/point_inventory.tsx - About 5 hrs to fix

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

                                render() {
                                  const { getConfigValue, dispatch, firmwareConfig,
                                    sourceFwConfig, sourceFbosConfig, resources, settingsPanelState,
                                  } = this.props;
                                  const showAdvanced = !!getConfigValue(BooleanSetting.show_advanced_settings);
                              Severity: Major
                              Found in frontend/settings/index.tsx - About 5 hrs to fix

                                File fbos_details.tsx has 387 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import React from "react";
                                import { Saucer, FBSelect, Help, Popover } from "../../ui";
                                import { updateConfig } from "../../devices/actions";
                                import { last, isNumber, isString } from "lodash";
                                import { Content, ToolTips } from "../../constants";
                                Severity: Minor
                                Found in frontend/settings/fbos_settings/fbos_details.tsx - About 5 hrs to fix

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

                                    render() {
                                      const { dispatch, plantsPanelState, plants } = this.props;
                                      const filteredPlants = plants
                                        .filter(p => p.body.name.toLowerCase()
                                          .includes(this.state.searchTerm.toLowerCase()));
                                  Severity: Major
                                  Found in frontend/plants/plant_inventory.tsx - About 5 hrs to fix

                                    File reducer_support.ts has 377 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    import {
                                      ResourceName, SpecialStatus, TaggedResource, TaggedSequence,
                                    } from "farmbot";
                                    import { combineReducers, ReducersMapObject, UnknownAction } from "redux";
                                    import { helpReducer as help } from "../help/reducer";
                                    Severity: Minor
                                    Found in frontend/resources/reducer_support.ts - About 5 hrs to fix

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

                                        render() {
                                          const wDEnvGet = (key: WDENVKey) => envGet(key, this.props.wDEnv);
                                          const { syncStatus, botToMqttStatus, photosPanelState } = this.props;
                                          const botOnline = isBotOnline(syncStatus, botToMqttStatus);
                                          const common = {
                                      Severity: Major
                                      Found in frontend/photos/photos.tsx - About 5 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language