Showing 323 of 551 total issues
Function start
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.start = function(id, options, cb) {
var error,
self = this,
returned = 0;
Function get_connection_status
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
exp.get_connection_status = function (cb) {
const data = config.all();
const configData = data;
const proxy = configData.try_proxy;
const protocol = configData['control-panel.protocol'];
- 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 readWithoutVerification
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const readWithoutVerification = (cb) => {
const extractedData = {};
let nameBefore = '';
let content = '';
try {
Function getPreyUserVersions
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getPreyUserVersions = (preyUserVersion, cb) => {
const successHandler = (foundVersion) => {
if (foundVersion) {
compareVersionsDaemon(foundVersion, preyUserVersion, cb);
} else {
Function generate_keys
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.generate_keys = (cb) => {
storage.do('all', { type: 'keys' }, (err, values) => {
if (err || !values) { return cb(new Error('Error reading stored security keys')); }
// Read stored keys if they exists
Function verifyPreyConfData
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const verifyPreyConfData = (doNotVerifyApiDeviceKey = false) => {
const dataToFix = {};
let somethingWrong = false;
resetDefaultValues();
let content = '';
Function collectFiles
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const collectFiles = (outputFile, cb) => {
const output = fs.createWriteStream(outputFile);
const archive = archiver('zip', {
zlib: { level: 9 },
});
Function as_user
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function as_user(options, cb) {
const { user } = options;
const { bin } = options;
const { type } = options;
const { opts } = options;
Function get_battery_status
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.get_battery_status = function(cb) {
var keys = 'Availability,BatteryStatus,EstimatedChargeRemaining,EstimatedRunTime';
var get_state = function(num) {
Function start
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.start = function(id, opts, cb) {
var os_name = os.platform().replace('darwin', 'mac').replace('win32', 'windows');
if (os_name != 'windows')
return cb(new Error('Action only allowed on Windows 1O'));
Function link
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
exports.link = (data, cb) => {
if (!data || Object.keys(data).length == 0)
return cb(errors.arguments('Empty data.'));
if (keys.get().device)
- 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 eachFileOrDirectory
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
var eachFileOrDirectory = function(directory, fileHandler, completeHandler) {
var filesToCheck = 0;
// var checkedFiles = [];
// var checkedStats = [];
- 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
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
exports.parse = function (body) {
let c;
let matches;
if ((matches = body.match(/^help\s?(\w+)?/))) c = ['help', matches[1]];
- 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 unprocessable
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
exports.unprocessable = function(errors) {
if (typeof errors == 'object') {
var arr = [];
for (var key in errors) {
var err_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 request
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const request = function () {
if (current_request) {
logger.debug('Already running request');
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 RemoteTerminal
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
var RemoteTerminal = function(options) {
var self = this;
var options = 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 start
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
exports.start = function(id, opts, cb) {
var os_name = os.platform().replace('darwin', 'mac').replace('win32', 'windows');
if (os_name != 'windows')
return cb(new Error('Action only allowed on Windows 1O'));
- 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 toPrecisionFixed
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
var toPrecisionFixed = function(number, precision) {
if (isNaN(number)) return 'NaN';
var numb = number < 0 ? -number : number; // can't take log of -ve number...
var sign = number < 0 ? '-' : '';
- 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_connection_status
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
exp.get_connection_status = function (cb) {
const data = config.all();
const configData = data;
const proxy = configData.try_proxy;
const protocol = configData['control-panel.protocol'];
Function watch_stopped
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const watch_stopped = function () {
if (!watching) return;
hooks.on('action', (event, id) => {
if (event == 'stopped' || event == 'failed') {