ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Function _unwrapChildren has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    _unwrapChildren( parent, startOffset, endOffset, unwrapElement ) {
        let i = startOffset;
        const unwrapPositions = [];

        // Iterate over each element between provided offsets inside parent.
Severity: Minor
Found in src/view/downcastwriter.js - About 1 hr 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 matchStyles has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function matchStyles( patterns, element ) {
    const match = [];

    for ( const name in patterns ) {
        const pattern = patterns[ name ];
Severity: Minor
Found in src/view/matcher.js - About 1 hr 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 _unwrapAttributeElement has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    _unwrapAttributeElement( wrapper, toUnwrap ) {
        if ( !canBeJoined( wrapper, toUnwrap ) ) {
            return false;
        }

Severity: Minor
Found in src/view/downcastwriter.js - About 1 hr 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 _revert has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    _revert( 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 1 hr 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 _updateAttributes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    _updateAttributes( clearAll ) {
        const newAttributes = toMap( this._getSurroundingAttributes() );
        const oldAttributes = toMap( this.getAttributes() );

        if ( clearAll ) {
Severity: Minor
Found in src/model/documentselection.js - About 1 hr 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 setTo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    setTo( selectable, placeOrOffset, options ) {
        if ( selectable === null ) {
            this._setRanges( [] );
        } else if ( selectable instanceof Selection ) {
            this._setRanges( selectable.getRanges(), selectable.isBackward );
Severity: Minor
Found in src/model/selection.js - About 1 hr 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 hasContent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    hasContent( rangeOrElement, options ) {
        const range = rangeOrElement instanceof ModelElement ? ModelRange._createIn( rangeOrElement ) : rangeOrElement;

        if ( range.isCollapsed ) {
            return false;
Severity: Minor
Found in src/model/model.js - About 1 hr 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 constructor has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    constructor( model ) {
        /**
         * The {@link module:engine/model/model~Model model} that the document is a part of.
         *
         * @readonly
Severity: Minor
Found in src/model/document.js - About 1 hr to fix

    Function _getSurroundingAttributes has 42 lines of code (exceeds 25 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 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

                  if ( type === 'move' ) {
                      isAffected =
                          positionOrRange.containsPosition( markerRange.start ) ||
                          positionOrRange.start.isEqual( markerRange.start ) ||
                          positionOrRange.containsPosition( markerRange.end ) ||
      Severity: Critical
      Found in src/model/writer.js - About 1 hr to fix

        Function parse has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function parse( data, schema, options = {} ) {
            const mapper = new Mapper();
        
            // Replace not accepted by XML `$text` tag name by valid one `model-text-with-attributes`.
            data = data.replace( new RegExp( '\\$text', 'g' ), 'model-text-with-attributes' );
        Severity: Minor
        Found in src/dev-utils/model.js - About 1 hr to fix

          Function render has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              render() {
                  let inlineFillerPosition;
          
                  // Refresh mappings.
                  for ( const element of this.markedChildren ) {
          Severity: Minor
          Found in src/view/renderer.js - About 1 hr to fix

            Function parseInlineStyles has 40 lines of code (exceeds 25 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 1 hr to fix

              Function stringify has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              export function stringify( node, selectionOrPositionOrRange = null, markers = null ) {
                  const model = new Model();
                  const mapper = new Mapper();
                  let selection, range;
              
              
              Severity: Minor
              Found in src/dev-utils/model.js - About 1 hr 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 _wrapChildren has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  _wrapChildren( parent, startOffset, endOffset, wrapElement ) {
                      let i = startOffset;
                      const wrapPositions = [];
              
                      while ( i < endOffset ) {
              Severity: Minor
              Found in src/view/downcastwriter.js - About 1 hr 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 _convertViewElements has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function _convertViewElements( rootNode ) {
                  if ( rootNode.is( 'element' ) || rootNode.is( 'documentFragment' ) ) {
                      // Convert element or leave document fragment.
              
                      const convertedElement = rootNode.is( 'documentFragment' ) ?
              Severity: Minor
              Found in src/dev-utils/view.js - About 1 hr 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 _formatReturnValue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  _formatReturnValue( type, item, previousPosition, nextPosition, length ) {
                      // Text is a specific parent, because contains string instead of children.
                      // Walker doesn't enter to the Text except situations when walker is iterating over every single character,
                      // or the bound starts/ends inside the Text. So when the position is at the beginning or at the end of the Text
                      // we move it just before or just after Text.
              Severity: Minor
              Found in src/view/treewalker.js - About 1 hr 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 _createRanges has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  _createRanges() {
                      const ranges = [];
                      let range = null;
              
                      for ( const item of this._positions ) {
              Severity: Minor
              Found in src/dev-utils/view.js - About 1 hr 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 isElementMatching has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function isElementMatching( element, pattern ) {
                  // If pattern is provided as function - return result of that function;
                  if ( typeof pattern == 'function' ) {
                      return pattern( element );
                  }
              Severity: Minor
              Found in src/view/matcher.js - About 1 hr 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 setTo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  setTo( selectable, placeOrOffset, options ) {
                      if ( selectable === null ) {
                          this._setRanges( [] );
                          this._setFakeOptions( placeOrOffset );
                      } else if ( selectable instanceof Selection || selectable instanceof DocumentSelection ) {
              Severity: Minor
              Found in src/view/selection.js - About 1 hr 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