superdesk/superdesk-client-core

View on GitHub
scripts/core/editor3/directive.tsx

Summary

Maintainability
F
3 days
Test Coverage

Function initialize has 274 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initialize($element, editor3, $scope, $rootScope) {
        if (this.item == null) {
            throw new Error(
                'Item must be provided in order to be able to save editor_state on it',
            );
Severity: Major
Found in scripts/core/editor3/directive.tsx - About 1 day to fix

    File directive.tsx has 429 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable react/no-multi-comp */
    /* eslint-disable complexity */
    import React from 'react';
    import ReactDOM from 'react-dom';
    import {Provider} from 'react-redux';
    Severity: Minor
    Found in scripts/core/editor3/directive.tsx - About 6 hrs to fix

      Function renderEditor3 has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      const renderEditor3 = () => {
                          const element = $element.get(0);
      
                          ReactDOM.unmountComponentAtNode(element);
      
      
      Severity: Major
      Found in scripts/core/editor3/directive.tsx - About 4 hrs to fix

        Function generateHtml has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function generateHtml(
            store: Store<IEditorStore, AnyAction>,
            item: IArticle,
            pathToValue: string,
        ) {
        Severity: Minor
        Found in scripts/core/editor3/directive.tsx - About 1 hr to fix

          Function constructor has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              constructor() {
                  this.scope = {};
                  this.controllerAs = 'vm';
                  this.controller = [
                      '$element',
          Severity: Minor
          Found in scripts/core/editor3/directive.tsx - About 1 hr to fix

            Function getTemplateForHeader has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                                const getTemplateForHeader = () => {
                                    return (
                                        <div style={{display: 'flex'}} className="sd-input-style">
                                            <div className="authoring-header__item-label">
                                                {fieldName}
            Severity: Minor
            Found in scripts/core/editor3/directive.tsx - About 1 hr to fix

              Function generateHtml has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              function generateHtml(
                  store: Store<IEditorStore, AnyAction>,
                  item: IArticle,
                  pathToValue: string,
              ) {
              Severity: Minor
              Found in scripts/core/editor3/directive.tsx - 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

              There are no issues that match your filters.

              Category
              Status