ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Function clear has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    clear( range, element ) {
        validateRangeContainer( range, this.document );

        // Create walker on given range.
        // We walk backward because when we remove element during walk it modifies range end position.
Severity: Minor
Found in src/view/downcastwriter.js - About 2 hrs 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        let inlineFillerPosition;

        // Refresh mappings.
        for ( const element of this.markedChildren ) {
Severity: Minor
Found in src/view/renderer.js - About 2 hrs 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 _mergeSiblingsOf has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    _mergeSiblingsOf( node, context ) {
        if ( !( node instanceof Element ) ) {
            return;
        }

Severity: Minor
Found in src/model/utils/insertcontent.js - About 2 hrs 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 handleBackwardMovement has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    handleBackwardMovement( position, data ) {
        const attribute = this.attribute;

        // When the gravity is already overridden...
        if ( this._isGravityOverridden ) {
Severity: Minor
Found in src/utils/bindtwostepcarettoattribute.js - About 1 hr to fix

    Function _previous has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _previous() {
            const previousPosition = this.position;
            const position = this.position.clone();
            const parent = this._visitedParent;
    
    
    Severity: Minor
    Found in src/model/treewalker.js - About 1 hr to fix

      Function changeAttribute has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function changeAttribute( attributeCreator ) {
          return ( evt, data, conversionApi ) => {
              const oldAttribute = attributeCreator( data.attributeOldValue, data );
              const newAttribute = attributeCreator( data.attributeNewValue, data );
      
      
      Severity: Minor
      Found in src/conversion/downcasthelpers.js - About 1 hr to fix

        Function _next has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _next() {
                const previousPosition = this.position;
                const position = this.position.clone();
                const parent = this._visitedParent;
        
        
        Severity: Minor
        Found in src/model/treewalker.js - About 1 hr to fix

          Function transformSets has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function transformSets( operationsA, operationsB, options ) {
              // Create new arrays so the originally passed arguments are not changed.
              // No need to clone operations, they are cloned as they are transformed.
              operationsA = operationsA.slice();
              operationsB = operationsB.slice();
          Severity: Minor
          Found in src/model/operation/transform.js - About 1 hr to fix

            Function matchClasses has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function matchClasses( patterns, element ) {
                const match = [];
            
                for ( const pattern of patterns ) {
                    if ( pattern instanceof RegExp ) {
            Severity: Minor
            Found in src/view/matcher.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 matchAttributes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function matchAttributes( patterns, element ) {
                const match = [];
            
                for ( const name in patterns ) {
                    const pattern = patterns[ name ];
            Severity: Minor
            Found in src/view/matcher.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 _breakAttributes has a Cognitive Complexity of 15 (exceeds 5 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

            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 isEqual has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                isEqual( otherSelection ) {
                    if ( this.isFake != otherSelection.isFake ) {
                        return false;
                    }
            
            
            Severity: Minor
            Found in src/view/selection.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 _normalizeNodes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            export function _normalizeNodes( nodes ) {
                const normalized = [];
            
                if ( !( nodes instanceof Array ) ) {
                    nodes = [ nodes ];
            Severity: Minor
            Found in src/model/operation/utils.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 _getTransformedByDeletion has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                _getTransformedByDeletion( deletePosition, howMany ) {
                    const transformed = Position._createAt( this );
            
                    // This position can't be affected if deletion was in a different root.
                    if ( this.root != deletePosition.root ) {
            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 createViewElementFromDefinition has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function createViewElementFromDefinition( viewElementDefinition, viewWriter, viewElementType ) {
                if ( typeof viewElementDefinition == 'string' ) {
                    // If `viewElementDefinition` is given as a `String`, normalize it to an object with `name` property.
                    viewElementDefinition = { name: viewElementDefinition };
                }
            Severity: Minor
            Found in src/conversion/downcasthelpers.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 _mergeSiblingsOf has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _mergeSiblingsOf( node, context ) {
                    if ( !( node instanceof Element ) ) {
                        return;
                    }
            
            
            Severity: Minor
            Found in src/model/utils/insertcontent.js - About 1 hr to fix

              Function _unwrapChildren has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _unwrapChildren( parent, startOffset, endOffset, unwrapElement ) {
                      let i = startOffset;
                      const unwrapPositions = [];
              
                      // Iterate over each element between provided offsets inside parent.
              Severity: Minor
              Found in src/view/downcastwriter.js - About 1 hr to fix

                Function insert has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    insert( item, itemOrPosition, offset = 0 ) {
                        this._assertWriterUsedCorrectly();
                
                        if ( item instanceof Text && item.data == '' ) {
                            return;
                Severity: Minor
                Found in src/model/writer.js - About 1 hr to fix

                  Function _getTransformedByMove has 45 lines of code (exceeds 25 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

                    Function domToView has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        domToView( domNode, options = {} ) {
                            if ( this.isBlockFiller( domNode, this.blockFillerMode ) ) {
                                return null;
                            }
                    
                    
                    Severity: Minor
                    Found in src/view/domconverter.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language