Showing 43 of 49 total issues
Function set
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
set( name, value ) {
// If the first parameter is an Object, iterate over its properties.
if ( isObject( name ) ) {
Object.keys( name ).forEach( property => {
this.set( property, name[ property ] );
Function stopListening
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
stopListening( emitter, event, callback ) {
const emitters = this[ _listeningTo ];
let emitterId = emitter && _getEmitterId( emitter );
const emitterInfo = emitters && emitterId && emitters[ emitterId ];
const eventCallbacks = emitterInfo && event && emitterInfo.callbacks[ event ];
Function getCode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function getCode( key ) {
let keyCode;
if ( typeof key == 'string' ) {
keyCode = keyCodes[ key.toLowerCase() ];
- 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 scrollViewportToShowTarget
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function scrollViewportToShowTarget( { target, viewportOffset = 0 } ) {
const targetWindow = getWindow( target );
let currentWindow = targetWindow;
let currentFrame = null;
- 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 getSubNodes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function getSubNodes( head ) {
const nodes = [ head ];
// Nodes are stored to prevent infinite looping.
const subNodes = new Set();
- 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 bind
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
bind( ...bindProperties ) {
if ( !bindProperties.length || !isStringArray( bindProperties ) ) {
/**
* All properties must be strings.
*
Function excludeScrollbarsAndBorders
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
excludeScrollbarsAndBorders() {
const source = this._source;
let scrollBarWidth, scrollBarHeight, direction;
if ( isWindow( source ) ) {
Function generateKnownKeyCodes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateKnownKeyCodes() {
const keyCodes = {
arrowleft: 37,
arrowup: 38,
arrowright: 39,
Function _setToTarget
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_setToTarget( target, name, value, isDefine = false ) {
// In case of an object, iterate through it and call `_setToTarget` again for each property.
if ( isPlainObject( name ) ) {
this._setObjectToTarget( target, name, isDefine );
- 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 createEventNamespace
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function createEventNamespace( source, eventName ) {
const events = getEvents( source );
// First, check if the event we want to add to the structure already exists.
if ( events[ eventName ] ) {
- 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 getOptimalPosition
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function getOptimalPosition( { element, target, positions, limiter, fitInViewport } ) {
// If the {@link module:utils/dom/position~Options#target} is a function, use what it returns.
// https://github.com/ckeditor/ckeditor5-utils/issues/157
if ( isFunction( target ) ) {
target = target();
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
set( name, value ) {
// If the first parameter is an Object, iterate over its properties.
if ( isObject( name ) ) {
Object.keys( name ).forEach( property => {
this.set( property, name[ property ] );
- 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 _translate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function _translate( language, message, quantity = 1 ) {
if ( typeof quantity !== 'number' ) {
/**
* An incorrect value was passed to the translation function. This was probably caused
* by an incorrect message interpolation of a plural form. Note that for messages supporting plural forms
- 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 remove
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
remove( subject ) {
let index, id, item;
let itemDoesNotExist = false;
const idProperty = this._idProperty;
- 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 createElement
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function createElement( doc, name, attributes = {}, children = [] ) {
const namespace = attributes && attributes.xmlns;
const element = namespace ? doc.createElementNS( namespace, name ) : doc.createElement( name );
for ( const key in 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 constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor( source ) {
const isSourceRange = isRange( source );
/**
* The object this rect is for.
- 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 scrollWindowToShowRect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function scrollWindowToShowRect( window, rect, viewportOffset ) {
const targetShiftedDownRect = rect.clone().moveBy( 0, viewportOffset );
const targetShiftedUpRect = rect.clone().moveBy( 0, -viewportOffset );
const viewportRect = new Rect( window ).excludeScrollbarsAndBorders();
- 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 getDomRangeRects
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static getDomRangeRects( range ) {
const rects = [];
// Safari does not iterate over ClientRectList using for...of loop.
const clientRects = Array.from( range.getClientRects() );
- 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 _getItemIdBeforeAdding
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_getItemIdBeforeAdding( item ) {
const idProperty = this._idProperty;
let itemId;
if ( ( idProperty in item ) ) {
- 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 removeCallback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function removeCallback( emitter, event, callback ) {
const lists = getCallbacksListsForNamespace( emitter, event );
for ( const callbacks of lists ) {
for ( let i = 0; i < callbacks.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"