Function stringifyReplacer
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
function stringifyReplacer(parentValue) {
const references = [];
const safeResults = [];
let complexity = 0;
return function stringifyKeyValue(key, value) {
- 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 stringifyReplacer
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function stringifyReplacer(parentValue) {
const references = [];
const safeResults = [];
let complexity = 0;
return function stringifyKeyValue(key, value) {
Function stringifyKeyValue
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function stringifyKeyValue(key, value) {
if (typeof value === 'object') {
if (value === null || value instanceof Date || value instanceof RegExp) {
return value;
}
Function getGenericEventHandler
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getGenericEventHandler() {
const logContainer = document.querySelector('#eventsLog');
let currentEventGroup = '';
let currentEventType = '';
let lastEvent = '';
Function genericEventHandler
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const genericEventHandler = function(e, type, eventGroup) {
currentEventGroup = eventGroup;
currentEventType = type;
let group = eventLogGroups[eventGroup];
Function incrementEvent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function incrementEvent(group, currentEventType, currentEventGroup, div, datum) {
Function getGenericEventHandler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getGenericEventHandler() {
const logContainer = document.querySelector('#eventsLog');
let currentEventGroup = '';
let currentEventType = '';
let lastEvent = '';
- 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
Avoid too many return
statements within this function. Open
return value;
Avoid too many return
statements within this function. Open
return value;
Avoid too many return
statements within this function. Open
return safe;
Avoid too many return
statements within this function. Open
return '<complexity exceeded>';
Avoid too many return
statements within this function. Open
return (safeResults[referenceIndex] = '<' + value + '...(see console)>');
Avoid too many return
statements within this function. Open
return `${value}`;
Function appendEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function appendEvent(container, currentEventType, currentEventGroup, data) {
const div = document.createElement('div');
div.classList.add('group-' + currentEventGroup, 'event-' + currentEventType, 'pre');
div.textContent = textContentGrouped(currentEventType);
div.setAttribute('title', `${currentEventGroup} event "${currentEventType}"`);
- 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 incrementEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function incrementEvent(group, currentEventType, currentEventGroup, div, datum) {
group[currentEventType]++;
div.textContent = textContentGrouped(currentEventType, group);
const logPreviousEvents = div.onclick;
const scopedDatum = Object.assign({}, datum);
- 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"