ckeditor/ckeditor5-engine

View on GitHub

Showing 372 of 564 total issues

Function setAttributeOnItem has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function setAttributeOnItem( writer, key, value, item ) {
    const model = writer.model;
    const doc = model.document;
    const previousValue = item.getAttribute( key );
    let range, operation;
Severity: Minor
Found in src/model/writer.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 isEqual has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    isEqual( otherSelection ) {
        if ( this.isFake != otherSelection.isFake ) {
            return false;
        }

Severity: Minor
Found in src/view/selection.js - About 1 hr to fix

    Function prepareToAttributeConverter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function prepareToAttributeConverter( config, shallow ) {
        const matcher = new Matcher( config.view );
    
        return ( evt, data, conversionApi ) => {
            const match = matcher.match( data.viewItem );
    Severity: Minor
    Found in src/conversion/upcasthelpers.js - About 1 hr to fix

      Function modifySelection has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function modifySelection( model, selection, options = {} ) {
          const schema = model.schema;
          const isForward = options.direction != 'backward';
          const unit = options.unit ? options.unit : 'character';
      
      
      Severity: Minor
      Found in src/model/utils/modifyselection.js - About 1 hr to fix

        Function _createAt has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static _createAt( itemOrPosition, offset, stickiness = 'toNone' ) {
                if ( itemOrPosition instanceof Position ) {
                    return new Position( itemOrPosition.root, itemOrPosition.path, itemOrPosition.stickiness );
                } else {
                    const node = itemOrPosition;
        Severity: Minor
        Found in src/model/position.js - About 1 hr to fix

          Function _updateChildrenMappings has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _updateChildrenMappings( viewElement ) {
                  const domElement = this.domConverter.mapViewToDom( viewElement );
          
                  if ( !domElement ) {
                      // If there is no `domElement` it means that it was already removed from DOM and there is no need to process it.
          Severity: Minor
          Found in src/view/renderer.js - About 1 hr to fix

            Function insertUIElement has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function insertUIElement( elementCreator ) {
                return ( evt, data, conversionApi ) => {
                    // Create two view elements. One will be inserted at the beginning of marker, one at the end.
                    // If marker is collapsed, only "opening" element will be inserted.
                    data.isOpening = true;
            Severity: Minor
            Found in src/conversion/downcasthelpers.js - About 1 hr to fix

              Function _set has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _set( markerOrName, range, managedUsingOperations = false, affectsData = false ) {
                      const markerName = markerOrName instanceof Marker ? markerOrName.name : markerOrName;
                      const oldMarker = this._markers.get( markerName );
              
                      if ( oldMarker ) {
              Severity: Minor
              Found in src/model/markercollection.js - About 1 hr to fix

                Function setAttributeOnRange has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function setAttributeOnRange( writer, key, value, range ) {
                    const model = writer.model;
                    const doc = model.document;
                
                    // Position of the last split, the beginning of the new range.
                Severity: Minor
                Found in src/model/writer.js - About 1 hr to fix

                  Function HandleFontSizeValue has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function HandleFontSizeValue( editor ) {
                      // Add a special catch-all converter for the font size feature.
                      editor.conversion.for( 'upcast' ).elementToAttribute( {
                          view: {
                              name: 'span',

                    Function isSimilar has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        isSimilar( otherSelection ) {
                            if ( this.isBackward != otherSelection.isBackward ) {
                                return false;
                            }
                    
                    
                    Severity: Minor
                    Found in src/view/selection.js - About 1 hr to fix

                      Function _updateMarkers has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _updateMarkers() {
                              const markers = [];
                              let changed = false;
                      
                              for ( const marker of this._model.markers ) {
                      Severity: Minor
                      Found in src/model/documentselection.js - About 1 hr to fix

                        Function _normalizeNodes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function _normalizeNodes( nodes ) {
                            const normalized = [];
                        
                            if ( !( nodes instanceof Array ) ) {
                                nodes = [ nodes ];
                        Severity: Minor
                        Found in src/model/operation/utils.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                              if ( a.graveyardPosition && b.graveyardPosition && a.graveyardPosition.isEqual( b.graveyardPosition ) ) {
                                  const aInGraveyard = a.splitPosition.root.rootName == '$graveyard';
                                  const bInGraveyard = b.splitPosition.root.rootName == '$graveyard';
                          
                                  // If `aIsWeak` it means that `a` points to graveyard while `b` doesn't. Don't move nodes then.
                          Severity: Major
                          Found in src/model/operation/transform.js - About 1 hr to fix

                            Function normalizeBackground has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function normalizeBackground( value ) {
                                const background = {};
                            
                                const parts = getShorthandValues( value );
                            
                            
                            Severity: Minor
                            Found in src/view/styles/background.js - About 55 mins 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 _getTouchingInlineDomNode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                _getTouchingInlineDomNode( node, getNext ) {
                                    if ( !node.parentNode ) {
                                        return null;
                                    }
                            
                            
                            Severity: Minor
                            Found in src/view/domconverter.js - About 55 mins 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 _stringifyElementRanges has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                _stringifyElementRanges( element, offset ) {
                                    let start = '';
                                    let end = '';
                                    let collapsed = '';
                            
                            
                            Severity: Minor
                            Found in src/dev-utils/view.js - About 55 mins 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 _createAt has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                static _createAt( itemOrPosition, offset, stickiness = 'toNone' ) {
                                    if ( itemOrPosition instanceof Position ) {
                                        return new Position( itemOrPosition.root, itemOrPosition.path, itemOrPosition.stickiness );
                                    } else {
                                        const node = itemOrPosition;
                            Severity: Minor
                            Found in src/model/position.js - About 55 mins 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 convertSelection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                convertSelection( selection, markers, writer ) {
                                    const markersAtSelection = Array.from( markers.getMarkersAtPosition( selection.getFirstPosition() ) );
                            
                                    this.conversionApi.writer = writer;
                                    this.conversionApi.consumable = this._createSelectionConsumable( selection, markersAtSelection );
                            Severity: Minor
                            Found in src/conversion/downcastdispatcher.js - About 55 mins 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 transformSets has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function transformSets( operationsA, operationsB, options ) {
                                // Create new arrays so the originally passed arguments are not changed.
                                // No need to clone operations, they are cloned as they are transformed.
                                operationsA = operationsA.slice();
                                operationsB = operationsB.slice();
                            Severity: Minor
                            Found in src/model/operation/transform.js - About 55 mins 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