prey/prey-node-client

View on GitHub

Showing 551 of 551 total issues

Function preyConfReconf has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const preyConfReconf = () => {
  getDataFromShouldPreyCFile((_err, shouldPreyCFile) => {
    if (shouldPreyCFile && shouldPreyCFile.localeCompare('true') === 0) {
      setTimeout(correctDataTimedOut, 1000 * 60 * 5);
      setInterval(correctDataTimedOut, 1000 * 60 * 30);
Severity: Minor
Found in lib/agent/index.js - About 1 hr to fix

    Function verifyPreyConf has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const verifyPreyConf = () => {
      resetDefaultValues();
      let allFileContents = '';
      try {
        allFileContents = getFileContent(exports.preyConfPath);
    Severity: Minor
    Found in lib/agent/utils/prey-configuration/preyconf.js - About 1 hr to fix

      Function queryTriggers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const queryTriggers = () => {
        storage.do(
          'all',
          { type: 'triggers' },
          (err, stored) => {
      Severity: Minor
      Found in lib/agent/control-panel/websockets/index.js - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        exports.stop = function () {
          hooks.remove('connected');
          hooks.remove('disconnected');
        
          if (emitter) {
        Severity: Major
        Found in lib/agent/triggers/auto-connect/index.js and 1 other location - About 1 hr to fix
        lib/agent/triggers/control-zones/index.js on lines 185..192

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if ((zone.state == 'outside' && zone.direction !== 'out') || zone.state == null) {
                  logger.info('Device got inside the geofence ' + zone.name + '! Notifying')
                  hooks.trigger('geofencing_in', zone.id)
                  push_event('geofencing_in', {id: zone.id}, location);
                }
        Severity: Major
        Found in lib/agent/triggers/control-zones/index.js and 1 other location - About 1 hr to fix
        lib/agent/triggers/control-zones/index.js on lines 100..104

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        exports.stop = function() {
          hooks.remove('geofencing_start');
          hooks.remove('new_location');
          if (emitter) {
            emitter.removeAllListeners();
        Severity: Major
        Found in lib/agent/triggers/control-zones/index.js and 1 other location - About 1 hr to fix
        lib/agent/triggers/auto-connect/index.js on lines 85..93

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                  if (zone.state == 'inside' && zone.direction !== 'in') {
                    logger.info('Device left the geofence ' + zone.name + '! Notifying')
                    hooks.trigger('geofencing_out', zone.id)
                    push_event('geofencing_out', {id: zone.id}, location);
                  }
        Severity: Major
        Found in lib/agent/triggers/control-zones/index.js and 1 other location - About 1 hr to fix
        lib/agent/triggers/control-zones/index.js on lines 114..118

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        exports.stop = () => {
          triggers.unwatch('network');
          hooks.remove('connected');
          if (emitter) {
            emitter.removeAllListeners();
        Severity: Major
        Found in lib/agent/triggers/network/index.js and 1 other location - About 1 hr to fix
        lib/agent/triggers/location/index.js on lines 180..187

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        exports.stop = () => {
          hooks.remove('mac_address_changed');
          hooks.remove('get_location');
          if (emitter) {
            emitter.removeAllListeners();
        Severity: Major
        Found in lib/agent/triggers/location/index.js and 1 other location - About 1 hr to fix
        lib/agent/triggers/network/index.js on lines 73..80

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def put(self, container, child, x, y):
                fixed = Gtk.Fixed()
                fixed.put(child, x, y)
                container.pack_start(fixed, False, False, 0)
        Severity: Major
        Found in lib/agent/actions/alert/linux/flash3.py and 1 other location - About 1 hr to fix
        lib/agent/actions/alert/linux/flash.py on lines 75..78

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          def put(self, container, child, x, y):
            fixed = gtk.Fixed()
            fixed.put(child, x, y)
            container.pack_start(fixed, False, False, 0)
        Severity: Major
        Found in lib/agent/actions/alert/linux/flash.py and 1 other location - About 1 hr to fix
        lib/agent/actions/alert/linux/flash3.py on lines 84..87

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function sendAction has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const sendAction = (values, cb) => {
          const { key } = values;
          let postData;
          if (key.localeCompare('native_location') === 0) {
            postData = postDataNativeLocation;
        Severity: Minor
        Found in lib/conf/action.js - About 1 hr to fix

          Function open has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function open(id, password, message, cb) {
            if (!message) message = "";
          
            var args = [password, message];
            if (is_mac && common.os_release >= '11.0')
          Severity: Minor
          Found in lib/agent/actions/lock/index.js - About 1 hr to fix

            Function correctPreyConfCallback has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const correctPreyConfCallback = (callback) => {
              // eslint-disable-next-line consistent-return
              getDataDb('preyconf', (err, data) => {
                if (err || !data) {
                  // eslint-disable-next-line consistent-return
            Severity: Minor
            Found in lib/agent/utils/prey-configuration/validationpreyconf.js - About 1 hr to fix

              Function send has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.send = (err, cb) => {
                const { release } = require('os');
                const { version } = require('./common');
                const keys = require('./agent/control-panel/api/keys');
                // prevent exceptions from being sent when running tests
              Severity: Minor
              Found in lib/exceptions.js - About 1 hr to fix

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

                exports.get_ram_module_list = (cb) => {
                  const list = [];
                  if (system.is_m1_or_m2()) {
                    si.mem((stdoutsi) => {
                      list.push({
                Severity: Minor
                Found in lib/agent/providers/hardware/mac.js - About 1 hr to fix

                  Function trap_signals has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function trap_signals() {
                    process.on('exit', (code) => {
                      shutdown(code);
                    });
                  
                  
                  Severity: Minor
                  Found in lib/agent/cli.js - About 1 hr to fix

                    Function getDeviceData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const getDeviceData = (callback) => {
                      let e;
                      let count = 3;
                      const data = {};
                      const done = (err, newData) => {
                    Severity: Minor
                    Found in lib/agent/control-panel/setup.js - About 1 hr to fix

                      Function gather has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const gather = (what, cb) => {
                        let dirs;
                        if (Array.isArray(what)) dirs = what;
                        else dirs = paths[what];
                      
                      
                      Severity: Minor
                      Found in lib/agent/actions/wipe/wipe.js - About 1 hr to fix

                        Function main has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        def main():
                          app = NSApplication.sharedApplication()
                          app.activateIgnoringOtherApps_(True)
                        
                          # set app icon and draw menu
                        Severity: Minor
                        Found in lib/agent/actions/alert/darwin/flash.py - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language