denniss17/pimatic-angular-material-frontend

View on GitHub

Showing 35 of 43 total issues

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

                this.socket.on('pageAdded', function (page) {
                    $log.debug('websocketApi', 'pageAdded', page);
                    self.apply(function () {
                        store.add('pages', page, true);
                    });
Severity: Major
Found in app/adapters/websocketAdapter.js and 9 other locations - About 1 hr to fix
app/adapters/websocketAdapter.js on lines 196..201
app/adapters/websocketAdapter.js on lines 202..207
app/adapters/websocketAdapter.js on lines 219..224
app/adapters/websocketAdapter.js on lines 243..248
app/adapters/websocketAdapter.js on lines 249..254
app/adapters/websocketAdapter.js on lines 267..272
app/adapters/websocketAdapter.js on lines 273..278
app/adapters/websocketAdapter.js on lines 290..295
app/adapters/websocketAdapter.js on lines 296..301

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

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

                this.socket.on('ruleAdded', function (rule) {
                    $log.debug('websocketApi', 'ruleAdded', rule);
                    self.apply(function () {
                        store.add('rules', rule, true);
                    });
Severity: Major
Found in app/adapters/websocketAdapter.js and 9 other locations - About 1 hr to fix
app/adapters/websocketAdapter.js on lines 196..201
app/adapters/websocketAdapter.js on lines 202..207
app/adapters/websocketAdapter.js on lines 219..224
app/adapters/websocketAdapter.js on lines 225..230
app/adapters/websocketAdapter.js on lines 243..248
app/adapters/websocketAdapter.js on lines 249..254
app/adapters/websocketAdapter.js on lines 273..278
app/adapters/websocketAdapter.js on lines 290..295
app/adapters/websocketAdapter.js on lines 296..301

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

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

                this.socket.on('groupRemoved', function (group) {
                    $log.debug('websocketApi', 'groupRemoved', group);
                    self.apply(function () {
                        store.remove('groups', group, true);
                    });
Severity: Major
Found in app/adapters/websocketAdapter.js and 9 other locations - About 1 hr to fix
app/adapters/websocketAdapter.js on lines 196..201
app/adapters/websocketAdapter.js on lines 202..207
app/adapters/websocketAdapter.js on lines 219..224
app/adapters/websocketAdapter.js on lines 225..230
app/adapters/websocketAdapter.js on lines 249..254
app/adapters/websocketAdapter.js on lines 267..272
app/adapters/websocketAdapter.js on lines 273..278
app/adapters/websocketAdapter.js on lines 290..295
app/adapters/websocketAdapter.js on lines 296..301

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

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

                this.socket.on('variableRemoved', function (variable) {
                    $log.debug('websocketApi', 'variableRemoved', variable);
                    self.apply(function () {
                        store.remove('variables', variable, true);
                    });
Severity: Major
Found in app/adapters/websocketAdapter.js and 9 other locations - About 1 hr to fix
app/adapters/websocketAdapter.js on lines 196..201
app/adapters/websocketAdapter.js on lines 202..207
app/adapters/websocketAdapter.js on lines 219..224
app/adapters/websocketAdapter.js on lines 225..230
app/adapters/websocketAdapter.js on lines 243..248
app/adapters/websocketAdapter.js on lines 249..254
app/adapters/websocketAdapter.js on lines 267..272
app/adapters/websocketAdapter.js on lines 273..278
app/adapters/websocketAdapter.js on lines 290..295

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

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

                this.socket.on('deviceAdded', function (device) {
                    $log.debug('websocketApi', 'deviceAdded', device);
                    self.apply(function () {
                        store.add('devices', device, true);
                    });
Severity: Major
Found in app/adapters/websocketAdapter.js and 9 other locations - About 1 hr to fix
app/adapters/websocketAdapter.js on lines 196..201
app/adapters/websocketAdapter.js on lines 219..224
app/adapters/websocketAdapter.js on lines 225..230
app/adapters/websocketAdapter.js on lines 243..248
app/adapters/websocketAdapter.js on lines 249..254
app/adapters/websocketAdapter.js on lines 267..272
app/adapters/websocketAdapter.js on lines 273..278
app/adapters/websocketAdapter.js on lines 290..295
app/adapters/websocketAdapter.js on lines 296..301

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

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

                this.socket.on('variableAdded', function (variable) {
                    $log.debug('websocketApi', 'variableAdded', variable);
                    self.apply(function () {
                        store.add('variables', variable, true);
                    });
Severity: Major
Found in app/adapters/websocketAdapter.js and 9 other locations - About 1 hr to fix
app/adapters/websocketAdapter.js on lines 196..201
app/adapters/websocketAdapter.js on lines 202..207
app/adapters/websocketAdapter.js on lines 219..224
app/adapters/websocketAdapter.js on lines 225..230
app/adapters/websocketAdapter.js on lines 243..248
app/adapters/websocketAdapter.js on lines 249..254
app/adapters/websocketAdapter.js on lines 267..272
app/adapters/websocketAdapter.js on lines 273..278
app/adapters/websocketAdapter.js on lines 296..301

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

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

                $http.get('assets/fixtures/variables.json').then(function (response) {
                    self.addData('variables', response.data);
                }, function () {
                    self.addData('variables', []);
                });
Severity: Major
Found in app/adapters/fixtureAdapter.js and 3 other locations - About 1 hr to fix
app/adapters/fixtureAdapter.js on lines 46..50
app/adapters/fixtureAdapter.js on lines 51..55
app/adapters/fixtureAdapter.js on lines 56..60

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

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

                $http.get('assets/fixtures/rules.json').then(function (response) {
                    self.addData('rules', response.data);
                }, function () {
                    self.addData('rules', []);
                });
Severity: Major
Found in app/adapters/fixtureAdapter.js and 3 other locations - About 1 hr to fix
app/adapters/fixtureAdapter.js on lines 46..50
app/adapters/fixtureAdapter.js on lines 51..55
app/adapters/fixtureAdapter.js on lines 61..65

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

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

                $http.get('assets/fixtures/pages.json').then(function (response) {
                    self.addData('pages', response.data);
                }, function () {
                    self.addData('pages', []);
                });
Severity: Major
Found in app/adapters/fixtureAdapter.js and 3 other locations - About 1 hr to fix
app/adapters/fixtureAdapter.js on lines 46..50
app/adapters/fixtureAdapter.js on lines 56..60
app/adapters/fixtureAdapter.js on lines 61..65

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

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

                $http.get('assets/fixtures/groups.json').then(function (response) {
                    self.addData('groups', response.data);
                }, function () {
                    self.addData('groups', []);
                });
Severity: Major
Found in app/adapters/fixtureAdapter.js and 3 other locations - About 1 hr to fix
app/adapters/fixtureAdapter.js on lines 51..55
app/adapters/fixtureAdapter.js on lines 56..60
app/adapters/fixtureAdapter.js on lines 61..65

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

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

                this.socket.on('variables', function (variables) {
                    $log.debug('websocketApi', 'variables', variables);
                    self.handleIncomingData('variables', variables);
                });
Severity: Minor
Found in app/adapters/websocketAdapter.js and 2 other locations - About 35 mins to fix
app/adapters/websocketAdapter.js on lines 142..145
app/adapters/websocketAdapter.js on lines 152..155

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

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

                this.socket.on('rules', function (rules) {
                    $log.debug('websocketApi', 'rules', rules);
                    self.handleIncomingData('rules', rules);
                });
Severity: Minor
Found in app/adapters/websocketAdapter.js and 2 other locations - About 35 mins to fix
app/adapters/websocketAdapter.js on lines 147..150
app/adapters/websocketAdapter.js on lines 152..155

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

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

                this.socket.on('pages', function (pages) {
                    $log.debug('websocketApi', 'pages', pages);
                    self.handleIncomingData('pages', pages);
                });
Severity: Minor
Found in app/adapters/websocketAdapter.js and 2 other locations - About 35 mins to fix
app/adapters/websocketAdapter.js on lines 142..145
app/adapters/websocketAdapter.js on lines 147..150

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

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.down = function () {
            $scope.setTemperatureSetpoint($scope.getAttribute('temperatureSetpoint').value - 0.5);
        };
Severity: Minor
Found in app/controllers/devices/thermostat.js and 1 other location - About 35 mins to fix
app/controllers/devices/thermostat.js on lines 12..14

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

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.up = function () {
            $scope.setTemperatureSetpoint($scope.getAttribute('temperatureSetpoint').value + 0.5);
        };
Severity: Minor
Found in app/controllers/devices/thermostat.js and 1 other location - About 35 mins to fix
app/controllers/devices/thermostat.js on lines 19..21

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

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