ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

File transform.js has 950 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: Major
Found in src/model/operation/transform.js - About 2 days to fix

    Function _handleChange has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
    Open

        _handleChange( inc, changes ) {
            // We need a helper variable that will store how many nodes are to be still handled for this change item.
            // `nodesToHandle` (how many nodes still need to be handled) and `howMany` (how many nodes were affected)
            // needs to be differentiated.
            //
    Severity: Minor
    Found in src/model/differ.js - About 2 days 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 downcastwriter.js has 668 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: Major
    Found in src/view/downcastwriter.js - About 1 day to fix

      File differ.js has 592 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: Major
      Found in src/model/differ.js - About 1 day to fix

        File domconverter.js has 545 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: Major
        Found in src/view/domconverter.js - About 1 day to fix

          File writer.js has 543 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: Major
          Found in src/model/writer.js - About 1 day to fix

            File schema.js has 534 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: Major
            Found in src/model/schema.js - About 1 day to fix

              Function updateRelation has a Cognitive Complexity of 54 (exceeds 5 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: Minor
              Found in src/model/operation/transform.js - About 1 day 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 renderer.js has 469 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/renderer.js - About 7 hrs to fix

                File downcasthelpers.js has 465 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/conversion/downcasthelpers.js - About 7 hrs to fix

                  File documentselection.js has 464 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/documentselection.js - About 7 hrs to fix

                    File view.js has 457 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/dev-utils/view.js - About 7 hrs to fix

                      Function getChanges has a Cognitive Complexity of 45 (exceeds 5 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: Minor
                      Found in src/model/differ.js - About 6 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

                      DowncastWriter has 46 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export default class DowncastWriter {
                          /**
                           * @param {module:engine/view/document~Document} document The view document instance.
                           */
                          constructor( document ) {
                      Severity: Minor
                      Found in src/view/downcastwriter.js - About 6 hrs to fix

                        Function _getPositions has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                        Open

                            _getPositions( node ) {
                                if ( node.is( 'documentFragment' ) || node.is( 'element' ) ) {
                                    // Copy elements into the array, when nodes will be removed from parent node this array will still have all the
                                    // items needed for iteration.
                                    const children = [ ...node.getChildren() ];
                        Severity: Minor
                        Found in src/dev-utils/view.js - About 6 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

                        Writer has 44 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        export default class Writer {
                            /**
                             * Creates a writer instance.
                             *
                             * **Note:** It is not recommended to use it directly. Use {@link module:engine/model/model~Model#change `Model#change()`} or
                        Severity: Minor
                        Found in src/model/writer.js - About 6 hrs to fix

                          Function _handleChange has 141 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              _handleChange( inc, changes ) {
                                  // We need a helper variable that will store how many nodes are to be still handled for this change item.
                                  // `nodesToHandle` (how many nodes still need to be handled) and `howMany` (how many nodes were affected)
                                  // needs to be differentiated.
                                  //
                          Severity: Major
                          Found in src/model/differ.js - About 5 hrs to fix

                            File position.js has 400 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/position.js - About 5 hrs to fix

                              Consider simplifying this complex logical expression.
                              Open

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

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

                                    _onMutations( domMutations ) {
                                        // As a result of this.flush() we can have an empty collection.
                                        if ( domMutations.length === 0 ) {
                                            return;
                                        }
                                Severity: Minor
                                Found in src/view/observer/mutationobserver.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

                                Severity
                                Category
                                Status
                                Source
                                Language