Showing 372 of 564 total issues
Function _updateChildren
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_updateChildren( viewElement, options ) {
const domElement = this.domConverter.mapViewToDom( viewElement );
if ( !domElement ) {
// If there is no `domElement` it means that it was already removed from DOM.
- Read upRead up
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 _updateMarkers
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_updateMarkers() {
const markers = [];
let changed = false;
for ( const marker of this._model.markers ) {
- Read upRead up
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 isSimilar
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
isSimilar( otherElement ) {
if ( !( otherElement instanceof Element ) ) {
return false;
}
- Read upRead up
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 isTouching
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
isTouching( otherPosition ) {
let left = null;
let right = null;
const compare = this.compareWith( otherPosition );
- Read upRead up
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 _createFromRanges
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
static _createFromRanges( ranges ) {
if ( ranges.length === 0 ) {
/**
* At least one range has to be passed to
* {@link module:engine/model/range~Range._createFromRanges `Range._createFromRanges()`}.
- Read upRead up
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 updateMarker
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
updateMarker( markerOrName, options ) {
this._assertWriterUsedCorrectly();
const markerName = typeof markerOrName == 'string' ? markerOrName : markerOrName.name;
const currentMarker = this.model.markers.get( markerName );
- Read upRead up
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 _getTransformedByMove
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_getTransformedByMove( sourcePosition, targetPosition, howMany, spread = false ) {
// Special case for transforming a collapsed range. Just transform it like a position.
if ( this.isCollapsed ) {
const newPos = this.start._getTransformedByMove( sourcePosition, targetPosition, howMany );
- Read upRead up
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 viewToDom
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
viewToDom( viewNode, domDocument, options = {} ) {
if ( viewNode.is( 'text' ) ) {
const textData = this._processDataFromViewText( viewNode );
return domDocument.createTextNode( textData );
Function domPositionToView
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
domPositionToView( domParent, domOffset ) {
if ( this.isBlockFiller( domParent, this.blockFillerMode ) ) {
return this.domPositionToView( domParent.parentNode, indexOf( domParent ) );
}
Function _breakAttributes
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
_breakAttributes( position, forceSplitText = false ) {
const positionOffset = position.offset;
const positionParent = position.parent;
// If position is placed inside EmptyElement - throw an exception as we cannot break inside.
Function _wrapAttributeElement
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
_wrapAttributeElement( wrapper, toWrap ) {
if ( !canBeJoined( wrapper, toWrap ) ) {
return false;
}
Function _updateChildren
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
_updateChildren( viewElement, options ) {
const domElement = this.domConverter.mapViewToDom( viewElement );
if ( !domElement ) {
// If there is no `domElement` it means that it was already removed from DOM.
Function _wrapChildren
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
_wrapChildren( parent, startOffset, endOffset, wrapElement ) {
let i = startOffset;
const wrapPositions = [];
while ( i < endOffset ) {
Function setTo
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
setTo( selectable, placeOrOffset, options ) {
if ( selectable === null ) {
this._setRanges( [] );
this._setFakeOptions( placeOrOffset );
} else if ( selectable instanceof Selection || selectable instanceof DocumentSelection ) {
Function constructor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor( doc ) {
super();
// List of selection markers.
// Marker is a selection marker when selection range is inside the marker range.
Function tryFixingNonCollapsedRage
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function tryFixingNonCollapsedRage( range, schema ) {
const start = range.start;
const end = range.end;
const isTextAllowedOnStart = schema.checkChild( start, '$text' );
Function viewPositionToDom
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
viewPositionToDom( viewPosition ) {
const viewParent = viewPosition.parent;
if ( viewParent.is( 'text' ) ) {
const domParent = this.findCorrespondingDomText( viewParent );
Function constructor
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor( model, stylesProcessor ) {
/**
* Editor model.
*
* @readonly
Function attachDomRoot
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
attachDomRoot( domRoot, name = 'main' ) {
const viewRoot = this.document.getRoot( name );
// Set view root name the same as DOM root tag name.
viewRoot._name = domRoot.tagName.toLowerCase();
Function isTouching
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
isTouching( otherPosition ) {
let left = null;
let right = null;
const compare = this.compareWith( otherPosition );