superdesk/superdesk-client-core

View on GitHub
scripts/core/editor3/helpers/patch-editor-3-html.ts

Summary

Maintainability
B
5 hrs
Test Coverage

Function updateText has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updateText(
    editorState: EditorState,
    contentState: ContentState,
    block: ContentBlock,
    newText: string,
Severity: Minor
Found in scripts/core/editor3/helpers/patch-editor-3-html.ts - About 1 hr to fix

    Function updateMedia has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    function updateMedia(
        contentState: ContentState,
        block: ContentBlock,
        newDescription: string,
        newAlt: string,
    Severity: Minor
    Found in scripts/core/editor3/helpers/patch-editor-3-html.ts - About 55 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

    Function updateText has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        editorState: EditorState,
        contentState: ContentState,
        block: ContentBlock,
        newText: string,
        diffMatchPatch,
    Severity: Minor
    Found in scripts/core/editor3/helpers/patch-editor-3-html.ts - About 45 mins to fix

      Function replaceText has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          editorState: EditorState,
          content: ContentState,
          block: ContentBlock,
          offset: number,
          text: string,
      Severity: Minor
      Found in scripts/core/editor3/helpers/patch-editor-3-html.ts - About 45 mins to fix

        Function updateMedia has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            contentState: ContentState,
            block: ContentBlock,
            newDescription: string,
            newAlt: string,
            newHeadline: string,
        Severity: Minor
        Found in scripts/core/editor3/helpers/patch-editor-3-html.ts - About 35 mins to fix

          Function removeText has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              editorState: EditorState,
              contentState: ContentState,
              block: ContentBlock,
              offset: number,
              text: string,
          Severity: Minor
          Found in scripts/core/editor3/helpers/patch-editor-3-html.ts - About 35 mins to fix

            Function insertText has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                editorState: EditorState,
                content: ContentState,
                block: ContentBlock,
                offset: number,
                text: string,
            Severity: Minor
            Found in scripts/core/editor3/helpers/patch-editor-3-html.ts - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status