o2xp/react-datatable

View on GitHub

Showing 19 of 79 total issues

File BodyActionsCell.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { Component, Fragment } from "react";
import {
  Tooltip,
  IconButton,
  Checkbox,
Severity: Minor
Found in src/components/DatatableCore/Body/BodyActionsCell.js - About 3 hrs to fix

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

      render() {
        const {
          rowsSelected,
          printText,
          printTitleText,
    Severity: Major
    Found in src/components/DatatableHeader/Widgets/Print.js - About 3 hrs to fix

      File DownloadData.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { Component, Fragment } from "react";
      import { connect } from "react-redux";
      import { cloneDeep } from "lodash";
      import {
        IconButton,
      Severity: Minor
      Found in src/components/DatatableHeader/Widgets/DownloadData.js - About 3 hrs to fix

        File Print.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { Component, Fragment } from "react";
        import { connect } from "react-redux";
        import {
          IconButton,
          Tooltip,
        Severity: Minor
        Found in src/components/DatatableHeader/Widgets/Print.js - About 2 hrs to fix

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

                      <FormControl>
                        <FormControlLabel
                          control={
                            <Checkbox
                              checked={columnsDisplayed}
          Severity: Major
          Found in src/components/DatatableHeader/Widgets/Print.js and 1 other location - About 2 hrs to fix
          src/components/DatatableHeader/Widgets/DownloadData.js on lines 230..243

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

          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

                      <FormControl>
                        <FormControlLabel
                          control={
                            <Checkbox
                              checked={columnsDisplayed}
          Severity: Major
          Found in src/components/DatatableHeader/Widgets/DownloadData.js and 1 other location - About 2 hrs to fix
          src/components/DatatableHeader/Widgets/Print.js on lines 201..214

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

          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 3 locations. Consider refactoring.
          Open

            onDateChange = date => {
              const newState = setValue({
                ...this.props,
                date
              });
          src/components/DatatableCore/InputTypes/DateTimePickerWrapper.js on lines 47..55
          src/components/DatatableCore/InputTypes/TimePickerWrapper.js on lines 47..55

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

          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 3 locations. Consider refactoring.
          Open

            onDateChange = date => {
              const newState = setValue({
                ...this.props,
                date
              });
          src/components/DatatableCore/InputTypes/DatePickerWrapper.js on lines 47..55
          src/components/DatatableCore/InputTypes/TimePickerWrapper.js on lines 47..55

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

          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 3 locations. Consider refactoring.
          Open

            onDateChange = date => {
              const newState = setValue({
                ...this.props,
                date
              });
          src/components/DatatableCore/InputTypes/DatePickerWrapper.js on lines 47..55
          src/components/DatatableCore/InputTypes/DateTimePickerWrapper.js on lines 47..55

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

          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 saveRowEdited has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const saveRowEdited = (state, payload) => {
            const row = payload;
            delete row.idOfColumnErr;
            delete row.hasBeenEdited;
            const { data, rowsEdited, keyColumn, pagination, actions } = state;
          Severity: Minor
          Found in src/redux/reducers/datatableReducer.js - About 1 hr to fix

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

              render() {
                const { canSelect, column, isScrolling } = this.props;
                const { checked } = this.state;
            
                return (
            Severity: Minor
            Found in src/components/DatatableCore/Header/HeaderActionsCell.js - About 1 hr to fix

              Function revertAllRowsToEdited has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const revertAllRowsToEdited = state => {
                const { newRows, data, keyColumn, pagination, rowsDeleted, actions } = state;
                const newRowsId = newRows.map(r => r[keyColumn]);
                const { rows } = data;
              
              
              Severity: Minor
              Found in src/redux/reducers/datatableReducer.js - About 1 hr to fix

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

                        <Tooltip
                          arrow
                          open={tooltipOpen}
                          classes={{
                            tooltip: classes.errorTooltip
                Severity: Major
                Found in src/components/DatatableCore/InputTypes/DatePickerWrapper.js and 3 other locations - About 40 mins to fix
                src/components/DatatableCore/InputTypes/DateTimePickerWrapper.js on lines 70..103
                src/components/DatatableCore/InputTypes/TextFieldWrapper.js on lines 102..126
                src/components/DatatableCore/InputTypes/TimePickerWrapper.js on lines 69..101

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

                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 4 locations. Consider refactoring.
                Open

                      <Tooltip
                        arrow
                        open={tooltipOpen}
                        classes={{
                          tooltip: classes.errorTooltip
                Severity: Major
                Found in src/components/DatatableCore/InputTypes/TextFieldWrapper.js and 3 other locations - About 40 mins to fix
                src/components/DatatableCore/InputTypes/DatePickerWrapper.js on lines 70..102
                src/components/DatatableCore/InputTypes/DateTimePickerWrapper.js on lines 70..103
                src/components/DatatableCore/InputTypes/TimePickerWrapper.js on lines 69..101

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

                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 4 locations. Consider refactoring.
                Open

                        <Tooltip
                          arrow
                          open={tooltipOpen}
                          classes={{
                            tooltip: classes.errorTooltip
                src/components/DatatableCore/InputTypes/DatePickerWrapper.js on lines 70..102
                src/components/DatatableCore/InputTypes/TextFieldWrapper.js on lines 102..126
                src/components/DatatableCore/InputTypes/TimePickerWrapper.js on lines 69..101

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

                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 4 locations. Consider refactoring.
                Open

                        <Tooltip
                          arrow
                          open={tooltipOpen}
                          classes={{
                            tooltip: classes.errorTooltip
                Severity: Major
                Found in src/components/DatatableCore/InputTypes/TimePickerWrapper.js and 3 other locations - About 40 mins to fix
                src/components/DatatableCore/InputTypes/DatePickerWrapper.js on lines 70..102
                src/components/DatatableCore/InputTypes/DateTimePickerWrapper.js on lines 70..103
                src/components/DatatableCore/InputTypes/TextFieldWrapper.js on lines 102..126

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

                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 setValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export const setValue = ({
                  date,
                  value,
                  dateFormat,
                  rowId,
                Severity: Minor
                Found in src/components/DatatableCore/InputTypes/PickersFunction.js - About 35 mins 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 4 locations. Consider refactoring.
                Open

                        <Dialog
                          open={dialogOpen}
                          onClose={() => this.toggleDialog(false)}
                          TransitionComponent={Transition}
                          fullWidth
                Severity: Major
                Found in src/components/DatatableHeader/Widgets/Print.js and 3 other locations - About 30 mins to fix
                src/components/DatatableHeader/Widgets/DownloadData.js on lines 188..275
                src/components/DatatableHeader/Widgets/RefreshRows.js on lines 91..146
                src/components/DatatableHeader/Widgets/UserConfiguration.js on lines 86..149

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

                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 CreateInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                const CreateInput = ({
                  cellVal,
                  valueVerification,
                  rowId,
                  columnId,
                Severity: Minor
                Found in src/components/DatatableCore/InputTypes/CreateInput.js - About 25 mins 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