prey/prey-node-client

View on GitHub

Showing 312 of 527 total issues

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

            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 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 (!check_range_format(date_from, date_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

                  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

                        if (current_date > end_date) 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

                        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

                        if (!check_repeat_format(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

                        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 (current_triggers[trigger_index].last_exec) 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 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 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 (!check_rules(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 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;
                                  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 0;
                                      Severity: Major
                                      Found in lib/agent/actions/triggers/index.js - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language