react-scheduler/react-big-schedule

View on GitHub

Showing 504 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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          if (isEvent) {
            const event = item;
            if (config.relativeMove) {
              newStart = localeDayjs(event.start)
                .add(localeDayjs(newStart).diff(localeDayjs(new Date(initialStart))), 'ms')
    Severity: Major
    Found in src/components/DnDContext.js and 1 other location - About 1 day to fix
    src/components/DnDSource.js on lines 33..57

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 302.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          if (isEvent) {
            const event = item;
            if (config.relativeMove) {
              newStart = localeDayjs(event.start)
                .add(localeDayjs(newStart).diff(localeDayjs(new Date(initialStart))), 'ms')
    Severity: Major
    Found in src/components/DnDSource.js and 1 other location - About 1 day to fix
    src/components/DnDContext.js on lines 90..114

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 302.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                if (viewType === ViewType.Day) {
                  this.startDate = date;
                  this.endDate = this.startDate;
                  this.cellUnit = CellUnit.Hour;
                } else if (viewType === ViewType.Week) {
      Severity: Major
      Found in src/components/SchedulerData.js and 1 other location - About 1 day to fix
      src/components/SchedulerData.js on lines 170..182

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 246.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        render() {
          const { viewModel } = this.state;
          return (
            <div>
              <div>
      Severity: Major
      Found in src/examples/CustomEventStyle.jsx and 1 other location - About 1 day to fix
      src/examples/CustomPopoverStyle.jsx on lines 18..45

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 246.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                if (viewType === ViewType.Week) {
                  this.startDate = this.localeDayjs(new Date(date)).startOf('week');
                  this.endDate = this.localeDayjs(new Date(this.startDate)).endOf('week');
                } else if (viewType === ViewType.Month) {
                  this.startDate = this.localeDayjs(new Date(date)).startOf('month');
      Severity: Major
      Found in src/components/SchedulerData.js and 1 other location - About 1 day to fix
      src/components/SchedulerData.js on lines 199..212

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 246.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        render() {
          const { viewModel } = this.state;
          return (
            <div>
              <div>
      Severity: Major
      Found in src/examples/CustomPopoverStyle.jsx and 1 other location - About 1 day to fix
      src/examples/CustomEventStyle.jsx on lines 24..51

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 246.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Identical blocks of code found in 6 locations. Consider refactoring.
        Open

          newEvent = (schedulerData, slotId, slotName, start, end, type, item) => {
            if (confirm(`Do you want to create a new event? {slotId: ${slotId}, slotName: ${slotName}, start: ${start}, end: ${end}, type: ${type}, item: ${item}}`)) {
              let newFreshId = 0;
              schedulerData.events.forEach(item => {
                if (item.id >= newFreshId) newFreshId = item.id + 1;
        Severity: Major
        Found in src/examples/AddMore.jsx and 5 other locations - About 7 hrs to fix
        src/examples/AddResource.jsx on lines 110..121
        src/examples/Basic.jsx on lines 103..123
        src/examples/CustomHeader.jsx on lines 103..123
        src/examples/CustomPopoverStyle.jsx on lines 91..111
        src/examples/OverlapCheck.jsx on lines 79..99

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 178.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 6 locations. Consider refactoring.
        Open

          newEvent = (schedulerData, slotId, slotName, start, end, type, item) => {
            if (confirm(`Do you want to create a new event? {slotId: ${slotId}, slotName: ${slotName}, start: ${start}, end: ${end}, type: ${type}, item: ${item}}`)) {
              let newFreshId = 0;
              schedulerData.events.forEach(item => {
                if (item.id >= newFreshId) newFreshId = item.id + 1;
        Severity: Major
        Found in src/examples/CustomHeader.jsx and 5 other locations - About 7 hrs to fix
        src/examples/AddMore.jsx on lines 119..139
        src/examples/AddResource.jsx on lines 110..121
        src/examples/Basic.jsx on lines 103..123
        src/examples/CustomPopoverStyle.jsx on lines 91..111
        src/examples/OverlapCheck.jsx on lines 79..99

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 178.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 6 locations. Consider refactoring.
        Open

          newEvent = (schedulerData, slotId, slotName, start, end, type, item) => {
            if (confirm(`Do you want to create a new event? {slotId: ${slotId}, slotName: ${slotName}, start: ${start}, end: ${end}, type: ${type}, item: ${item}}`)) {
              let newFreshId = 0;
              schedulerData.events.forEach(item => {
                if (item.id >= newFreshId) newFreshId = item.id + 1;
        Severity: Major
        Found in src/examples/Basic.jsx and 5 other locations - About 7 hrs to fix
        src/examples/AddMore.jsx on lines 119..139
        src/examples/AddResource.jsx on lines 110..121
        src/examples/CustomHeader.jsx on lines 103..123
        src/examples/CustomPopoverStyle.jsx on lines 91..111
        src/examples/OverlapCheck.jsx on lines 79..99

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 178.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 6 locations. Consider refactoring.
        Open

          newEvent = (schedulerData, slotId, slotName, start, end, type, item) => {
            if (confirm(`Do you want to create a new event? {slotId: ${slotId}, slotName: ${slotName}, start: ${start}, end: ${end}, type: ${type}, item: ${item}}`)) {
              let newFreshId = 0;
              schedulerData.events.forEach(item => {
                if (item.id >= newFreshId) newFreshId = item.id + 1;
        Severity: Major
        Found in src/examples/OverlapCheck.jsx and 5 other locations - About 7 hrs to fix
        src/examples/AddMore.jsx on lines 119..139
        src/examples/AddResource.jsx on lines 110..121
        src/examples/Basic.jsx on lines 103..123
        src/examples/CustomHeader.jsx on lines 103..123
        src/examples/CustomPopoverStyle.jsx on lines 91..111

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 178.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 6 locations. Consider refactoring.
        Open

          newEvent = (schedulerData, slotId, slotName, start, end, type, item) => {
            if (confirm(`Do you want to create a new event? {slotId: ${slotId}, slotName: ${slotName}, start: ${start}, end: ${end}, type: ${type}, item: ${item}}`)) {
              let newFreshId = 0;
              schedulerData.events.forEach(item => {
                if (item.id >= newFreshId) newFreshId = item.id + 1;
        Severity: Major
        Found in src/examples/AddResource.jsx and 5 other locations - About 7 hrs to fix
        src/examples/AddMore.jsx on lines 119..139
        src/examples/Basic.jsx on lines 103..123
        src/examples/CustomHeader.jsx on lines 103..123
        src/examples/CustomPopoverStyle.jsx on lines 91..111
        src/examples/OverlapCheck.jsx on lines 79..99

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 178.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 6 locations. Consider refactoring.
        Open

          newEvent = (schedulerData, slotId, slotName, start, end, type, item) => {
            if (confirm(`Do you want to create a new event? {slotId: ${slotId}, slotName: ${slotName}, start: ${start}, end: ${end}, type: ${type}, item: ${item}}`)) {
              let newFreshId = 0;
              schedulerData.events.forEach(item => {
                if (item.id >= newFreshId) newFreshId = item.id + 1;
        Severity: Major
        Found in src/examples/CustomPopoverStyle.jsx and 5 other locations - About 7 hrs to fix
        src/examples/AddMore.jsx on lines 119..139
        src/examples/AddResource.jsx on lines 110..121
        src/examples/Basic.jsx on lines 103..123
        src/examples/CustomHeader.jsx on lines 103..123
        src/examples/OverlapCheck.jsx on lines 79..99

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 178.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          cancelEndDrag = ev => {
            ev.stopPropagation();
        
            this.endResizer.removeEventListener('touchmove', this.doEndDrag, false);
            this.endResizer.removeEventListener('touchend', this.stopEndDrag, false);
        Severity: Major
        Found in src/components/EventItem.jsx and 1 other location - About 7 hrs to fix
        src/components/EventItem.jsx on lines 229..240

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 175.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          cancelStartDrag = ev => {
            ev.stopPropagation();
        
            this.startResizer.removeEventListener('touchmove', this.doStartDrag, false);
            this.startResizer.removeEventListener('touchend', this.stopStartDrag, false);
        Severity: Major
        Found in src/components/EventItem.jsx and 1 other location - About 7 hrs to fix
        src/components/EventItem.jsx on lines 362..373

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 175.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          _validateResource(resources) {
            if (Object.prototype.toString.call(resources) !== '[object Array]') {
              throw new Error('Resources should be Array object');
            }
        
        
        Severity: Major
        Found in src/components/SchedulerData.js and 1 other location - About 6 hrs to fix
        src/components/SchedulerData.js on lines 1044..1059

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 164.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          _validateEventGroups(eventGroups) {
            if (Object.prototype.toString.call(eventGroups) !== '[object Array]') {
              throw new Error('Event groups should be Array object');
            }
        
        
        Severity: Major
        Found in src/components/SchedulerData.js and 1 other location - About 6 hrs to fix
        src/components/SchedulerData.js on lines 1027..1042

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 164.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

        Severity
        Category
        Status
        Source
        Language