Showing 312 of 527 total issues
Function getRestartsPreyconf
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
const getRestartsPreyconf = (callback) => {
try {
// eslint-disable-next-line consistent-return
getDataDb('restarts_preyconf', (err, stored) => {
if (err) {
- 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
Open
return;
Avoid too many return
statements within this function. Open
Open
return cb(null, out);
Avoid too many return
statements within this function. Open
Open
return;
Avoid too many return
statements within this function. Open
Open
return True
Avoid too many return
statements within this function. Open
Open
return 2;
Avoid too many return
statements within this function. Open
Open
if (!check_range_format(date_from, date_until)) return 4;
Avoid too many return
statements within this function. Open
Open
return True
Avoid too many return
statements within this function. Open
Open
if (current_date > end_date) return 3;
Avoid too many return
statements within this function. Open
Open
return False
Avoid too many return
statements within this function. Open
Open
if (!check_repeat_format(days, hour_from, hour_until, until)) return 4;
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
if (current_triggers[trigger_index].last_exec) return;
Avoid too many return
statements within this function. Open
Open
return False
Avoid too many return
statements within this function. Open
Open
return 1;
Avoid too many return
statements within this function. Open
Open
if (!check_rules(rule)) return 2;
Avoid too many return
statements within this function. Open
Open
return 2;
Avoid too many return
statements within this function. Open
Open
return;
Avoid too many return
statements within this function. Open
Open
} else return 2;
Avoid too many return
statements within this function. Open
Open
return 0;