prey/prey-node-client

View on GitHub

Showing 551 of 551 total issues

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

    def error_or_exit(self):
        if self.result == 0:
            return self.exit_ok()
        #      self.run_prey()
        #      if self.result == 0:
Severity: Major
Found in lib/conf/gui/linux/prey-config3.py and 1 other location - About 2 hrs to fix
lib/conf/gui/linux/prey-config.py on lines 318..329

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

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

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

  def error_or_exit(self):
    if self.result == 0:
      return self.exit_ok()
#      self.run_prey()
#      if self.result == 0:
Severity: Major
Found in lib/conf/gui/linux/prey-config.py and 1 other location - About 2 hrs to fix
lib/conf/gui/linux/prey-config3.py on lines 352..363

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

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 __init__ has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def __init__(self):

    button_text = "Close"
    title = args.title

Severity: Major
Found in lib/agent/actions/alert/linux/flash.py - About 2 hrs to fix

    File index.js has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const needle = require('needle');
    const Emitter = require('events').EventEmitter;
    const https = require('https');
    
    const common = require('../../common');
    Severity: Minor
    Found in lib/agent/control-panel/long-polling/index.js - About 2 hrs to fix

      Function createServer has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const createServer = (cb) => {
        if (osName === 'linux') return cb(new Error('Service only available for mac and windows'));
      
        checkService((valid) => {
          if (!valid) return cb(new Error('Windows Service not compatible'));
      Severity: Major
      Found in lib/agent/control-panel/websockets/server.js - About 2 hrs to fix

        Function fetchLocation has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const fetchLocation = (typeFetch, callback) => {
          if (callback && typeof callback === 'function') locCallbacks.push(callback);
          if (checking) return;
        
          const fireCallbacks = (err, coords) => {
        Severity: Major
        Found in lib/agent/triggers/location/index.js - About 2 hrs to fix

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

            var cls = function Geolocator() {
              this.desiredAccuracyInMeters = new Number();
              this.reportInterval = new Number();
              this.movementThreshold = new Number();
              this.desiredAccuracy = new PositionAccuracy();
          lib/agent/providers/geo/win32/windows.devices.geolocation/lib/NodeRT_Windows_Devices_Geolocation.d.js on lines 132..138
          lib/agent/providers/geo/win32/windows.devices.geolocation/lib/NodeRT_Windows_Devices_Geolocation.d.js on lines 210..216

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

          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 3 locations. Consider refactoring.
          Open

            var cls = function CivicAddress() {
              this.city = new String();
              this.country = new String();
              this.postalCode = new String();
              this.state = new String();
          lib/agent/providers/geo/win32/windows.devices.geolocation/lib/NodeRT_Windows_Devices_Geolocation.d.js on lines 177..183
          lib/agent/providers/geo/win32/windows.devices.geolocation/lib/NodeRT_Windows_Devices_Geolocation.d.js on lines 210..216

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

          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 3 locations. Consider refactoring.
          Open

            var cls = function Geocircle() {
              this.center = new BasicGeoposition();
              this.radius = new Number();
              this.altitudeReferenceSystem = new AltitudeReferenceSystem();
              this.geoshapeType = new GeoshapeType();
          lib/agent/providers/geo/win32/windows.devices.geolocation/lib/NodeRT_Windows_Devices_Geolocation.d.js on lines 132..138
          lib/agent/providers/geo/win32/windows.devices.geolocation/lib/NodeRT_Windows_Devices_Geolocation.d.js on lines 177..183

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

          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 directoryTreeToObj has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var directoryTreeToObj = function(dir, current_depth, depth, done) {
            var resultsDir  = [],
                resultsFile = [];
          
            if (os_name == 'windows') dir = dir + '\\';
          Severity: Major
          Found in lib/agent/providers/files/tree.js - About 2 hrs to fix

            Function as_user has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            function as_user(options, cb) {
              const { user } = options;
              const { bin } = options;
              const { type } = options;
              const { opts } = options;
            Severity: Minor
            Found in lib/system/index.js - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.start = function(id, opts, cb) {
              var opts    = opts || {},
                  message = opts.message || opts.alert_message,
                  title   = opts.title,
                  level   = opts.level || 'info',
            Severity: Minor
            Found in lib/agent/actions/alert/index.js - About 2 hrs 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

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

            FORCE_CONFIG = len(sys.argv) > 1 and (sys.argv[1] == "-f" or sys.argv[1] == "--force")
            Severity: Major
            Found in lib/conf/gui/linux/prey-config3.py and 2 other locations - About 2 hrs to fix
            lib/conf/gui/linux/prey-config.py on lines 41..41
            lib/conf/gui/mac/PreyConfig.app/Contents/MacOS/prey-config.py on lines 26..26

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

            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

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

              def button_clicked(self, widget):
                if self.entry:
                  self.enter_pressed(widget)
                elif self.respondable:
                  self.add_input()
            Severity: Major
            Found in lib/agent/actions/alert/linux/flash.py and 1 other location - About 2 hrs to fix
            lib/agent/actions/alert/linux/flash3.py on lines 71..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 55.

            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

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

            FORCE_CONFIG = len(sys.argv) > 1 and (sys.argv[1] == '-f' or sys.argv[1] == '--force')
            Severity: Major
            Found in lib/conf/gui/linux/prey-config.py and 2 other locations - About 2 hrs to fix
            lib/conf/gui/linux/prey-config3.py on lines 41..41
            lib/conf/gui/mac/PreyConfig.app/Contents/MacOS/prey-config.py on lines 26..26

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

            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

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

            FORCE_CONFIG = len(sys.argv) > 1 and (sys.argv[1] == '-f' or sys.argv[1] == '--force')
            lib/conf/gui/linux/prey-config.py on lines 41..41
            lib/conf/gui/linux/prey-config3.py on lines 41..41

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

            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

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

                def button_clicked(self, widget):
                    if self.entry:
                        self.enter_pressed(widget)
                    elif self.respondable:
                        self.add_input()
            Severity: Major
            Found in lib/agent/actions/alert/linux/flash3.py and 1 other location - About 2 hrs to fix
            lib/agent/actions/alert/linux/flash.py on lines 62..69

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

            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 attach_listeners has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function attach_listeners(request) {
                request.on('data', function(data) {
                  logger.info("Data received!");
            
                  try {
            Severity: Major
            Found in lib/conf/long-polling.js - About 2 hrs to fix

              Function start has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.start = function(id, opts, cb) {
                var opts    = opts || {},
                    message = opts.message || opts.alert_message,
                    title   = opts.title,
                    level   = opts.level || 'info',
              Severity: Major
              Found in lib/agent/actions/alert/index.js - About 2 hrs to fix

                Function start has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.start = function (id, options, cb) {
                  const url = `${UPLOAD_SERVER}?uploadID=${options.file_id}`;
                  // Make a call to get the last byte processed by the upload server
                  // in order to resume the upload from that position.
                  needle.request('get', url, null, (err, res) => {
                Severity: Major
                Found in lib/agent/actions/fileretrieval/index.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language