prey/prey-node-client

View on GitHub

Showing 323 of 551 total issues

Function lock_binary_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function lock_binary_path() {
  var binary_name = 'prey-lock';

  if (is_win) {
    binary_name = (release >= '6.1') ? 'new-prey-lock' : 'prey-lock';
Severity: Minor
Found in lib/agent/actions/lock/index.js - About 35 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 validate_new_user_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_new_user_fields(self, name, email, terms, age, passwd, passwd2 = None):
    if name == '':
      self.show_alert("Please type in your name.")
      return False
    if email == '':
Severity: Minor
Found in lib/conf/gui/mac/PreyConfig.app/Contents/MacOS/prey-config.py - About 35 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 delete_profile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

var delete_profile = function(ssid, cb) {
  get_existing_profiles(function(err, current_profiles) {
    // Check if the profile isn't original and exists in the current list also if the device is connected to that ap
    if (!ssid || exports.init_profiles.indexOf(ssid) != -1 || current_profiles.indexOf(ssid) == -1 || connected_to.ssid == ssid) {
      return cb(new Error("Nothing to delete " + ssid));
Severity: Minor
Found in lib/agent/triggers/auto-connect/reconnect.js - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

storage_fns.update = (opts, cb) => {
  init(opts.type, null, (err) => {
    let changes,
      values = opts.values,
      columns = opts.columns;
Severity: Minor
Found in lib/agent/utils/storage.js - About 35 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 status_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

exports.status_info = (cb) => {
  providers.get('status', (err, stdout) => {
    const statusStd = stdout;
    if (!err && stdout) {
      if (!statusStd.logged_user) statusStd.logged_user = 'null';
Severity: Minor
Found in lib/agent/triggers/status/index.js - About 35 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 clearAndResetIntervals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const clearAndResetIntervals = (aliveTimeReset = false) => {
  if (notifyAckInterval) clearInterval(notifyAckInterval);
  if (notifyActionInterval) clearInterval(notifyActionInterval);
  if (getStatusInterval) clearInterval(getStatusInterval);
  if (setIntervalWSStatus) clearInterval(setIntervalWSStatus);
Severity: Minor
Found in lib/agent/control-panel/websockets/index.js - About 35 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 tryToSendNew has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const tryToSendNew = () => {
  // eslint-disable-next-line array-callback-return, consistent-return
  messagesData = messagesData.reduce((acc, element) => {
    const timeObj = element.time;
    if (((new Date()).getTime() - timeObj) >= element.timeLimitPerMessage) {
Severity: Minor
Found in lib/agent/socket/index.js - About 35 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 postIt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const postIt = (data) => {
  if (!data || Object.keys(data).length === 0) return;

  logger.info('New location obtained! Making the Control Panel aware...');
  devices.post_location(data, (err, state) => {
Severity: Minor
Found in lib/agent/triggers/location/index.js - About 35 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 changeTab has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def changeTab(self, dir):
    index = self.getCurrentTab()

    if index == 0: # first page
      self.prev.setHidden_(False)
Severity: Minor
Found in lib/conf/gui/mac/PreyConfig.app/Contents/MacOS/prey-config.py - About 35 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 getRestartsPreyconf has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const getRestartsPreyconf = (callback) => {
  try {
    // eslint-disable-next-line consistent-return
    getDataDb('restarts_preyconf', (err, stored) => {
      if (err) {
Severity: Minor
Found in lib/agent/utils/prey-configuration/validationpreyconf.js - About 35 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

Avoid too many return statements within this function.
Open

      return;
Severity: Major
Found in lib/system/windows/index.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return cb(null, out);
    Severity: Major
    Found in lib/system/windows/index.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return;
      Severity: Major
      Found in lib/system/windows/index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            if (!checkRangeFormat(dateFrom, dateUntil)) 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

                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 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

                      if (currentDate > endDate) return 3;
              Severity: Major
              Found in lib/agent/actions/triggers/index.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          || date.getTime() > dateUntil) 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 true;
                  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 (!exports.currentTriggers) return;
                    Severity: Major
                    Found in lib/agent/actions/triggers/index.js - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language