Showing 312 of 527 total issues
Function pre_uninstall
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.pre_uninstall = (values, cb) => {
const argument = values['-u'] && values.positional[0];
const updating = argument == 'true' || parseInt(argument) === 1;
const tasks = [daemon.remove, osHooks.pre_uninstall];
- 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 all
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
storage_fns.all = (opts, cb) => {
init(opts.type, null, (err, db) => {
if (err) return cb(err);
db_comm.all(queries.SELECT(opts.type), function (err, rows) {
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
Function add_label
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_label(self, text, font_name, font_size, x, y, width, height):
Avoid deeply nested control flow statements. Open
if (a) {
analyze(a, options.slice(parseInt(i) + 1));
break;
} else {
Avoid deeply nested control flow statements. Open
if (!stdoutsiBattery || !stdoutsiBattery.hasBattery) {
data.device_type = 'Desktop';
callback(null, data);
} else {
data.device_type = 'Laptop';
Function get_battery_status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.get_battery_status = function(callback){
exec('pmset -g batt', function(err, stdout){
if (err) return callback(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 notify_action
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.notify_action = function (status, id, name, opts, err, out) {
Function install
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.install = function (cb) {
var next = function (err) {
// EBUSY error is when file is being run. that shouldn't happen normally
// but for the purposes of setting up the daemon, it doesn't really matter.
if (err && err.code !== 'EBUSY') 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 as
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function as(user_type, type, bin, args, opts, cb) {
Function accessPointsFn
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const accessPointsFn = (cmd, args, cb) => {
if (common.os_release >= '12.0') {
sudo(cmd, args, (err, stdout, stderr) => {
if (stderr) logger.error(stderr);
return cb(err, stdout);
- 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 (errSetting) logger.error(`Error while setting shouldPreyCFile: ${errSetting}`);
Function post_missing
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.post_missing = (opt, cb) => {
if (!keys.get().api || !keys.get().device)
return cb(errors.get('MISSING_KEY'));
if (opt == null || typeof opt != 'boolean')
- 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 send
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
const send = function (attempt, method, path, data, options, cb) {
Avoid deeply nested control flow statements. Open
if (match) {
const value = match[1];
const matchValue = reqPreyConf[count].possiblevalues.exec(value);
if (matchValue) {
preyConfData[reqPreyConf[count].name] = value;
Avoid deeply nested control flow statements. Open
if (preyConfDataToWrite) {
dataToInsert = preyConfDataToWrite[reqPreyConf[count].name] ? preyConfDataToWrite[reqPreyConf[count].name] : '';
} else {
dataToInsert = reqPreyConf[count].default
|| ((typeof reqPreyConf[count].default === 'boolean') && reqPreyConf[count].default === false) ? reqPreyConf[count].default : '';
Function validate_new_user_fields
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate_new_user_fields(self, name, email, terms, age, passwd, passwd2 = None):
Avoid deeply nested control flow statements. Open
if (line.match(reqPreyConf[count].value)) {
if (reqPreyConf[count].word === 'api_key') {
apiKeyValue = true;
} else if (reqPreyConf[count].word === 'device_key') {
deviceKeyValue = true;
Function reactToCheckLocationPerms
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const reactToCheckLocationPerms = (data) => {
permissionFile.setData('nativeLocation', data[1].result, () => {
network.isWifiPermissionActive((output) => {
permissionFile.setData('wifiLocation', stringBooleanOrEmpty(output), () => {
// eslint-disable-next-line max-len
- 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 drawImage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def drawImage(self, file, width, height, x, y, view):
Function requestNativePermission
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const requestNativePermission = (cb) => {
if (osName.localeCompare('mac') !== 0) return cb(new Error('Action only allowed on MacOS'));
// eslint-disable-next-line consistent-return
socket.writeMessage(permissionFunction, () => {
const permissionNative = permissionFile.getData('nativeLocation');
- 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"