prey/prey-node-client

View on GitHub

Showing 323 of 551 total issues

Avoid too many return statements within this function.
Open

            || (typeof exports.currentTriggers[triggerIndex].last_exec === 'number')) return;
Severity: Major
Found in lib/agent/actions/triggers/index.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return 1;
    Severity: Major
    Found in lib/agent/actions/triggers/index.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            if (!checkRules(rule)) return 2;
      Severity: Major
      Found in lib/agent/actions/triggers/index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return 0;
        Severity: Major
        Found in lib/agent/actions/triggers/index.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              if (!checkRepeatFormat(days, hour_from, hour_until, until)) return 4;
          Severity: Major
          Found in lib/agent/actions/triggers/index.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              } else return 2;
            Severity: Major
            Found in lib/agent/actions/triggers/index.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return True
              Severity: Major
              Found in lib/conf/gui/linux/prey-config3.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return True
                Severity: Major
                Found in lib/conf/gui/linux/prey-config.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return False
                  Severity: Major
                  Found in lib/conf/gui/linux/prey-config.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return True
                    Severity: Major
                    Found in lib/conf/gui/mac/PreyConfig.app/Contents/MacOS/prey-config.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return False
                      Severity: Major
                      Found in lib/conf/gui/linux/prey-config.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return False
                        Severity: Major
                        Found in lib/conf/gui/mac/PreyConfig.app/Contents/MacOS/prey-config.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return False
                          Severity: Major
                          Found in lib/conf/gui/mac/PreyConfig.app/Contents/MacOS/prey-config.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return False
                            Severity: Major
                            Found in lib/conf/gui/linux/prey-config3.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return False
                              Severity: Major
                              Found in lib/conf/gui/linux/prey-config3.py - About 30 mins to fix

                                Function setEmpty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                exports.setEmpty = function (values, cb) {
                                  const { key } = values;
                                  if (key === 'control-panel') return cb(new Error(`${key} is not able to be empty.`));
                                  const expReg = /.*/;
                                  const dataFromName = reqPreyConf.filter((item) => item.name === key);
                                Severity: Minor
                                Found in lib/conf/settings.js - About 25 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 watch_stopped has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const watch_stopped = function () {
                                  if (!watching) return;
                                
                                  hooks.on('action', (event, id) => {
                                    if (event == 'stopped' || event == 'failed') {
                                Severity: Minor
                                Found in lib/agent/commands.js - About 25 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_picture has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                exports.get_picture = (callback) => {
                                  socket.writeMessage(nameArray[2], (err, data) => {
                                    if (err) return exports.get_picture_old(callback);
                                    try {
                                      if (data.result.success.toString().localeCompare('false') === 0) return done(new Error("Couldn't get picture"), null, callback);
                                Severity: Minor
                                Found in lib/agent/providers/webcam/mac/index.js - About 25 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 send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const send = function (what, data, opts, cb) {
                                  var opts = opts || {};
                                
                                  const done = function (err, resp) {
                                    const str = err ? `Got error: ${err.message}` : `Got ${resp.statusCode} response: ${resp.body}`;
                                Severity: Minor
                                Found in lib/agent/control-panel/sender.js - About 25 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_firmware_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                exports.get_firmware_info = (callback) => {
                                  getSystemProfilerData('SPHardwareDataType', (err, spData) => {
                                    if (err) return callback(err);
                                    const data = {
                                      device_type: spData.model_name.indexOf('Book') === -1 ? 'Desktop' : 'Laptop',
                                Severity: Minor
                                Found in lib/agent/providers/hardware/mac.js - About 25 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