react-scheduler/react-big-schedule

View on GitHub

Showing 60 of 537 total issues

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

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

          setViewType(viewType = ViewType.Week, showAgenda = false, isEventPerspective = false) {
            this.showAgenda = showAgenda;
            this.isEventPerspective = isEventPerspective;
            this.cellUnit = CellUnit.Day;
        
        
        Severity: Major
        Found in src/components/SchedulerData.js - About 2 hrs to fix

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

              endDrag: (props, monitor) => {
                if (!monitor.didDrop()) return;
          
                const { moveEvent, newEvent, schedulerData } = props;
                const { events, config, viewType, localeDayjs } = schedulerData;
          Severity: Major
          Found in src/components/DnDSource.js - About 2 hrs to fix

            Function render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              render() {
                const { schedulerData, leftCustomHeader, rightCustomHeader } = this.props;
                const { viewType, renderData, showAgenda, config } = schedulerData;
                const width = schedulerData.getSchedulerWidth();
            
            
            Severity: Minor
            Found in src/components/index.jsx - About 2 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 DragAndDrop has a Cognitive Complexity of 17 (exceeds 5 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: Minor
            Found in src/examples/pages/Drag-And-Drop/functional-based.jsx - About 2 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 BodyView has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function BodyView({ schedulerData }) {
              const { renderData, headers, config, behaviors } = schedulerData;
              const width = schedulerData.getContentCellWidth();
            
              const tableRows = renderData
            Severity: Minor
            Found in src/components/BodyView.jsx - About 2 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 hover has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                hover: (props, monitor, component) => {
                  const { schedulerData, resourceEvents, movingEvent } = props;
                  const { cellUnit, config, viewType, localeDayjs } = schedulerData;
                  this.config = config;
                  const item = monitor.getItem();
            Severity: Major
            Found in src/components/DnDContext.js - About 2 hrs to fix

              Function AddMorePopover has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function AddMorePopover(props) {
                const { schedulerData, headerItem, left, top, height, closeAction } = props;
                const { config, localeDayjs } = schedulerData;
                const { time, start, end, events } = headerItem;
              
              
              Severity: Minor
              Found in src/components/AddMorePopover.jsx - About 1 hr to fix

                Function AgendaResourceEvents has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function AgendaResourceEvents(props) {
                  const { schedulerData, resourceEvents, slotClickedFunc, slotItemTemplateResolver } = props;
                  const { startDate, endDate, config, localeDayjs } = schedulerData;
                  const width = schedulerData.getResourceTableWidth() - 2;
                
                
                Severity: Minor
                Found in src/components/AgendaResourceEvents.jsx - About 1 hr to fix

                  Function render has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render() {
                      const { viewModel, taskDndSource, resourceDndSource } = this.state;
                  
                      return (
                        <div>
                  Severity: Minor
                  Found in src/examples/pages/Drag-And-Drop/class-based.jsx - About 1 hr to fix

                    Function render has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render() {
                        const { viewModel } = this.state;
                    
                        let popover = <div />;
                        if (this.state.headerItem !== undefined) {
                    Severity: Minor
                    Found in src/examples/pages/Add-More/class-based.jsx - About 1 hr to fix

                      Function renderSlotItem has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const renderSlotItem = (item, indents) => {
                          let indent = <span key={`es${item.indent}`} className="expander-space" />;
                      
                          const iconProps = { key: `es${item.indent}`, onClick: () => handleToggleExpand(item) };
                          if (item.hasChildren) {
                      Severity: Minor
                      Found in src/components/ResourceView.jsx - About 1 hr to fix

                        Function _resolveDate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          _resolveDate(num, date = undefined) {
                            if (date !== undefined) {
                              this.selectDate = this.localeDayjs(date);
                            }
                        
                        
                        Severity: Minor
                        Found in src/components/SchedulerData.js - About 1 hr to fix

                          Function AddMore has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function AddMore() {
                            const [state, dispatch] = useReducer(reducer, initialState);
                          
                            const [popoverState, setPopoverState] = useState({
                              headerItem: undefined,
                          Severity: Minor
                          Found in src/examples/pages/Add-More/functional-based.jsx - About 1 hr 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 _createInitHeaderEvents has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            _createInitHeaderEvents(header) {
                              const start = this.localeDayjs(new Date(header.time));
                              const startValue = start.format(DATETIME_FORMAT);
                          
                              let endValue;
                          Severity: Minor
                          Found in src/components/SchedulerData.js - About 1 hr to fix

                            Function getDateLabel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const getDateLabel = (schedulerData, viewType, startDate, endDate) => {
                              const { localeDayjs } = schedulerData;
                              const start = localeDayjs(new Date(startDate));
                              const end = localeDayjs(endDate);
                              let dateLabel = '';
                            Severity: Minor
                            Found in src/helper/behaviors.js - About 1 hr 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 _resolveDate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                              _resolveDate(num, date = undefined) {
                                if (date !== undefined) {
                                  this.selectDate = this.localeDayjs(date);
                                }
                            
                            
                            Severity: Minor
                            Found in src/components/SchedulerData.js - About 1 hr 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 AgendaEventItem has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function AgendaEventItem(props) {
                              const { eventItem, isStart, isEnd, eventItemClick, schedulerData, eventItemTemplateResolver } = props;
                              const { config, behaviors } = schedulerData;
                            
                              let roundCls = 'round-none';
                            Severity: Minor
                            Found in src/components/AgendaEventItem.jsx - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language