FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

Function DefaultFarmwareStep has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const DefaultFarmwareStep = (props: StepParams<ExecuteScript>) => {
  const {
    dispatch, currentStep, index, currentSequence, farmwareData,
  } = props;

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

    Function ProfileViewer has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const ProfileViewer = (props: ProfileViewerProps) => {
      const { dispatch } = props;
      const { profileOpen, profileFollowBot } = props.designer;
      const axis = props.designer.profileAxis;
      const panelStatus = getPanelStatus();
    Severity: Major
    Found in frontend/farm_designer/map/profile/viewer.tsx - About 2 hrs to fix

      Function ToolSlotSVG has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const ToolSlotSVG = (props: ToolSlotSVGProps) => {
        const toolProps: ToolGraphicProps = {
          toolName: props.toolName,
          x: 0, y: 0,
          hovered: false,
      Severity: Major
      Found in frontend/farm_designer/map/layers/tool_slots/tool_graphics.tsx - About 2 hrs to fix

        Function WeedsSection has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const WeedsSection = (props: WeedsSectionProps) => {
          const { layerSetting } = props;
          const rawMaxSize = Math.max(...props.items.map(item => item.body.radius));
          const maxSize = isFinite(rawMaxSize) ? rawMaxSize : 0;
          const noWeeds = props.allWeeds?.length == 0;
        Severity: Major
        Found in frontend/weeds/weeds_inventory.tsx - About 2 hrs to fix

          Function PointInventoryItem has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const PointInventoryItem = (props: PointInventoryItemProps) => {
            const navigate = useNavigate();
            const point = props.tpp.body;
            const color = point.meta.color || "green";
            const { tpp, dispatch, hovered, colorOverride } = props;
          Severity: Major
          Found in frontend/points/point_inventory_item.tsx - About 2 hrs to fix

            File fbos_metric_history_plot.tsx has 261 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from "react";
            import { trim } from "../../util";
            import { Telemetry } from "farmbot/dist/resources/api_resources";
            import { TaggedTelemetry } from "farmbot";
            import { flatten, isNumber, last, max, range, sortBy } from "lodash";
            Severity: Minor
            Found in frontend/devices/connectivity/fbos_metric_history_plot.tsx - About 2 hrs to fix

              Function render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                render() {
                  const {
                    cropSearchResults, cropSearchInProgress, dispatch, plant,
                  } = this.props;
                  const { plantUUID } = this.props.hoveredPlant;
              Severity: Minor
              Found in frontend/plants/openfarm_search_results.tsx - About 2 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 StepIconGroup has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function StepIconGroup(props: StepIconBarProps) {
                const {
                  index, dispatch, step, sequence, helpText, confirmStepDeletion, readOnly,
                } = props;
              
              
              Severity: Major
              Found in frontend/sequences/step_ui/step_icon_group.tsx - About 2 hrs to fix

                Function DragHelpers has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function DragHelpers(props: DragHelpersProps) {
                  const {
                    dragging, plant, zoomLvl, activeDragXY, mapTransformProps, plantAreaOffset
                  } = props;
                  const { xySwap } = mapTransformProps;
                Severity: Major
                Found in frontend/farm_designer/map/active_plant/drag_helpers.tsx - About 2 hrs to fix

                  Function PlantLayer has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function PlantLayer(props: PlantLayerProps) {
                    const {
                      plants,
                      currentPlant,
                      dragging,
                  Severity: Major
                  Found in frontend/farm_designer/map/layers/plants/plant_layer.tsx - About 2 hrs to fix

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

                      render() {
                        const { isEditing } = this.state;
                        const status = getArrayStatus(this.props.peripherals);
                        const editButtonText = isEditing
                          ? t("Back")
                    Severity: Major
                    Found in frontend/controls/peripherals/index.tsx - About 2 hrs to fix

                      Function SequencePublishMenu has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const SequencePublishMenu = (props: SequenceShareMenuProps) => {
                        const { sequence } = props;
                        const disabled = sequence.specialStatus !== SpecialStatus.SAVED;
                        const [publishing, setPublishing] = React.useState(false);
                        const [copyright, setCopyright] = React.useState(sequence.body.copyright || "");
                      Severity: Major
                      Found in frontend/sequences/sequence_editor_middle_active.tsx - About 2 hrs to fix

                        Function TextInRoundedSvgBox has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const TextInRoundedSvgBox = (props: RoundedBoxProps) => {
                          const { x, y, width, height, fill, radius } = props;
                          const r = radius || 4;
                          const upperRightCorner = `a${r},${r} 0 0 1 ${r},${r}`;
                          const lowerRightCorner = `a${r},${r} 0 0 1 -${r},${r}`;
                        Severity: Major
                        Found in frontend/farm_designer/map/background/grid_labels.tsx - About 2 hrs to fix

                          Function PresetButton has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const PresetButton = (props: PresetButtonProps) => {
                            const { preset, choosePreset, hovered, setHovered, startPosition, index } = props;
                            const btnHeight = 50;
                            const btnZ = 0;
                            const textZ = btnHeight / 2 + 1;
                          Severity: Major
                          Found in frontend/three_d_garden/button.tsx - About 2 hrs to fix

                            Function LogsFilterMenu has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const LogsFilterMenu = (props: LogsFilterMenuProps) => {
                              /** Set the filter level to the same value for all log message types. */
                              const setAll = (level: number) => () => {
                                MESSAGE_TYPES.map((x: keyof Filters) => props.setFilterLevel(x)(level));
                              };
                            Severity: Major
                            Found in frontend/logs/components/filter_menu.tsx - About 2 hrs to fix

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

                              import React from "react";
                              import { uniq, sortBy, ceil, range, cloneDeep, reverse } from "lodash";
                              import {
                                TaggedPoint, TaggedToolSlotPointer, TaggedWeedPointer,
                              } from "farmbot";
                              Severity: Minor
                              Found in frontend/farm_designer/map/profile/content.tsx - About 2 hrs to fix

                                File reducer.ts has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import { generateReducer } from "../redux/generate_reducer";
                                import { RestResources } from "./interfaces";
                                import {
                                  indexUpsert,
                                  mutateSpecialStatus,
                                Severity: Minor
                                Found in frontend/resources/reducer.ts - About 2 hrs to fix

                                  Class Transport has 21 methods (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  class Transport
                                    OPTS = { read_timeout: 10, heartbeat: 10, log_level: "warn" }
                                    CLOUDAMQP_ENV_KEY = ENV.fetch("WHERE_IS_CLOUDAMQP_URL", "CLOUDAMQP_URL")
                                  
                                    def self.amqp_url
                                  Severity: Minor
                                  Found in app/models/transport.rb - About 2 hrs to fix

                                    Function ImportedBanner has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const ImportedBanner = (props: ImportedBannerProps) => {
                                      const versionId = props.sequence.body.sequence_version_id;
                                      const allIds = sortBy(props.sequence.body.sequence_versions);
                                      const latestId = last(allIds);
                                      const versionList = sequenceVersionList(allIds);
                                    Severity: Major
                                    Found in frontend/sequences/sequence_editor_middle_active.tsx - About 2 hrs to fix

                                      Function EnvEditor has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export const EnvEditor = (props: EnvEditorProps) => {
                                        const [newKey, setNewKey] = React.useState("");
                                        const [newValue, setNewValue] = React.useState("");
                                        const sortedFarmware = sortBy(props.farmwareEnvs, "body.id").reverse();
                                        return <div className={"farmware-env-editor"}>
                                      Severity: Major
                                      Found in frontend/photos/data_management/env_editor.tsx - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language