Showing 25 of 73 total issues
File DataSheet.js
has 691 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import Sheet from './Sheet';
import Row from './Row';
import Cell from './Cell';
DataSheet
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
export default class DataSheet extends PureComponent {
constructor(props) {
super(props);
this.onMouseDown = this.onMouseDown.bind(this);
this.onMouseUp = this.onMouseUp.bind(this);
Function render
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
sheetRenderer: SheetRenderer,
rowRenderer: RowRenderer,
cellRenderer,
Function handleCopy
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
handleCopy(e) {
if (isEmpty(this.state.editing)) {
e.preventDefault();
const { dataRenderer, valueRenderer, data } = this.props;
const { start, end } = this.getState();
- Read upRead up
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 _setState
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
_setState(state) {
const { editModeChanged } = this.props;
if (editModeChanged && state.editing) {
const wasEditing = !isEmpty(this.state.editing);
const wilBeEditing = !isEmpty(state.editing);
- Read upRead up
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 handleKey
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
handleKey(e) {
if (e.isPropagationStopped && e.isPropagationStopped()) {
return;
}
const keyCode = e.which || e.keyCode;
- Read upRead up
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 handlePaste
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
handlePaste(e) {
if (isEmpty(this.state.editing)) {
let { start, end } = this.getState();
start = { i: Math.min(start.i, end.i), j: Math.min(start.j, end.j) };
Function searchForNextSelectablePos
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
searchForNextSelectablePos(isCellNavigable, data, start, offsets, jumpRow) {
const previousRow = location => ({
i: location.i - 1,
j: data[0].length - 1,
});
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
row,
col,
cell,
Function handleKeyboardCellMovement
has a Cognitive Complexity of 14 (exceeds 5 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];
- Read upRead up
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 handlePaste
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
handlePaste(e) {
if (isEmpty(this.state.editing)) {
let { start, end } = this.getState();
start = { i: Math.min(start.i, end.i), j: Math.min(start.j, end.j) };
- Read upRead up
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 handleKey
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleKey(e) {
if (e.isPropagationStopped && e.isPropagationStopped()) {
return;
}
const keyCode = e.which || e.keyCode;
Function handleCopy
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleCopy(e) {
if (isEmpty(this.state.editing)) {
e.preventDefault();
const { dataRenderer, valueRenderer, data } = this.props;
const { start, end } = this.getState();
Function searchForNextSelectablePos
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
searchForNextSelectablePos(isCellNavigable, data, start, offsets, jumpRow) {
const previousRow = location => ({
i: location.i - 1,
j: data[0].length - 1,
});
- Read upRead up
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 handleComponentKey
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
handleComponentKey(e) {
// handles keyboard events when editing components
const keyCode = e.which || e.keyCode;
if (![ENTER_KEY, ESCAPE_KEY, TAB_KEY].includes(keyCode)) {
return;
- Read upRead up
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 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
cell,
row,
col,
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();
- Read upRead up
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);
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;
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];