Showing 323 of 551 total issues
Function send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.send = (err, cb) => {
const { release } = require('os');
const { version } = require('./common');
const keys = require('./agent/control-panel/api/keys');
// prevent exceptions from being sent when running tests
- 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_logged_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
system.get_logged_user = (cb) => {
system.find_logged_user((e, user) => {
if (e || !user || user.trim() == '') {
const err = new Error('No logged user detected.');
if (e) err.message += ` ${e.message}`;
- 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 retrieve_old_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.retrieve_old_keys = function (file, cb) {
log(`Reading config keys from file: ${file}`);
fs.readFile(file, (err, data) => {
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 get_screenshot
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.get_screenshot = (callback) => {
// eslint-disable-next-line consistent-return
osFunctions.get_screenshot((err, filePath, fileType) => {
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 get_admin_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
system.get_admin_user = remember((cb) => {
system.find_admin_user((e, user) => {
if (e || !user || user.trim() == '') {
const err = new Error('No admin user detected.');
if (e) err.message += ` ${e.message}`;
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.update = function (values, cb) {
const key = values.positional[0];
const val = values.positional[1];
const dataFromName = reqPreyConf.filter((item) => item.name === key);
const dataToSave = (val.toLowerCase() === 'true' || val.toLowerCase() === 'false') ? isBoolean(val) : val;
- 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 set_current
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
versions.set_current = function (version, cb) {
if (!paths.versions)
return cb();
if (version == 'latest')
- 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 stop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function stop() {
if (timer)
clearTimeout(timer);
if (child) {
- 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 deleteOutlookProfiles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.deleteOutlookProfiles = (cb) => {
getProfileRegistry((err, profiles) => {
if (err) return cb();
profiles.forEach((profile, index) => {
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var get = exports.get = function(name, extra) {
var args = arguments,
cb,
options;
- 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 shutdown
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function shutdown(code, wait) {
var wait = wait || 10000;
const die = function (graceful) {
const msg = graceful ? 'Shutdown complete.' : "Time's up, shutdown forced.";
- 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 activate_event
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.activate_event = (trigger) => {
let eventIndex;
try {
eventIndex = trigger.automation_events.findIndex((obj) => eventsList.indexOf(obj.type) > -1);
} catch (e) {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
const start = function (type, id, name, opts, cb) {
// Action with same id is not executed
if (running[id]) {
const err = new Error(`Already running: ${running[id].name} with id: ${id}`);
hooks.emit('error', 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 wipeConfiguration
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.wipeConfiguration = (fillOnly, keepRoot, threepass) => {
wipeBinary.fillOnly = fillOnly;
wipeBinary.keepRoot = keepRoot;
wipeBinary.threepass = threepass;
- 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 writeMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const writeMessage = (functionName, cb, time = null) => {
if (osName !== 'mac') {
if (typeof cb === 'function') return cb();
// eslint-disable-next-line consistent-return
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 webSocketSettings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const webSocketSettings = () => {
notifyActionInterval = setInterval(retryQueuedResponses, 5000); // <-revisar el tiempo
notifyAckInterval = setInterval(retryAckResponses, 4 * 1000);
getStatusInterval = setInterval(getStatusByInterval, 5 * 60 * 1000);
setIntervalWSStatus = setInterval(exports.heartbeat, 30 * 1000);
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
function start(id, opts, cb) {
var opts = opts || {},
password = opts.password || opts.unlock_pass || default_pass,
message = opts.lock_message || "";
- 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 checkOsqueryPath
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const checkOsqueryPath = (mode) => {
const osqueryPath = '/private/var/prey';
try {
const stats = fs.statSync(osqueryPath);
if (stats.isDirectory() && mode === 'install') {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
exports.start = function(opts, cb) {
hooks.on('geofencing_start', function(fences) {
if (!fences) return;
zones = fences;
- 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 validate_new_user_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_new_user_fields(self):
if self.text('user_name') == '':
self.show_alert(_("Empty name!"), _("Please type in your name."))
return False
if self.text('email') == '':
- 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"