react-scheduler/react-big-schedule

View on GitHub
src/components/ResourceEvents.jsx

Summary

Maintainability
D
2 days
Test Coverage

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

      Consider simplifying this complex logical expression.
      Open

                if ((start >= eStart && start < eEnd) || (end > eStart && end <= eEnd) || (eStart >= start && eStart < end) || (eEnd > start && eEnd <= end)) hasConflict = true;
      Severity: Critical
      Found in src/components/ResourceEvents.jsx - About 1 hr to fix

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

            if (this.supportTouch) {
              document.documentElement.removeEventListener('touchmove', this.doDrag, false);
              document.documentElement.removeEventListener('touchend', this.stopDrag, false);
              document.documentElement.removeEventListener('touchcancel', this.cancelDrag, false);
            } else {
        Severity: Major
        Found in src/components/ResourceEvents.jsx and 1 other location - About 4 hrs to fix
        src/components/ResourceEvents.jsx on lines 95..102

        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 120.

        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 (this.supportTouch) {
              document.documentElement.addEventListener('touchmove', this.doDrag, false);
              document.documentElement.addEventListener('touchend', this.stopDrag, false);
              document.documentElement.addEventListener('touchcancel', this.cancelDrag, false);
            } else {
        Severity: Major
        Found in src/components/ResourceEvents.jsx and 1 other location - About 4 hrs to fix
        src/components/ResourceEvents.jsx on lines 152..159

        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 120.

        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 (schedulerData._getEventSlotId(e) === slotId) {
                  const eStart = localeDayjs(e.start);
                  const eEnd = localeDayjs(e.end);
                  if ((start >= eStart && start < eEnd) || (end > eStart && end <= eEnd) || (eStart >= start && eStart < end) || (eEnd > start && eEnd <= end)) hasConflict = true;
                }
        Severity: Major
        Found in src/components/ResourceEvents.jsx and 1 other location - About 3 hrs to fix
        src/components/DnDSource.js on lines 65..69

        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 105.

        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

        There are no issues that match your filters.

        Category
        Status