react-scheduler/react-big-schedule

View on GitHub

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';
Severity: Major
Found in src/components/SchedulerData.js - About 2 days to fix

    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 = [];
    Severity: Major
    Found in src/components/SchedulerData.js - About 1 day to fix

      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';
      Severity: Minor
      Found in src/components/EventItem.jsx - About 7 hrs to fix

        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));
        
        
        Severity: Major
        Found in src/examples/pages/Drag-And-Drop/functional-based.jsx - About 6 hrs to fix

          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();
          Severity: Minor
          Found in src/components/SchedulerData.js - About 6 hrs 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 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,
          Severity: Major
          Found in src/examples/pages/Add-More/functional-based.jsx - About 6 hrs to fix

            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;
            Severity: Minor
            Found in src/components/EventItem.jsx - About 5 hrs 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 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();
            
            
            Severity: Major
            Found in src/components/index.jsx - About 5 hrs to fix

              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;
              
              
              Severity: Minor
              Found in src/components/SchedulerData.js - About 5 hrs 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

              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
              Severity: Minor
              Found in src/components/index.jsx - About 5 hrs to fix

                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;
                Severity: Minor
                Found in src/components/SchedulerData.js - About 5 hrs 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 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);
                
                
                Severity: Minor
                Found in src/components/SchedulerHeader.jsx - About 4 hrs 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

                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' },
                Severity: Minor
                Found in src/sample-data/sample1.js - About 4 hrs to fix

                  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';
                  Severity: Minor
                  Found in src/components/ResourceEvents.jsx - About 3 hrs to fix

                    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;
                    Severity: Major
                    Found in src/components/EventItem.jsx - About 3 hrs to fix

                      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();
                      Severity: Major
                      Found in src/components/ResourceEvents.jsx - About 3 hrs to fix

                        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;
                        Severity: Major
                        Found in src/components/SchedulerData.js - About 3 hrs to fix

                          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);
                          Severity: Minor
                          Found in src/components/ResourceView.jsx - About 3 hrs 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 _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 => {
                          Severity: Major
                          Found in src/components/SchedulerData.js - About 2 hrs to fix

                            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();
                            Severity: Major
                            Found in src/components/SchedulerData.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language