react-scheduler/react-big-schedule

View on GitHub

Showing 537 of 537 total issues

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

  onViewChange = (schedulerData, view) => {
    const start = new Date();
    schedulerData.setViewType(view.viewType, view.showAgenda, view.isEventPerspective);
    schedulerData.setEvents(DemoData.events);
    this.setState({ viewModel: schedulerData });
Severity: Major
Found in src/examples/pages/Custom-Time/class-based.jsx and 1 other location - About 5 hrs to fix
src/examples/pages/Basic/class-based.jsx on lines 71..82

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

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

  onViewChange = (schedulerData, view) => {
    const start = new Date();
    schedulerData.setViewType(view.viewType, view.showAgenda, view.isEventPerspective);
    schedulerData.setEvents(DemoData.events);
    this.setState({ viewModel: schedulerData });
Severity: Major
Found in src/examples/pages/Basic/class-based.jsx and 1 other location - About 5 hrs to fix
src/examples/pages/Custom-Time/class-based.jsx on lines 76..87

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

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.schedulerContent.scrollLeft !== this.scrollLeft) {
      if (this.schedulerContent.scrollLeft === 0 && onScrollLeft !== undefined) {
        onScrollLeft(schedulerData, this.schedulerContent, this.schedulerContent.scrollWidth - this.schedulerContent.clientWidth);
      }
      if (Math.round(this.schedulerContent.scrollLeft) === this.schedulerContent.scrollWidth - this.schedulerContent.clientWidth && onScrollRight !== undefined) {
Severity: Major
Found in src/components/index.jsx and 1 other location - About 5 hrs to fix
src/components/index.jsx on lines 415..422

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

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

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

            const schedulerData = new SchedulerData('2022-12-18', ViewType.Month, false, false, {
              schedulerMaxHeight: 500,
              besidesWidth: window.innerWidth <= 1600 ? 400 : 500,
              views: [
                { viewName: 'Agenda View', viewType: ViewType.Month, showAgenda: true, isEventPerspective: false },
        Severity: Major
        Found in src/examples/pages/Drag-And-Drop/class-based.jsx and 1 other location - About 4 hrs to fix
        src/examples/pages/Drag-And-Drop/functional-based.jsx on lines 33..41

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

        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

            schedulerData = new SchedulerData('2022-12-18', ViewType.Month, false, false, {
              schedulerMaxHeight: 500,
              besidesWidth: window.innerWidth <= 1600 ? 400 : 500,
              views: [
                { viewName: 'Agenda View', viewType: ViewType.Month, showAgenda: true, isEventPerspective: false },
        Severity: Major
        Found in src/examples/pages/Drag-And-Drop/functional-based.jsx and 1 other location - About 4 hrs to fix
        src/examples/pages/Drag-And-Drop/class-based.jsx on lines 15..23

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

        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.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 97..104

        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 154..161

        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

        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

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

            if (viewType === ViewType.Custom1) {
              const monday = localeDayjs(new Date(date)).startOf('week');
              startDate = num === 0 ? monday : localeDayjs(new Date(monday)).add(2 * num, 'weeks');
              endDate = localeDayjs(new Date(startDate)).add(1, 'weeks').endOf('week');
              cellUnit = CellUnit.Day;
          Severity: Major
          Found in src/helper/behaviors.js and 1 other location - About 3 hrs to fix
          src/helper/behaviors.js on lines 19..28

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

          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

            } else if (viewType === ViewType.Custom2) {
              const firstDayOfMonth = localeDayjs(new Date(date)).startOf('month');
              startDate = num === 0 ? firstDayOfMonth : localeDayjs(new Date(firstDayOfMonth)).add(2 * num, 'months');
              endDate = localeDayjs(new Date(startDate)).add(1, 'months').endOf('month');
              cellUnit = CellUnit.Day;
          Severity: Major
          Found in src/helper/behaviors.js and 1 other location - About 3 hrs to fix
          src/helper/behaviors.js on lines 14..28

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

          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

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

                    if (schedulerData._getEventSlotId(e) === slotId && (!isEvent || e.id !== item.id)) {
                      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/DnDSource.js and 1 other location - About 3 hrs to fix
          src/components/ResourceEvents.jsx on lines 192..196

          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

          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
              Severity
              Category
              Status
              Source
              Language