bokuweb/react-resizable-box

View on GitHub
src/index.tsx

Summary

Maintainability
F
1 wk
Test Coverage

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

import * as React from 'react';
import { flushSync } from 'react-dom';

import { Resizer, Direction } from './resizer';

Severity: Major
Found in src/index.tsx - About 2 days to fix

    Function onMouseMove has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

      onMouseMove(event: MouseEvent | TouchEvent) {
        if (!this.state.isResizing || !this.resizable || !this.window) {
          return;
        }
        if (this.window.TouchEvent && isTouchEvent(event)) {
    Severity: Minor
    Found in src/index.tsx - About 4 hrs 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 calculateNewMaxFromBoundary has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

      calculateNewMaxFromBoundary(maxWidth?: number, maxHeight?: number) {
        const { boundsByDirection } = this.props;
        const { direction } = this.state;
        const widthByDirection = boundsByDirection && hasDirection('left', direction);
        const heightByDirection = boundsByDirection && hasDirection('top', direction);
    Severity: Minor
    Found in src/index.tsx - About 4 hrs 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 onMouseMove has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      onMouseMove(event: MouseEvent | TouchEvent) {
        if (!this.state.isResizing || !this.resizable || !this.window) {
          return;
        }
        if (this.window.TouchEvent && isTouchEvent(event)) {
    Severity: Major
    Found in src/index.tsx - About 4 hrs to fix

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

        onResizeStart(event: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>, direction: Direction) {
          if (!this.resizable || !this.window) {
            return;
          }
          let clientX = 0;
      Severity: Minor
      Found in src/index.tsx - About 3 hrs 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

      Resizable has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class Resizable extends React.PureComponent<ResizableProps, State> {
        flexDir?: 'row' | 'column';
      
        get parentNode(): HTMLElement | null {
          if (!this.resizable) {
      Severity: Minor
      Found in src/index.tsx - About 2 hrs to fix

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

          onResizeStart(event: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>, direction: Direction) {
            if (!this.resizable || !this.window) {
              return;
            }
            let clientX = 0;
        Severity: Major
        Found in src/index.tsx - About 2 hrs to fix

          Function calculateNewSizeFromDirection has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            calculateNewSizeFromDirection(clientX: number, clientY: number) {
              const scale = this.props.scale || 1;
              const [resizeRatioX, resizeRatioY] = normalizeToPair(this.props.resizeRatio || 1);
              const { direction, original } = this.state;
              const { lockAspectRatio, lockAspectRatioExtraHeight, lockAspectRatioExtraWidth } = this.props;
          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 render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              const extendsProps = Object.keys(this.props).reduce((acc, key) => {
                if (definedProps.indexOf(key) !== -1) {
                  return acc;
                }
          Severity: Minor
          Found in src/index.tsx - About 1 hr to fix

            Function calculateNewMaxFromBoundary has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              calculateNewMaxFromBoundary(maxWidth?: number, maxHeight?: number) {
                const { boundsByDirection } = this.props;
                const { direction } = this.state;
                const widthByDirection = boundsByDirection && hasDirection('left', direction);
                const heightByDirection = boundsByDirection && hasDirection('top', direction);
            Severity: Minor
            Found in src/index.tsx - About 1 hr to fix

              Function calculateNewSizeFromDirection has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                calculateNewSizeFromDirection(clientX: number, clientY: number) {
                  const scale = this.props.scale || 1;
                  const [resizeRatioX, resizeRatioY] = normalizeToPair(this.props.resizeRatio || 1);
                  const { direction, original } = this.state;
                  const { lockAspectRatio, lockAspectRatioExtraHeight, lockAspectRatioExtraWidth } = this.props;
              Severity: Minor
              Found in src/index.tsx - About 1 hr to fix

                Function sizeStyle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  get sizeStyle(): { width: string; height: string } {
                    const { size } = this.props;
                    const getSize = (key: 'width' | 'height'): string => {
                      if (typeof this.state[key] === 'undefined' || this.state[key] === 'auto') {
                        return 'auto';
                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 constructor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  constructor(props: ResizableProps) {
                    super(props);
                    this.state = {
                      isResizing: false,
                      width: this.propsSize?.width ?? 'auto',
                Severity: Minor
                Found in src/index.tsx - About 1 hr to fix

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

                    getParentSize(): { width: number; height: number } {
                      if (!this.parentNode) {
                        if (!this.window) {
                          return { width: 0, height: 0 };
                        }
                  Severity: Minor
                  Found in src/index.tsx - About 1 hr to fix

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

                    const getPixelSize = (
                      size: undefined | string | number,
                      parentSize: number,
                      innerWidth: number,
                      innerHeight: number,
                    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 size has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      get size(): NumberSize {
                        let width = 0;
                        let height = 0;
                        if (this.resizable && this.window) {
                          const orgWidth = this.resizable.offsetWidth;
                    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

                    Function renderResizer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      renderResizer() {
                        const { enable, handleStyles, handleClasses, handleWrapperStyle, handleWrapperClass, handleComponent } = this.props;
                        if (!enable) {
                          return null;
                        }
                    Severity: Minor
                    Found in src/index.tsx - About 35 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

                    Function getStringSize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const getStringSize = (n: number | string): string => {
                      n = n.toString();
                      if (n === 'auto') {
                        return n;
                      }
                    Severity: Minor
                    Found in src/index.tsx - About 35 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 n;
                    Severity: Major
                    Found in src/index.tsx - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        return `${n}px`;
                      Severity: Major
                      Found in src/index.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

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

                              Function setBoundingClientRect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                setBoundingClientRect() {
                                  // For parent boundary
                                  if (this.props.bounds === 'parent') {
                                    const parent = this.parentNode;
                                    if (parent) {
                              Severity: Minor
                              Found in src/index.tsx - About 25 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

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

                                render() {
                                  const extendsProps = Object.keys(this.props).reduce((acc, key) => {
                                    if (definedProps.indexOf(key) !== -1) {
                                      return acc;
                                    }
                              Severity: Minor
                              Found in src/index.tsx - About 25 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

                              Function calculateNewSizeFromAspectRatio has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                calculateNewSizeFromAspectRatio(
                                  newWidth: number,
                                  newHeight: number,
                                  max: { width?: number; height?: number },
                                  min: { width?: number; height?: number },
                              Severity: Minor
                              Found in src/index.tsx - About 25 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

                              Function getParentSize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                getParentSize(): { width: number; height: number } {
                                  if (!this.parentNode) {
                                    if (!this.window) {
                                      return { width: 0, height: 0 };
                                    }
                              Severity: Minor
                              Found in src/index.tsx - About 25 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

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

                                  if (width && typeof width === 'string') {
                                    if (width.endsWith('%')) {
                                      const percent = (newWidth / parentSize.width) * 100;
                                      newWidth = `${percent}%`;
                                    } else if (width.endsWith('vw')) {
                              Severity: Major
                              Found in src/index.tsx and 1 other location - About 7 hrs to fix
                              src/index.tsx on lines 831..842

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

                              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 (height && typeof height === 'string') {
                                    if (height.endsWith('%')) {
                                      const percent = (newHeight / parentSize.height) * 100;
                                      newHeight = `${percent}%`;
                                    } else if (height.endsWith('vw')) {
                              Severity: Major
                              Found in src/index.tsx and 1 other location - About 7 hrs to fix
                              src/index.tsx on lines 818..829

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

                              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 (typeof this.props.size.height !== 'undefined' && this.props.size.height !== this.state.height) {
                                      this.setState({ height: this.props.size.height });
                                    }
                              Severity: Major
                              Found in src/index.tsx and 1 other location - About 2 hrs to fix
                              src/index.tsx on lines 707..709

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

                              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 (typeof this.props.size.width !== 'undefined' && this.props.size.width !== this.state.width) {
                                      this.setState({ width: this.props.size.width });
                                    }
                              Severity: Major
                              Found in src/index.tsx and 1 other location - About 2 hrs to fix
                              src/index.tsx on lines 704..706

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

                              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

                                  if (hasDirection('bottom', direction)) {
                                    newHeight = original.height + ((clientY - original.y) * resizeRatioY) / scale;
                                    if (lockAspectRatio) {
                                      newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
                                    }
                              Severity: Major
                              Found in src/index.tsx and 3 other locations - About 1 hr to fix
                              src/index.tsx on lines 594..599
                              src/index.tsx on lines 600..605
                              src/index.tsx on lines 612..617

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

                              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

                                  if (hasDirection('right', direction)) {
                                    newWidth = original.width + ((clientX - original.x) * resizeRatioX) / scale;
                                    if (lockAspectRatio) {
                                      newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
                                    }
                              Severity: Major
                              Found in src/index.tsx and 3 other locations - About 1 hr to fix
                              src/index.tsx on lines 600..605
                              src/index.tsx on lines 606..611
                              src/index.tsx on lines 612..617

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

                              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

                                  if (hasDirection('top', direction)) {
                                    newHeight = original.height - ((clientY - original.y) * resizeRatioY) / scale;
                                    if (lockAspectRatio) {
                                      newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
                                    }
                              Severity: Major
                              Found in src/index.tsx and 3 other locations - About 1 hr to fix
                              src/index.tsx on lines 594..599
                              src/index.tsx on lines 600..605
                              src/index.tsx on lines 606..611

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

                              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

                                  if (hasDirection('left', direction)) {
                                    newWidth = original.width - ((clientX - original.x) * resizeRatioX) / scale;
                                    if (lockAspectRatio) {
                                      newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
                                    }
                              Severity: Major
                              Found in src/index.tsx and 3 other locations - About 1 hr to fix
                              src/index.tsx on lines 594..599
                              src/index.tsx on lines 606..611
                              src/index.tsx on lines 612..617

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

                              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

                                  const height =
                                    size && typeof size.height !== 'undefined' && !this.state.isResizing
                                      ? getStringSize(size.height)
                                      : getSize('height');
                              Severity: Minor
                              Found in src/index.tsx and 1 other location - About 55 mins to fix
                              src/index.tsx on lines 348..351

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

                              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

                                    boundHeight = heightByDirection
                                      ? this.resizableBottom - this.targetTop
                                      : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop);
                              Severity: Minor
                              Found in src/index.tsx and 1 other location - About 55 mins to fix
                              src/index.tsx on lines 569..571

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

                              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

                                  const width =
                                    size && typeof size.width !== 'undefined' && !this.state.isResizing
                                      ? getStringSize(size.width)
                                      : getSize('width');
                              Severity: Minor
                              Found in src/index.tsx and 1 other location - About 55 mins to fix
                              src/index.tsx on lines 352..355

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

                              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

                                    boundWidth = widthByDirection
                                      ? this.resizableRight - this.targetLeft
                                      : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft);
                              Severity: Minor
                              Found in src/index.tsx and 1 other location - About 55 mins to fix
                              src/index.tsx on lines 572..574

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

                              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

                                  if (size.endsWith('vw')) {
                                    const ratio = Number(size.replace('vw', '')) / 100;
                                    return innerWidth * ratio;
                                  }
                              Severity: Minor
                              Found in src/index.tsx and 2 other locations - About 35 mins to fix
                              src/index.tsx on lines 194..197
                              src/index.tsx on lines 202..205

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

                              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

                                  if (size.endsWith('vh')) {
                                    const ratio = Number(size.replace('vh', '')) / 100;
                                    return innerHeight * ratio;
                                  }
                              Severity: Minor
                              Found in src/index.tsx and 2 other locations - About 35 mins to fix
                              src/index.tsx on lines 194..197
                              src/index.tsx on lines 198..201

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

                              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

                                  if (size.endsWith('%')) {
                                    const ratio = Number(size.replace('%', '')) / 100;
                                    return parentSize * ratio;
                                  }
                              Severity: Minor
                              Found in src/index.tsx and 2 other locations - About 35 mins to fix
                              src/index.tsx on lines 198..201
                              src/index.tsx on lines 202..205

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

                              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

                                      boundWidth = widthByDirection
                                        ? this.resizableRight - this.parentLeft
                                        : parent.offsetWidth + (this.parentLeft - this.resizableLeft);
                              Severity: Minor
                              Found in src/index.tsx and 1 other location - About 30 mins to fix
                              src/index.tsx on lines 559..561

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

                              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

                                      boundHeight = heightByDirection
                                        ? this.resizableBottom - this.parentTop
                                        : parent.offsetHeight + (this.parentTop - this.resizableTop);
                              Severity: Minor
                              Found in src/index.tsx and 1 other location - About 30 mins to fix
                              src/index.tsx on lines 556..558

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

                              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