FarmBot/Farmbot-Web-App

View on GitHub
frontend/photos/camera_calibration/config.tsx

Summary

Maintainability
D
2 days
Test Coverage

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

  render() {
    const simple = !!this.wdEnvGet(this.namespace("easy_calibration"));
    const commonProps = {
      wdEnvGet: this.wdEnvGet,
      onChange: this.props.onChange,
Severity: Major
Found in frontend/photos/camera_calibration/config.tsx - About 2 hrs to fix

    Function BoolConfig has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const BoolConfig = (props: BoolConfigProps) => {
      const value = !!props.wdEnvGet(props.configKey);
      return <Highlight settingName={props.settingName}
        hidden={props.advanced && !(props.showAdvanced || props.modified)}
        className={props.advanced ? "advanced" : undefined}
    Severity: Minor
    Found in frontend/photos/camera_calibration/config.tsx - About 1 hr to fix

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

            <NumberBoxConfig {...commonProps}
              settingName={DeviceSetting.cameraOffsetX}
              configKey={this.namespace("camera_offset_x")}
              helpText={t(ToolTips.CAMERA_OFFSET, {
                defaultX: this.getDefault("camera_offset_x"),
      Severity: Major
      Found in frontend/photos/camera_calibration/config.tsx and 1 other location - About 2 hrs to fix
      frontend/photos/camera_calibration/config.tsx on lines 72..78

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

      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

            <NumberBoxConfig {...commonProps}
              settingName={DeviceSetting.cameraOffsetY}
              configKey={this.namespace("camera_offset_y")}
              helpText={t(ToolTips.CAMERA_OFFSET, {
                defaultX: this.getDefault("camera_offset_x"),
      Severity: Major
      Found in frontend/photos/camera_calibration/config.tsx and 1 other location - About 2 hrs to fix
      frontend/photos/camera_calibration/config.tsx on lines 65..71

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

      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

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

            <div className="row grid-exp-2 half-gap">
              <label htmlFor={props.configKey}>
                {t(props.settingName)}
              </label>
              <Help text={props.helpText} />
      Severity: Major
      Found in frontend/photos/camera_calibration/config.tsx and 1 other location - About 1 hr to fix
      frontend/photos/camera_calibration/config.tsx on lines 161..166

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

      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

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

            <div className="row grid-exp-2 half-gap">
              <label htmlFor={props.configKey}>
                {t(props.settingName)}
              </label>
              <Help text={props.helpText} />
      Severity: Major
      Found in frontend/photos/camera_calibration/config.tsx and 1 other location - About 1 hr to fix
      frontend/photos/camera_calibration/config.tsx on lines 193..198

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

      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

            <NumberBoxConfig {...commonProps}
              settingName={DeviceSetting.pixelCoordinateScale}
              configKey={this.namespace("coord_scale")}
              helpText={t(ToolTips.COORDINATE_SCALE, {
                defaultScale: this.getDefault("coord_scale")
      Severity: Major
      Found in frontend/photos/camera_calibration/config.tsx and 2 other locations - About 1 hr to fix
      frontend/photos/camera_calibration/config.tsx on lines 50..55
      frontend/photos/camera_calibration/config.tsx on lines 92..97

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

      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

            <NumberBoxConfig {...commonProps}
              settingName={DeviceSetting.cameraRotation}
              configKey={this.namespace("total_rotation_angle")}
              helpText={t(ToolTips.IMAGE_ROTATION_ANGLE, {
                defaultAngle: this.getDefault("total_rotation_angle")
      Severity: Major
      Found in frontend/photos/camera_calibration/config.tsx and 2 other locations - About 1 hr to fix
      frontend/photos/camera_calibration/config.tsx on lines 50..55
      frontend/photos/camera_calibration/config.tsx on lines 86..91

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

      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

                <NumberBoxConfig {...commonProps}
                  settingName={DeviceSetting.calibrationObjectSeparation}
                  configKey={this.namespace("calibration_object_separation")}
                  helpText={t(ToolTips.OBJECT_SEPARATION, {
                    defaultSeparation: this.getDefault("calibration_object_separation")
      Severity: Major
      Found in frontend/photos/camera_calibration/config.tsx and 2 other locations - About 1 hr to fix
      frontend/photos/camera_calibration/config.tsx on lines 86..91
      frontend/photos/camera_calibration/config.tsx on lines 92..97

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

      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