Showing 323 of 551 total issues
Function get_outbound_connections_list
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.get_outbound_connections_list = function(callback) {
var connections = [],
command = 'netstat -ano';
Function versionPromise
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const versionPromise = new Promise((resolve, reject) => {
exec(exports.cmdExistInstallPreyUser, (_parentError, parentStdout) => {
if (parentStdout && parentStdout.trim() !== '') {
exec(exports.cmdInstallPreyUserVersion, (error, preyUserVersionInstall) => {
if (error) {
Function return_status
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function return_status(err, res) {
function disconnected(err) {
logger.debug('Device cannot connect to host');
if (err) {
logger.error(`Connection error: ${err}`);
Function exports
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(cmd, opts, cb) {
var out = '',
err = '',
args = Array.isArray(cmd) ? cmd : cmd.split(' '),
bin = args.shift();
Function try_connecting_to
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.try_connecting_to = function(list, cb) {
var array = [];
list.forEach(function(ap) {
array.push(
function(callback) {
Function find_logged_user
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.find_logged_user = function(callback) {
var done = function(err, stdout) {
if (err) {
if (typeof callback !== 'function')
return;
Function get_firmware_info
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.get_firmware_info = function(callback) {
var get_value = function(output, string) {
var regex = new RegExp(string + ": (.*)");
var matches = output.toString().match(regex);
Function create_server
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var create_server = (cb) => {
os_name = os.platform().replace('darwin', 'mac').replace('win32', 'windows');
if (os_name == 'linux') return cb(new Error('Service only available for mac and windows'));
check_service((valid) => {
Function get_update_data
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
package.get_update_data = (cb) => {
var location = require('./agent/triggers/location'),
data = {public_ip: null, country: null, location: {lat: null, lon: null}},
loc = location.current;
Function check_hostname
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var check_hostname = () => {
if (checking) return;
checking = true;
var done = (err) => {
Function start
has 28 lines of code (exceeds 25 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);
Function get_encryption_status
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports.get_encryption_status = function(cb) {
logger.info("Getting encryption status");
system.get_as_admin_user('encryptStatus', (err, info) => {
if (err) return cb(err);
if (!Array.isArray(info)) return cb(new Error("Invalid encryption status information"));
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
exports.start = function (cb) {
var count,
last_err,
files_removed = [];
- 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 parse_access_points_list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.parse_access_points_list = function(output) {
return output.split(/Cell \d\d - /).splice(1).map(function(block) {
var parsed = {};
- 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_process_list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.get_process_list = function(callback) {
var processes = [],
cmd = 'ps axo stat,user,ppid,pid,pcpu,pmem,time,comm | egrep -v " ps|grep"';
- 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 parse_access_points_list_netsh
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.parse_access_points_list_netsh = (out) => {
// eslint-disable-next-line prefer-const
let list = [];
const blocks = out.split(/\nSSID \d{1,2}\s:/);
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
exports.start = function (cb) {
var count,
last_err,
folders_removed = [];
- 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_process_list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.get_process_list = function(callback) {
var processes = [],
cmd = 'ps axo stat,user,ppid,pid,pcpu,pmem,time,comm | egrep -v " ps|grep"';
- 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_encryption_keys
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports.get_encryption_keys = function(cb) {
logger.info("Getting encryption keys");
system.get_as_admin_user('recoveryKeys', (err, info) => {
if (err) return cb(err);
if (!Array.isArray(info)) return cb(new Error("Invalid encryption keys information"));
- 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 check_service
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.check_service = function(data, cb) {
if (exports.monitoring_service_go) {
if (typeof cb !== 'function')
return;
return cb(null, data);
- 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"