Showing 372 of 564 total issues
Function ConvertDivAttributes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ConvertDivAttributes( editor ) {
// Allow <div> elements in the model.
editor.model.schema.register( 'div', {
allowWhere: '$block',
allowContentOf: '$root'
Function parse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parse( data, options = {} ) {
const viewDocument = new ViewDocument( new StylesProcessor() );
options.order = options.order || [];
const rangeParser = new RangeParser( {
Function isSimilar
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
isSimilar( otherElement ) {
if ( !( otherElement instanceof Element ) ) {
return false;
}
Function createViewElementFromDefinition
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createViewElementFromDefinition( viewElementDefinition, viewWriter, viewElementType ) {
if ( typeof viewElementDefinition == 'string' ) {
// If `viewElementDefinition` is given as a `String`, normalize it to an object with `name` property.
viewElementDefinition = { name: viewElementDefinition };
}
Function _stringifyTextRanges
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_stringifyTextRanges( node ) {
const length = node.data.length;
let result = node.data.split( '' );
let rangeStartToken, rangeEndToken;
- 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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
constructor( options = {} ) {
if ( !options.boundaries && !options.startPosition ) {
/**
* Neither boundaries nor starting position have been defined.
*
- 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 parse
has a Cognitive Complexity of 11 (exceeds 5 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' );
- 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 _checkAndSplitToAllowedPosition
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_checkAndSplitToAllowedPosition( node ) {
const allowedIn = this._getAllowedIn( node, this.position.parent );
if ( !allowedIn ) {
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 _set
has a Cognitive Complexity of 11 (exceeds 5 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 ) {
- 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 getSelectedBlocks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
* getSelectedBlocks() {
const visited = new WeakSet();
for ( const range of this.getRanges() ) {
// Get start block of range in case of a collapsed 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 modifySelection
has a Cognitive Complexity of 11 (exceeds 5 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';
- 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 checkAttributeInSelection
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
checkAttributeInSelection( selection, attribute ) {
if ( selection.isCollapsed ) {
const firstPosition = selection.getFirstPosition();
const context = [
...firstPosition.getAncestors(),
- 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 combineWalkers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function* combineWalkers( backward, forward ) {
let done = false;
while ( !done ) {
done = 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 getNearestSelectionRange
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
getNearestSelectionRange( position, direction = 'both' ) {
// Return collapsed range if provided position is valid.
if ( this.checkChild( position, '$text' ) ) {
return new Range( position );
}
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_unwrapAttributeElement( wrapper, toUnwrap ) {
if ( !canBeJoined( wrapper, toUnwrap ) ) {
return false;
}
Function _getAttributesDiff
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getAttributesDiff( range, oldAttributes, newAttributes ) {
// Results holder.
const diffs = [];
// Clone new attributes as we will be performing changes on this object.
Function _createFromRanges
has 31 lines of code (exceeds 25 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()`}.
Function jumpOverUiElement
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function jumpOverUiElement( evt, data, domConverter ) {
if ( data.keyCode == keyCodes.arrowright ) {
const domSelection = data.domTarget.ownerDocument.defaultView.getSelection();
const domSelectionCollapsed = domSelection.rangeCount == 1 && domSelection.getRangeAt( 0 ).collapsed;
Function _getTouchingInlineDomNode
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getTouchingInlineDomNode( node, getNext ) {
if ( !node.parentNode ) {
return null;
}
Function highlightText
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function highlightText( highlightDescriptor ) {
return ( evt, data, conversionApi ) => {
if ( !data.item ) {
return;
}