prey/prey-node-client

View on GitHub

Showing 551 of 551 total issues

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

const start = function (type, id, name, opts, cb) {
  // Action with same id is not executed
  if (running[id]) {
    const err = new Error(`Already running: ${running[id].name} with id: ${id}`);
    hooks.emit('error', err);
Severity: Minor
Found in lib/agent/actions.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 wipeConfiguration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

exports.wipeConfiguration = (fillOnly, keepRoot, threepass) => {
  wipeBinary.fillOnly = fillOnly;
  wipeBinary.keepRoot = keepRoot;
  wipeBinary.threepass = threepass;

Severity: Minor
Found in lib/agent/actions/wipe/wipe.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 writeMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const writeMessage = (functionName, cb, time = null) => {
  if (osName !== 'mac') {
    if (typeof cb === 'function') return cb();
    // eslint-disable-next-line consistent-return
    return;
Severity: Minor
Found in lib/agent/socket/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 webSocketSettings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const webSocketSettings = () => {
  notifyActionInterval = setInterval(retryQueuedResponses, 5000); // <-revisar el tiempo
  notifyAckInterval = setInterval(retryAckResponses, 4 * 1000);
  getStatusInterval = setInterval(getStatusByInterval, 5 * 60 * 1000);
  setIntervalWSStatus = setInterval(exports.heartbeat, 30 * 1000);
Severity: Minor
Found in lib/agent/control-panel/websockets/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 start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function start(id, opts, cb) {
  var opts     = opts || {},
      password = opts.password || opts.unlock_pass || default_pass,
      message  = opts.lock_message || "";

Severity: Minor
Found in lib/agent/actions/lock/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 checkOsqueryPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const checkOsqueryPath = (mode) => {
  const osqueryPath = '/private/var/prey';
  try {
    const stats = fs.statSync(osqueryPath);
    if (stats.isDirectory() && mode === 'install') {
Severity: Minor
Found in lib/agent/actions/osquery/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 start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

exports.start = function(opts, cb) {
  hooks.on('geofencing_start', function(fences) {
    if (!fences) return;

    zones = fences;
Severity: Minor
Found in lib/agent/triggers/control-zones/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 validate_new_user_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_new_user_fields(self):
    if self.text('user_name') == '':
      self.show_alert(_("Empty name!"), _("Please type in your name."))
      return False
    if self.text('email') == '':
Severity: Minor
Found in lib/conf/gui/linux/prey-config.py - 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 apply_settings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def apply_settings(self, button):
        self.get("button_apply").set_label(_("Saving..."))

        page_name = self.get_page_name()
        if page_name == "new_user":
Severity: Minor
Found in lib/conf/gui/linux/prey-config3.py - 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 apply_settings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_settings(self, button):
    self.get('button_apply').set_label(_("Saving..."))

    page_name = self.get_page_name()
    if page_name == 'new_user':
Severity: Minor
Found in lib/conf/gui/linux/prey-config.py - 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 validate_new_user_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_new_user_fields(self):
        if self.text("user_name") == "":
            self.show_alert(_("Empty name!"), _("Please type in your name."))
            return False
        if self.text("email") == "":
Severity: Minor
Found in lib/conf/gui/linux/prey-config3.py - 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