ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Function domToView has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    domToView( domNode, options = {} ) {
        if ( this.isBlockFiller( domNode, this.blockFillerMode ) ) {
            return null;
        }

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

Position has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Position {
    /**
     * Creates a position.
     *
     * @param {module:engine/model/element~Element|module:engine/model/documentfragment~DocumentFragment} root Root of the position.
Severity: Minor
Found in src/model/position.js - About 5 hrs to fix

    Function _previous has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        _previous() {
            let position = this.position.clone();
            const previousPosition = this.position;
            const parent = position.parent;
    
    
    Severity: Minor
    Found in src/view/treewalker.js - About 4 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 _next has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        _next() {
            let position = this.position.clone();
            const previousPosition = this.position;
            const parent = position.parent;
    
    
    Severity: Minor
    Found in src/view/treewalker.js - About 4 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

    DomConverter has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class DomConverter {
        /**
         * Creates DOM converter.
         *
         * @param {module:engine/view/document~Document} document The view document instance.
    Severity: Minor
    Found in src/view/domconverter.js - About 4 hrs to fix

      Range has 35 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default class Range {
          /**
           * Creates a range spanning from `start` position to `end` position.
           *
           * @param {module:engine/model/position~Position} start Start position.
      Severity: Minor
      Found in src/model/range.js - About 4 hrs to fix

        Function viewToDom has a Cognitive Complexity of 30 (exceeds 5 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 4 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 _getSurroundingAttributes has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            _getSurroundingAttributes() {
                const position = this.getFirstPosition();
                const schema = this._model.schema;
        
                let attrs = null;
        Severity: Minor
        Found in src/model/documentselection.js - About 4 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

        File range.js has 348 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
         * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
         */
        
        
        Severity: Minor
        Found in src/model/range.js - About 4 hrs to fix

          DocumentSelection has 34 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default class DocumentSelection {
              /**
               * Creates an empty live selection for given {@link module:engine/model/document~Document}.
               *
               * @param {module:engine/model/document~Document} doc Document which owns this selection.
          Severity: Minor
          Found in src/model/documentselection.js - About 4 hrs to fix

            Element has 34 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export default class Element extends Node {
                /**
                 * Creates a view element.
                 *
                 * Attributes can be passed in various formats:
            Severity: Minor
            Found in src/view/element.js - About 4 hrs to fix

              Function bufferOperation has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                  bufferOperation( operation ) {
                      // Below we take an operation, check its type, then use its parameters in marking (private) methods.
                      // The general rule is to not mark elements inside inserted element. All inserted elements are re-rendered.
                      // Marking changes in them would cause a "double" changing then.
                      //
              Severity: Minor
              Found in src/model/differ.js - About 4 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 tryFixingNonCollapsedRage has a Cognitive Complexity of 29 (exceeds 5 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 4 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 updateRelation has 102 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  updateRelation( opA, opB ) {
                      // The use of relations is described in a bigger detail in transformation functions.
                      //
                      // In brief, this function, for specified pairs of operation types, checks how positions defined in those operations relate.
                      // Then those relations are saved. For example, for two move operations, it is saved if one of those operations target
              Severity: Major
              Found in src/model/operation/transform.js - About 4 hrs to fix

                Function getChanges has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    getChanges( options = { includeChangesInGraveyard: false } ) {
                        // If there are cached changes, just return them instead of calculating changes again.
                        if ( this._cachedChanges ) {
                            if ( options.includeChangesInGraveyard ) {
                                return this._cachedChangesWithGraveyard.slice();
                Severity: Major
                Found in src/model/differ.js - About 4 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ( !name ) {
                              return type === 'editableElement' || type === 'view:editableElement' ||
                                  // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
                                  type === 'containerElement' || type === 'view:containerElement' ||
                                  type === this.name || type === 'view:' + this.name ||
                  Severity: Critical
                  Found in src/view/editableelement.js - About 4 hrs to fix

                    Function domPositionToView has a Cognitive Complexity of 27 (exceeds 5 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 3 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 a Cognitive Complexity of 27 (exceeds 5 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 3 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

                    Selection has 29 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export default class Selection {
                        /**
                         * Creates a new selection instance based on the given {@link module:engine/model/selection~Selectable selectable}
                         * or creates an empty selection if no arguments were passed.
                         *
                    Severity: Minor
                    Found in src/model/selection.js - About 3 hrs to fix

                      File element.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
                       * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
                       */
                      
                      
                      Severity: Minor
                      Found in src/view/element.js - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language