Showing 312 of 527 total issues
Function linkDevice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const linkDevice = (cb) => {
getDeviceData((err, deviceData) => {
const data = deviceData;
if (err) return cb(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
Function start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.start = function (opts, cb) {
hooks.on('connected', () => {
network.get_active_access_point((err, ap) => {
if (was_disconnected) {
logger.info(`Connection achieved! ${ap ? ap.ssid || '' : ''}`);
- 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 deeply nested control flow statements. Open
if (reqPreyConf[count].possiblevalues) {
if (reqPreyConf[count].value && !reqPreyConf[count].value.test(line)) {
somethingWrong = true;
dataToFix[reqPreyConf[count].name] = false;
}
Function start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.start = (id, opts, cb) => {
const done = (err = null) => {
if (err) return cb(err);
if (!emitter) emitter = new Emitter();
cb(err, emitter);
- 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 __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self):
button_text = "Close"
title = args.title
- 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 __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self):
button_text = "Close"
title = args.title
- 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
Consider simplifying this complex logical expression. Open
} else if ((body && body.key) || (body && body.user && body.user.key)) {
cb(null, set(body.key || body.user.key));
} else {
cb(errors.unknown(resp));
}
Consider simplifying this complex logical expression. Open
if (data.os_name == 'windows' && gte(os.release().trim(), "10.0.0") &&
data.os_edition && editions.includes(data.os_edition) &&
data.winsvc_version && gte(data.winsvc_version, "2.0.0"))
return true;
Consider simplifying this complex logical expression. Open
if ((val !== 'false' && val !== 'off' && key.includes('wipe_')) && (val === 'on' || val === 'true' || validDirs(val))) {
const method = key.replace('wipe_', ''); // just 'cookies'
if (typeof wipe[method] === 'function') list.push(method);
}
Consider simplifying this complex logical expression. Open
if (!dataToVerify || !dataFromDb
|| (typeof dataToVerify) !== 'object' || (typeof dataFromDb) !== 'object'
|| Object.keys(dataToVerify).length === 0
|| Object.keys(dataFromDb).length === 0) { return callback(false); }
Consider simplifying this complex logical expression. Open
} else if (info.days_of_week && info.hour) {
// At least the days and hour
try {
let rule = new schedule.RecurrenceRule();
Function trigger_running
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var trigger_running = function (type, trigger, name, opts, emitter) {
Function set_proxy_and_send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const set_proxy_and_send = function (method, path, data, opts, cb) {
Function store
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var store = function (type, id, name, opts, cb) {
Function drawRadio
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def drawRadio(self, title, default, tag, width, height):
Function drawInput
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def drawInput(self, type, id, title, x, y):
Function start
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const start = function (type, id, name, opts, cb) {
Function request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.request = function request(method, url, data, opts, cb) {
Function isAirportWorking
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const isAirportWorking = (cb) => {
sudo(airportCmd, ['-s'], (err, stdout, stderr) => {
if (err) {
logger.error(err);
return cb(false);
- 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 show_and_exit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var show_and_exit = function(force) {
var args = [],
gui_path = join(__dirname, os_name, 'prey-config');
- 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"