FarmBot/Farmbot-Web-App

View on GitHub
frontend/settings/pin_bindings/model.tsx

Summary

Maintainability
F
3 days
Test Coverage

Function Model has 252 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Model = (props: BoxTopBaseProps) => {
  const box = useGLTF(MODELS.box, LIB_DIR) as Box;
  const btn = useGLTF(MODELS.btn, LIB_DIR) as Btn;
  const led = useGLTF(MODELS.led, LIB_DIR) as Led;
  const SCALE = 1000;
Severity: Major
Found in frontend/settings/pin_bindings/model.tsx - About 1 day to fix

    File model.tsx has 370 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable react/no-unknown-property */
    /* eslint-disable no-null/no-null */
    import React, { useRef } from "react";
    import * as THREE from "three";
    import {
    Severity: Minor
    Found in frontend/settings/pin_bindings/model.tsx - About 4 hrs to fix

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

                <Cylinder ref={ref} name={"led-color"}
                  material-color={color}
                  args={[6.75, 6.75, 3]}
                  position={[-50, position, Z]}
                  rotation={[Math.PI / 2, 0, 0]} />
      Severity: Major
      Found in frontend/settings/pin_bindings/model.tsx and 1 other location - About 1 hr to fix
      frontend/settings/pin_bindings/model.tsx on lines 325..330

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

      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

                  <Cylinder ref={ref}
                    name={"button-color"}
                    material-color={color}
                    args={[9, 0, 3.5]}
                    position={[-30, btnPosition, Z]}
      Severity: Major
      Found in frontend/settings/pin_bindings/model.tsx and 1 other location - About 1 hr to fix
      frontend/settings/pin_bindings/model.tsx on lines 372..376

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

      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

          <mesh name={"electronicsBoxLid"}
            geometry={box.nodes.Electronics_Box_Lid.geometry}
            material={box.materials[Material.lid]}
            scale={SCALE} />
      Severity: Major
      Found in frontend/settings/pin_bindings/model.tsx and 1 other location - About 1 hr to fix
      frontend/settings/pin_bindings/model.tsx on lines 284..287

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

      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

          <mesh name={"electronicsBoxGasket"}
            geometry={box.nodes.Electronics_Box_Gasket.geometry}
            material={box.materials[Material.gasket]}
            scale={SCALE} />
      Severity: Major
      Found in frontend/settings/pin_bindings/model.tsx and 1 other location - About 1 hr to fix
      frontend/settings/pin_bindings/model.tsx on lines 288..291

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

      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

          {
            label: t("Button 4"),
            pinNumber: ButtonPin.btn4,
            position: 30,
            color: {
      Severity: Major
      Found in frontend/settings/pin_bindings/model.tsx and 2 other locations - About 1 hr to fix
      frontend/settings/pin_bindings/model.tsx on lines 166..174
      frontend/settings/pin_bindings/model.tsx on lines 184..192

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

      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

          {
            label: t("Button 5"),
            pinNumber: ButtonPin.btn5,
            position: 60,
            color: {
      Severity: Major
      Found in frontend/settings/pin_bindings/model.tsx and 2 other locations - About 1 hr to fix
      frontend/settings/pin_bindings/model.tsx on lines 166..174
      frontend/settings/pin_bindings/model.tsx on lines 175..183

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

      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

          {
            label: t("Button 3"),
            pinNumber: ButtonPin.btn3,
            position: 0,
            color: {
      Severity: Major
      Found in frontend/settings/pin_bindings/model.tsx and 2 other locations - About 1 hr to fix
      frontend/settings/pin_bindings/model.tsx on lines 175..183
      frontend/settings/pin_bindings/model.tsx on lines 184..192

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

      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

          {
            label: t("LED 3"),
            pinNumber: -1,
            position: 15,
            color: {
      Severity: Major
      Found in frontend/settings/pin_bindings/model.tsx and 1 other location - About 1 hr to fix
      frontend/settings/pin_bindings/model.tsx on lines 228..236

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

      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

          {
            label: t("LED 4"),
            pinNumber: -1,
            position: 45,
            color: {
      Severity: Major
      Found in frontend/settings/pin_bindings/model.tsx and 1 other location - About 1 hr to fix
      frontend/settings/pin_bindings/model.tsx on lines 219..227

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

      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