Showing 60 of 537 total issues
File SchedulerData.js
has 987 lines of code (exceeds 250 allowed). Consider refactoring. Open
import dayjs from 'dayjs';
import quarterOfYear from 'dayjs/plugin/quarterOfYear';
import utc from 'dayjs/plugin/utc';
import weekday from 'dayjs/plugin/weekday';
import { RRuleSet, rrulestr } from 'rrule';
SchedulerData
has 75 functions (exceeds 20 allowed). Consider refactoring. Open
export default class SchedulerData {
constructor(date = dayjs(), viewType = ViewType.Week, showAgenda = false, isEventPerspective = false, newConfig = undefined, newBehaviors = undefined) {
this.resources = [];
this.events = [];
this.eventGroups = [];
File EventItem.jsx
has 481 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/anchor-is-valid */
/* eslint-disable no-return-assign */
import { Popover } from 'antd';
Function DragAndDrop
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
function DragAndDrop() {
const [state, dispatch] = useReducer(reducer, initialState);
const [taskDndSource, setTaskDndSource] = useState(new DnDSource(props => props.task, TaskItem, true, DnDTypes.TASK));
const [resourceDndSource, setResourceDndSource] = useState(new DnDSource(props => props.resource, ResourceItem, true, DnDTypes.RESOURCE));
Function _getSpan
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
_getSpan(startTime, endTime, headers) {
if (this.showAgenda) return 1;
// function startOfWeek(date) {
// const day = date.getDay();
- 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 AddMore
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AddMore() {
const [state, dispatch] = useReducer(reducer, initialState);
const [popoverState, setPopoverState] = useState({
headerItem: undefined,
Function render
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { eventItem, isStart, isEnd, isInPopover, eventItemClick, schedulerData, isDragging, connectDragSource, connectDragPreview, eventItemTemplateResolver } = this.props;
const { config, localeDayjs } = schedulerData;
const { left, width, top } = this.state;
let roundCls;
- 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 145 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { schedulerData, leftCustomHeader, rightCustomHeader } = this.props;
const { viewType, renderData, showAgenda, config } = schedulerData;
const width = schedulerData.getSchedulerWidth();
Function setViewType
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
setViewType(viewType = ViewType.Week, showAgenda = false, isEventPerspective = false) {
this.showAgenda = showAgenda;
this.isEventPerspective = isEventPerspective;
this.cellUnit = CellUnit.Day;
- 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
File index.jsx
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable */
// Col, Row and Icon do not have their own less files for styling. They use
// rules declared in antd's global css. If these styles are imported directly
// from within antd, they'll include, for instance, reset rules. These will
// affect everything on the page and in essence would leak antd's global styles
Function _createHeaders
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
_createHeaders() {
const headers = [];
let start = this.localeDayjs(new Date(this.startDate));
let end = this.localeDayjs(new Date(this.endDate));
let header = start;
- 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 SchedulerHeader
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
function SchedulerHeader({ onViewChange, goNext, goBack, onSelectDate, schedulerData, leftCustomHeader, rightCustomHeader }) {
const [viewSpinning, setViewSpinning] = useState(false);
const [dateSpinning, setDateSpinning] = useState(false);
const [visible, setVisible] = useState(false);
- 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
File sample1.js
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
const DemoData = {
resources: [
{ id: 'r0', name: 'Resource0', title: 'Resource 0', groupOnly: true },
{ id: 'r1', name: 'Resource1', title: 'Resource 1', parentId: 'r0' },
{ id: 'r2', name: 'Resource2', parentId: 'r3' },
File ResourceEvents.jsx
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable */
import { PropTypes } from 'prop-types';
import React, { Component } from 'react';
import { CellUnit, DATETIME_FORMAT, DnDTypes, SummaryPos } from '../config/default';
import { getPos } from '../helper/utility';
Function render
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { eventItem, isStart, isEnd, isInPopover, eventItemClick, schedulerData, isDragging, connectDragSource, connectDragPreview, eventItemTemplateResolver } = this.props;
const { config, localeDayjs } = schedulerData;
const { left, width, top } = this.state;
let roundCls;
Function render
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { resourceEvents, schedulerData, connectDropTarget, dndSource } = this.props;
const { cellUnit, startDate, endDate, config, localeDayjs } = schedulerData;
const { isSelecting, left, width } = this.state;
const cellWidth = schedulerData.getContentCellWidth();
Function _createRenderData
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createRenderData() {
const initRenderData = this._createInitRenderData(this.isEventPerspective, this.eventGroups, this.resources, this.headers);
// this.events.sort(this._compare);
const cellMaxEventsCount = this.getCellMaxEvents();
const cellMaxEventsCountValue = 30;
Function ResourceView
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function ResourceView({ schedulerData, contentScrollbarHeight, slotClickedFunc, slotItemTemplateResolver, toggleExpandFunc }) {
const { renderData } = schedulerData;
const width = schedulerData.getResourceTableWidth() - 2;
const paddingBottom = contentScrollbarHeight;
const displayRenderData = renderData.filter(o => o.render);
- 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 _createInitRenderData
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createInitRenderData(isEventPerspective, eventGroups, resources, headers) {
const slots = isEventPerspective ? eventGroups : resources;
const slotTree = [];
const slotMap = new Map();
slots.forEach(slot => {
Function _getSpan
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getSpan(startTime, endTime, headers) {
if (this.showAgenda) return 1;
// function startOfWeek(date) {
// const day = date.getDay();