Showing 323 of 551 total issues
Function get_active_access_point
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.get_active_access_point = (callback) => {
exports.isWifiPermissionActive((itWorks) => {
if (itWorks) {
const processActiveAp = (stdout) => {
if (stdout.includes('AirPort: Off') || !stdout.includes('SSID')) {
Function start
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.start = function (cb) {
var count,
last_err,
folders_removed = [];
Function start
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.start = function (cb) {
var count,
last_err,
files_removed = [];
Function gather
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const gather = (reportName, list, cb) => {
const data = {};
let gathered = false;
let count = list.length;
let listReports = [...list];
Function correctPreyConf
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const correctPreyConf = (preyConfDataToWrite, callback) => {
let allFileContents = '';
allFileContents = getFileContent(join(__dirname, '../../../../prey.conf.default'));
if (allFileContents === '') {
Function start
has 40 lines of code (exceeds 25 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);
Function update_version_attempt
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
package.update_version_attempt = (old_version, new_version, attempt_plus, set_notified, error, cb) => {
var create_version = function(version, cb) {
// Before creating the registry the table it's cleared
storage.do('clear', {type: 'versions'}, (err) => {
if (err) return cb(new Error("Unable to edit local database, update cancelled"));
Function get_tree
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
module.exports.get_tree = function(options, cb) {
var dir = options.path;
// We need to run the tree walker script personifying
- 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_and_show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
exports.check_and_show = function(values, cb) {
var force = values['-f'] === true;
var old_config = (values['-c'] || values['--check-file']) && values.positional[0];
var show = function() {
- 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 retryQueuedResponses
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const retryQueuedResponses = () => {
if (exports.responses_queue.length === 0) return;
exports.responses_queue.forEach((respQueued) => {
exports.notify_action(
- 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 init
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
var init = function (type, path, cb) {
storage_path = path ? path : storage_path ? storage_path : join(config, 'commands.db');
backup_path = storage_path;
var create_db = () => {
db_comm = new sqlite3.Database(storage_path, function (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_os_edition
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.get_os_edition = (callback) => {
if (os_name != "windows") {
if (typeof callback !== 'function')
return;
return callback(new Error('Only for Windows'));
Function reconnect
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.reconnect = function(done) {
var network_service,
airport_name = '',
providers = require('./../../agent/providers');
Function check_zones
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
var check_zones = function() {
if (!location || checking) return;
checking = true;
zones.forEach(function (zone) {
Function get_status
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.get_status = (cb) => {
if (exports.status) {
return cb(null, exports.status);
}
if (!timeoutGetStatus) {
Function start
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.start = function(opts, cb) {
hooks.on('geofencing_start', function(fences) {
if (!fences) return;
zones = fences;
Function retrieve_file_as_user
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const retrieve_file_as_user = function (options, cb) {
if (os_name == 'windows') {
path_arg = path.resolve(options.path);
name_arg = path.resolve(options.name);
} else {
Function run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const run = () => {
if (running) return;
running = true;
// eslint-disable-next-line consistent-return
Function init
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var init = function (type, path, cb) {
storage_path = path ? path : storage_path ? storage_path : join(config, 'commands.db');
backup_path = storage_path;
var create_db = () => {
db_comm = new sqlite3.Database(storage_path, function (err) {
Function check
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports.check = function (id, target, opts, cb) {
function done(err) {
if (cb && typeof cb === 'function') return cb && 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"