FarmBot/Farmbot-Web-App

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

Summary

Maintainability
C
1 day
Test Coverage

Function ErrorHandling has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function ErrorHandling(props: ErrorHandlingProps) {

  const { error_handling } = props.settingsPanelState;
  const {
    dispatch, sourceFwConfig, arduinoBusy, firmwareHardware, showAdvanced,
Severity: Major
Found in frontend/settings/hardware_settings/error_handling.tsx - About 3 hrs to fix

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

          <NumericMCUInputGroup {...commonProps}
            label={DeviceSetting.calibrationRetryResetDistance}
            tooltip={ToolTips.CALIBRATION_RETRY_RESET_DISTANCE}
            advanced={true}
            x={"movement_calibration_deadzone_x"}
    Severity: Major
    Found in frontend/settings/hardware_settings/error_handling.tsx and 1 other location - About 2 hrs to fix
    frontend/settings/hardware_settings/motors.tsx on lines 91..100

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

    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

          <NumericMCUInputGroup {...commonProps}
            label={DeviceSetting.timeoutAfter}
            tooltip={ToolTips.TIMEOUT_AFTER}
            advanced={true}
            x={"movement_timeout_x"}
    Severity: Major
    Found in frontend/settings/hardware_settings/error_handling.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/axis_settings.tsx on lines 118..124
    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

          <NumericMCUInputGroup {...commonProps}
            label={DeviceSetting.calibrationTotalRetries}
            tooltip={ToolTips.CALIBRATION_TOTAL_RETRIES}
            advanced={true}
            x={"movement_calibration_retry_total_x"}
    Severity: Major
    Found in frontend/settings/hardware_settings/error_handling.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/axis_settings.tsx on lines 118..124
    frontend/settings/hardware_settings/error_handling.tsx on lines 75..81
    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 4 locations. Consider refactoring.
    Open

          <NumericMCUInputGroup {...commonProps}
            label={DeviceSetting.calibrationRetries}
            tooltip={ToolTips.CALIBRATION_RETRIES}
            x={"movement_calibration_retry_x"}
            y={"movement_calibration_retry_y"}
    Severity: Major
    Found in frontend/settings/hardware_settings/error_handling.tsx and 3 other locations - About 55 mins to fix
    frontend/settings/hardware_settings/limit_switches.tsx on lines 50..55
    frontend/settings/hardware_settings/motors.tsx on lines 170..175
    frontend/settings/hardware_settings/motors.tsx on lines 176..181

    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

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

          <SingleSettingRow settingType="input"
            label={DeviceSetting.maxRetries}
            tooltip={t(ToolTips.MAX_MOVEMENT_RETRIES, {
              retries: getDefault("param_mov_nr_retry")
            })}>
    Severity: Minor
    Found in frontend/settings/hardware_settings/error_handling.tsx and 1 other location - About 35 mins to fix
    frontend/settings/hardware_settings/error_handling.tsx on lines 58..73

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

    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

          <SingleSettingRow settingType="button"
            label={DeviceSetting.estopOnMovementError}
            tooltip={t(ToolTips.E_STOP_ON_MOV_ERR, {
              eStopOnError: getDefault("param_e_stop_on_mov_err")
            })}>
    Severity: Minor
    Found in frontend/settings/hardware_settings/error_handling.tsx and 1 other location - About 35 mins to fix
    frontend/settings/hardware_settings/error_handling.tsx on lines 46..57

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

    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