prey/prey-node-client

View on GitHub

Showing 323 of 551 total issues

Function RemoteDesktop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

var RemoteDesktop = function(options){

    var self = this;
    var options = options || {};

Severity: Minor
Found in lib/agent/actions/remote-desktop/index.js - About 1 hr to fix

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 move has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

var move = function(from, to, cb) {
  if (process.platform != 'win32')
    return fs.rename(from, to, cb);

  // on windows, antivirus softwares lock new folders until all files are scanned
Severity: Minor
Found in lib/package.js - About 1 hr to fix

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 verificationPreyConfiguration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const verificationPreyConfiguration = (callback) => {
  try {
    clearIntervalDbPreyConf();
    saveDataVerify(() => {});
    dbPreyConfInterval = setIntervalDbPreyConf();
Severity: Minor
Found in lib/agent/utils/prey-configuration/validationpreyconf.js - About 1 hr to fix

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 notify_action has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.notify_action = function (status, id, name, opts, err, out) {
  if (name === 'geofencing' || name === 'triggers') return; // geofencing and triggers needs to send custom notification

  let body = {
    command: 'start',
Severity: Minor
Found in lib/agent/control-panel/sender.js - About 1 hr to fix

    Function get_access_points_list has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.get_access_points_list = (callback) => {
      let cmd;
      let parser;
      let list = [];
    
    
    Severity: Minor
    Found in lib/agent/providers/network/windows.js - About 1 hr to fix

      Function osQueryModeData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const osQueryModeData = (opts, done) => {
        let args = null;
        const data = {
          key: 'device-key',
          token: 'token',
      Severity: Minor
      Found in lib/agent/actions/osquery/index.js - About 1 hr to fix

        Function send_update_event has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var send_update_event = (type, status, old_version, new_version, attempt, error, cb) => {
          const config = require('./utils/configfile');
          var shared = require('./conf/shared');
        
          shared.keys.verify_current(function(err) {
        Severity: Minor
        Found in lib/package.js - About 1 hr to fix

          Function load_hooks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function load_hooks() {
            storage.do('query', { type: 'keys', column: 'id', data: 'last_connection' }, (err, stored) => {
              if (err) logger.info('Error getting the last connection data');
              if (stored && stored.length > 0) {
                last_stored = stored[0];
          Severity: Minor
          Found in lib/agent/control-panel/long-polling/index.js - About 1 hr to fix

            Function get_process_list has 26 lines of code (exceeds 25 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"';
            
            
            Severity: Minor
            Found in lib/agent/providers/processes/linux.js - About 1 hr to fix

              Function get_killswitch_compatible has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.get_killswitch_compatible = (cb) => {
                const data = {
                  key: 'device-key',
                  token: 'token',
                  logged: false,
              Severity: Minor
              Found in lib/agent/providers/hardware/windows.js - About 1 hr to fix

                Function get_ram_module_list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.get_ram_module_list = (cb) => {
                  const list = [];
                  const file = join(__dirname, 'ramcheck.vbs');
                
                  // eslint-disable-next-line consistent-return
                Severity: Minor
                Found in lib/agent/providers/hardware/windows.js - About 1 hr to fix

                  Function setUpVersion has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const setUpVersion = function (version, cb) {
                    const finish = () => {
                      log(`Setting permissions on ${paths.current}`);
                      exports.chmodr(paths.current, 0o755, function (err) {
                        if (err) return cb(err);
                  Severity: Minor
                  Found in lib/conf/tasks/index.js - About 1 hr to fix

                    Function get_process_list has 26 lines of code (exceeds 25 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"';
                    
                    
                    Severity: Minor
                    Found in lib/agent/providers/processes/mac.js - About 1 hr to fix

                      Function parse_access_points_list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      exports.parse_access_points_list = function(output) {
                      
                        return output.split(/Cell \d\d - /).splice(1).map(function(block) {
                          var parsed = {};
                      
                      
                      Severity: Minor
                      Found in lib/agent/providers/network/linux.js - About 1 hr to fix

                        Function get has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const get = (reportName, options, callback) => {
                          let cb;
                          let optionsGet;
                          if (typeof options === 'function') {
                            cb = options;
                        Severity: Minor
                        Found in lib/agent/reports.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                              if (reportName === 'specs' && osName === 'windows' && gte(system.os_release, '10.0.0')
                                && data.os_edition && editions.includes(data.os_edition)
                                && data.winsvc_version && gte(data.winsvc_version, '2.0.0')) {
                                providers.get('tpm_module', (err, output) => {
                                  if (!err) data.tpm_module = output;
                          Severity: Major
                          Found in lib/agent/reports.js - About 1 hr to fix

                            Function bind has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            Operetta.prototype.bind = function(args, description, listener, type) {
                              if (args) {
                                var operetta  = this;
                            
                                if (args.constructor !== Array)
                            Severity: Minor
                            Found in lib/conf/utils/operetta.js - About 55 mins to fix

                            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 pre_uninstall has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            exports.pre_uninstall = (values, cb) => {
                              const argument = values['-u'] && values.positional[0];
                              const updating = argument == 'true' || parseInt(argument) === 1;
                            
                              const tasks = [daemon.remove, osHooks.pre_uninstall];
                            Severity: Minor
                            Found in lib/conf/tasks/index.js - About 55 mins to fix

                            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_for_update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const check_for_update = function (cb) {
                              config.load(() => {
                                if (!exports.check_enabled || exports.upgrading) {
                                  if (cb && typeof cb === 'function') return cb();
                                  return;
                            Severity: Minor
                            Found in lib/agent/updater.js - About 55 mins to fix

                            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_active_access_point_mac has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            exports.get_active_access_point_mac = (callback) => {
                              if (release >= 6.0) {
                                // eslint-disable-next-line consistent-return
                                exec('netsh wlan show interfaces', (err, stdout) => {
                                  if (err) return callback(err);
                            Severity: Minor
                            Found in lib/agent/providers/network/windows.js - About 55 mins to fix

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language