FarmBot/Farmbot-Web-App

View on GitHub
frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx

Summary

Maintainability
F
5 days
Test Coverage

Function BotPeripherals has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function BotPeripherals(props: BotPeripheralsProps) {
  const {
    peripheralValues, position, plantAreaOffset, mapTransformProps, getConfigValue,
  } = props;
  const { xySwap } = mapTransformProps;
Severity: Minor
Found in frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx - About 1 hr to fix

    Function waterFigure has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function waterFigure(
      props: { i: number, cx: number, cy: number, animate: boolean }) {
      const { i, cx, cy, animate } = props;
      const color = "rgb(11, 83, 148)";
      const copies = animate ? 3 : 1;
    Severity: Minor
    Found in frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx - About 1 hr to fix

      Function rotaryFigure has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function rotaryFigure(
        props: { i: number, cx: number, cy: number, animate: boolean }) {
        const { i, cx, cy, animate } = props;
        const color = "black";
        const copies = animate ? 3 : 1;
      Severity: Minor
      Found in frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx - About 1 hr to fix

        Function vacuumFigure has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function vacuumFigure(
          props: { i: number, cx: number, cy: number, animate: boolean }) {
          const { i, cx, cy, animate } = props;
          const color = "black";
          const copies = animate ? 3 : 1;
        Severity: Minor
        Found in frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx - About 1 hr to fix

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

          function lightsFigure(
            props: { i: number, x: number, y: number, height: number, xySwap: boolean }) {
            const { i, x, y, height, xySwap } = props;
            const mapHeightMid = height / 2 + y;
            return <g id="lights" key={`peripheral_${i}`}>
          Severity: Minor
          Found in frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx - About 1 hr to fix

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

            function vacuumFigure(
              props: { i: number, cx: number, cy: number, animate: boolean }) {
              const { i, cx, cy, animate } = props;
              const color = "black";
              const copies = animate ? 3 : 1;
            Severity: Major
            Found in frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx and 1 other location - About 2 days to fix
            frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx on lines 123..154

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

            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

            function rotaryFigure(
              props: { i: number, cx: number, cy: number, animate: boolean }) {
              const { i, cx, cy, animate } = props;
              const color = "black";
              const copies = animate ? 3 : 1;
            Severity: Major
            Found in frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx and 1 other location - About 2 days to fix
            frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx on lines 90..121

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

            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

                  <linearGradient id="LightingGradient">
                    <stop offset="0%" stopColor="white" stopOpacity={0.5} />
                    <stop offset="100%" stopColor="white" stopOpacity={0} />
                  </linearGradient>
            frontend/farm_designer/map/layers/plant_radius/plant_radius_layer.tsx on lines 18..21

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

            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

            export interface BotPeripheralsProps {
              position: BotPosition;
              peripheralValues: PeripheralValues;
              mapTransformProps: MapTransformProps;
              plantAreaOffset: AxisNumberProperty;
            Severity: Minor
            Found in frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx and 1 other location - About 55 mins to fix
            frontend/settings/fbos_settings/interfaces.ts on lines 84..90

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

            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