ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Function ConvertDivAttributes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ConvertDivAttributes( editor ) {
    // Allow <div> elements in the model.
    editor.model.schema.register( 'div', {
        allowWhere: '$block',
        allowContentOf: '$root'
Severity: Minor
Found in docs/_snippets/framework/extending-content-allow-div-attributes.js - About 1 hr to fix

    Function parse has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function parse( data, options = {} ) {
        const viewDocument = new ViewDocument( new StylesProcessor() );
    
        options.order = options.order || [];
        const rangeParser = new RangeParser( {
    Severity: Minor
    Found in src/dev-utils/view.js - About 1 hr to fix

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

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

          Function _stringifyTextRanges has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              _stringifyTextRanges( node ) {
                  const length = node.data.length;
                  let result = node.data.split( '' );
                  let rangeStartToken, rangeEndToken;
          
          
          Severity: Minor
          Found in src/dev-utils/view.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 constructor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              constructor( options = {} ) {
                  if ( !options.boundaries && !options.startPosition ) {
                      /**
                       * Neither boundaries nor starting position have been defined.
                       *
          Severity: Minor
          Found in src/view/treewalker.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 parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          export function parse( data, schema, options = {} ) {
              const mapper = new Mapper();
          
              // Replace not accepted by XML `$text` tag name by valid one `model-text-with-attributes`.
              data = data.replace( new RegExp( '\\$text', 'g' ), 'model-text-with-attributes' );
          Severity: Minor
          Found in src/dev-utils/model.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 _checkAndSplitToAllowedPosition has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              _checkAndSplitToAllowedPosition( node ) {
                  const allowedIn = this._getAllowedIn( node, this.position.parent );
          
                  if ( !allowedIn ) {
                      return false;
          Severity: Minor
          Found in src/model/utils/insertcontent.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 _set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              _set( markerOrName, range, managedUsingOperations = false, affectsData = false ) {
                  const markerName = markerOrName instanceof Marker ? markerOrName.name : markerOrName;
                  const oldMarker = this._markers.get( markerName );
          
                  if ( oldMarker ) {
          Severity: Minor
          Found in src/model/markercollection.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 getSelectedBlocks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              * getSelectedBlocks() {
                  const visited = new WeakSet();
          
                  for ( const range of this.getRanges() ) {
                      // Get start block of range in case of a collapsed range.
          Severity: Minor
          Found in src/model/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 modifySelection has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function modifySelection( model, selection, options = {} ) {
              const schema = model.schema;
              const isForward = options.direction != 'backward';
              const unit = options.unit ? options.unit : 'character';
          
          
          Severity: Minor
          Found in src/model/utils/modifyselection.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 checkAttributeInSelection has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              checkAttributeInSelection( selection, attribute ) {
                  if ( selection.isCollapsed ) {
                      const firstPosition = selection.getFirstPosition();
                      const context = [
                          ...firstPosition.getAncestors(),
          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 combineWalkers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          function* combineWalkers( backward, forward ) {
              let done = false;
          
              while ( !done ) {
                  done = 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

          Function getNearestSelectionRange has a Cognitive Complexity of 11 (exceeds 5 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

          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 _unwrapAttributeElement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Function _getAttributesDiff has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _getAttributesDiff( range, oldAttributes, newAttributes ) {
                    // Results holder.
                    const diffs = [];
            
                    // Clone new attributes as we will be performing changes on this object.
            Severity: Minor
            Found in src/model/differ.js - About 1 hr to fix

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

                Function jumpOverUiElement has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function jumpOverUiElement( evt, data, domConverter ) {
                    if ( data.keyCode == keyCodes.arrowright ) {
                        const domSelection = data.domTarget.ownerDocument.defaultView.getSelection();
                        const domSelectionCollapsed = domSelection.rangeCount == 1 && domSelection.getRangeAt( 0 ).collapsed;
                
                
                Severity: Minor
                Found in src/view/uielement.js - About 1 hr to fix

                  Function _getTouchingInlineDomNode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _getTouchingInlineDomNode( node, getNext ) {
                          if ( !node.parentNode ) {
                              return null;
                          }
                  
                  
                  Severity: Minor
                  Found in src/view/domconverter.js - About 1 hr to fix

                    Function highlightText has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function highlightText( highlightDescriptor ) {
                        return ( evt, data, conversionApi ) => {
                            if ( !data.item ) {
                                return;
                            }
                    Severity: Minor
                    Found in src/conversion/downcasthelpers.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language