nadbm/react-datasheet

View on GitHub

Showing 73 of 73 total issues

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

  handleNavigate(e, offsets, jumpRow) {
    if (offsets && (offsets.i || offsets.j)) {
      const { data } = this.props;
      const { start } = this.getState();

Severity: Minor
Found in src/DataSheet.js - 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 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(props) {
    super(props);
    this.onMouseDown = this.onMouseDown.bind(this);
    this.onMouseUp = this.onMouseUp.bind(this);
    this.onMouseOver = this.onMouseOver.bind(this);
Severity: Minor
Found in src/DataSheet.js - About 1 hr to fix

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

      onMouseDown(i, j, e) {
        const isNowEditingSameCell =
          !isEmpty(this.state.editing) &&
          this.state.editing.i === i &&
          this.state.editing.j === j;
    Severity: Minor
    Found in src/DataSheet.js - About 1 hr to fix

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

        handleKeyboardCellMovement(e, commit = false) {
          const { start, editing } = this.getState();
          const { data } = this.props;
          const isEditing = editing && !isEmpty(editing);
          const currentCell = data[start.i] && data[start.i][start.j];
      Severity: Minor
      Found in src/DataSheet.js - About 1 hr to fix

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

              end = { i: Math.max(start.i, end.i), j: Math.max(start.j, end.j) };
        Severity: Minor
        Found in src/DataSheet.js and 1 other location - About 50 mins to fix
        src/DataSheet.js on lines 218..218

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

        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

              start = { i: Math.min(start.i, end.i), j: Math.min(start.j, end.j) };
        Severity: Minor
        Found in src/DataSheet.js and 1 other location - About 50 mins to fix
        src/DataSheet.js on lines 219..219

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

        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

          isEditing(i, j) {
            return this.state.editing.i === i && this.state.editing.j === j;
          }
        Severity: Minor
        Found in src/DataSheet.js and 1 other location - About 40 mins to fix
        src/DataSheet.js on lines 649..651

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

        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

          isClearing(i, j) {
            return this.state.clear.i === i && this.state.clear.j === j;
          }
        Severity: Minor
        Found in src/DataSheet.js and 1 other location - About 40 mins to fix
        src/DataSheet.js on lines 645..647

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

        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

        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

          Adjoining classes: .data-grid-container .data-grid.wrap .cell.wrap
          Open

          .data-grid-container .data-grid.wrap .cell.wrap,
          Severity: Minor
          Found in src/react-datasheet.css by csslint

          Adjoining classes: .data-grid-container .data-grid .cell.updated
          Open

          .data-grid-container .data-grid .cell.updated {
          Severity: Minor
          Found in src/react-datasheet.css by csslint

          Adjoining classes: .data-grid-container .data-grid .cell.read-only
          Open

          .data-grid-container .data-grid .cell.read-only {
          Severity: Minor
          Found in src/react-datasheet.css by csslint

          Adjoining classes: .data-grid-container .data-grid.wrap .cell.wrap
          Open

          .data-grid-container .data-grid.wrap .cell.wrap,
          Severity: Minor
          Found in src/react-datasheet.css by csslint

          Adjoining classes: .data-grid-container .data-grid .cell.nowrap
          Open

          .data-grid-container .data-grid .cell.nowrap,
          Severity: Minor
          Found in src/react-datasheet.css by csslint

          Rule doesn't have all its properties in alphabetical order.
          Open

          .data-grid-container .data-grid .cell.selected {
          Severity: Minor
          Found in src/react-datasheet.css by csslint

          Rule doesn't have all its properties in alphabetical order.
          Open

          .data-grid-container .data-grid.nowrap .cell,
          Severity: Minor
          Found in src/react-datasheet.css by csslint
          Severity
          Category
          Status
          Source
          Language