react-scheduler/react-big-schedule

View on GitHub

Showing 537 of 537 total issues

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

      if (cellUnit !== CellUnit.Hour) {
        newEnd = localeDayjs(new Date(resourceEvents.headerItems[leftIndex].start)).hour(23).minute(59).second(59)
          .format(DATETIME_FORMAT);
      }
Severity: Major
Found in src/components/DnDContext.js and 1 other location - About 1 hr to fix
src/components/DnDContext.js on lines 44..47

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

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

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

          let newEnd = localeDayjs(new Date(eventItem.end))
            .add(cellUnit === CellUnit.Hour ? count * config.minuteStep : count, cellUnit === CellUnit.Hour ? 'minutes' : 'days')
            .format(DATETIME_FORMAT);
      Severity: Major
      Found in src/components/EventItem.jsx and 1 other location - About 1 hr to fix
      src/components/EventItem.jsx on lines 188..190

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

      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

          let newStart = localeDayjs(new Date(eventItem.start))
            .add(cellUnit === CellUnit.Hour ? count * config.minuteStep : count, cellUnit === CellUnit.Hour ? 'minutes' : 'days')
            .format(DATETIME_FORMAT);
      Severity: Major
      Found in src/components/EventItem.jsx and 1 other location - About 1 hr to fix
      src/components/EventItem.jsx on lines 319..321

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

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

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

              onViewChange = (schedulerData, view) => {
                schedulerData.setViewType(view.viewType, view.showAgenda, view.isEventPerspective);
                schedulerData.setEvents(DemoData.events);
                this.setState({
                  viewModel: schedulerData,
            Severity: Major
            Found in src/examples/pages/Read-Only/class-based.jsx and 1 other location - About 1 hr to fix
            src/examples/pages/Add-More/class-based.jsx on lines 93..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 69.

            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) => {
                schedulerData.setViewType(view.viewType, view.showAgenda, view.isEventPerspective);
                schedulerData.setEvents(DemoData.events);
                this.setState({
                  viewModel: schedulerData,
            Severity: Major
            Found in src/examples/pages/Add-More/class-based.jsx and 1 other location - About 1 hr to fix
            src/examples/pages/Read-Only/class-based.jsx on lines 61..67

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

            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 (this.supportTouch) {
                  if (ev.changedTouches.length === 0) return;
                  const touch = ev.changedTouches[0];
                  clientX = touch.pageX;
                } else {
            Severity: Major
            Found in src/components/EventItem.jsx and 1 other location - About 1 hr to fix
            src/components/EventItem.jsx on lines 124..130

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

            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 (this.supportTouch) {
                  if (ev.changedTouches.length === 0) return;
                  const touch = ev.changedTouches[0];
                  clientX = touch.pageX;
                } else {
            Severity: Major
            Found in src/components/EventItem.jsx and 1 other location - About 1 hr to fix
            src/components/EventItem.jsx on lines 252..258

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

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

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

              function reducer(state, action) {
                switch (action.type) {
                  case 'INITIALIZE':
                    return { showScheduler: true, viewModel: action.payload };
                  case 'UPDATE_SCHEDULER':
              Severity: Major
              Found in src/examples/pages/Drag-And-Drop/functional-based.jsx and 1 other location - About 1 hr to fix
              src/examples/pages/Add-More/functional-based.jsx on lines 11..20

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

              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

              function reducer(state, action) {
                switch (action.type) {
                  case 'INITIALIZE':
                    return { showScheduler: true, viewModel: action.payload };
                  case 'UPDATE_SCHEDULER':
              Severity: Major
              Found in src/examples/pages/Add-More/functional-based.jsx and 1 other location - About 1 hr to fix
              src/examples/pages/Drag-And-Drop/functional-based.jsx on lines 15..24

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

              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) {
                    contentScrollbarHeight = this.schedulerContent.offsetHeight - this.schedulerContent.clientHeight;
                    contentScrollbarWidth = this.schedulerContent.offsetWidth - this.schedulerContent.clientWidth;
                  }
              Severity: Major
              Found in src/components/index.jsx and 1 other location - About 1 hr to fix
              src/components/index.jsx on lines 319..322

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

              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.schedulerResource) {
                    resourceScrollbarHeight = this.schedulerResource.offsetHeight - this.schedulerResource.clientHeight;
                    resourceScrollbarWidth = this.schedulerResource.offsetWidth - this.schedulerResource.clientWidth;
                  }
              Severity: Major
              Found in src/components/index.jsx and 1 other location - About 1 hr to fix
              src/components/index.jsx on lines 315..318

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

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

                Severity
                Category
                Status
                Source
                Language