Function stopListening
has a Cognitive Complexity of 19 (exceeds 5 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 ];
- 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
File emittermixin.js
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
Function fire
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
fire( eventOrInfo, ...args ) {
try {
const eventInfo = eventOrInfo instanceof EventInfo ? eventOrInfo : new EventInfo( this, eventOrInfo );
const event = eventInfo.name;
let callbacks = getCallbacksForEvent( this, event );
- 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 listenTo
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
listenTo( emitter, event, callback, options = {} ) {
let emitterInfo, eventCallbacks;
// _listeningTo contains a list of emitters that this object is listening to.
// This list has the following format:
Function listenTo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
listenTo( emitter, event, callback, options = {} ) {
let emitterInfo, eventCallbacks;
// _listeningTo contains a list of emitters that this object is listening to.
// This list has the following format:
- 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 fire
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
fire( eventOrInfo, ...args ) {
try {
const eventInfo = eventOrInfo instanceof EventInfo ? eventOrInfo : new EventInfo( this, eventOrInfo );
const event = eventInfo.name;
let callbacks = getCallbacksForEvent( this, event );
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 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 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"
Further reading
Function stopDelegating
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
stopDelegating( event, emitter ) {
if ( !this._delegations ) {
return;
}
- 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"