SU-SWS/react_paragraphs

View on GitHub
js/src/Contexts/WidgetManager.js

Summary

Maintainability
A
0 mins
Test Coverage

File WidgetManager.js has 428 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import React, {Component} from "react";
import {v4 as uuidv4} from 'uuid';
import {UrlFix} from "../utils/UrlFix";

export const WidgetContext = React.createContext({});
Severity: Minor
Found in js/src/Contexts/WidgetManager.js - About 6 hrs to fix

    WidgetManager has 30 functions (exceeds 25 allowed). Consider refactoring.
    Wontfix

    export class WidgetManager extends Component {
    
      functions = {
        removeRowItem: this.removeRowItem.bind(this),
        onBeforeCapture: this.onBeforeCapture.bind(this),
    Severity: Minor
    Found in js/src/Contexts/WidgetManager.js - About 2 hrs to fix

      Function constructor has 50 lines of code (exceeds 40 allowed). Consider refactoring.
      Wontfix

        constructor(props) {
          super(props);
      
          // If the form was submitted and rebuilt, we will want to use the existing
          // form data to re-build the UI.
      Severity: Minor
      Found in js/src/Contexts/WidgetManager.js - About 1 hr to fix

        todo found
        Wontfix

          // todo: Improve these two methods!
        Severity: Minor
        Found in js/src/Contexts/WidgetManager.js by fixme

        todo found
        Wontfix

          // todo: Improve these two methods!
        Severity: Minor
        Found in js/src/Contexts/WidgetManager.js by fixme

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

            newState.rowOrder.map(rowId => {
              if (typeof newState.rows[rowId].items[itemId] !== 'undefined') {
                newState.rows[rowId].items[itemId].admin_title = title;
              }
            });
        Severity: Major
        Found in js/src/Contexts/WidgetManager.js and 1 other location - About 1 hr to fix
        js/src/Contexts/WidgetManager.js on lines 535..539

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

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

            newState.rowOrder.map(rowId => {
              if (typeof newState.rows[rowId].items[itemId] !== 'undefined') {
                newState.rows[rowId].items[itemId].width = newWidth;
              }
            });
        Severity: Major
        Found in js/src/Contexts/WidgetManager.js and 1 other location - About 1 hr to fix
        js/src/Contexts/WidgetManager.js on lines 160..164

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

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

              this.addRow(() => {
                const simulated_drag = {
                  draggableId: item_name,
                  destination: {
                    index: 0,
        Severity: Major
        Found in js/src/Contexts/WidgetManager.js and 1 other location - About 1 hr to fix
        js/src/Contexts/WidgetManager.js on lines 212..222

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

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

            else {
              const simulated_drag = {
                draggableId: item_name,
                destination: {
                  index: 0,
        Severity: Major
        Found in js/src/Contexts/WidgetManager.js and 1 other location - About 1 hr to fix
        js/src/Contexts/WidgetManager.js on lines 200..210

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

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

            const rowItemId = this.state.rows[rowId].itemsOrder.find(rowItemId => this.state.rows[rowId].items[rowItemId].target_id === itemId)
        Severity: Minor
        Found in js/src/Contexts/WidgetManager.js and 1 other location - About 50 mins to fix
        js/src/Contexts/WidgetManager.js on lines 657..657

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

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

            const rowId = this.state.rowOrder.find(rowId => this.state.rows[rowId].itemsOrder.find(rowItemId => this.state.rows[rowId].items[rowItemId].target_id === itemId));
        Severity: Minor
        Found in js/src/Contexts/WidgetManager.js and 1 other location - About 50 mins to fix
        js/src/Contexts/WidgetManager.js on lines 658..658

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

        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

        Parsing error: Unexpected token =
        Invalid

          functions = {
        Severity: Minor
        Found in js/src/Contexts/WidgetManager.js by eslint

        For more information visit Source: http://eslint.org/docs/rules/

        There are no issues that match your filters.

        Category
        Status