bokuweb/react-rnd

View on GitHub

Showing 86 of 86 total issues

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

/* tslint:disable */

import test from "ava";
import * as React from "react";
import { spy } from "sinon";
Severity: Major
Found in src/index.test.tsx - About 1 day to fix

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

    export default class dragAxisX extends React.Component<{}, State> {
      constructor(props) {
        super(props);
        this.state = {
          width: 100,
    Severity: Major
    Found in stories/dragAxis/dragAxisY.tsx and 2 other locations - About 1 day to fix
    stories/dragAxis/dragAxisNone.tsx on lines 12..50
    stories/dragAxis/dragAxisX.tsx on lines 12..50

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

    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

    export default class dragAxisY extends React.Component<{}, State> {
      constructor(props) {
        super(props);
        this.state = {
          width: 100,
    Severity: Major
    Found in stories/dragAxis/dragAxisX.tsx and 2 other locations - About 1 day to fix
    stories/dragAxis/dragAxisNone.tsx on lines 12..50
    stories/dragAxis/dragAxisY.tsx on lines 12..50

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

    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

    export default class dragAxisX extends React.Component<{}, State> {
      constructor(props) {
        super(props);
        this.state = {
          width: 100,
    Severity: Major
    Found in stories/dragAxis/dragAxisNone.tsx and 2 other locations - About 1 day to fix
    stories/dragAxis/dragAxisX.tsx on lines 12..50
    stories/dragAxis/dragAxisY.tsx on lines 12..50

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

    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 362..372

    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

      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 374..384

    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 4 locations. Consider refactoring.
    Open

    test("should snapped by original grid when x axis resizing larger then threshold", async (t) => {
      const onResize = spy();
      const rnd = mount(
        <Rnd
          default={{ x: 100, y: 100, width: 100, height: 100 }}
    Severity: Major
    Found in src/index.test.tsx and 3 other locations - About 1 day to fix
    src/index.test.tsx on lines 475..508
    src/index.test.tsx on lines 545..578
    src/index.test.tsx on lines 580..613

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

    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

    test("should snapped by original grid when y axis resizing smaller then threshold", async (t) => {
      const onResize = spy();
      const rnd = mount(
        <Rnd
          default={{ x: 100, y: 100, width: 100, height: 100 }}
    Severity: Major
    Found in src/index.test.tsx and 3 other locations - About 1 day to fix
    src/index.test.tsx on lines 475..508
    src/index.test.tsx on lines 510..543
    src/index.test.tsx on lines 580..613

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

    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

    test("should snapped by original grid when y axis resizing larger then threshold", async (t) => {
      const onResize = spy();
      const rnd = mount(
        <Rnd
          default={{ x: 100, y: 100, width: 100, height: 100 }}
    Severity: Major
    Found in src/index.test.tsx and 3 other locations - About 1 day to fix
    src/index.test.tsx on lines 475..508
    src/index.test.tsx on lines 510..543
    src/index.test.tsx on lines 545..578

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

    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

    test("should snapped by original grid when x axis resizing smaller then threshold", async (t) => {
      const onResize = spy();
      const rnd = mount(
        <Rnd
          default={{ x: 100, y: 100, width: 100, height: 100 }}
    Severity: Major
    Found in src/index.test.tsx and 3 other locations - About 1 day to fix
    src/index.test.tsx on lines 510..543
    src/index.test.tsx on lines 545..578
    src/index.test.tsx on lines 580..613

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

    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

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

    import * as React from "react";
    import { DraggableEventHandler, default as DraggableRoot } from "react-draggable";
    import { Enable, Resizable, ResizeDirection } from "re-resizable";
    
    // FIXME: https://github.com/mzabriskie/react-draggable/issues/381
    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

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

              <div style={parentBoundary}>
                <Rnd
                  style={style}
                  bounds=".boundary"
                  size={{
      Severity: Major
      Found in stories/bounds/selector-controlled.tsx and 1 other location - About 1 day to fix
      stories/bounds/body-controlled.tsx on lines 25..50

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

      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

            <div style={parentBoundary}>
              <Rnd
                style={style}
                bounds="body"
                size={{
      Severity: Major
      Found in stories/bounds/body-controlled.tsx and 1 other location - About 1 day to fix
      stories/bounds/selector-controlled.tsx on lines 26..51

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

      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

      test("should enable dragging both x & y when axis equals both", async (t) => {
        const onDrag = spy();
        const rnd = mount(<Rnd onDrag={onDrag} dragAxis="both" default={{ x: 100, y: 100, width: 100, height: 100 }} />, {
          attachTo: document.querySelector("div"),
        });
      Severity: Major
      Found in src/index.test.tsx and 3 other locations - About 1 day to fix
      src/index.test.tsx on lines 156..165
      src/index.test.tsx on lines 167..176
      src/index.test.tsx on lines 178..187

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

      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

      test("should dragging disabled when axis equals none", async (t) => {
        const onDrag = spy();
        const rnd = mount(<Rnd onDrag={onDrag} dragAxis="none" default={{ x: 100, y: 100, width: 100, height: 100 }} />, {
          attachTo: document.querySelector("div"),
        });
      Severity: Major
      Found in src/index.test.tsx and 3 other locations - About 1 day to fix
      src/index.test.tsx on lines 167..176
      src/index.test.tsx on lines 178..187
      src/index.test.tsx on lines 189..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 200.

      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

      test("xdragging only y when axis equals y", async (t) => {
        const onDrag = spy();
        const rnd = mount(<Rnd onDrag={onDrag} dragAxis="y" default={{ x: 100, y: 100, width: 100, height: 100 }} />, {
          attachTo: document.querySelector("div"),
        });
      Severity: Major
      Found in src/index.test.tsx and 3 other locations - About 1 day to fix
      src/index.test.tsx on lines 156..165
      src/index.test.tsx on lines 167..176
      src/index.test.tsx on lines 189..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 200.

      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

      test("should enable dragging only x when axis equals x", async (t) => {
        const onDrag = spy();
        const rnd = mount(<Rnd onDrag={onDrag} dragAxis="x" default={{ x: 100, y: 100, width: 100, height: 100 }} />, {
          attachTo: document.querySelector("div"),
        });
      Severity: Major
      Found in src/index.test.tsx and 3 other locations - About 1 day to fix
      src/index.test.tsx on lines 156..165
      src/index.test.tsx on lines 178..187
      src/index.test.tsx on lines 189..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 200.

      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

      test("should snap when dragging smaller than threshold", async (t) => {
        const rnd = mount(<Rnd dragGrid={[30, 100]} default={{ x: 100, y: 100, width: 100, height: 100 }} />, {
          attachTo: document.querySelector("div"),
        });
        rnd.find("div").at(0).simulate("mousedown", { clientX: 0, clientY: 0 });
      Severity: Major
      Found in src/index.test.tsx and 1 other location - About 6 hrs to fix
      src/index.test.tsx on lines 209..216

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

      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

      test("should snap when dragging larger than threshold", async (t) => {
        const rnd = mount(<Rnd dragGrid={[30, 100]} default={{ x: 100, y: 100, width: 100, height: 100 }} />, {
          attachTo: document.querySelector("div"),
        });
        rnd.find("div").at(0).simulate("mousedown", { clientX: 0, clientY: 0 });
      Severity: Major
      Found in src/index.test.tsx and 1 other location - About 6 hrs to fix
      src/index.test.tsx on lines 200..207

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

      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

      Severity
      Category
      Status
      Source
      Language