Showing 312 of 527 total issues
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 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 collect_files
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
const collect_files = (output_file, cb) => {
const output = fs.createWriteStream(output_file);
const archive = archiver('zip', {
zlib: { level: 9 },
});
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 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 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) {
var c;
var 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 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 start
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.start = function (cb) {
var count,
last_err,
files_removed = [];
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 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 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 create_server
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const create_server = (cb) => {
if (osName === 'linux') return cb(new Error('Service only available for mac and windows'));
check_service((valid) => {
if (!valid) return cb(new Error('Windows Service not compatible'));