ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Consider simplifying this complex logical expression.
Open

        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 ||
                type === 'element' || type === 'view:element' ||
Severity: Critical
Found in src/view/emptyelement.js - About 2 hrs to fix

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

    export default class Range {
        /**
         * Creates a range spanning from `start` position to `end` position.
         *
         * **Note:** Constructor creates it's own {@link module:engine/view/position~Position} instances basing on passed values.
    Severity: Minor
    Found in src/view/range.js - About 2 hrs to fix

      Function _next has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

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

      function _generateActionsFromChanges( oldChildrenLength, changes ) {
          const actions = [];
      
          let offset = 0;
          let oldChildrenHandled = 0;
      Severity: Minor
      Found in src/model/differ.js - About 2 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 insert has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          insert( item, itemOrPosition, offset = 0 ) {
              this._assertWriterUsedCorrectly();
      
              if ( item instanceof Text && item.data == '' ) {
                  return;
      Severity: Minor
      Found in src/model/writer.js - About 2 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 addBorderRules has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function addBorderRules( stylesProcessor ) {
          stylesProcessor.setNormalizer( 'border', borderNormalizer );
      
          // Border-position shorthands.
          stylesProcessor.setNormalizer( 'border-top', getBorderPositionNormalizer( 'top' ) );
      Severity: Major
      Found in src/view/styles/border.js - About 2 hrs to fix

        Renderer has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export default class Renderer {
            /**
             * Creates a renderer instance.
             *
             * @param {module:engine/view/domconverter~DomConverter} domConverter Converter instance.
        Severity: Minor
        Found in src/view/renderer.js - About 2 hrs to fix

          Differ has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default class Differ {
              /**
               * Creates a `Differ` instance.
               *
               * @param {module:engine/model/markercollection~MarkerCollection} markerCollection Model's marker collection.
          Severity: Minor
          Found in src/model/differ.js - About 2 hrs to fix

            Function findCorrespondingViewText has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                findCorrespondingViewText( domText ) {
                    if ( isInlineFiller( domText ) ) {
                        return null;
                    }
            
            
            Severity: Minor
            Found in src/view/domconverter.js - About 2 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 tryExtendingTo has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            function tryExtendingTo( data, value ) {
                // If found text, we can certainly put the focus in it. Let's just find a correct position
                // based on the unit.
                if ( value.type == 'text' ) {
                    if ( data.unit === 'word' ) {
            Severity: Minor
            Found in src/model/utils/modifyselection.js - About 2 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 _consume has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                _consume( type, item ) {
                    const items = isArray( item ) ? item : [ item ];
                    const consumables = this._consumables[ type ];
            
                    for ( const name of items ) {
            Severity: Minor
            Found in src/conversion/viewconsumable.js - About 2 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 getCorrectWordBreakPosition has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            function getCorrectWordBreakPosition( walker, isForward ) {
                let textNode = walker.position.textNode;
            
                if ( textNode ) {
                    let offset = walker.position.offset - textNode.startOffset;
            Severity: Minor
            Found in src/model/utils/modifyselection.js - About 2 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

            View has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export default class View {
                /**
                 * @param {module:engine/view/stylesmap~StylesProcessor} stylesProcessor The styles processor instance.
                 */
                constructor( stylesProcessor ) {
            Severity: Minor
            Found in src/view/view.js - About 2 hrs to fix

              Function parseInlineStyles has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              function parseInlineStyles( stylesString ) {
                  // `null` if no quote was found in input string or last found quote was a closing quote. See below.
                  let quoteType = null;
                  let propertyNameStart = 0;
                  let propertyValueStart = 0;
              Severity: Minor
              Found in src/view/stylesmap.js - About 2 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

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

              export default class DocumentSelection {
                  /**
                   * Creates new DocumentSelection instance.
                   *
                   *         // Creates empty selection without ranges.
              Severity: Minor
              Found in src/view/documentselection.js - About 2 hrs to fix

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

                export default class Position {
                    /**
                     * Creates a position.
                     *
                     * @param {module:engine/view/node~Node|module:engine/view/documentfragment~DocumentFragment} parent Position parent.
                Severity: Minor
                Found in src/view/position.js - About 2 hrs to fix

                  Mapper has 21 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export default class Mapper {
                      /**
                       * Creates an instance of the mapper.
                       */
                      constructor() {
                  Severity: Minor
                  Found in src/conversion/mapper.js - About 2 hrs to fix

                    Model has 21 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export default class Model {
                        constructor() {
                            /**
                             * Model's marker collection.
                             *
                    Severity: Minor
                    Found in src/model/model.js - About 2 hrs to fix

                      File insertcontent.js has 255 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/utils/insertcontent.js - About 2 hrs to fix

                        Function _walkView has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            _walkView( root, callback ) {
                                const ignore = this.ignoreRoot && this.root === root;
                        
                                if ( root.is( 'element' ) || root.is( 'documentFragment' ) ) {
                                    if ( root.is( 'element' ) && !ignore ) {
                        Severity: Minor
                        Found in src/dev-utils/view.js - About 2 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