ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

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

    match( ...element ) {
        for ( const singleElement of element ) {
            for ( const pattern of this._patterns ) {
                const match = isElementMatching( singleElement, pattern );

Severity: Minor
Found in src/view/matcher.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 validateNodesToInsert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function validateNodesToInsert( nodes, errorContext ) {
    for ( const node of nodes ) {
        if ( !validNodesToInsert.some( ( validNode => node instanceof validNode ) ) ) { // eslint-disable-line no-use-before-define
            /**
             * Inserted nodes should be valid to insert. of {@link module:engine/view/attributeelement~AttributeElement AttributeElement},
Severity: Minor
Found in src/view/downcastwriter.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 _processDataFromDomText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _processDataFromDomText( node ) {
        let data = node.data;

        if ( _hasDomParentOfType( node, this.preElements ) ) {
            return getDataWithoutFiller( node );
Severity: Minor
Found in src/view/domconverter.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 _removeFromClonedElementsGroup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _removeFromClonedElementsGroup( element ) {
        // Traverse the element's children recursively to find other attribute elements that also got removed.
        // The loop is at the beginning so we can make fast returns later in the code.
        if ( element.is( 'element' ) ) {
            for ( const child of element.getChildren() ) {
Severity: Minor
Found in src/view/downcastwriter.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 _callPostFixers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _callPostFixers( writer ) {
        let wasFixed = false;

        do {
            for ( const callback of this._postFixers ) {
Severity: Minor
Found in src/view/document.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 normalizeBorderShorthand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function normalizeBorderShorthand( string ) {
    const result = {};

    const parts = getShorthandValues( string );

Severity: Minor
Found in src/view/styles/border.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 _removeAttribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _removeAttribute( key ) {
        this._fireChange( 'attributes', this );

        // Remove class attribute.
        if ( key == 'class' ) {
Severity: Minor
Found in src/view/element.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 _callPostFixers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _callPostFixers( writer ) {
        let wasFixed = false;

        do {
            for ( const callback of this._postFixers ) {
Severity: Minor
Found in src/model/document.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 _validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _validate() {
        const element = this.splitPosition.parent;
        const offset = this.splitPosition.offset;

        // Validate whether split operation has correct parameters.
Severity: Minor
Found in src/model/operation/splitoperation.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 _setAttributesTo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _setAttributesTo( attrs ) {
        const changed = new Set();

        for ( const [ oldKey, oldValue ] of this.getAttributes() ) {
            // Do not remove attribute if attribute with same key and value is about to be set.
Severity: Minor
Found in src/model/documentselection.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 normalizeToAttributeConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function normalizeToAttributeConfig( view ) {
    if ( typeof view == 'string' ) {
        return modelAttributeValue => ( { key: view, value: modelAttributeValue } );
    } else if ( typeof view == 'object' ) {
        // { key, value, ... }
Severity: Minor
Found in src/conversion/downcasthelpers.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 _getTransformedByMergeOperation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _getTransformedByMergeOperation( operation ) {
        const movedRange = operation.movedRange;
        const isContained = movedRange.containsPosition( this ) || movedRange.start.isEqual( this );

        let pos;
Severity: Minor
Found in src/model/position.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 _markDescendantTextToSync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _markDescendantTextToSync( viewNode ) {
        if ( !viewNode ) {
            return;
        }

Severity: Minor
Found in src/view/renderer.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 downcastAttributeToElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function downcastAttributeToElement( config ) {
    config = cloneDeep( config );

    const modelKey = config.model.key ? config.model.key : config.model;
    let eventName = 'attribute:' + modelKey;
Severity: Minor
Found in src/conversion/downcasthelpers.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 downcastAttributeToAttribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function downcastAttributeToAttribute( config ) {
    config = cloneDeep( config );

    const modelKey = config.model.key ? config.model.key : config.model;
    let eventName = 'attribute:' + modelKey;
Severity: Minor
Found in src/conversion/downcasthelpers.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 getAttribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    getAttribute( key ) {
        if ( key == 'class' ) {
            if ( this._classes.size > 0 ) {
                return [ ...this._classes ].join( ' ' );
            }
Severity: Minor
Found in src/view/element.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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    constructor( root, path, stickiness = 'toNone' ) {
        if ( !root.is( 'element' ) && !root.is( 'documentFragment' ) ) {
            /**
             * Position root is invalid.
             *
Severity: Minor
Found in src/model/position.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 getDifference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    getDifference( otherRange ) {
        const ranges = [];

        if ( this.isIntersecting( otherRange ) ) {
            // Ranges intersect.
Severity: Minor
Found in src/view/range.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 _getStoredAttributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    * _getStoredAttributes() {
        const selectionParent = this.getFirstPosition().parent;

        if ( this.isCollapsed && selectionParent.isEmpty ) {
            for ( const key of selectionParent.getAttributeKeys() ) {
Severity: Minor
Found in src/model/documentselection.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 jumpOverInlineFiller has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function jumpOverInlineFiller( evt, data ) {
    if ( data.keyCode == keyCodes.arrowleft ) {
        const domSelection = data.domTarget.ownerDocument.defaultView.getSelection();

        if ( domSelection.rangeCount == 1 && domSelection.getRangeAt( 0 ).collapsed ) {
Severity: Minor
Found in src/view/filler.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