Showing 372 of 564 total issues
Function insertContent
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function insertContent( model, content, selectable, placeOrOffset ) {
return model.change( writer => {
let selection;
if ( !selectable ) {
Function prepareToElementConverter
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function prepareToElementConverter( config ) {
const matcher = config.view ? new Matcher( config.view ) : null;
return ( evt, data, conversionApi ) => {
let match = {};
Function isSimilar
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
isSimilar( otherSelection ) {
if ( this.isBackward != otherSelection.isBackward ) {
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 _updateChildrenMappings
has a Cognitive Complexity of 12 (exceeds 5 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.
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
constructor( options = {} ) {
if ( !options.boundaries && !options.startPosition ) {
/**
* Neither boundaries nor starting position of a `TreeWalker` 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 isEqual
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
isEqual( otherSelection ) {
if ( this.rangeCount != otherSelection.rangeCount ) {
return false;
} else if ( this.rangeCount === 0 ) {
return 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 getSelectedContent
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function getSelectedContent( model, selection ) {
return model.change( writer => {
const frag = writer.createDocumentFragment();
const range = selection.getFirstRange();
Function setTo
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
setTo( selectable, placeOrOffset, options ) {
if ( selectable === null ) {
this._setRanges( [] );
} else if ( selectable instanceof Selection ) {
this._setRanges( selectable.getRanges(), selectable.isBackward );
Function updateMarker
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateMarker( markerOrName, options ) {
this._assertWriterUsedCorrectly();
const markerName = typeof markerOrName == 'string' ? markerOrName : markerOrName.name;
const currentMarker = this.model.markers.get( markerName );
Function _stringifyTextRanges
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_stringifyTextRanges( node ) {
const length = node.data.length;
let result = node.data.split( '' );
let rangeStartToken, rangeEndToken;
Function findCorrespondingViewText
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
findCorrespondingViewText( domText ) {
if ( isInlineFiller( domText ) ) {
return null;
}
Function setData
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function setData( model, data, options = {} ) {
if ( !( model instanceof Model ) ) {
throw new TypeError( 'Model needs to be an instance of module:engine/model/model~Model.' );
}
Function convertSelection
has 34 lines of code (exceeds 25 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 );
Function constructor
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
/**
* Model's marker collection.
*
* @readonly
Consider simplifying this complex logical expression. Open
if ( isStartInLimit || isEndInLimit ) {
const bothInSameParent = ( start.nodeAfter && end.nodeBefore ) && start.nodeAfter.parent === end.nodeBefore.parent;
const expandStart = isStartInLimit && ( !bothInSameParent || !isInObject( start.nodeAfter, schema ) );
const expandEnd = isEndInLimit && ( !bothInSameParent || !isInObject( end.nodeBefore, schema ) );
Consider simplifying this complex logical expression. Open
if ( !name ) {
return type === 'rootElement' || type === 'model:rootElement' ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
type === 'element' || type === 'model:element' ||
type === this.name || type === 'model:' + this.name ||
Consider simplifying this complex logical expression. Open
if (
a.sourcePosition.isEqual( b.sourcePosition ) && !a.targetPosition.isEqual( b.targetPosition ) &&
!context.bWasUndone && context.abRelation != 'splitAtSource'
) {
const aToGraveyard = a.targetPosition.root.rootName == '$graveyard';
Consider simplifying this complex logical expression. Open
if ( !name ) {
return type === this.name || type === 'view:' + this.name ||
type === 'element' || type === 'view:element' ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
type === 'node' || type === 'view:node';
Function constructor
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor( stylesProcessor ) {
/**
* Instance of the {@link module:engine/view/document~Document} associated with this view controller.
*
* @readonly
Function _generateActionsFromChanges
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _generateActionsFromChanges( oldChildrenLength, changes ) {
const actions = [];
let offset = 0;
let oldChildrenHandled = 0;