FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

Function FOCI has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const FOCI = (config: Config): Focus[] => [
  {
    label: "What you can grow",
    info: {
      description: <div className={"description-wrapper"}>
Severity: Minor
Found in frontend/three_d_garden/zoom_beacons_constants.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 SensorReadingDisplay has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  ({ label, value, mode }: SensorReadingDisplayProps) => {
    const moistureSensor = label.toLowerCase().includes("moisture")
      ? "moisture-sensor"
      : "";
    const toolSensor = label.toLowerCase().includes("verification")
Severity: Minor
Found in frontend/sensors/sensor_list.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 hotkeysWithActions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const hotkeysWithActions = (
  navigate: (path: string) => void,
  dispatch: Function,
  slug: string,
) => {
Severity: Minor
Found in frontend/hotkeys.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 validBotLocationData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function validBotLocationData(
  botLocationData: BotLocationData | undefined): ValidLocationData {
  return forceOnline()
    ? {
      position: {
Severity: Minor
Found in frontend/util/location.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

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

  render() {
    const { curve, setHovered } = this;
    const { dispatch } = this.props;
    const { hovered } = this.state;
    const curvesPath = Path.curves();
Severity: Minor
Found in frontend/curves/edit_curve.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 PlantStatusBulkUpdate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const PlantStatusBulkUpdate = (props: PlantStatusBulkUpdateProps) =>
  <div className="plant-status-bulk-update row grid-2-col">
    <p>{t("Update status to")}</p>
    <FBSelect
      key={JSON.stringify(props.selected)}
Severity: Minor
Found in frontend/plants/edit_plant_status.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 determineDropdown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  (node: VariableNode, resources: ResourceIndex, uuid?: UUID): DropDownItem => {
    if (node.kind === "parameter_declaration") {
      return {
        label: t("Externally defined"),
        value: "?"
Severity: Minor
Found in frontend/resources/sequence_meta.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

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

Function hidden has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  get hidden() {
    const isolateName = getUrlQuery("only");
    if (isolateName) {
      const inSection = this.isSectionHeader && this.inContent(isolateName, true);
      const settingMatch =
Severity: Minor
Found in frontend/settings/maybe_highlight.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 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 computeEditorUrlFromState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  (resource: "Sequence" | "Regimen"): () => string => {
    return () => {
      const { resources } = store.getState();
      const current = resource === "Sequence"
        ? resources.consumers.sequences.current
Severity: Minor
Found in frontend/nav/compute_editor_url_from_state.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 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 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 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 (panelSlug === "location") { return Mode.locationInfo; }
                  Severity: Major
                  Found in frontend/farm_designer/map/util.ts - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language