ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Function _getAllUpcastDefinitions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function* _getAllUpcastDefinitions( definition ) {
    if ( definition.model.values ) {
        for ( const value of definition.model.values ) {
            const model = { key: definition.model.key, value };
            const view = definition.view[ value ];
Severity: Minor
Found in src/conversion/conversion.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

Function _getTransformedByMove has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    _getTransformedByMove( sourcePosition, targetPosition, howMany ) {
        // Update target position, as it could be affected by nodes removal.
        targetPosition = targetPosition._getTransformedByDeletion( sourcePosition, howMany );

        if ( sourcePosition.isEqual( targetPosition ) ) {
Severity: Minor
Found in src/model/position.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

Function _splitToAllowedParent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    _splitToAllowedParent( node, modelCursor ) {
        // Try to find allowed parent.
        const allowedParent = this.conversionApi.schema.findAllowedParent( modelCursor, node );

        // When there is no parent that allows to insert node then return `null`.
Severity: Minor
Found in src/conversion/upcastdispatcher.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

Function extractMarkersFromModelFragment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function extractMarkersFromModelFragment( modelItem, writer ) {
    const markerElements = new Set();
    const markers = new Map();

    // Create ModelTreeWalker.
Severity: Minor
Found in src/conversion/upcastdispatcher.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

Function updatePlaceholder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function updatePlaceholder( writer, element, config ) {
    const { text, isDirectHost } = config;

    const hostElement = isDirectHost ? element : getChildPlaceholderHostSubstitute( element );
    let wasViewModified = false;
Severity: Minor
Found in src/view/placeholder.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

Function _findReplaceActions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    _findReplaceActions( actions, actualDom, expectedDom ) {
        // If there is no both 'insert' and 'delete' actions, no need to check for replaced elements.
        if ( actions.indexOf( 'insert' ) === -1 || actions.indexOf( 'delete' ) === -1 ) {
            return actions;
        }
Severity: Minor
Found in src/view/renderer.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

Function mergeBranches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function mergeBranches( writer, startPos, endPos ) {
    const startParent = startPos.parent;
    const endParent = endPos.parent;

    // If both positions ended up in the same parent, then there's nothing more to merge:
Severity: Minor
Found in src/model/utils/deletecontent.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

Function _getChildrenSnapshot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function _getChildrenSnapshot( children ) {
    const snapshot = [];

    for ( const child of children ) {
        if ( child.is( 'text' ) ) {
Severity: Minor
Found in src/model/differ.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

Function fromJSON has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    static fromJSON( json ) {
        let children = null;

        if ( json.children ) {
            children = [];
Severity: Minor
Found in src/model/element.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

Avoid too many return statements within this function.
Open

                    return true;
Severity: Major
Found in src/utils/bindtwostepcarettoattribute.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                        return new ViewPosition( viewParent, 0 );
    Severity: Major
    Found in src/view/domconverter.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                          return null;
      Severity: Major
      Found in src/view/domconverter.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return this.mergeAttributes( new Position( nodeBefore, count ) );
        Severity: Major
        Found in src/view/downcastwriter.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return this._next();
          Severity: Major
          Found in src/view/treewalker.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return this._formatReturnValue( 'text', textProxy, previousPosition, position, textLength );
            Severity: Major
            Found in src/view/treewalker.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return true;
              Severity: Major
              Found in src/view/downcastwriter.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return this._formatReturnValue( 'elementStart', node, previousPosition, position, 1 );
                Severity: Major
                Found in src/view/treewalker.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return false;
                  Severity: Major
                  Found in src/view/matcher.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return this._formatReturnValue( 'text', textProxy, previousPosition, position, textLength );
                    Severity: Major
                    Found in src/view/treewalker.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return position;
                      Severity: Major
                      Found in src/view/downcastwriter.js - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language