bokuweb/react-rnd

View on GitHub
src/index.tsx

Summary

Maintainability
F
1 wk
Test Coverage

File index.tsx has 628 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as React from "react";
import Draggable, { DraggableEventHandler } from "react-draggable";
import { Enable, Resizable, ResizeDirection } from "re-resizable";

export type Grid = [number, number];
Severity: Major
Found in src/index.tsx - About 1 day to fix

    Function onResizeStart has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
    Open

      onResizeStart(
        e: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>,
        dir: ResizeDirection,
        elementRef: HTMLElement,
      ) {
    Severity: Minor
    Found in src/index.tsx - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

      render() {
        const {
          disableDragging,
          style,
          dragHandleClassName,
    Severity: Major
    Found in src/index.tsx - About 3 hrs to fix

      Function onResizeStart has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        onResizeStart(
          e: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>,
          dir: ResizeDirection,
          elementRef: HTMLElement,
        ) {
      Severity: Major
      Found in src/index.tsx - About 3 hrs to fix

        Function onDragStart has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          onDragStart(e: RndDragEvent, data: DraggableData) {
            if (this.props.onDragStart) {
              this.props.onDragStart(e, data);
            }
            const pos = this.getDraggablePosition();
        Severity: Major
        Found in src/index.tsx - About 2 hrs to fix

          Rnd has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class Rnd extends React.PureComponent<Props, State> {
            public static defaultProps: DefaultProps = {
              maxWidth: Number.MAX_SAFE_INTEGER,
              maxHeight: Number.MAX_SAFE_INTEGER,
              scale: 1,
          Severity: Minor
          Found in src/index.tsx - About 2 hrs to fix

            Function onDragStart has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              onDragStart(e: RndDragEvent, data: DraggableData) {
                if (this.props.onDragStart) {
                  this.props.onDragStart(e, data);
                }
                const pos = this.getDraggablePosition();
            Severity: Minor
            Found in src/index.tsx - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function onResize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              onResize(
                e: MouseEvent | TouchEvent,
                direction: ResizeDirection,
                elementRef: HTMLElement,
                delta: { height: number; width: number },
            Severity: Minor
            Found in src/index.tsx - About 1 hr to fix

              Function render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                render() {
                  const {
                    disableDragging,
                    style,
                    dragHandleClassName,
              Severity: Minor
              Found in src/index.tsx - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function onResize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                onResize(
                  e: MouseEvent | TouchEvent,
                  direction: ResizeDirection,
                  elementRef: HTMLElement,
                  delta: { height: number; width: number },
              Severity: Minor
              Found in src/index.tsx - About 45 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Avoid too many return statements within this function.
              Open

                    return;
              Severity: Major
              Found in src/index.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    if (!this.resizable) return;
                Severity: Major
                Found in src/index.tsx - About 30 mins to fix

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

                    onDrag(e: RndDragEvent, data: DraggableData) {
                      if (!this.props.onDrag) return;
                      const { left, top } = this.offsetFromParent;
                      if (!this.props.dragAxis || this.props.dragAxis === "both") {
                        return this.props.onDrag(e, { ...data, x: data.x + left, y: data.y + top });
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 1 day to fix
                  src/index.tsx on lines 369..379

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

                  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

                    onDragStop(e: RndDragEvent, data: DraggableData) {
                      if (!this.props.onDragStop) return;
                      const { left, top } = this.offsetFromParent;
                      if (!this.props.dragAxis || this.props.dragAxis === "both") {
                        return this.props.onDragStop(e, { ...data, x: data.x + left, y: data.y + top });
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 1 day to fix
                  src/index.tsx on lines 357..367

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

                  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

                          if (maxWidth && typeof maxWidth === "string") {
                            if (maxWidth.endsWith("%")) {
                              const ratio = Number(maxWidth.replace("%", "")) / 100;
                              maxWidth = parentSize.width * ratio;
                            } else if (maxWidth.endsWith("px")) {
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 3 hrs to fix
                  src/index.tsx on lines 427..434

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

                  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

                          if (maxHeight && typeof maxHeight === "string") {
                            if (maxHeight.endsWith("%")) {
                              const ratio = Number(maxHeight.replace("%", "")) / 100;
                              maxHeight = parentSize.height * ratio;
                            } else if (maxHeight.endsWith("px")) {
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 3 hrs to fix
                  src/index.tsx on lines 419..426

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

                  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

                    getOffsetWidth(boundary: HTMLElement) {
                      const scale = this.props.scale as number;
                      switch (this.props.bounds) {
                        case "window":
                          return window.innerWidth / scale;
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 2 hrs to fix
                  src/index.tsx on lines 272..282

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

                  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

                    getOffsetHeight(boundary: HTMLElement) {
                      const scale = this.props.scale as number;
                      switch (this.props.bounds) {
                        case "window":
                          return window.innerHeight / scale;
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 2 hrs to fix
                  src/index.tsx on lines 284..294

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

                  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

                          if ((hasLeft || hasTop) && this.resizable) {
                            const max = (selfLeft - boundaryLeft) / scale + this.resizable.size.width;
                            this.setState({ maxWidth: max > Number(maxWidth) ? maxWidth : max });
                          }
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 2 hrs to fix
                  src/index.tsx on lines 457..462

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

                  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

                          if (hasBottom || (this.props.lockAspectRatio && !hasTop && !hasLeft)) {
                            const max = offsetHeight + (boundaryTop - selfTop) / scale;
                            this.setState({
                              maxHeight: max > Number(maxHeight) ? maxHeight : max,
                            });
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 2 hrs to fix
                  src/index.tsx on lines 453..456

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

                  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

                          if (hasRight || (this.props.lockAspectRatio && !hasLeft && !hasTop)) {
                            const max = offsetWidth + (boundaryLeft - selfLeft) / scale;
                            this.setState({ maxWidth: max > Number(maxWidth) ? maxWidth : max });
                          }
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 2 hrs to fix
                  src/index.tsx on lines 464..469

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

                  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

                          if ((hasTop || hasLeft) && this.resizable) {
                            const max = (selfTop - boundaryTop) / scale + this.resizable.size.height;
                            this.setState({
                              maxHeight: max > Number(maxHeight) ? maxHeight : max,
                            });
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 2 hrs to fix
                  src/index.tsx on lines 448..451

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

                  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

                        } else if (this.props.bounds === "window") {
                          boundary = window;
                        } else if (typeof this.props.bounds === "string") {
                          boundary = document.querySelector(this.props.bounds);
                        } else if (this.props.bounds instanceof HTMLElement) {
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 2 hrs to fix
                  src/index.tsx on lines 318..332

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

                  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

                      } else if (this.props.bounds === "window") {
                        if (!this.resizable) return;
                        const parentRect = parent.getBoundingClientRect();
                        const parentLeft = parentRect.left;
                        const parentTop = parentRect.top;
                  Severity: Major
                  Found in src/index.tsx and 1 other location - About 2 hrs to fix
                  src/index.tsx on lines 403..409

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

                  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

                    onResizeStop(
                      e: MouseEvent | TouchEvent,
                      direction: ResizeDirection,
                      elementRef: HTMLElement,
                      delta: { height: number; width: number },
                  Severity: Minor
                  Found in src/index.tsx and 1 other location - About 35 mins to fix
                  src/index.tsx on lines 482..521

                  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

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

                    onResize(
                      e: MouseEvent | TouchEvent,
                      direction: ResizeDirection,
                      elementRef: HTMLElement,
                      delta: { height: number; width: number },
                  Severity: Minor
                  Found in src/index.tsx and 1 other location - About 35 mins to fix
                  src/index.tsx on lines 523..537

                  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