FarmBot/Farmbot-Web-App

View on GitHub
frontend/settings/hardware_settings/axis_settings.tsx

Summary

Maintainability
D
1 day
Test Coverage

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

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

          <CalibrationRow
            type={"calibrate"}
            title={DeviceSetting.findAxisLength}
            axisTitle={t("FIND LENGTH")}
            toolTip={!showEncoders
    Severity: Major
    Found in frontend/settings/hardware_settings/axis_settings.tsx and 1 other location - About 2 hrs to fix
    frontend/settings/hardware_settings/axis_settings.tsx on lines 69..80

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

    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

          <CalibrationRow
            type={"find_home"}
            title={DeviceSetting.findHome}
            axisTitle={t("FIND HOME")}
            toolTip={!showEncoders
    Severity: Major
    Found in frontend/settings/hardware_settings/axis_settings.tsx and 1 other location - About 2 hrs to fix
    frontend/settings/hardware_settings/axis_settings.tsx on lines 125..136

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

    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 5 locations. Consider refactoring.
    Open

          <BooleanMCUInputGroup {...commonProps}
            label={DeviceSetting.negativeCoordinatesOnly}
            tooltip={ToolTips.NEGATIVE_COORDINATES_ONLY}
            advanced={true}
            x={"movement_home_up_x"}
    Severity: Major
    Found in frontend/settings/hardware_settings/axis_settings.tsx and 4 other locations - About 1 hr to fix
    frontend/settings/hardware_settings/axis_settings.tsx on lines 102..108
    frontend/settings/hardware_settings/error_handling.tsx on lines 75..81
    frontend/settings/hardware_settings/error_handling.tsx on lines 88..94
    frontend/settings/hardware_settings/motors.tsx on lines 194..200

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

    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 5 locations. Consider refactoring.
    Open

          <BooleanMCUInputGroup {...commonProps}
            label={DeviceSetting.stopAtHome}
            tooltip={ToolTips.STOP_AT_HOME}
            advanced={true}
            x={"movement_stop_at_home_x"}
    Severity: Major
    Found in frontend/settings/hardware_settings/axis_settings.tsx and 4 other locations - About 1 hr to fix
    frontend/settings/hardware_settings/axis_settings.tsx on lines 118..124
    frontend/settings/hardware_settings/error_handling.tsx on lines 75..81
    frontend/settings/hardware_settings/error_handling.tsx on lines 88..94
    frontend/settings/hardware_settings/motors.tsx on lines 194..200

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

    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

      const axisLengthDisabled = {
        x: !sourceFwConfig("movement_axis_nr_steps_x").value,
        y: !sourceFwConfig("movement_axis_nr_steps_y").value,
        z: !sourceFwConfig("movement_axis_nr_steps_z").value
      };
    Severity: Minor
    Found in frontend/settings/hardware_settings/axis_settings.tsx and 1 other location - About 55 mins to fix
    frontend/settings/hardware_settings/encoders_or_stall_detection.tsx on lines 22..26

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

    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

    There are no issues that match your filters.

    Category
    Status