Showing 4,753 of 10,532 total issues

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

app.factory('CostCenterTariffService', function($http) {
    return {
        addPair: function(costcenterid, tariffid, headers, callback ) {
            $http.post(getAPI()+'costcenters/'+costcenterid+'/tariffs',{data:{'tariff_id':tariffid}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

if (!Array.prototype.indexOf) {
        Array.prototype.indexOf = function (searchElement, fromIndex) {
                var k;

                // 1. Let O be the result of calling ToObject passing
Severity: Major
Found in myems-admin/js/plugins/oclazyload/ocLazyLoad.js and 1 other location - About 1 day to fix
myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js on lines 367..429

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

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

app.factory('ShopfloorPointService', function($http) {
    return {
        addPair: function(shopfloorID,pointID, headers, callback) {
            $http.post(getAPI()+'shopfloors/'+shopfloorID+'/points',{data:{'point_id':pointID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

app.factory('StoreSensorService', function($http) {
    return {
        addPair: function(storeID,sensorID, headers, callback) {
            $http.post(getAPI()+'stores/'+storeID+'/sensors',{data:{'sensor_id':sensorID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

app.factory('SpaceStoreService', function($http) {
    return {
        addPair: function(spaceID,storeID, headers, callback) {
            $http.post(getAPI()+'spaces/'+spaceID+'/stores',{data:{'store_id':storeID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

app.factory('VirtualPowerPlantMicrogridService', function($http) {
    return {
        addPair: function(virtualpowerplantID,microgridID, headers, callback) {
            $http.post(getAPI()+'virtualpowerplants/'+virtualpowerplantID+'/microgrids',{data:{'microgrid_id':microgridID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30

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

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

app.factory('StorePointService', function($http) {
    return {
        addPair: function(storeID,pointID, headers, callback) {
            $http.post(getAPI()+'stores/'+storeID+'/points',{data:{'point_id':pointID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

app.factory('SpaceShopfloorService', function($http) {
    return {
        addPair: function(spaceID,shopfloorID, headers, callback) {
            $http.post(getAPI()+'spaces/'+spaceID+'/shopfloors',{data:{'shopfloor_id':shopfloorID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

app.factory('EnergyStoragePowerStationUserService', function($http) {
    return {
        addPair: function(energystoragepowerstationID,userID, headers, callback) {
            $http.post(getAPI()+'energystoragepowerstations/'+energystoragepowerstationID+'/users',{data:{'user_id':userID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

app.factory('SpaceCommandService', function($http) {
    return {
        addPair: function(spaceID,commandID, headers, callback) {
            $http.post(getAPI()+'spaces/'+spaceID+'/commands',{data:{'command_id':commandID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function (searchElement, fromIndex) {

    var k;

myems-admin/js/plugins/oclazyload/ocLazyLoad.js on lines 1293..1354

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

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

app.factory('ShopfloorEquipmentService', function($http) {
    return {
        addPair: function(shopfloorID,equipmentID, headers, callback) {
            $http.post(getAPI()+'shopfloors/'+shopfloorID+'/equipments',{data:{'equipment_id':equipmentID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

app.factory('MeterPointService', function($http) {
    return {
        addPair: function(meterID, pointID, headers, callback) {
            $http.post(getAPI() + 'meters/' + meterID + '/points', {data:{'point_id':pointID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacepoint.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

app.factory('SpacePointService', function($http) {
    return {
        addPair: function(spaceID,pointID, headers, callback) {
            $http.post(getAPI()+'spaces/'+spaceID+'/points',{data:{'point_id':pointID}}, {headers})
            .then(function (response) {
myems-admin/app/services/settings/combinedequipment/combinedequipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/combinedequipment/combinedequipmentequipment.service.js on lines 2..30
myems-admin/app/services/settings/costcenter/costcentertariff.service.js on lines 2..29
myems-admin/app/services/settings/distributionsystem/distributioncircuitpoint.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationcontainer.service.js on lines 2..30
myems-admin/app/services/settings/energystoragepowerstation/energystoragepowerstationuser.service.js on lines 2..30
myems-admin/app/services/settings/equipment/equipmentcommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/metercommand.service.js on lines 2..30
myems-admin/app/services/settings/meter/meterpoint.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgridsensor.service.js on lines 2..30
myems-admin/app/services/settings/microgrid/microgriduser.service.js on lines 2..30
myems-admin/app/services/settings/sensor/sensorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorcommand.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorequipment.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorpoint.service.js on lines 2..30
myems-admin/app/services/settings/shopfloor/shopfloorsensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecombinedequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacecommand.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceenergystoragepowerstation.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceequipment.service.js on lines 2..30
myems-admin/app/services/settings/space/spacesensor.service.js on lines 2..30
myems-admin/app/services/settings/space/spaceshopfloor.service.js on lines 2..30
myems-admin/app/services/settings/space/spacestore.service.js on lines 2..30
myems-admin/app/services/settings/space/spacetenant.service.js on lines 2..30
myems-admin/app/services/settings/store/storecommand.service.js on lines 2..30
myems-admin/app/services/settings/store/storepoint.service.js on lines 2..30
myems-admin/app/services/settings/store/storesensor.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantcommand.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantpoint.service.js on lines 2..30
myems-admin/app/services/settings/tenant/tenantsensor.service.js on lines 2..30
myems-admin/app/services/settings/virtualpowerplant/virtualpowerplantmicrogrid.service.js on lines 2..30

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

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

                meta_result = {"id": row[0],
                               "name": row[1],
                               "uuid": row[2],
                               "address": row[3],
                               "postal_code": row[4],
Severity: Major
Found in myems-api/core/microgrid.py and 1 other location - About 1 day to fix
myems-api/core/microgrid.py on lines 351..371

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

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 rows_point is not None and len(rows_point) > 0:
            for row in rows_point:
                meta_result = {"id": row[0],
                               "name": row[1],
                               "object_type": row[2],
Severity: Major
Found in myems-api/core/datasource.py and 1 other location - About 1 day to fix
myems-api/core/datasource.py on lines 793..809

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

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

        if row is None:
            raise falcon.HTTPError(status=falcon.HTTP_404, title='API.NOT_FOUND',
                                   description='API.MICROGRID_NOT_FOUND')
        else:
            meta_result = {"id": row[0],
Severity: Major
Found in myems-api/core/microgrid.py and 1 other location - About 1 day to fix
myems-api/core/microgrid.py on lines 72..88

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

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 'latitude' in new_values['data'].keys() and new_values['data']['latitude'] is not None:
            if not (isinstance(new_values['data']['latitude'], float) or
                    isinstance(new_values['data']['latitude'], int)) or \
                    new_values['data']['latitude'] < -90.0 or \
                    new_values['data']['latitude'] > 90.0:
Severity: Major
Found in myems-api/core/space.py and 1 other location - About 1 day to fix
myems-api/core/space.py on lines 193..202

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

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 'longitude' in new_values['data'].keys() and new_values['data']['longitude'] is not None:
            if not (isinstance(new_values['data']['longitude'], float) or
                    isinstance(new_values['data']['longitude'], int)) or \
                    new_values['data']['longitude'] < -180.0 or \
                    new_values['data']['longitude'] > 180.0:
Severity: Major
Found in myems-api/core/space.py and 1 other location - About 1 day to fix
myems-api/core/space.py on lines 182..191

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

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 rows_point is not None and len(rows_point) > 0:
            for row in rows_point:
                result = {"id": row[0],
                          "name": row[1],
                          "object_type": row[2],
Severity: Major
Found in myems-api/core/datasource.py and 1 other location - About 1 day to fix
myems-api/core/datasource.py on lines 565..581

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

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