Showing 564 of 564 total issues
Function mergeAttributes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
mergeAttributes( position ) {
const positionOffset = position.offset;
const positionParent = position.parent;
// When inside text node - nothing to merge.
- 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 _createAt
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static _createAt( itemOrPosition, offset ) {
if ( itemOrPosition instanceof Position ) {
return new this( itemOrPosition.parent, itemOrPosition.offset );
} else {
const node = itemOrPosition;
- 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 _add
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_add( type, item ) {
const items = isArray( item ) ? item : [ item ];
const consumables = this._consumables[ type ];
for ( const name of items ) {
- 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 markToSync
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
markToSync( type, node ) {
if ( type === 'text' ) {
if ( this.domConverter.mapViewToDom( node.parent ) ) {
this.markedTexts.add( node );
}
- 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 _validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_validate() {
const sourceElement = this.sourcePosition.parent;
const targetElement = this.targetPosition.parent;
const sourceOffset = this.sourcePosition.offset;
const targetOffset = this.targetPosition.offset;
- 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 mergeIntersectingRanges
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function mergeIntersectingRanges( ranges ) {
const nonIntersectingRanges = [];
// First range will always be fine.
nonIntersectingRanges.push( ranges.shift() );
- 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 getTransformedByOperations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
getTransformedByOperations( operations ) {
const ranges = [ new Range( this.start, this.end ) ];
for ( const operation of operations ) {
for ( let i = 0; i < ranges.length; i++ ) {
- 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 compileInheritPropertiesFrom
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function compileInheritPropertiesFrom( compiledDefinitions, itemName ) {
const item = compiledDefinitions[ itemName ];
for ( const inheritPropertiesOfItem of item.inheritTypesFrom ) {
const inheritFrom = compiledDefinitions[ inheritPropertiesOfItem ];
- 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 setAttributeOnRange
has a Cognitive Complexity of 10 (exceeds 5 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.
- 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 _getValidRangesForRange
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
* _getValidRangesForRange( range, attribute ) {
let start = range.start;
let end = range.start;
for ( const item of range.getItems( { shallow: true } ) ) {
- 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 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;
- 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 isEqual
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
isEqual( otherSelection ) {
if ( this.isFake != otherSelection.isFake ) {
return false;
}
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 );
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';
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;
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.
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;
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 ) {
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.
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',