Showing 551 of 551 total issues
Function get_osquery_running
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.get_osquery_running = (cb) => {
exec('sc query preyosqueryd', (err, stdout, stderr) => {
if (err) return cb(null, false, 'osquery_running');
if (stderr) return cb(null, false, 'osquery_running');
if (stdout.includes('RUNNING')) {
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
exports.get_screenshot = (callback) => {
socket.writeMessage(nameArray[4], (err, data) => {
if (err) return exports.get_screenshot_old(callback);
try {
if (typeof data.result.success === 'boolean' && data.result.success === 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 get_current_hostname
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.get_current_hostname = (callback) => {
exec("hostname", (err, stdout) => {
if (err) {
if (typeof callback !== 'function')
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 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"
Further reading
Function get_picture
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.get_picture = (callback) => {
// eslint-disable-next-line consistent-return
osFunction.get_picture((err, filePath, fileType) => {
try {
if (err) return callback(err, null, 'picture');
- 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 exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(cmd, args, opts, cb) {
var opts = opts || {};
// set detached so that when running from an already-detached process we don't
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
const update = (key, val, cb) => {
if (!key) { return cb(new Error('Key required.')); }
const current = config.getData(key);
if (val === null || val === undefined) { return cb(new Error(`Please provide a value for ${key}. Current is \`${current}\``)); }
- 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 unlink
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.unlink = (cb) => {
if (!keys.get().api || !keys.get().device)
return cb(errors.get('MISSING_KEY'));
request.delete('/devices/' + keys.get().device, {}, (err, resp) => {
- 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 exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(msg) {
if (empty(msg)) return;
if (!stream) {
if (process.stdout && process.stdout.writable) {
- 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_os_version
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.get_os_version = function(cb){
var release = os.release();
if (!release || release.trim() == ''){
if (typeof cb !== 'function')
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 saveDataToDb
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const saveDataToDb = (dataToSave, cb) => {
try {
// eslint-disable-next-line consistent-return
getDataDb('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
Function lock_binary_path
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function lock_binary_path() {
var binary_name = 'prey-lock';
if (is_win) {
binary_name = (release >= '6.1') ? 'new-prey-lock' : 'prey-lock';
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_new_user_fields(self, name, email, terms, age, passwd, passwd2 = None):
if name == '':
self.show_alert("Please type in your name.")
return False
if 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"
Further reading
Function delete_profile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var delete_profile = function(ssid, cb) {
get_existing_profiles(function(err, current_profiles) {
// Check if the profile isn't original and exists in the current list also if the device is connected to that ap
if (!ssid || exports.init_profiles.indexOf(ssid) != -1 || current_profiles.indexOf(ssid) == -1 || connected_to.ssid == ssid) {
return cb(new Error("Nothing to delete " + 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
Function update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
storage_fns.update = (opts, cb) => {
init(opts.type, null, (err) => {
let changes,
values = opts.values,
columns = opts.columns;
- 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 status_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.status_info = (cb) => {
providers.get('status', (err, stdout) => {
const statusStd = stdout;
if (!err && stdout) {
if (!statusStd.logged_user) statusStd.logged_user = 'null';
- 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 clearAndResetIntervals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const clearAndResetIntervals = (aliveTimeReset = false) => {
if (notifyAckInterval) clearInterval(notifyAckInterval);
if (notifyActionInterval) clearInterval(notifyActionInterval);
if (getStatusInterval) clearInterval(getStatusInterval);
if (setIntervalWSStatus) clearInterval(setIntervalWSStatus);
- 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 tryToSendNew
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const tryToSendNew = () => {
// eslint-disable-next-line array-callback-return, consistent-return
messagesData = messagesData.reduce((acc, element) => {
const timeObj = element.time;
if (((new Date()).getTime() - timeObj) >= element.timeLimitPerMessage) {
- 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 postIt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const postIt = (data) => {
if (!data || Object.keys(data).length === 0) return;
logger.info('New location obtained! Making the Control Panel aware...');
devices.post_location(data, (err, state) => {
- 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 changeTab
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def changeTab(self, dir):
index = self.getCurrentTab()
if index == 0: # first page
self.prev.setHidden_(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"