FarmBot/Farmbot-Web-App

View on GitHub

Showing 612 of 1,578 total issues

Function render has a Cognitive Complexity of 7 (exceeds 5 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: Minor
Found in frontend/plants/plant_inventory.tsx - About 35 mins 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 mapStateToProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function mapStateToProps(props: Everything): EditPlantInfoProps {
  const openedSavedGarden =
    props.resources.consumers.farm_designer.openedSavedGarden;
  const gardenOpen = !!openedSavedGarden;
  const findPlant = (id: string | undefined) => {
Severity: Minor
Found in frontend/plants/map_state_to_props.ts - About 35 mins 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

Avoid too many return statements within this method.
Open

          return
Severity: Major
Found in app/controllers/api/rmq_utils_controller.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return
    Severity: Major
    Found in app/controllers/api/rmq_utils_controller.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return
      Severity: Major
      Found in app/controllers/api/rmq_utils_controller.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return
        Severity: Major
        Found in app/controllers/api/rmq_utils_controller.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return
          Severity: Major
          Found in app/controllers/api/rmq_utils_controller.rb - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return DDI.STATUS;
            Severity: Major
            Found in frontend/sequences/step_tiles/tile_mark_as/field_selection.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return getStageLookup(stepResourceType)["" + props.value]
                      || { label: "" + props.value, value: "" + props.value };
              Severity: Major
              Found in frontend/sequences/step_tiles/tile_mark_as/value_selection.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return Mode.createPoint;
                Severity: Major
                Found in frontend/farm_designer/map/util.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    if (includes(lower, "soil sensor")) { return ToolName.soilSensor; }
                  Severity: Major
                  Found in frontend/farm_designer/map/tool_graphics/all_tools.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      if (Path.lastChunkIsNum()) { return Mode.editPlant; }
                    Severity: Major
                    Found in frontend/farm_designer/map/util.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        if (includes(lower, "seed bin")) { return ToolName.seedBin; }
                      Severity: Major
                      Found in frontend/farm_designer/map/tool_graphics/all_tools.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return Mode.points;
                        Severity: Major
                        Found in frontend/farm_designer/map/util.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            return ToolName.tool;
                          Severity: Major
                          Found in frontend/farm_designer/map/tool_graphics/all_tools.tsx - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return Mode.createWeed;
                            Severity: Major
                            Found in frontend/farm_designer/map/util.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return {
                                      x: variable.vector.x + offset.x,
                                      y: variable.vector.y + offset.y,
                                    };
                              Severity: Major
                              Found in frontend/farm_designer/map/sequence_visualization.tsx - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                  if (includes(lower, "seed tray")) { return ToolName.seedTray; }
                                Severity: Major
                                Found in frontend/farm_designer/map/tool_graphics/all_tools.tsx - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                    return OverlapColor.NONE;
                                  Severity: Major
                                  Found in frontend/farm_designer/map/layers/spread/spread_overlap_helper.tsx - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                          if (!sequenceUuid) { return; }
                                    Severity: Major
                                    Found in frontend/farm_designer/map/sequence_visualization.tsx - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language