FarmBot/Farmbot-Web-App

View on GitHub
frontend/points/create_points.tsx

Summary

Maintainability
D
2 days
Test Coverage

File create_points.tsx has 328 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from "react";
import { connect } from "react-redux";
import { Everything, ResourceColor } from "../interfaces";
import { initSave } from "../api/crud";
import { Row, Col, BlurableInput, ColorPicker } from "../ui";
Severity: Minor
Found in frontend/points/create_points.tsx - About 3 hrs to fix

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

      render() {
        const panelType = this.panel == "weeds" ? Panel.Weeds : Panel.Points;
        const panelDescription = this.panel == "weeds"
          ? Content.CREATE_WEEDS_DESCRIPTION
          : Content.CREATE_POINTS_DESCRIPTION;
    Severity: Minor
    Found in frontend/points/create_points.tsx - About 1 hr to fix

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

                <Col xs={3}>
                  <label>{t("Z (mm)")}</label>
                  <BlurableInput
                    name="z"
                    type="number"
      Severity: Major
      Found in frontend/points/create_points.tsx and 2 other locations - About 3 hrs to fix
      frontend/points/create_points.tsx on lines 240..247
      frontend/points/create_points.tsx on lines 248..255

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

      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={3}>
                  <label>{t("X (mm)")}</label>
                  <BlurableInput
                    name="cx"
                    type="number"
      Severity: Major
      Found in frontend/points/create_points.tsx and 2 other locations - About 3 hrs to fix
      frontend/points/create_points.tsx on lines 248..255
      frontend/points/create_points.tsx on lines 256..263

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

      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={3}>
                  <label>{t("Y (mm)")}</label>
                  <BlurableInput
                    name="cy"
                    type="number"
      Severity: Major
      Found in frontend/points/create_points.tsx and 2 other locations - About 3 hrs to fix
      frontend/points/create_points.tsx on lines 240..247
      frontend/points/create_points.tsx on lines 256..263

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

      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

            this.props.dispatch({
              type: this.panel == "weeds"
                ? Actions.SET_DRAWN_WEED_DATA
                : Actions.SET_DRAWN_POINT_DATA,
              payload: point
      Severity: Minor
      Found in frontend/points/create_points.tsx and 2 other locations - About 40 mins to fix
      frontend/points/create_points.tsx on lines 101..106
      frontend/points/create_points.tsx on lines 179..184

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

      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

          this.props.dispatch({
            type: this.panel == "weeds"
              ? Actions.SET_DRAWN_WEED_DATA
              : Actions.SET_DRAWN_POINT_DATA,
            payload: point
      Severity: Minor
      Found in frontend/points/create_points.tsx and 2 other locations - About 40 mins to fix
      frontend/points/create_points.tsx on lines 101..106
      frontend/points/create_points.tsx on lines 158..163

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

      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

          this.props.dispatch({
            type: this.panel == "weeds"
              ? Actions.SET_DRAWN_WEED_DATA
              : Actions.SET_DRAWN_POINT_DATA,
            payload: undefined
      Severity: Minor
      Found in frontend/points/create_points.tsx and 2 other locations - About 40 mins to fix
      frontend/points/create_points.tsx on lines 158..163
      frontend/points/create_points.tsx on lines 179..184

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

      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

            <button className="fb-button green save"
              title={t("save")}
              onClick={this.createPoint}>
              {t("Save")}
            </button>
      Severity: Major
      Found in frontend/points/create_points.tsx and 3 other locations - About 35 mins to fix
      frontend/farmware/panel/add.tsx on lines 62..67
      frontend/saved_gardens/garden_snapshot.tsx on lines 58..63
      frontend/sensors/sensor_readings/sensor_readings.tsx on lines 65..69

      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