Showing 323 of 551 total issues
Function remote
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.remote = function(values, cb) {
var wants_version = values.version;
var destination = values['-d'] || paths.versions;
- 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 use
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.use = function (obj) {
for (const key in obj) {
if (defaults.hasOwnProperty(key)) {
if (key == 'protocol' && ['http', 'https'].indexOf(obj[key]) === -1) {
logger.error(`Invalid protocol: ${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"
Further reading
Function send
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const send = function (attempt, method, path, data, options, cb) {
if (!defaults.client) {
const err = new Error('No HTTP client set!');
if (cb) return cb(err);
return 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 createServer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const createServer = (cb) => {
if (osName === 'linux') return cb(new Error('Service only available for mac and windows'));
checkService((valid) => {
if (!valid) return cb(new Error('Windows Service not compatible'));
- 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 notifyAck
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.notifyAck = (ackId, type, id, sent, retries = 0) => {
if (retries >= retriesMaxAck) {
removeAckFromArray(ackId);
return;
}
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
exports.start = (id, _opts, cb) => {
cb();
api.devices.get.status((err, response) => {
if (err) return;
const result = response && response.body;
- 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 checkRules
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const checkRules = (rule) => {
if (rule.second && (rule.second < 0 || rule.second > 60)) return false;
if (rule.minute && (rule.minute < 0 || rule.minute > 60)) return false;
if (rule.hour && (rule.hour < 0 || rule.hour > 24)) return false;
if (rule.dayOfWeek.some((elem) => elem > 6 || elem < 0)) return 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 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):
Function as
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function as(user_type, type, bin, args, opts, cb) {
Avoid deeply nested control flow statements. Open
if (errSetting) logger.error(`Error while setting shouldPreyCFile: ${errSetting}`);
Function get_osquery_running
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.get_osquery_running = (cb) => {
exec('ps aux | grep "/opt/osquery/lib/osquery.app/Contents/MacOS/osqueryd --flagfile=/private/var/prey/osquery.flags" | grep "^root" | awk \'{print $2}\' | tr -d \'\\n\'', (err, stdout, stderr) => {
if (err) return cb(null, false, 'osquery_running');
if (stderr) return cb(null, false, 'osquery_running');
const matchResult = stdout.match(/\d+/);
- 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 (!stdoutsiBattery || !stdoutsiBattery.hasBattery) {
data.device_type = 'Desktop';
callback(null, data);
} else {
data.device_type = 'Laptop';
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
Avoid deeply nested control flow statements. Open
if (a) {
analyze(a, options.slice(parseInt(i) + 1));
break;
} else {
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 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
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 send
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
const send = function (attempt, method, path, data, options, cb) {