Showing 26 of 74 total issues
Function render
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
render() {
let selectingModeFrom = this.props.selectingModeFrom;
let mode = this.props.mode;
let startDotStyle =
this.props.style && this.props.style.fromDot ? this.props.style.fromDot : { backgroundColor: '#12bc00' };
- 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 keyboardCellCallback
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
keyboardCellCallback(originalDate, newDate) {
let startDate;
let endDate;
// If original date same as start and end date, and not in smart mode
// Then if cell end called allow new end date. Allow new start if cell start called
- 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 styleCellNonMouseEnter
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
styleCellNonMouseEnter() {
let cellDay = this.props.cellDay;
let date = this.props.date;
let otherDate = this.props.otherDate;
- 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 keyDown
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
keyDown(e) {
let componentFocused = document.activeElement === ReactDOM.findDOMNode(this.cell);
if (componentFocused && e.keyCode >= 37 && e.keyCode <= 40) {
e.preventDefault();
let newDate = moment(this.props.cellDay);
- 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 propValidation
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const propValidation = props => {
if (props.years) {
if (!Array.isArray(props.years)) {
return 'Year props should be an array e.g. [2019, 2020]';
}
- 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 componentDidUpdate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
componentDidUpdate(prevProps, prevState) {
if (this.props !== prevProps) {
let focused = this.props.focused[this.props.index];
if (this.props.index === this.props.selectedRange || focused) {
this.setRangeSelectedStyle();
- 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 updateTime
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
updateTime(origDate, newHour, newMinute, mode, stateDateToChangeName, stateLabelToChangeName) {
let date = moment(origDate);
date.hours(newHour);
date.minutes(newMinute);
// If Past Max Date Dont allow update
- 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 createYears
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const createYears = (userDefinedYears, descendingYears) => {
let years = [];
if (!userDefinedYears) {
//Range from 1900 to 25 years into the future
let past = moment('19000101', 'YYYYMMDD');
- 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 getDaysBeforeStartMonday
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const getDaysBeforeStartMonday = firstDayOfMonth => {
let fourtyTwoDays = [];
let dayBeforeFirstDayOfMonth = firstDayOfMonth.day() - 1; // We dont want to include the first day of the new month
// Case whereby day before is a Saturday (6) and we require Saturday back to Monday for that week
if (dayBeforeFirstDayOfMonth === -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 browserVersion
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const browserVersion = () => {
let ua = navigator.userAgent,
tem,
M =
ua.match(
- 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 workOutMonthYear
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function workOutMonthYear(date, secondDate, mode, pastSearchFriendly, smartMode) {
Function updateDate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
updateDate(
mode,
newDate,
isValidNewDate,
isValidDateChange,
- 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 componentDidUpdate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
componentDidUpdate(oldProps) {
let isDifferentMomentObject = !oldProps.date.isSame(this.props.date) || !oldProps.otherDate.isSame(this.props.otherDate);
let isDifferentTime = this.props.date.format('DD-MM-YYYY HH:mm') !== oldProps.date.format('DD-MM-YYYY HH:mm') || this.props.otherDate.format('DD-MM-YYYY HH:mm') !== oldProps.otherDate.format('DD-MM-YYYY HH:mm')
if (isDifferentMomentObject || isDifferentTime) {
- 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 renderButtons
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
renderButtons() {
let applyButton;
let closeButtonText = (this.props.local && this.props.local.close) ? this.props.local.close : 'Close';
if (!this.props.autoApply) {
applyButton = this.renderButton(
- 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
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return 'End year should be in the custom years defined';
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return <div />;
Avoid too many return
statements within this function. Open
return false;
Function rangeSelectedCallback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
rangeSelectedCallback(index, value) {
// If Past Max Date Dont allow update
let start;
let end;
if (value !== 'Custom Range') {
- 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"