FarmBot/Farmbot-Web-App

View on GitHub

Showing 1,578 of 1,578 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

export const DevWidgetShowInternalEnvsRow = () =>
  <Row>
    <Col xs={8}>
      <label>
        {"Show internal envs"}
Severity: Major
Found in frontend/settings/dev/dev_settings.tsx and 2 other locations - About 4 hrs to fix
frontend/settings/dev/dev_settings.tsx on lines 5..19
frontend/settings/dev/dev_settings.tsx on lines 45..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 131.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

export const DevWidgetFERow = () =>
  <Row>
    <Col xs={8}>
      <label>
        {"Enable unstable FE features"}
Severity: Major
Found in frontend/settings/dev/dev_settings.tsx and 2 other locations - About 4 hrs to fix
frontend/settings/dev/dev_settings.tsx on lines 45..59
frontend/settings/dev/dev_settings.tsx on lines 61..75

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 131.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          {sequence && <Popover className={"color-picker"}
            position={Position.BOTTOM}
            popoverClassName={"colorpicker-menu gray"}
            target={<i title={t("select color")}
              className={"fa fa-paint-brush fb-icon-button"} />}
Severity: Major
Found in frontend/sequences/panel/editor.tsx and 1 other location - About 4 hrs to fix
frontend/regimens/editor/editor.tsx on lines 51..58

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 131.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

export const DevWidgetDelModeRow = () =>
  <Row>
    <Col xs={8}>
      <label>
        {"Enable quick delete mode"}
Severity: Major
Found in frontend/settings/dev/dev_settings.tsx and 2 other locations - About 4 hrs to fix
frontend/settings/dev/dev_settings.tsx on lines 5..19
frontend/settings/dev/dev_settings.tsx on lines 61..75

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 131.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        {regimen && <Popover className={"color-picker"}
          position={Position.BOTTOM}
          popoverClassName={"colorpicker-menu gray"}
          target={<i title={t("select color")}
            className={"fa fa-paint-brush fb-icon-button"} />}
Severity: Major
Found in frontend/regimens/editor/editor.tsx and 1 other location - About 4 hrs to fix
frontend/sequences/panel/editor.tsx on lines 80..87

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 131.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  render() {
    const {
      legend_menu_open,
      show_plants,
      show_points,
Severity: Major
Found in frontend/farm_designer/index.tsx - About 4 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            {!isDefaultValueForm && variableType == VariableType.Text &&
              celeryNode.kind != "parameter_declaration" &&
              !usingDefaultValue && celeryNode.args.data_value.kind != "identifier" &&
              <Row>
                <Col xs={narrowLabel ? 5 : 6} />
    Severity: Major
    Found in frontend/sequences/locals_list/variable_form.tsx and 1 other location - About 4 hrs to fix
    frontend/sequences/locals_list/variable_form.tsx on lines 184..191

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 127.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            {!isDefaultValueForm && variableType == VariableType.Number &&
              celeryNode.kind != "parameter_declaration" &&
              !usingDefaultValue && celeryNode.args.data_value.kind != "identifier" &&
              <Row>
                <Col xs={narrowLabel ? 5 : 6} />
    Severity: Major
    Found in frontend/sequences/locals_list/variable_form.tsx and 1 other location - About 4 hrs to fix
    frontend/sequences/locals_list/variable_form.tsx on lines 192..199

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 127.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                <Row>
                  <Col xs={4} xsOffset={1}>
                    <label>{t("width")}</label>
                  </Col>
                  <Col xs={7}>
    Severity: Major
    Found in frontend/photos/capture_settings/capture_size_selection.tsx and 1 other location - About 4 hrs to fix
    frontend/photos/capture_settings/capture_size_selection.tsx on lines 109..119

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                <Row>
                  <Col xs={4} xsOffset={1}>
                    <label>{t("height")}</label>
                  </Col>
                  <Col xs={7}>
    Severity: Major
    Found in frontend/photos/capture_settings/capture_size_selection.tsx and 1 other location - About 4 hrs to fix
    frontend/photos/capture_settings/capture_size_selection.tsx on lines 98..108

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File interfaces.ts has 353 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { OpenFarm } from "../open_farm/openfarm";
    import { DropDownItem } from "../ui";
    import {
      TaggedFarmEvent,
      TaggedSequence,
    Severity: Minor
    Found in frontend/farm_designer/interfaces.ts - About 4 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            : <path id={"rotary-tool-front-view"}
              d={trim(`M${x + motorR} ${y}
                       v ${motorV} h -${motorR - spindleR}
                       v ${spindleV} h ${cutterR - spindleR} v ${cutterV}
                       h -${cutterR * 2}
      Severity: Major
      Found in frontend/farm_designer/map/tool_graphics/rotary_tool.tsx and 1 other location - About 4 hrs to fix
      frontend/farm_designer/map/tool_graphics/rotary_tool.tsx on lines 48..55

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 124.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            ? <path id={"rotary-tool-side-view"}
              d={trim(`M${x + motorR} ${y}
                       v ${motorV} h -${motorR - spindleR}
                       v ${spindleV} h ${cutterR - spindleR} v ${cutterV}
                       h -${cutterR * 2}
      Severity: Major
      Found in frontend/farm_designer/map/tool_graphics/rotary_tool.tsx and 1 other location - About 4 hrs to fix
      frontend/farm_designer/map/tool_graphics/rotary_tool.tsx on lines 56..63

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 124.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function EncodersOrStallDetection has 111 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function EncodersOrStallDetection(props: EncodersOrStallDetectionProps) {
      
        const { encoders_or_stall_detection } = props.settingsPanelState;
        const {
          dispatch, sourceFwConfig, firmwareHardware, arduinoBusy, showAdvanced,
      Severity: Major
      Found in frontend/settings/hardware_settings/encoders_or_stall_detection.tsx - About 4 hrs to fix

        Function HomeButton has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

        export const HomeButton = (props: HomeButtonProps) => {
          const { doFindHome, homeDirection, locked, arduinoBusy, botOnline } = props;
          const icon = doFindHome ? "fa-search" : "fa-arrow-right";
          const style = doFindHome ? {} : { transform: `rotate(${homeDirection}deg)` };
          const disabledAxes = disabledAxisMap(props.firmwareSettings);
        Severity: Minor
        Found in frontend/controls/move/home_button.tsx - About 4 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              <BooleanMCUInputGroup {...commonProps}
                label={DeviceSetting.invertLimitSwitches}
                tooltip={ToolTips.INVERT_LIMIT_SWITCHES}
                x={"movement_invert_2_endpoints_x"}
                y={"movement_invert_2_endpoints_y"}
        Severity: Major
        Found in frontend/settings/hardware_settings/limit_switches.tsx and 1 other location - About 4 hrs to fix
        frontend/settings/hardware_settings/limit_switches.tsx on lines 56..67

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 123.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              <BooleanMCUInputGroup {...commonProps}
                label={DeviceSetting.swapLimitSwitches}
                tooltip={ToolTips.SWAP_LIMIT_SWITCHES}
                x={"movement_invert_endpoints_x"}
                y={"movement_invert_endpoints_y"}
        Severity: Major
        Found in frontend/settings/hardware_settings/limit_switches.tsx and 1 other location - About 4 hrs to fix
        frontend/settings/hardware_settings/limit_switches.tsx on lines 68..79

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 123.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Class AbstractExpress has 34 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class AbstractExpress < AbstractGenesis
              def settings_device_name
                device.update!(name: Names::EXPRESS)
              end
        
        
        Severity: Minor
        Found in app/mutations/devices/seeders/abstract_express.rb - About 4 hrs to fix

          Class AbstractGenesis has 34 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class AbstractGenesis < AbstractSeeder
                def peripherals_vacuum
                  add_peripheral(9, ToolNames::VACUUM)
                end
          
          
          Severity: Minor
          Found in app/mutations/devices/seeders/abstract_genesis.rb - About 4 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export const getOffsetNode = (
              offsetValue: string | number | undefined,
              disabled: boolean,
            ): AxisAddition["args"]["axis_operand"] | undefined => {
              if (isUndefined(offsetValue) || disabled) { return; }
            frontend/sequences/step_tiles/tile_computed_move/speed.tsx on lines 30..41

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 120.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language