nadbm/react-datasheet

View on GitHub

Showing 25 of 73 total issues

Function renderData has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function renderData(cell, row, col, valueRenderer, dataRenderer) {
Severity: Minor
Found in src/renderHelpers.js - About 35 mins to fix

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

      componentDidUpdate(prevProps) {
        if (
          !this.props.cell.disableUpdatedFlag &&
          initialValue(prevProps) !== initialValue(this.props)
        ) {
    Severity: Minor
    Found in src/DataCell.js - 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 range has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const range = (start, end) => {
      const array = [];
      const inc = end - start > 0;
      for (let i = start; inc ? i <= end : i >= end; inc ? i++ : i--) {
        inc ? array.push(i) : array.unshift(i);
    Severity: Minor
    Found in src/DataSheet.js - 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 handleIEClipboardEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      handleIEClipboardEvents(e) {
        if (e.ctrlKey) {
          if (e.keyCode === 67) {
            // C - copy
            this.handleCopy(e);
    Severity: Minor
    Found in src/DataSheet.js - 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 isSelected has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      isSelected(i, j) {
        const { start, end } = this.getState();
        const posX = j >= start.j && j <= end.j;
        const negX = j <= start.j && j >= end.j;
        const posY = i >= start.i && i <= end.i;
    Severity: Minor
    Found in src/DataSheet.js - 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

    Severity
    Category
    Status
    Source
    Language