Showing 73 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
handleMouseDown(e) {
const { row, col, onMouseDown, cell } = this.props;
if (!cell.disableEvents) {
onMouseDown(row, col, e);
}
- Read upRead up
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 63.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
handleContextMenu(e) {
const { row, col, onContextMenu, cell } = this.props;
if (!cell.disableEvents) {
onContextMenu(e, row, col);
}
- Read upRead up
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 63.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
handleDoubleClick(e) {
const { row, col, onDoubleClick, cell } = this.props;
if (!cell.disableEvents) {
onDoubleClick(row, col);
}
- Read upRead up
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 62.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
handleMouseOver(e) {
const { row, col, onMouseOver, cell } = this.props;
if (!cell.disableEvents) {
onMouseOver(row, col);
}
- Read upRead up
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 62.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
cell,
row,
col,