react-scheduler/react-big-schedule

View on GitHub

Showing 57 of 504 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 no-return-assign */
      import React, { Component } from 'react';
      import { PropTypes } from 'prop-types';
      import { Popover } from 'antd';
      import EventItemPopover from './EventItemPopover';
      Severity: Minor
      Found in src/components/EventItem.jsx - About 7 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 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 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

        Function render has 139 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 _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

          File index.jsx has 388 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { Component } from 'react';
          import PropTypes from 'prop-types';
          
          // 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
          Severity: Minor
          Found in src/components/index.jsx - About 5 hrs to fix

            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 ResourceEvents.jsx has 328 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { Component } from 'react';
            import { PropTypes } from 'prop-types';
            import AddMore from './AddMore';
            import Summary from './Summary';
            import SelectedArea from './SelectedArea';
            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

                        Scheduler has 23 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Scheduler extends Component {
                          constructor(props) {
                            super(props);
                        
                            const { schedulerData, dndSources, parentRef } = props;
                        Severity: Minor
                        Found in src/components/index.jsx - About 2 hrs to fix

                          Function _createHeaders has 62 lines of code (exceeds 25 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: Major
                          Found in src/components/SchedulerData.js - About 2 hrs to fix

                            Function _handleRecurringEvents has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _handleRecurringEvents() {
                                const recurringEvents = this.events.filter(x => !!x.rrule);
                                recurringEvents.forEach(item => {
                                  this._detachEvent(item);
                                });
                            Severity: Major
                            Found in src/components/SchedulerData.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language