ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Function _updateChildren has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    _updateChildren( viewElement, options ) {
        const domElement = this.domConverter.mapViewToDom( viewElement );

        if ( !domElement ) {
            // If there is no `domElement` it means that it was already removed from DOM.
Severity: Minor
Found in src/view/renderer.js - 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

Function _updateMarkers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    _updateMarkers() {
        const markers = [];
        let changed = false;

        for ( const marker of this._model.markers ) {
Severity: Minor
Found in src/model/documentselection.js - 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

Function isSimilar has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    isSimilar( otherElement ) {
        if ( !( otherElement instanceof Element ) ) {
            return false;
        }

Severity: Minor
Found in src/view/element.js - 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

Function isTouching has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    isTouching( otherPosition ) {
        let left = null;
        let right = null;
        const compare = this.compareWith( otherPosition );

Severity: Minor
Found in src/model/position.js - 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

Function _createFromRanges has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    static _createFromRanges( ranges ) {
        if ( ranges.length === 0 ) {
            /**
             * At least one range has to be passed to
             * {@link module:engine/model/range~Range._createFromRanges `Range._createFromRanges()`}.
Severity: Minor
Found in src/model/range.js - 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

Function updateMarker has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    updateMarker( markerOrName, options ) {
        this._assertWriterUsedCorrectly();

        const markerName = typeof markerOrName == 'string' ? markerOrName : markerOrName.name;
        const currentMarker = this.model.markers.get( markerName );
Severity: Minor
Found in src/model/writer.js - 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

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

    _getTransformedByMove( sourcePosition, targetPosition, howMany, spread = false ) {
        // Special case for transforming a collapsed range. Just transform it like a position.
        if ( this.isCollapsed ) {
            const newPos = this.start._getTransformedByMove( sourcePosition, targetPosition, howMany );

Severity: Minor
Found in src/model/range.js - 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

Function viewToDom has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    viewToDom( viewNode, domDocument, options = {} ) {
        if ( viewNode.is( 'text' ) ) {
            const textData = this._processDataFromViewText( viewNode );

            return domDocument.createTextNode( textData );
Severity: Minor
Found in src/view/domconverter.js - About 1 hr to fix

    Function domPositionToView has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        domPositionToView( domParent, domOffset ) {
            if ( this.isBlockFiller( domParent, this.blockFillerMode ) ) {
                return this.domPositionToView( domParent.parentNode, indexOf( domParent ) );
            }
    
    
    Severity: Minor
    Found in src/view/domconverter.js - About 1 hr to fix

      Function _breakAttributes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _breakAttributes( position, forceSplitText = false ) {
              const positionOffset = position.offset;
              const positionParent = position.parent;
      
              // If position is placed inside EmptyElement - throw an exception as we cannot break inside.
      Severity: Minor
      Found in src/view/downcastwriter.js - About 1 hr to fix

        Function _wrapAttributeElement has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _wrapAttributeElement( wrapper, toWrap ) {
                if ( !canBeJoined( wrapper, toWrap ) ) {
                    return false;
                }
        
        
        Severity: Minor
        Found in src/view/downcastwriter.js - About 1 hr to fix

          Function _updateChildren has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _updateChildren( viewElement, options ) {
                  const domElement = this.domConverter.mapViewToDom( viewElement );
          
                  if ( !domElement ) {
                      // If there is no `domElement` it means that it was already removed from DOM.
          Severity: Minor
          Found in src/view/renderer.js - About 1 hr to fix

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

                _wrapChildren( parent, startOffset, endOffset, wrapElement ) {
                    let i = startOffset;
                    const wrapPositions = [];
            
                    while ( i < endOffset ) {
            Severity: Minor
            Found in src/view/downcastwriter.js - About 1 hr to fix

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

                  setTo( selectable, placeOrOffset, options ) {
                      if ( selectable === null ) {
                          this._setRanges( [] );
                          this._setFakeOptions( placeOrOffset );
                      } else if ( selectable instanceof Selection || selectable instanceof DocumentSelection ) {
              Severity: Minor
              Found in src/view/selection.js - About 1 hr to fix

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

                    constructor( doc ) {
                        super();
                
                        // List of selection markers.
                        // Marker is a selection marker when selection range is inside the marker range.
                Severity: Minor
                Found in src/model/documentselection.js - About 1 hr to fix

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

                  function tryFixingNonCollapsedRage( range, schema ) {
                      const start = range.start;
                      const end = range.end;
                  
                      const isTextAllowedOnStart = schema.checkChild( start, '$text' );
                  Severity: Minor
                  Found in src/model/utils/selection-post-fixer.js - About 1 hr to fix

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

                        viewPositionToDom( viewPosition ) {
                            const viewParent = viewPosition.parent;
                    
                            if ( viewParent.is( 'text' ) ) {
                                const domParent = this.findCorrespondingDomText( viewParent );
                    Severity: Minor
                    Found in src/view/domconverter.js - About 1 hr to fix

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

                          constructor( model, stylesProcessor ) {
                              /**
                               * Editor model.
                               *
                               * @readonly
                      Severity: Minor
                      Found in src/controller/editingcontroller.js - About 1 hr to fix

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

                            attachDomRoot( domRoot, name = 'main' ) {
                                const viewRoot = this.document.getRoot( name );
                        
                                // Set view root name the same as DOM root tag name.
                                viewRoot._name = domRoot.tagName.toLowerCase();
                        Severity: Minor
                        Found in src/view/view.js - About 1 hr to fix

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

                              isTouching( otherPosition ) {
                                  let left = null;
                                  let right = null;
                                  const compare = this.compareWith( otherPosition );
                          
                          
                          Severity: Minor
                          Found in src/model/position.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language