ckeditor/ckeditor5-engine

View on GitHub

Showing 564 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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                      export function addMarginRules( stylesProcessor ) {
                          stylesProcessor.setNormalizer( 'margin', getPositionShorthandNormalizer( 'margin' ) );
                      
                          stylesProcessor.setNormalizer( 'margin-top', value => ( { path: 'margin.top', value } ) );
                          stylesProcessor.setNormalizer( 'margin-right', value => ( { path: 'margin.right', value } ) );
                      Severity: Major
                      Found in src/view/styles/margin.js and 1 other location - About 6 hrs to fix
                      src/view/styles/padding.js on lines 30..40

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 171.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                      export function addPaddingRules( stylesProcessor ) {
                          stylesProcessor.setNormalizer( 'padding', getPositionShorthandNormalizer( 'padding' ) );
                          stylesProcessor.setNormalizer( 'padding-top', value => ( { path: 'padding.top', value } ) );
                          stylesProcessor.setNormalizer( 'padding-right', value => ( { path: 'padding.right', value } ) );
                          stylesProcessor.setNormalizer( 'padding-bottom', value => ( { path: 'padding.bottom', value } ) );
                      Severity: Major
                      Found in src/view/styles/padding.js and 1 other location - About 6 hrs to fix
                      src/view/styles/margin.js on lines 30..41

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 171.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      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

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              is( type, name = null ) {
                                  if ( !name ) {
                                      return type === 'uiElement' || type === 'view:uiElement' ||
                                          // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
                                          type === this.name || type === 'view:' + this.name ||
                          Severity: Major
                          Found in src/view/uielement.js and 1 other location - About 5 hrs to fix
                          src/view/emptyelement.js on lines 76..89

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 151.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              is( type, name = null ) {
                                  if ( !name ) {
                                      return type === 'emptyElement' || type === 'view:emptyElement' ||
                                          // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
                                          type === this.name || type === 'view:' + this.name ||
                          Severity: Major
                          Found in src/view/emptyelement.js and 1 other location - About 5 hrs to fix
                          src/view/uielement.js on lines 89..102

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 151.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language