FarmBot/Farmbot-Web-App

View on GitHub

Showing 1,573 of 1,573 total issues

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

      outcomes: [
        {
          slug: "nothing",
          description: t("Nothing happened"),
          tips: t("Return to the"),
Severity: Major
Found in frontend/wizard/data.ts and 1 other location - About 6 hrs to fix
frontend/wizard/data.ts on lines 658..683

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 160.

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

    {
      section: WizardSectionSlug.home,
      slug: WizardStepSlug.xAxisFindHome,
      title: t("Home X"),
      prerequisites: [botOnlineReq],
Severity: Major
Found in frontend/wizard/data.ts and 1 other location - About 6 hrs to fix
frontend/wizard/data.ts on lines 744..767

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 158.

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

    {
      section: WizardSectionSlug.home,
      slug: WizardStepSlug.yAxisFindHome,
      title: t("Home Y"),
      prerequisites: [botOnlineReq],
Severity: Major
Found in frontend/wizard/data.ts and 1 other location - About 6 hrs to fix
frontend/wizard/data.ts on lines 720..743

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 158.

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 chart.tsx has 422 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from "react";
import { t } from "../i18next_wrapper";
import { floor, isUndefined, range, round } from "lodash";
import { Curve } from "farmbot/dist/resources/api_resources";
import { Color, Popover } from "../ui";
Severity: Minor
Found in frontend/curves/chart.tsx - About 6 hrs to fix

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

            <PanelSection isOpen={this.props.curvesPanelState.spread}
              panel={Panel.Curves}
              toggleOpen={this.toggleOpen(CurveType.spread)}
              itemCount={spreadCurves.length}
              addNew={this.addNew(CurveType.spread)}
    Severity: Major
    Found in frontend/curves/curves_inventory.tsx and 2 other locations - About 6 hrs to fix
    frontend/curves/curves_inventory.tsx on lines 102..113
    frontend/curves/curves_inventory.tsx on lines 126..137

    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 156.

    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

          <Col xs={width} className={"centered-button-div low-pad"}>
            <ToggleButton dispatch={dispatch}
              grayscale={grayscale?.z}
              disabled={this.props.disabled || disable?.z}
              dim={!zParam.consistent}
    frontend/settings/hardware_settings/boolean_mcu_input_group.tsx on lines 30..40
    frontend/settings/hardware_settings/boolean_mcu_input_group.tsx on lines 41..51

    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 156.

    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

          <Col xs={width} className={"centered-button-div low-pad"}>
            <ToggleButton dispatch={dispatch}
              grayscale={grayscale?.x}
              disabled={this.props.disabled || disable?.x}
              dim={!xParam.consistent}
    frontend/settings/hardware_settings/boolean_mcu_input_group.tsx on lines 41..51
    frontend/settings/hardware_settings/boolean_mcu_input_group.tsx on lines 52..62

    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 156.

    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

          <Col xs={width} className={"centered-button-div low-pad"}>
            <ToggleButton dispatch={dispatch}
              grayscale={grayscale?.y}
              disabled={this.props.disabled || disable?.y}
              dim={!yParam.consistent}
    frontend/settings/hardware_settings/boolean_mcu_input_group.tsx on lines 30..40
    frontend/settings/hardware_settings/boolean_mcu_input_group.tsx on lines 52..62

    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 156.

    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

            <PanelSection isOpen={this.props.curvesPanelState.height}
              panel={Panel.Curves}
              toggleOpen={this.toggleOpen(CurveType.height)}
              itemCount={heightCurves.length}
              addNew={this.addNew(CurveType.height)}
    Severity: Major
    Found in frontend/curves/curves_inventory.tsx and 2 other locations - About 6 hrs to fix
    frontend/curves/curves_inventory.tsx on lines 102..113
    frontend/curves/curves_inventory.tsx on lines 114..125

    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 156.

    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

            <PanelSection isOpen={this.props.curvesPanelState.water}
              panel={Panel.Curves}
              toggleOpen={this.toggleOpen(CurveType.water)}
              itemCount={waterCurves.length}
              addNew={this.addNew(CurveType.water)}
    Severity: Major
    Found in frontend/curves/curves_inventory.tsx and 2 other locations - About 6 hrs to fix
    frontend/curves/curves_inventory.tsx on lines 114..125
    frontend/curves/curves_inventory.tsx on lines 126..137

    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 156.

    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 150 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const { dispatch, sequence } = this.props;
        const { viewSequenceCeleryScript, view } = this.state;
        const variableData = this.props.resources.sequenceMetas[sequence.uuid] || {};
        const declarations = betterCompact(Object.values(variableData)
    Severity: Major
    Found in frontend/sequences/sequence_editor_middle_active.tsx - About 6 hrs to fix

      Function VariableForm has 147 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        (props: VariableFormProps) => {
          const { sequenceUuid, resources, bodyVariables, variable, variableType,
            allowedVariableNodes, hideGroups, removeVariable, onChange } = props;
          const { celeryNode, dropdown, vector, isDefault } = maybeUseStepData({
            resources, bodyVariables, variable, uuid: sequenceUuid
      Severity: Major
      Found in frontend/sequences/locals_list/variable_form.tsx - About 5 hrs to fix

        File map_image.tsx has 407 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from "react";
        import { TaggedImage } from "farmbot";
        import { CameraCalibrationData, BotOriginQuadrant } from "../../../interfaces";
        import { MapTransformProps } from "../../interfaces";
        import { transformXY } from "../../util";
        Severity: Minor
        Found in frontend/farm_designer/map/layers/images/map_image.tsx - About 5 hrs to fix

          Function AxisSettings has 144 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function AxisSettings(props: AxisSettingsProps) {
          
            const {
              dispatch, bot, sourceFwConfig, firmwareConfig, botOnline,
              firmwareHardware, showAdvanced,
          Severity: Major
          Found in frontend/settings/hardware_settings/axis_settings.tsx - About 5 hrs to fix

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

            import React from "react";
            import { t } from "../i18next_wrapper";
            import { Content, SetupWizardContent } from "../constants";
            import { FilePath } from "../internal_urls";
            
            
            Severity: Minor
            Found in frontend/os_download/content.tsx - About 5 hrs to fix

              Function WIZARD_STEPS has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

              export const WIZARD_STEPS = (props: WizardStepDataProps): WizardSteps => {
                const { firmwareHardware } = props;
                const xySwap = !!props.getConfigValue?.(BooleanSetting.xy_swap);
                const positiveMovementInstruction = (swap: boolean) =>
                  swap
              Severity: Minor
              Found in frontend/wizard/data.ts - About 5 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

              export const mapStateToProps = (props: Everything): EditWeedProps => ({
                dispatch: props.dispatch,
                findPoint: id => maybeFindWeedPointerById(props.resources.index, id),
                botOnline: isBotOnlineFromState(props.bot),
                defaultAxes: validGoButtonAxes(getWebAppConfigValue(() => props)),
              Severity: Major
              Found in frontend/weeds/weeds_edit.tsx and 1 other location - About 5 hrs to fix
              frontend/points/point_info.tsx on lines 38..47

              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 146.

              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

              export const mapStateToProps = (props: Everything): EditPointProps => ({
                dispatch: props.dispatch,
                findPoint: id => maybeFindGenericPointerById(props.resources.index, id),
                botOnline: isBotOnlineFromState(props.bot),
                defaultAxes: validGoButtonAxes(getWebAppConfigValue(() => props)),
              Severity: Major
              Found in frontend/points/point_info.tsx and 1 other location - About 5 hrs to fix
              frontend/weeds/weeds_edit.tsx on lines 38..47

              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 146.

              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 variable_form.tsx has 395 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from "react";
              import { Row, Col, FBSelect, Color, BlurableInput, Help } from "../../ui";
              import {
                variableFormList, NO_VALUE_SELECTED_DDI, sortVariables, heading, sequences2Ddi,
                LOCATION_PLACEHOLDER_DDI,
              Severity: Minor
              Found in frontend/sequences/locals_list/variable_form.tsx - About 5 hrs to fix

                File edit_curve.tsx has 392 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React from "react";
                import { t } from "../i18next_wrapper";
                import { connect } from "react-redux";
                import { push } from "../history";
                import { SpecialStatus, TaggedCurve } from "farmbot";
                Severity: Minor
                Found in frontend/curves/edit_curve.tsx - About 5 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language