LukasBombach/Type.js

View on GitHub

Showing 5 of 10 total issues

Type has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Type {

  /**
   * Creates a new Type editor and sets up the core
   * modules used for WYSIWYG editing. The core
Severity: Minor
Found in src/core.js - About 2 hrs to fix

    Function insert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      insert(tag, startNode, endNode) {
    
        // Required variables
        var currentNode = startNode;
        var createdNodes = [];
    Severity: Minor
    Found in src/formatters/inline_formatter.js - About 45 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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
    
        // Load all nodes that need to be rendered
        const nodesToRender = this._cache.getOrCreateNodesForDocument(this._type.getDocument());
        let lastIdInCurrentlyRenderedNodes = null;
    Severity: Minor
    Found in src/renderers/dom/dom_renderer.js - About 45 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 getChild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getChild(id) {
    
        if (this.id === id) return this;
        let childWithId;
    
    
    Severity: Minor
    Found in src/document/block_node.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

    Function extend has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      static extend(copyTo, copyFrom) {
    
        var i;
        var key;
    
    
    Severity: Minor
    Found in src/utilities/utilities.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