ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Function isElementMatching has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function isElementMatching( element, pattern ) {
    // If pattern is provided as function - return result of that function;
    if ( typeof pattern == 'function' ) {
        return pattern( element );
    }
Severity: Minor
Found in src/view/matcher.js - About 1 hr to fix

    Function split has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        split( position, limitElement ) {
            this._assertWriterUsedCorrectly();
    
            let splitElement = position.parent;
    
    
    Severity: Minor
    Found in src/model/writer.js - About 1 hr to fix

      Function getNearestSelectionRange has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          getNearestSelectionRange( position, direction = 'both' ) {
              // Return collapsed range if provided position is valid.
              if ( this.checkChild( position, '$text' ) ) {
                  return new Range( position );
              }
      Severity: Minor
      Found in src/model/schema.js - About 1 hr to fix

        Function mergeAttributes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            mergeAttributes( position ) {
                const positionOffset = position.offset;
                const positionParent = position.parent;
        
                // When inside text node - nothing to merge.
        Severity: Minor
        Found in src/view/downcastwriter.js - About 1 hr to fix

          Function _handleSelectionChange has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _handleSelectionChange( domDocument ) {
                  if ( !this.isEnabled ) {
                      return;
                  }
          
          
          Severity: Minor
          Found in src/view/observer/selectionobserver.js - About 1 hr to fix

            Function _formatReturnValue has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _formatReturnValue( type, item, previousPosition, nextPosition, length ) {
                    // Text is a specific parent, because contains string instead of children.
                    // Walker doesn't enter to the Text except situations when walker is iterating over every single character,
                    // or the bound starts/ends inside the Text. So when the position is at the beginning or at the end of the Text
                    // we move it just before or just after Text.
            Severity: Minor
            Found in src/view/treewalker.js - About 1 hr to fix

              Function clear has 28 lines of code (exceeds 25 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 1 hr to fix

                Function _updateAttributes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _updateAttributes( clearAll ) {
                        const newAttributes = toMap( this._getSurroundingAttributes() );
                        const oldAttributes = toMap( this.getAttributes() );
                
                        if ( clearAll ) {
                Severity: Minor
                Found in src/model/documentselection.js - About 1 hr to fix

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

                      constructor( options = {} ) {
                          if ( !options.boundaries && !options.startPosition ) {
                              /**
                               * Neither boundaries nor starting position of a `TreeWalker` have been defined.
                               *
                  Severity: Minor
                  Found in src/model/treewalker.js - About 1 hr to fix

                    Function deleteContent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function deleteContent( model, selection, options = {} ) {
                        if ( selection.isCollapsed ) {
                            return;
                        }
                    
                    
                    Severity: Minor
                    Found in src/model/utils/deletecontent.js - About 1 hr to fix

                      Function mergeAttributes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          mergeAttributes( position ) {
                              const positionOffset = position.offset;
                              const positionParent = position.parent;
                      
                              // When inside text node - nothing to merge.
                      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 _createAt has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          static _createAt( itemOrPosition, offset ) {
                              if ( itemOrPosition instanceof Position ) {
                                  return new this( itemOrPosition.parent, itemOrPosition.offset );
                              } else {
                                  const node = itemOrPosition;
                      Severity: Minor
                      Found in src/view/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 _add has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          _add( type, item ) {
                              const items = isArray( item ) ? item : [ item ];
                              const consumables = this._consumables[ type ];
                      
                              for ( const name of items ) {
                      Severity: Minor
                      Found in src/conversion/viewconsumable.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 markToSync has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          markToSync( type, node ) {
                              if ( type === 'text' ) {
                                  if ( this.domConverter.mapViewToDom( node.parent ) ) {
                                      this.markedTexts.add( node );
                                  }
                      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 _validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          _validate() {
                              const sourceElement = this.sourcePosition.parent;
                              const targetElement = this.targetPosition.parent;
                              const sourceOffset = this.sourcePosition.offset;
                              const targetOffset = this.targetPosition.offset;
                      Severity: Minor
                      Found in src/model/operation/moveoperation.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 mergeIntersectingRanges has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function mergeIntersectingRanges( ranges ) {
                          const nonIntersectingRanges = [];
                      
                          // First range will always be fine.
                          nonIntersectingRanges.push( ranges.shift() );
                      Severity: Minor
                      Found in src/model/utils/selection-post-fixer.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 getTransformedByOperations has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          getTransformedByOperations( operations ) {
                              const ranges = [ new Range( this.start, this.end ) ];
                      
                              for ( const operation of operations ) {
                                  for ( let i = 0; i < ranges.length; i++ ) {
                      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 compileInheritPropertiesFrom has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function compileInheritPropertiesFrom( compiledDefinitions, itemName ) {
                          const item = compiledDefinitions[ itemName ];
                      
                          for ( const inheritPropertiesOfItem of item.inheritTypesFrom ) {
                              const inheritFrom = compiledDefinitions[ inheritPropertiesOfItem ];
                      Severity: Minor
                      Found in src/model/schema.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 setAttributeOnRange has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function setAttributeOnRange( writer, key, value, range ) {
                          const model = writer.model;
                          const doc = model.document;
                      
                          // Position of the last split, the beginning of the new range.
                      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 _getValidRangesForRange has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          * _getValidRangesForRange( range, attribute ) {
                              let start = range.start;
                              let end = range.start;
                      
                              for ( const item of range.getItems( { shallow: true } ) ) {
                      Severity: Minor
                      Found in src/model/schema.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

                      Severity
                      Category
                      Status
                      Source
                      Language