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.
- 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 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 ];
- 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 _unwrapAttributeElement
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
_unwrapAttributeElement( wrapper, toUnwrap ) {
if ( !canBeJoined( wrapper, toUnwrap ) ) {
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 _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 ) {
- 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 _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 ) {
- 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 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 );
- 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 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;
- 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 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
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;
Consider simplifying this complex logical expression. Open
if ( type === 'move' ) {
isAffected =
positionOrRange.containsPosition( markerRange.start ) ||
positionOrRange.start.isEqual( markerRange.start ) ||
positionOrRange.containsPosition( markerRange.end ) ||
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' );
Function render
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let inlineFillerPosition;
// Refresh mappings.
for ( const element of this.markedChildren ) {
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;
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;
- 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 _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 ) {
- 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 _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' ) ?
- 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 _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.
- 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 _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 ) {
- 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 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 );
}
- 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 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 ) {
- 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"