ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Function removeDisallowedAttributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    removeDisallowedAttributes( nodes, writer ) {
        for ( const node of nodes ) {
            // When node is a `Text` it has no children, so just filter it out.
            if ( node.is( 'text' ) ) {
                removeDisallowedAttributeFromNode( this, node, writer );
Severity: Minor
Found in src/model/schema.js - About 45 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

Avoid deeply nested control flow statements.
Open

                        if ( inc.offset < old.offset ) {
                            const intersectionLength = incEnd - old.offset;

                            old.offset = inc.offset;

Severity: Major
Found in src/model/differ.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        } else if ( inc.offset >= old.offset && inc.offset < oldEnd ) {
                            if ( incEnd > oldEnd ) {
                                inc.nodesToHandle = incEnd - oldEnd;
                                inc.offset = oldEnd;
                            } else {
    Severity: Major
    Found in src/model/differ.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if ( incEnd > oldEnd ) {
                                  // This case is similar to a case described when incoming change was insert and old change was attribute.
                                  // See comment above.
                                  //
                                  // This time incoming change is attribute. We need to split incoming change in this case too.
      Severity: Major
      Found in src/model/differ.js - About 45 mins to fix

        Function _isInInsertedElement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            _isInInsertedElement( element ) {
                const parent = element.parent;
        
                if ( !parent ) {
                    return false;
        Severity: Minor
        Found in src/model/differ.js - About 45 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 getLimitElement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            getLimitElement( selectionOrRangeOrPosition ) {
                let element;
        
                if ( selectionOrRangeOrPosition instanceof Position ) {
                    element = selectionOrRangeOrPosition.parent;
        Severity: Minor
        Found in src/model/schema.js - About 45 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

        Consider simplifying this complex logical expression.
        Open

                if ( !name ) {
                    return type === 'element' || type === 'model:element' ||
                        type === this.name || type === 'model:' + this.name ||
                        // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
                        type === 'node' || type === 'model:node';
        Severity: Major
        Found in src/model/element.js - About 40 mins to fix

          Function formatReturnValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function formatReturnValue( type, item, previousPosition, nextPosition, length ) {
          Severity: Minor
          Found in src/model/treewalker.js - About 35 mins to fix

            Function applyMarkerOperation has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function applyMarkerOperation( writer, name, oldRange, newRange, affectsData ) {
            Severity: Minor
            Found in src/model/writer.js - About 35 mins to fix

              Function handleForwardMovement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  handleForwardMovement( position, data ) {
                      const attribute = this.attribute;
              
                      // DON'T ENGAGE 2-SCM if gravity is already overridden. It means that we just entered
                      //
              Severity: Minor
              Found in src/utils/bindtwostepcarettoattribute.js - About 35 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 _handleSelectionChange has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  _handleSelectionChange( domDocument ) {
                      if ( !this.isEnabled ) {
                          return;
                      }
              
              
              Severity: Minor
              Found in src/view/observer/selectionobserver.js - About 35 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 matchAll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  matchAll( ...element ) {
                      const results = [];
              
                      for ( const singleElement of element ) {
                          for ( const pattern of this._patterns ) {
              Severity: Minor
              Found in src/view/matcher.js - About 35 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 _convertElement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function _convertElement( viewDocument, viewElement ) {
                  const info = _convertElementNameAndInfo( viewElement );
                  const ElementConstructor = allowedTypes[ info.type ];
                  const newElement = ElementConstructor ? new ElementConstructor( viewDocument, info.name ) : new ViewElement( viewDocument, info.name );
              
              
              Severity: Minor
              Found in src/dev-utils/view.js - About 35 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 _getTouchingViewTextNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  _getTouchingViewTextNode( node, getNext ) {
                      const treeWalker = new ViewTreeWalker( {
                          startPosition: getNext ? ViewPosition._createAfter( node ) : ViewPosition._createBefore( node ),
                          direction: getNext ? 'forward' : 'backward'
                      } );
              Severity: Minor
              Found in src/view/domconverter.js - About 35 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 wrap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  wrap( range, attribute ) {
                      if ( !( attribute instanceof AttributeElement ) ) {
                          throw new CKEditorError( 'view-writer-wrap-invalid-attribute', this.document );
                      }
              
              
              Severity: Minor
              Found in src/view/downcastwriter.js - About 35 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 compareWith has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  compareWith( otherPosition ) {
                      if ( this.root !== otherPosition.root ) {
                          return 'different';
                      }
              
              
              Severity: Minor
              Found in src/view/position.js - About 35 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 insert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  insert( position, nodes ) {
                      nodes = isIterable( nodes ) ? [ ...nodes ] : [ nodes ];
              
                      // Check if nodes to insert are instances of AttributeElements, ContainerElements, EmptyElements, UIElements or Text.
                      validateNodesToInsert( nodes, this.document );
              Severity: Minor
              Found in src/view/downcastwriter.js - About 35 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 _addToClonedElementsGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  _addToClonedElementsGroup( element ) {
                      // Add only if the element is in document tree.
                      if ( !element.root.is( 'rootElement' ) ) {
                          return;
                      }
              Severity: Minor
              Found in src/view/downcastwriter.js - About 35 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 getNormalized has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  getNormalized( name, styles ) {
                      if ( !name ) {
                          return merge( {}, styles );
                      }
              
              
              Severity: Minor
              Found in src/view/stylesmap.js - About 35 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 _needsInlineFillerAtSelection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  _needsInlineFillerAtSelection() {
                      if ( this.selection.rangeCount != 1 || !this.selection.isCollapsed ) {
                          return false;
                      }
              
              
              Severity: Minor
              Found in src/view/renderer.js - About 35 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