File index.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
//////////////////////////////////////////
// Prey Node.js Windows Client Functions
// (c) 2011 - Fork Ltd.
// by Tomas Pollak - http://forkhq.com
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 find_logged_user
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
exports.find_logged_user = function(callback) {
var done = function(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 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 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"
Further reading
Consider simplifying this complex logical expression. Open
if (data.os_name == 'windows' && gte(os.release().trim(), "10.0.0") &&
data.os_edition && editions.includes(data.os_edition) &&
data.winsvc_version && gte(data.winsvc_version, "2.0.0"))
return true;
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 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
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return cb(null, out);
Avoid too many return
statements within this function. Open
return;