denniss17/pimatic-angular-material-frontend

View on GitHub

Showing 43 of 43 total issues

Function setupSocket has 221 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            setupSocket: function () {
                var store = this.store;
                var self = this;

                if (this.socket !== null) {
Severity: Major
Found in app/adapters/websocketAdapter.js - About 1 day to fix

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

                update: function (type, object) {
                    return $q(function (resolve, reject) {
                        var singular = singulars[type];
                        var data = {};
                        data[singular] = object;
    Severity: Major
    Found in app/adapters/websocketAdapter.js and 1 other location - About 5 hrs to fix
    app/adapters/websocketAdapter.js on lines 414..425

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

    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

                add: function (type, object) {
                    return $q(function (resolve, reject) {
                        var singular = singulars[type];
                        var data = {};
                        data[singular] = object;
    Severity: Major
    Found in app/adapters/websocketAdapter.js and 1 other location - About 5 hrs to fix
    app/adapters/websocketAdapter.js on lines 434..445

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

    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

    File websocketAdapter.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    angular.module('pimaticApp.adapters').factory('websocketAdapter', [
        '$http',
        '$q',
        '$rootScope',
        '$log',
    Severity: Minor
    Found in app/adapters/websocketAdapter.js - About 4 hrs to fix

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

              $scope.moveUp = function () {
                  var attribute = $scope.getAttribute('position');
                  var action = attribute.value == 'up' ? 'stop' : 'moveUp';
      
                  store.adapter.deviceAction($scope.device.id, action).then(function () {
      Severity: Major
      Found in app/controllers/devices/shutter.js and 1 other location - About 4 hrs to fix
      app/controllers/devices/shutter.js on lines 17..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 127.

      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

              $scope.moveDown = function () {
                  var attribute = $scope.getAttribute('position');
                  var action = attribute.value == 'down' ? 'stop' : 'moveDown';
      
                  store.adapter.deviceAction($scope.device.id, action).then(function () {
      Severity: Major
      Found in app/controllers/devices/shutter.js and 1 other location - About 4 hrs to fix
      app/controllers/devices/shutter.js on lines 6..15

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

      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

              $scope.setMode = function (mode) {
                  var action = 'changeModeTo';
                  // Todo indicate that mode is selected but not confirmed by backend ?
      
                  store.adapter.deviceAction($scope.device.id, action, {'mode': mode}).then(function () {
      Severity: Major
      Found in app/controllers/devices/thermostat.js and 1 other location - About 3 hrs to fix
      app/controllers/devices/thermostat.js on lines 27..36

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

      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

              $scope.setTemperatureSetpoint = function (setPoint) {
                  var action = 'changeTemperatureTo';
      
                  // Execute the action
                  store.adapter.deviceAction($scope.device.id, action, {'temperatureSetpoint': setPoint}).then(function () {
      Severity: Major
      Found in app/controllers/devices/thermostat.js and 1 other location - About 3 hrs to fix
      app/controllers/devices/thermostat.js on lines 42..51

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

      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

              $scope.start = function () {
                  var action = 'startTimer';
                  store.adapter.deviceAction($scope.device.id, action).then(function () {
                      events.onDeviceActionDone($scope.device, action);
                  }, function () {
      Severity: Major
      Found in app/controllers/devices/timer.js and 2 other locations - About 3 hrs to fix
      app/controllers/devices/timer.js on lines 15..22
      app/controllers/devices/timer.js on lines 24..31

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

      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

              $scope.stop = function () {
                  var action = 'stopTimer';
                  store.adapter.deviceAction($scope.device.id, action).then(function () {
                      events.onDeviceActionDone($scope.device, action);
                  }, function () {
      Severity: Major
      Found in app/controllers/devices/timer.js and 2 other locations - About 3 hrs to fix
      app/controllers/devices/timer.js on lines 6..13
      app/controllers/devices/timer.js on lines 24..31

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

      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

              $scope.reset = function () {
                  var action = 'resetTimer';
                  store.adapter.deviceAction($scope.device.id, action).then(function () {
                      events.onDeviceActionDone($scope.device, action);
                  }, function () {
      Severity: Major
      Found in app/controllers/devices/timer.js and 2 other locations - About 3 hrs to fix
      app/controllers/devices/timer.js on lines 6..13
      app/controllers/devices/timer.js on lines 15..22

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

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

      module.exports = function (grunt) {
      
          // Project configuration.
          grunt.initConfig({
              pkg: grunt.file.readJSON('package.json'),
      Severity: Major
      Found in Gruntfile.js - About 2 hrs to fix

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

                $scope.save = function () {
                    store.add('groups', $scope.group).then(function () {
                        $location.path('settings/groups');
                    }, function (message) {
                        toast.error('Saving group failed: ' + message);
        Severity: Major
        Found in app/controllers/settings/groups/create.js and 1 other location - About 2 hrs to fix
        app/controllers/settings/groups/edit.js on lines 42..48

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

        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

                $scope.save = function () {
                    store.update('groups', $scope.group).then(function () {
                        $location.path('settings/groups');
                    }, function (message) {
                        toast.error('Saving group failed: ' + message);
        Severity: Major
        Found in app/controllers/settings/groups/edit.js and 1 other location - About 2 hrs to fix
        app/controllers/settings/groups/create.js on lines 14..20

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

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

                    start: function () {
                        var self = this;
        
                        this.store.setUser(
                            {
        Severity: Minor
        Found in app/adapters/fixtureAdapter.js - About 1 hr to fix

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

                          this.socket.on('groupChanged', function (group) {
                              $log.debug('websocketApi', 'groupChanged', group);
                              self.apply(function () {
                                  store.update('groups', group, true);
                              });
          Severity: Major
          Found in app/adapters/websocketAdapter.js and 4 other locations - About 1 hr to fix
          app/adapters/websocketAdapter.js on lines 190..195
          app/adapters/websocketAdapter.js on lines 213..218
          app/adapters/websocketAdapter.js on lines 261..266
          app/adapters/websocketAdapter.js on lines 284..289

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

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

                          this.socket.on('variableChanged', function (variable) {
                              $log.debug('websocketApi', 'variableChanged', variable);
                              self.apply(function () {
                                  store.update('variables', variable, true);
                              });
          Severity: Major
          Found in app/adapters/websocketAdapter.js and 4 other locations - About 1 hr to fix
          app/adapters/websocketAdapter.js on lines 190..195
          app/adapters/websocketAdapter.js on lines 213..218
          app/adapters/websocketAdapter.js on lines 237..242
          app/adapters/websocketAdapter.js on lines 261..266

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

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

                          this.socket.on('ruleChanged', function (rule) {
                              $log.debug('websocketApi', 'ruleChanged', rule);
                              self.apply(function () {
                                  store.update('rules', rule, true);
                              });
          Severity: Major
          Found in app/adapters/websocketAdapter.js and 4 other locations - About 1 hr to fix
          app/adapters/websocketAdapter.js on lines 190..195
          app/adapters/websocketAdapter.js on lines 213..218
          app/adapters/websocketAdapter.js on lines 237..242
          app/adapters/websocketAdapter.js on lines 284..289

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

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

                          this.socket.on('deviceChanged', function (device) {
                              $log.debug('websocketApi', 'deviceChanged', device);
                              self.apply(function () {
                                  store.update('devices', device, true);
                              });
          Severity: Major
          Found in app/adapters/websocketAdapter.js and 4 other locations - About 1 hr to fix
          app/adapters/websocketAdapter.js on lines 213..218
          app/adapters/websocketAdapter.js on lines 237..242
          app/adapters/websocketAdapter.js on lines 261..266
          app/adapters/websocketAdapter.js on lines 284..289

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

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

                          this.socket.on('pageChanged', function (page) {
                              $log.debug('websocketApi', 'pageChanged', page);
                              self.apply(function () {
                                  store.update('pages', page, true);
                              });
          Severity: Major
          Found in app/adapters/websocketAdapter.js and 4 other locations - About 1 hr to fix
          app/adapters/websocketAdapter.js on lines 190..195
          app/adapters/websocketAdapter.js on lines 237..242
          app/adapters/websocketAdapter.js on lines 261..266
          app/adapters/websocketAdapter.js on lines 284..289

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

          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

          Severity
          Category
          Status
          Source
          Language