logger.js
Function log_if_level
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
Open
logger.log_if_level = (level, key, plugin) => function () {
if (logger.loglevel < logger[key]) { return; }
let logobj = {
level,
uuid: '-',
- 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 log_if_level
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
logger.log_if_level = (level, key, plugin) => function () {
if (logger.loglevel < logger[key]) { return; }
let logobj = {
level,
uuid: '-',
File logger.js
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
// Log class
const util = require('util');
const tty = require('tty');
Avoid deeply nested control flow statements. Open
Open
if (data.todo.client_uuid) { // dirty hack
logobj.origin = `outbound] [${data.todo.client_uuid}`;
}
Avoid deeply nested control flow statements. Open
Open
if (data.todo.uuid) logobj.uuid = data.todo.uuid;
Avoid deeply nested control flow statements. Open
Open
if (!logobj.message.endsWith(' ')) logobj.message += ' ';
Function stringify
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function stringify (obj) {
let str = '';
let key;
for (key in obj) {
let v = obj[key];
- 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"