FarmBot/Farmbot-Web-App

View on GitHub

Showing 612 of 1,578 total issues

Method execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def execute
      # LEGACY SHIM:
      #  1. CelerySlicer inserts a `nothing` node at the start of the flat_ast
      #  2. The new Fragment table expects an ENTRY node at position 0 of the
      #     flat_ast
Severity: Minor
Found in app/mutations/fragments/create.rb - 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

Method recurse_into_body has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def recurse_into_body(heap, canonical_list, previous_address, index = 0)
      if canonical_list[index]
        is_head = index == 0
        # BE CAREFUL EDITING THIS LINE, YOU MIGHT BREAK `BODY` NODES:
        heap # See note above!
Severity: Minor
Found in app/lib/celery_script/slicer.rb - 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 cameraBtnProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const cameraBtnProps = (env: UserEnv, botOnline: boolean) => {
  const disabled = cameraDisabled(env) || !botOnline;
  const noCameraTitle = t(Content.NO_CAMERA_SELECTED);
  const offlineTitle = botOnline ? "" : t("FarmBot is offline");
  const title = cameraDisabled(env) ? noCameraTitle : offlineTitle;
Severity: Minor
Found in frontend/photos/capture_settings/camera_selection.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 setArgsDotPinNumber has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  (x: StepParams) => (d: DropDownItem) => {
    const { dispatch, currentSequence, index, resources, currentStep } = x;

    dispatch(editStep({
      step: currentStep,
Severity: Minor
Found in frontend/sequences/step_tiles/pin_support/pin_and_peripheral_support.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

Method emit_nodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def emit_nodes()
  nodes = NODES.map do |node|
    tags = node.fetch("tags").sort.uniq
    # Don't publish internal CeleryScript nodes:
    next if tags.include?(:private)
Severity: Minor
Found in latest_corpus.rb - 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

Method mark_as_seen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def mark_as_seen(bot = (current_user && current_user.device))
      when_farmbot_os do
        if bot
          v = fbos_version
          bot.last_saw_api = Time.now
Severity: Minor
Found in app/controllers/api/abstract_controller.rb - 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

Method create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def create
      # Around June of 2020, we started getting Rails double
      # render errors on this endpoint when users would try
      # to log in with an unverified account (500 error).
      # Still not sure what changed or why, but this is a
Severity: Minor
Found in app/controllers/api/tokens_controller.rb - 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 createPlant has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const createPlant = (props: CreatePlantProps): void => {
  const {
    cropName, slug, gardenCoords, gridSize, openedSavedGarden, depth, designer,
  } = props;
  const { x, y } = gardenCoords;
Severity: Minor
Found in frontend/farm_designer/map/layers/plants/plant_actions.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 { point, getX, soilHeight, getConfigValue, designer } = this.props;
    const { icon, spreadDiaCm } = this.state;
    const currentPlantUuid = designer.selectedPoints?.[0];
    const radius = point.uuid == currentPlantUuid && designer.hoveredSpread
Severity: Minor
Found in frontend/farm_designer/map/profile/plants_and_weeds.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 mapImagePositionData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const mapImagePositionData = (props: MapImagePositionDataProps):
  MapImagePositionData | undefined => {
  const { cameraCalibrationData, alreadyRotated, noRotation } = props;
  const imageRotated = alreadyRotated && !noRotation;
  const parsed = parseCalibrationData(cameraCalibrationData);
Severity: Minor
Found in frontend/farm_designer/map/layers/images/map_image.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 maybeUpdateGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  (props: MaybeUpdateGroupProps) => {
    const { group } = props;
    if (props.selectionBox && group) {
      if (props.editGroupAreaInMap) {
        props.dispatch(editGtLtCriteria(group, props.selectionBox));
Severity: Minor
Found in frontend/farm_designer/map/background/selection_box_actions.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 TextInRoundedSvgBox has a Cognitive Complexity of 7 (exceeds 5 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: Minor
Found in frontend/farm_designer/map/background/grid_labels.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 = (dispatch: Function, slug: string) => {
  const links = getLinks();
  const idx = links.indexOf(PANEL_BY_SLUG[slug]);
  const panelPlus = links[idx + 1] || links[0];
  const panelMinus = links[idx - 1] || links[links.length - 1];
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 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 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 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 { 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 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 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

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

Severity
Category
Status
Source
Language